Skip to content

KRA REST API v2

Marco Fargetta edited this page Dec 12, 2024 · 2 revisions

API endpoints

Warning
This feature is still under development. The API might still change. Do not use it in production.
Path Method Parameters Return code Mime Input

/kra/v2/agent/keys

GET

start, pageSize, maxTime, maxResults, status, clientKeyID, realm, owner

200

application/json

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    "https://$HOSTNAME:8443/kra/v2/agent/keys?start=4"
{
  "total" : 6,
  "entries" : [ {
    "keyId" : "0x0118d9072617d551c0a7b6975441b2a5",
    "keyURL" : "https://pki.example.com:8443/kra/v2/agent/keys/0x0118d9072617d551c0a7b6975441b2a5",
    "clientKeyID" : "tmyNewkey",
    "status" : "active",
    "algorithm" : "AES",
    "size" : 256,
    "ownerName" : "kraadmin"
  }, {
    "keyId" : "0x00b452e2c8ac1308afa8c3001d80dfead4",
    "keyURL" : "https://pki.example.com:8443/kra/v2/agent/keys/0x00b452e2c8ac1308afa8c3001d80dfead4",
    "clientKeyID" : "myNewkey",
    "status" : "active",
    "algorithm" : "AES",
    "size" : 256,
    "ownerName" : "kraadmin"
  } ]
}

/kra/v2/agent/keys/{id}

GET

None

200

application/json

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    https://$HOSTNAME:8443/kra/v2/agent/keys/0x00b452e2c8ac1308afa8c3001d80dfead4
{
  "keyId" : "0x00b452e2c8ac1308afa8c3001d80dfead4",
  "keyURL" : "https://pki.example.com:8443/kra/v2/agent/keys/0x00b452e2c8ac1308afa8c3001d80dfead4",
  "clientKeyID" : "myNewkey",
  "status" : "active",
  "algorithm" : "AES",
  "size" : 256,
  "ownerName" : "kraadmin"
}

/kra/v2/agent/keys/{id}

POST

status (active/inactive)

204

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    -X POST "https://$HOSTNAME:8443/kra/v2/agent/keys/0x00b452e2c8ac1308afa8c3001d80dfead4?status=inactive"

/kra/v2/agent/keys/active/{clientKeyId}

GET

None

200

application/json

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    https://$HOSTNAME:8443/kra/v2/agent/keys/active/myNewKey
{
  "keyId" : "0x00b452e2c8ac1308afa8c3001d80dfead4",
  "keyURL" : "https://pki.example.com:8443/kra/v2/agent/keys/0x00b452e2c8ac1308afa8c3001d80dfead4",
  "clientKeyID" : "myNewkey",
  "status" : "active",
  "algorithm" : "AES",
  "size" : 256,
  "ownerName" : "kraadmin"
}

/kra/v2/agent/keys/retrieve

POST

status (active/inactive)

200

application/json

Json with ClassName representing the request (com.netscape.certsrv.key.KeyRecoveryRequest) and Attrubutes containing the Attribute, a list of name and value

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    --json '{"ClassName":"com.netscape.certsrv.key.KeyRecoveryRequest","Attributes":{"Attribute":[{"name":"keyId","value":"239691407307142073417724771513900460756"},{"name":"transWrappedSessionKey","value":"PwTuAVVhNd2Ob2vKwJD6Ou+C/1SdmR2VnbsD3ExsSctfZ15rmkJMcyEdcJkj9ONcSgI8uAYJYKvRxlNXdLqhPwyVJ32x3plt53bVSU+j8+KtD4k4xlafJScrMsEQUzFbjAIU0QX0jaynRV+l5YCjOiL59LLEGIxLwOklZXFHq/Llr8RjXR9rV5zRySZhv1ev1oQMlDCNsnAy/H/hDNBIQ80KZErgMCLjN1NrJFyP9MHHhOCd0rsjmOFn9Va3KPGTLqI24EmG2vWqMy9BHbvc7z2DK8iNiwrr8eiHN6pvCGx5jnE1zyrzg3gABTy2CTz1dbwPIRn/QUhbZydQ3i7Cfg=="},{"name":"payloadEncryptionOID","value":"{2 16 840 1 101 3 4 1 2}"},{"name":"payloadWrappingName","value":"AES KeyWrap/Padding"}]}}' \
    https://$HOSTNAME:8443/kra/v2/agent/keys/retrieve
{
  "wrappedPrivateData" : "+1F2dUIf8ycaggtzcOQ/sCfgFmOTO4g3y3dj8A5wSsGMhbtrzhqpPjynmWqOUpKV",
  "algorithm" : "AES",
  "size" : 256,
  "wrapAlgorithm" : "AES KeyWrap/Padding",
  "type" : "symmetricKey"
}

/kra/v2/agent/keyrequests

GET

start, pageSize, maxTime, requestState, requestType, clientKeyID, realm

200

application/json

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    https://$HOSTNAME:8443/kra/v2/agent/keyrequests
{
  "total" : 1,
  "entries" : [ {
    "requestID" : "0x8ebdd92d23f6d91c343ca85b06c5eec1",
    "requestType" : "enrollment",
    "requestStatus" : "complete",
    "requestURL" : "https://pki.example.com:8443/kra/v2/agent/keyrequests/189736124367002838297682016085746249409",
    "creationTime" : 1733938273000,
    "modificationTime" : 1733938273000,
    "keyURL" : "https://pki.example.com:8443/kra/v2/agent/keys/248971174072089259484547109134225303881",
    "keyId" : "0x00bb4e1a9c0a05467927255f184ccee949",
    "requestId" : "0x8ebdd92d23f6d91c343ca85b06c5eec1"
  } ]
}

/kra/v2/agent/keyrequests

POST

None

201

application/json

Json with ClassName representing the request typology and Attrubutes containing the Attribute, a list of name and value

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    --json '{"ClassName":"com.netscape.certsrv.key.SymKeyGenerationRequest","Attributes":{"Attribute":[{"name":"clientKeyID","value":"myNewkey"},{"name":"keyAlgorithm","value":"AES"},{"name":"keySize","value":"256"},{"name":"keyUsage","value":"sign"},{"name":"transWrappedSessionKey","value":null}]}}' \
    https://$HOSTNAME:8443/kra/v2/agent/keyrequests
{
  "requestInfo" : {
    "requestID" : "0xe44da0d2163087a51b7481f2c5c91458",
    "requestType" : "symkeyGenRequest",
    "requestStatus" : "complete",
    "requestURL" : "https://pki.example.com:8443/kra/v2/agent/keyrequests/303467051727386052232820986458237637720",
    "creationTime" : 1733998928353,
    "modificationTime" : 1733998928378,
    "keyURL" : "https://pki.example.com:8443/kra/v2/agent/keys/239691407307142073417724771513900460756",
    "keyId" : "0x00b452e2c8ac1308afa8c3001d80dfead4",
    "requestId" : "0xe44da0d2163087a51b7481f2c5c91458"
  },
  "requestId" : "0xe44da0d2163087a51b7481f2c5c91458",
  "keyId" : "0x00b452e2c8ac1308afa8c3001d80dfead4"
}

/kra/v2/agent/keyrequests/{id}

GET

None

200

application/json

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    https://$HOSTNAME:8443/kra/v2/agent/keyrequests/0x8ebdd92d23f6d91c343ca85b06c5eec1
{
  "requestID" : "0x8ebdd92d23f6d91c343ca85b06c5eec1",
  "requestType" : "enrollment",
  "requestStatus" : "complete",
  "requestURL" : "https://pki.example.com:8443/kra/v2/agent/keyrequests/189736124367002838297682016085746249409",
  "creationTime" : 1733938273000,
  "modificationTime" : 1733938273000,
  "keyURL" : "https://pki.example.com:8443/kra/v2/agent/keys/248971174072089259484547109134225303881",
  "keyId" : "0x00bb4e1a9c0a05467927255f184ccee949",
  "requestId" : "0x8ebdd92d23f6d91c343ca85b06c5eec1"
}

/kra/v2/agent/keyrequests/{id}/approve
/kra/v2/agent/keyrequests/{id}/reject
/kra/v2/agent/keyrequests/{id}/cancel

POST

None

204

Example
$ curl --cacert ./ca_signing.crt -b session_cookie \
    -X POST https://$HOSTNAME:8443//kra/v2/agent/keyrequests/0xe44da0d2163087a51b7481f2c5c91458/cancel

/kra/v2/config/cert/transport

GET

None

200

application/json

Example
$ curl --cacert ./ca_signing.crt \
    https://$HOSTNAME:8443/kra/v2/config/cert/transport
{
  "id" : "0xc47ee26f8d009e3fae9d6a04e408a292",
  "IssuerDN" : "CN=CA Signing Certificate,OU=pki-tomcat,O=EXAMPLE",
  "SubjectDN" : "CN=DRM Transport Certificate,OU=pki-tomcat,O=EXAMPLE",
  "Encoded" : "-----BEGIN CERTIFICATE-----\nMIIEKTCCApGgAwIBAgIRAMR+4m+NAJ4/rp1qBOQIopIwDQYJKoZIhvcNAQELBQAwSDEQMA4GA1UE\r\nCgwHRVhBTVBMRTETMBEGA1UECwwKcGtpLXRvbWNhdDEfMB0GA1UEAwwWQ0EgU2lnbmluZyBDZXJ0\r\naWZpY2F0ZTAeFw0yNDEyMTExNjI1MDRaFw0yNjEyMDExNjI1MDRaMEsxEDAOBgNVBAoMB0VYQU1Q\r\nT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hnIxCuqWPsS1PpRuJ/OBBgEDxwxAA==",
  "NotBefore" : "Wed Dec 11 16:25:04 UTC 2024",
  "NotAfter" : "Tue Dec 01 16:25:04 UTC 2026"
}
Note
endpoints requiring authentication can be accessed providing the session cookie retrieved in the login api (/<app>/v2/account/login) or the user credentials (user/password or certificates).
Clone this wiki locally