Description: Creates a new key pair in Artifactory or replaces an existing pair.
Notes: You need to add the --data-binary
flag to the call when the keys are provided as part of the JSON payload.
Since: 7.6.0
Security: Requires a valid admin user
Usage: POST /api/security/keypair
Sample Usage:
POST /api/security/keypair { "pairName": "alpine-local-key" (mandatory), "pairType": "RSA" (mandatory), "alias": "artifactory-alpine-local" (mandatory), "privateKey": "-----BEGIN PRIVATE KEY----- MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgVcB/UNPxalR9zDYAjQIf jojUDiQuGnSJrFEEzZPT/92hRANCAASc7UJtgnF/abqWM60T3XNJEzBv5ez9TdwK H0M6xpM2q+53wmsN/eYLdgtjgBd3DBmHtPilCkiFICXyaA8z9LkJ -----END PRIVATE KEY-----" (mandatory), "publicKey": "-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1yHJxQgsHQREclQu4Ohe qxTxd1tHcNnvnQTu/UrTky8wWvgXT+jpveroeWWnzmsYlDI93eLI2ORakxb3gA2O Q0Ry4ws8vhaxLQGC74uQR5+/yYrLuTKydFzuPaS1dK19qJPXB8GMdmFOijnXX4SA jixuHLe1WW7kZVtjL7nufvpXkWBGjsfrvskdNA/5MfxAeBbqPgaq0QMEfxMAn6/R L5kNepi/Vr4S39Xvf2DzWkTLEK8pcnjNkt9/aafhWqFVW7m3HCAII6h/qlQNQKSo GuH34Q8GsFG30izUENV9avY7hSLq7nggsvknlNBZtFUcmGoQrtx3FmyYsIC8/R+B ywIDAQAB -----END PUBLIC KEY-----" (mandatory), "passphrase": "YouShallNotPass" }
Vault Sample Usage
{ "pairName": "alpine-local-key" (mandatory), "pairType": "RSA" (mandatory), "alias": "artifactory-alpine-local" (mandatory), "vaultKey": "hashicorp", "vaultPublicKey": {"path": "secret/default-gpg-key", "key": "gpg.key.pub"}, }
Response codes: 201 Successful with an empty response.