Difference between revisions of "Key REST API"

From Dogtag
Jump to: navigation, search
m (Retrieving a Key)
m (Archiving a Key)
Line 9: Line 9:
 
     "Attributes": {
 
     "Attributes": {
 
         "Attribute": [
 
         "Attribute": [
 +
            {
 +
                "name": "algorithmOID",
 +
                "value": "{1 2 840 113549 3 7}"
 +
            },
 
             {
 
             {
 
                 "name": "clientKeyID",
 
                 "name": "clientKeyID",
Line 18: Line 22:
 
             },
 
             },
 
             {
 
             {
                 "name": "wrappedPrivateData",
+
                 "name": "symmetricAlgorithmParams",
 
                 "value": <base64-encoded data>
 
                 "value": <base64-encoded data>
 
             },
 
             },
Line 26: Line 30:
 
             },
 
             },
 
             {
 
             {
                 "name": "algorithmOID",
+
                 "name": "wrappedPrivateData",
                "value": "{1 2 840 113549 3 7}"
 
            },
 
            {
 
                "name": "symmetricAlgorithmParams",
 
 
                 "value": <base64-encoded data>
 
                 "value": <base64-encoded data>
 
             }
 
             }
Line 44: Line 44:
 
{
 
{
 
     "RequestInfo": {
 
     "RequestInfo": {
 +
        "keyURL": "https://localhost:8443/kra/rest/agent/keys/<key ID>",
 +
        "requestStatus": "begin",
 
         "requestType": "securityDataEnrollment",
 
         "requestType": "securityDataEnrollment",
        "requestStatus": "begin",
+
         "requestURL": "https://localhost:8443/kra/rest/agent/keyrequests/<request ID>"
         "requestURL": "https://localhost:8443/kra/rest/agent/keyrequests/<request ID>",
 
        "keyURL": "https://localhost:8443/kra/rest/agent/keys/<key ID>"
 
 
     }
 
     }
 
}
 
}
Line 60: Line 60:
 
     "Attributes": {
 
     "Attributes": {
 
         "Attribute": [
 
         "Attribute": [
 +
            {
 +
                "name": "algorithmOID",
 +
                "value": "{2 16 840 1 101 3 4 1 2}"
 +
            },
 +
            {
 +
                "name": "clientKeyID",
 +
                "value": <client key ID>
 +
            },
 
             {
 
             {
 
                 "name": "dataType",
 
                 "name": "dataType",
Line 67: Line 75:
 
                 "name": "keyAlgorithm",
 
                 "name": "keyAlgorithm",
 
                 "value": ""
 
                 "value": ""
            },
 
            {
 
                "name": "clientKeyID",
 
                "value": <client key ID>
 
            },
 
            {
 
                "name": "algorithmOID",
 
                "value": "{2 16 840 1 101 3 4 1 2}"
 
 
             },
 
             },
 
             {
 
             {
Line 81: Line 81:
 
             },
 
             },
 
             {
 
             {
                 "name": "wrappedPrivateData",
+
                 "name": "transWrappedSessionKey",
 
                 "value": <base64-encoded data>
 
                 "value": <base64-encoded data>
 
             },
 
             },
 
             {
 
             {
                 "name": "transWrappedSessionKey",
+
                 "name": "wrappedPrivateData",
 
                 "value": <base64-encoded data>
 
                 "value": <base64-encoded data>
 
             }
 
             }
Line 99: Line 99:
 
{
 
{
 
     "RequestInfo": {
 
     "RequestInfo": {
 +
        "keyURL": "https://localhost:8443/kra/rest/agent/keys/<key ID>",
 +
        "requestStatus": "complete",
 
         "requestType": "securityDataEnrollment",
 
         "requestType": "securityDataEnrollment",
        "requestStatus": "complete",
+
         "requestURL": "https://localhost:8443/kra/rest/agent/keyrequests/<request ID>"
         "requestURL": "https://localhost:8443/kra/rest/agent/keyrequests/<request ID>",
 
        "keyURL": "https://localhost:8443/kra/rest/agent/keys/<key ID>"
 
 
     }
 
     }
 
}
 
}

Revision as of 17:26, 11 October 2019

Archiving a Key

Archiving Key with DES

Request:

{
    "Attributes": {
        "Attribute": [
            {
                "name": "algorithmOID",
                "value": "{1 2 840 113549 3 7}"
            },
            {
                "name": "clientKeyID",
                "value": <client key ID>
            },
            {
                "name": "dataType",
                "value": "passPhrase"
            },
            {
                "name": "symmetricAlgorithmParams",
                "value": <base64-encoded data>
            },
            {
                "name": "transWrappedSessionKey",
                "value": <base64-encoded data>
            },
            {
                "name": "wrappedPrivateData",
                "value": <base64-encoded data>
            }
        ]
    },
    "ClassName": "com.netscape.certsrv.key.KeyArchivalRequest"
}

Response:

{
    "RequestInfo": {
        "keyURL": "https://localhost:8443/kra/rest/agent/keys/<key ID>",
        "requestStatus": "begin",
        "requestType": "securityDataEnrollment",
        "requestURL": "https://localhost:8443/kra/rest/agent/keyrequests/<request ID>"
    }
}

Archiving Key with AES

Request:

{
    "Attributes": {
        "Attribute": [
            {
                "name": "algorithmOID",
                "value": "{2 16 840 1 101 3 4 1 2}"
            },
            {
                "name": "clientKeyID",
                "value": <client key ID>
            },
            {
                "name": "dataType",
                "value": "passPhrase"
            },
            {
                "name": "keyAlgorithm",
                "value": ""
            },
            {
                "name": "symmetricAlgorithmParams",
                "value": <base64-encoded data>
            },
            {
                "name": "transWrappedSessionKey",
                "value": <base64-encoded data>
            },
            {
                "name": "wrappedPrivateData",
                "value": <base64-encoded data>
            }
        ]
    },
    "ClassName": "com.netscape.certsrv.key.KeyArchivalRequest"
}

Response:

{
    "RequestInfo": {
        "keyURL": "https://localhost:8443/kra/rest/agent/keys/<key ID>",
        "requestStatus": "complete",
        "requestType": "securityDataEnrollment",
        "requestURL": "https://localhost:8443/kra/rest/agent/keyrequests/<request ID>"
    }
}

Retrieving a Key

Retrieving Key With DES

Request:

{
    "Attributes": {
        "Attribute": [
            {
                "name": "keyId",
                "value": <key ID>
            },
            {
                "name": "transWrappedSessionKey",
                "value": <base64-encoded data>
            },
            {
                "name": "payloadEncryptionOID",
                "value": "{1 2 840 113549 3 7}"
            },
            {
                "name": "payloadWrappingName",
                "value": "DES3/CBC/Pad"
            }
        ]
    },
    "ClassName": "com.netscape.certsrv.key.KeyRecoveryRequest"
}

Response:

{
    "wrappedPrivateData": <base64-encoded data>,
    "nonceData": <base64-encoded data>,
    "encryptAlgorithmOID": "DESede/CBC/PKCS5Padding/168",
    "type": "passPhrase"
}

Retrieving Key with AES

Request:

{
    "Attributes": {
        "Attribute": [
            {
                "name": "keyId",
                "value": <key ID>
            },
            {
                "name": "transWrappedSessionKey",
                "value": <base64-encoded data>
            },
            {
                "name": "payloadEncryptionOID",
                "value": "{2 16 840 1 101 3 4 1 2}"
            },
            {
                "name": "payloadWrappingName",
                "value": "AES KeyWrap/Padding"
            }
        ]
    },
    "ClassName": "com.netscape.certsrv.key.KeyRecoveryRequest"
}

Response:

{
    "wrappedPrivateData": <base64-encoded data>,
    "nonceData": <base64-encoded data>,
    "encryptAlgorithmOID": "AES/CBC/PKCS5Padding/128",
    "type": "passPhrase"
}

See Also