Bulk mode with Messages
Chapter 8 of the KMIP 2.1
specification defines the Messages functionality, which enables sending/receiving multiple requests/responses at
once (also known as bulk mode).
This is the standard way to communicate with the KMIP server using the Binary protocol on port 5696 or the JSON protocol
on port 9998 and endpoint /kmip.
The /kmip/2_1 endpoint is a Eviden extension allowing the posting of Operations directly to the server without
the need for a RequestMessage wrapper.
This is particularly useful for operations like Encrypt and Decrypt.
Multiple operations can be included in a single RequestMessage query.
Items run in order.
For every request message sent, the server returns a response message containing the result status of the requested operation, along with any relevant result data or error messages.
Batch semantics
- A
BatchCountthat differs from the number of items, or a message with zero items, returnsInvalid_Message. - More than 10,000 items returns
Invalid_Message. - An omitted Batch Error Continuation Option means
Stop. - On
StopandUndo, processing ends at the first failure and later items are not returned. - The response
BatchCountis the number of returned items. Undoreverts earlier items (limit 1,000 items, elseServer_Limit_Exceeded). Only items really reverted reportOperation Undone; the others keepSuccess. Usage Limits consumed by an undone item stay consumed: its response is still returned. An item the server cannot revert (Destroywithremove,Create Split Key,Join Split Key,RNG Seed, tag or keyset handles, Covercrypt keys, a missing or forbidden target, an HSM creation) is refused before it runs withOperation_Not_Supported, which undoes the earlier items.- A critical Message Extension fails every item with
Unknown_Message_Extension. - A Hashed Password credential returns
Feature_Not_Supported. - Maximum Response Size is applied to Query only: a Query response that would exceed it becomes
Response_Too_Large. A negative value returnsInvalid_Field. - An unimplemented operation fails only its own item with
Operation_Not_Supported. - A message-level error fails every item with that reason.
- The ID Placeholder lives for one message. A failed Check empties it.
- The Client Correlation Value is echoed in the response header.
Request and response example
Below are canonical KMIP 2.1 message examples, following the mandatory XML schema AKLC-M-1-21.xml. Each request and response is shown in JSON TTLV format.
1. CreateKeyPair
{
"tag": "RequestMessage",
"type": "Structure",
"value": [
{
"tag": "RequestHeader",
"type": "Structure",
"value": [
{ "tag": "ProtocolVersion", "type": "Structure", "value": [
{ "tag": "ProtocolVersionMajor", "type": "Integer", "value": 2 },
{ "tag": "ProtocolVersionMinor", "type": "Integer", "value": 1 }
] },
{ "tag": "ClientCorrelationValue", "type": "TextString", "value": "AKLC-M-1-21 step=0" },
{ "tag": "BatchCount", "type": "Integer", "value": 1 }
]
},
{
"tag": "BatchItem",
"type": "Structure",
"value": [
{ "tag": "Operation", "type": "Enumeration", "value": "CreateKeyPair" },
{ "tag": "RequestPayload", "type": "Structure", "value": [
{ "tag": "CommonAttributes", "type": "Structure", "value": [
{ "tag": "CryptographicAlgorithm", "type": "Enumeration", "value": "RSA" },
{ "tag": "CryptographicLength", "type": "Integer", "value": 2048 }
] },
{ "tag": "PrivateKeyAttributes", "type": "Structure", "value": [
{ "tag": "Name", "type": "Structure", "value": [
{ "tag": "NameValue", "type": "TextString", "value": "AKLC-M-1-21-private" },
{ "tag": "NameType", "type": "Enumeration", "value": "UninterpretedTextString" }
] },
{ "tag": "CryptographicUsageMask", "type": "Integer", "value": "Sign" }
] },
{ "tag": "PublicKeyAttributes", "type": "Structure", "value": [
{ "tag": "Name", "type": "Structure", "value": [
{ "tag": "NameValue", "type": "TextString", "value": "AKLC-M-1-21-public" },
{ "tag": "NameType", "type": "Enumeration", "value": "UninterpretedTextString" }
] },
{ "tag": "CryptographicUsageMask", "type": "Integer", "value": "Verify" }
] }
] }
]
}
]
}
2. GetAttributes (Private Key)
{
"tag": "RequestMessage",
"type": "Structure",
"value": [
{
"tag": "RequestHeader",
"type": "Structure",
"value": [
{ "tag": "ProtocolVersion", "type": "Structure", "value": [
{ "tag": "ProtocolVersionMajor", "type": "Integer", "value": 2 },
{ "tag": "ProtocolVersionMinor", "type": "Integer", "value": 1 }
] },
{ "tag": "ClientCorrelationValue", "type": "TextString", "value": "AKLC-M-1-21 step=1" },
{ "tag": "BatchCount", "type": "Integer", "value": 1 }
]
},
{
"tag": "BatchItem",
"type": "Structure",
"value": [
{ "tag": "Operation", "type": "Enumeration", "value": "GetAttributes" },
{ "tag": "RequestPayload", "type": "Structure", "value": [
{ "tag": "UniqueIdentifier", "type": "TextString", "value": "$UNIQUE_IDENTIFIER_0" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "State" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "CryptographicUsageMask" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "UniqueIdentifier" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "ObjectType" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "CryptographicAlgorithm" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "CryptographicLength" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "Digest" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "InitialDate" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "LastChangeDate" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "ActivationDate" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "OriginalCreationDate" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "RandomNumberGenerator" },
{ "tag": "AttributeReference", "type": "Enumeration", "value": "KeyFormatType" }
] }
]
}
]
}
3. Destroy (Private Key)
{
"tag": "RequestMessage",
"type": "Structure",
"value": [
{
"tag": "RequestHeader",
"type": "Structure",
"value": [
{ "tag": "ProtocolVersion", "type": "Structure", "value": [
{ "tag": "ProtocolVersionMajor", "type": "Integer", "value": 2 },
{ "tag": "ProtocolVersionMinor", "type": "Integer", "value": 1 }
] },
{ "tag": "ClientCorrelationValue", "type": "TextString", "value": "AKLC-M-1-21 step=3" },
{ "tag": "BatchCount", "type": "Integer", "value": 1 }
]
},
{
"tag": "BatchItem",
"type": "Structure",
"value": [
{ "tag": "Operation", "type": "Enumeration", "value": "Destroy" },
{ "tag": "RequestPayload", "type": "Structure", "value": [
{ "tag": "UniqueIdentifier", "type": "TextString", "value": "$UNIQUE_IDENTIFIER_0" }
] }
]
}
]
}