Safeguard
Supply Chain Security•

KMIP Explained: TTLV, Objects, Operations and How to Secure It

KMIP is the OASIS protocol that storage arrays and databases use to ask a key server to create, fetch, rotate and destroy keys over TLS on port 5696.

Safeguard Security Team
36 min read

KMIP, the Key Management Interoperability Protocol, is an OASIS standard that lets storage arrays, databases, hypervisors and other clients ask a central key server to create, fetch, rotate, revoke and destroy keys. Messages use a compact binary encoding called TTLV and travel over mutually authenticated TLS on TCP port 5696. Version 2.1 is the current OASIS Standard; 3.0 is still a draft.

Below we take the protocol apart layer by layer, from bytes on the wire to key states and profiles, then secure it and finish with a hands-on lab.

Key takeaways

  • KMIP is a wire protocol between a key management client and a key management server. It is not a key store, an HSM or an API library, although servers often sit in front of HSMs.
  • The OASIS KMIP Technical Committee maintains it. Version 1.0 became an OASIS Standard on 1 October 2010 and version 2.1 on 14 December 2020. KMIP 3.0 reached Committee Specification Draft 02 on 7 May 2026.
  • Every message is TTLV: a 3 byte tag, a 1 byte type, a 4 byte length and a value padded to a multiple of 8 bytes.
  • The KMIP 2.1 profiles require mutual TLS for the Basic Authentication Suite, require servers to support TLS 1.3, forbid TLS 1.0, TLS 1.1 and SSL, and fix the port at 5696.
  • Each object carries a State (Pre-Active, Active, Deactivated, Compromised, Destroyed, Destroyed Compromised) that only the server changes. KMIP says these states correspond to NIST SP 800-57 Part 1.
  • KMIP 2.1 sets Extractable to True and Sensitive to False when a client does not set them. Unless server policy overrides that, new keys can be read back in plaintext.
  • Access control is mostly server policy, not protocol, and that is where most deployments are weakest.

What problem does KMIP solve?

Before KMIP, every product that encrypted data at rest shipped its own connector for a specific key manager. Changing key servers meant rewriting every connector, and keys ended up scattered across products, each with its own backup, rotation and audit story.

KMIP defines one message format and one set of operations so that any conforming client can talk to any conforming server. The lifecycle of every key lives in one place, which is what makes rotation schedules, revocation after a compromise, consistent audit records and provable destruction possible.

Client categoryWhat it asks the key server forTypical KMIP pattern
Storage arrays with self-encrypting drivesKeys that unlock drives at bootLocate by name, Get
Tape librariesOne data key per tape or poolCreate, Get on read back, Destroy to make a tape unreadable
Databases with transparent data encryptionA master key that wraps the database's data keysCreate or Register, Get at startup, Re-key on rotation
HypervisorsKeys per virtual machine or clusterCreate, Get, Locate by group
Backup and archive softwareKeys per job or vaultCreate, Get, Revoke on retirement
Application codeSecret data, certificates, wrapping keysRegister, Get, server side Encrypt and Decrypt

The KMIP profiles name several of these categories directly, with a Storage Array with Self-Encrypting Drives profile, a Tape Library profile and an AES XTS profile. If the vocabulary is new, start with what key management is and envelope encryption with data keys and wrapping keys.

Who maintains KMIP, and which versions exist?

The OASIS KMIP Technical Committee publishes two normative documents per version. The specification defines objects, attributes, operations, messages and encodings. The profiles document defines authentication suites, conformance clauses and mandatory test cases. A usage guide and a test cases document are published as non-normative Committee Notes. The OASIS TC page records that KMIP received the OASIS Open Standards Cup in 2018.

Version timeline

Every date below comes from the cover page of the OASIS document.

VersionStatus and dateNotes
KMIP 1.0OASIS Standard, 1 October 2010First standard
KMIP 1.1OASIS Standard, 24 January 2013Added Discover Versions for version negotiation, and Re-key Key Pair
KMIP 1.2OASIS Standard, 19 May 2015Added server side Encrypt, Decrypt, Sign, Signature Verify, MAC and MAC Verify
KMIP 1.3OASIS Standard, 27 December 2016Further 1.x revision
KMIP 1.4OASIS Standard, 22 November 2017; Errata 01, 18 July 2019Last of the 1.x line
KMIP 2.0OASIS Standard, 31 October 2019First 2.x release; libraries such as PyKMIP mark some calls as 2.0 and later only
KMIP 2.1OASIS Standard, 14 December 2020Current OASIS Standard
KMIP 3.0Committee Specification Draft 02, 7 May 2026Draft; states it will replace 2.1 once approved

IANA's service name registry lists TCP port 5696 for KMIP, assigned to the OASIS KMIP Technical Committee on 25 July 2011. UDP 5696 is reserved.

Because older clients keep running for years, most servers speak several protocol versions and negotiate. A product sheet that says "KMIP compliant" without a version and a profile tells you very little.

How is a KMIP message encoded? TTLV byte by byte

The KMIP 2.1 specification makes TTLV (Tag, Type, Length, Value) the one mandatory encoding. Its stated goal is low CPU and memory cost for small clients and good alignment on 32 bit and 64 bit processors; it says bandwidth matters less.

PartSizeContent
Tag3 bytes, big endianWhich field this is, for example 0x420094 for Unique Identifier
Type1 byteThe data type, for example 0x01 for Structure
Length4 bytes, big endianBytes in the value, excluding trailing padding for most types
ValueVariableThe data, padded with zero bytes to a multiple of 8

KMIP tags have the form 0x42XXXX. Extension tags and extension enumerations (first nibble 8) are allowed, which matters later for interoperability.

The data types

Type codeTypeValue sizePadding
0x01StructureSum of contained itemsAlready a multiple of 8
0x02Integer4 bytes, signed4 bytes
0x03Long Integer8 bytes, signedNone
0x04Big IntegerMultiple of 8Sign extended leading bytes
0x05Enumeration4 bytes, unsigned4 bytes
0x06Boolean8 bytesNone
0x07Text StringUTF-8 bytesTo the next multiple of 8
0x08Byte StringRaw bytesTo the next multiple of 8
0x09Date Time8 bytes, POSIX secondsNone
0x0AInterval4 bytes, seconds4 bytes
0x0BDate Time Extended8 bytes, microsecondsNone

For a Structure, the length is the total of all nested items including padding. A parser always knows where the next item starts: round the length up to a multiple of 8 and skip.

Worked example 1: a Protocol Version structure

Every request header carries a Protocol Version. Here is version 2.1, using the 2.1 tag table: Protocol Version 0x420069, Major 0x42006A, Minor 0x42006B.

42 00 69 | 01 | 00 00 00 20                                  Protocol Version, Structure, length 32
  42 00 6A | 02 | 00 00 00 04 | 00 00 00 02 | 00 00 00 00   Major = 2, then 4 pad bytes
  42 00 6B | 02 | 00 00 00 04 | 00 00 00 01 | 00 00 00 00   Minor = 1, then 4 pad bytes

Each Integer takes 16 bytes: 8 bytes of header (3 + 1 + 4), 4 of value and 4 of padding. Two make 32 bytes, 0x20, the structure's length. With its own 8 byte header the whole item is 40 bytes.

Worked example 2: a text string

A Name Value (tag 0x420055) holding db-key:

42 00 55 | 07 | 00 00 00 06 | 64 62 2D 6B 65 79 00 00

The length is 6 because only six bytes are text; two zero bytes reach the 8 byte boundary, so the item is 16 bytes. For db-key-2024 (11 bytes) the length would be 0x0B with five padding bytes, a 24 byte item.

Worked example 3: an operation and a usage mask

The Operation field (tag 0x42005C) is an Enumeration. In 2.1, Create is 0x01, Register 0x03, Re-key 0x04, Locate 0x08, Get 0x0A, Activate 0x12, Revoke 0x13 and Destroy 0x14. A Get carries:

42 00 5C | 05 | 00 00 00 04 | 00 00 00 0A | 00 00 00 00

The Cryptographic Usage Mask (tag 0x42002C) is an Integer bit mask: Sign 0x1, Verify 0x2, Encrypt 0x4, Decrypt 0x8, Wrap Key 0x10, Unwrap Key 0x20, MAC Generate 0x80, MAC Verify 0x100. A key allowed only to encrypt and decrypt has 0x4 + 0x8 = 0xC, which is 12. A key encryption key limited to wrap and unwrap has 0x10 + 0x20 = 0x30, which is 48. In 2.1 the bit 0x40 is Reserved, although 1.x documents used it for Export, so a server handling old clients has to treat it carefully.

How a request is structured

A Request Message (tag 0x420078) holds a Request Header (Protocol Version, Batch Count, optional Authentication with a Credential, optional Maximum Response Size) and one or more Batch Items, each with an Operation and a Request Payload. Batching saves round trips, and the ID Placeholder makes it useful: after a Create succeeds, the server stores the new Unique Identifier in the placeholder, so a following Activate in the same batch can omit it. Responses carry a Result Status, Result Reason and Result Message per item.

The specification also lists HTTPS, JSON and XML message protocols, defined in the profiles for clients where text or HTTP is easier than raw TTLV over TLS.

Which transport, port and authentication does KMIP use?

The specification leaves authentication to the profiles, which define authentication suites. Under the KMIP 2.1 Basic Authentication Suite:

  • Servers SHALL support TLS 1.3 and SHOULD support TLS 1.2. Clients SHOULD support TLS 1.3 and MAY support TLS 1.2.
  • Nobody SHALL support TLS 1.0, TLS 1.1 or any SSL version.
  • For TLS 1.3, servers SHALL support both TLS_CHACHA20_POLY1305_SHA256 and TLS_AES_256_GCM_SHA384.
  • For TLS 1.2, both sides SHALL support TLS_RSA_WITH_AES_256_CBC_SHA256 and TLS_RSA_WITH_AES_128_CBC_SHA256, MAY support listed ECDHE, ECDH and PSK suites, and SHALL NOT support anything else.
  • Servers SHALL require TLS mutual authentication for all operations, except during automated client provisioning.
  • Servers SHALL use TCP port 5696.

The mandatory TLS 1.2 suites use RSA key transport, which has no forward secrecy. If the server's TLS key leaks later, recorded sessions could be decrypted, and in this protocol those sessions carry keys. Prefer TLS 1.3, and on TLS 1.2 prefer the permitted ECDHE suites.

How the server decides who the client is

If a request has no Authentication object, the server uses the identity from the TLS client certificate. If it carries one, the server uses the credential's identity. KMIP 2.1 defines six credential types (Username and Password, Device, Attestation, One Time Password, Hashed Password and Ticket), and the mapping from certificate or credential to identity is left to the implementation. Your server documentation should say exactly which identity wins.

The HTTPS Authentication Suite uses HTTP over TLS with the same versions, suites and client authentication rules, and SHOULD also use port 5696.

Which managed objects does KMIP define?

Object typeWhat it holdsTypical use
Symmetric KeyAn AES or other symmetric keyData keys, key encryption keys, drive unlock keys
Public Key and Private KeyThe halves of a key pairSigning, verification, TLS server keys
Split KeyOne share of a split keyDual control and recovery
CertificateAn X.509 certificateTLS and client identities
Certificate RequestA certificate signing requestIssuance through Certify
Secret DataPasswords, seeds and other non key secretsService passwords
Opaque ObjectBytes the server does not interpretProduct specific blobs
PGP KeyAn OpenPGP keyPGP tooling

Keys travel inside a Key Block, which holds the Key Value, its format, algorithm, length and optional Key Wrapping Data. Key Wrapping Data is how a server returns a key encrypted under another key instead of in plaintext.

Which attributes matter most?

KMIP 2.1 defines 63 attributes. These change security outcomes:

AttributeWhat it controlsWhy it matters
StateLifecycle position; server onlyDecides whether a key may protect or only process data
Cryptographic Usage MaskAllowed operations; not modifiable by the clientSeparates encryption, wrapping and signing keys
Activation DateWhen the key becomes ActiveA past date at creation makes the key Active at once
Deactivation DateWhen the key stops protecting new dataEnforces the cryptoperiod
Process Start Date and Protect Stop DateSeparate windows for processing and protectingOld data stays decryptable after encryption stops
ExtractableWhether the value can be retrieved at allDefaults to True if the client is silent
SensitiveWhether Get must wrap the valueDefaults to False if the client is silent
Never Extractable, Always Sensitive, FreshWhether the key was ever exposed or servedAudit evidence
LinkReplacement Object, Replaced Key, Wrapping Key LinkTracks rotation chains

The 2.1 text says that if Extractable is False the server SHALL prevent retrieval, and it SHALL set Extractable to True if the client does not provide it. If Sensitive is True the server SHALL prevent retrieval through Get unless the value is wrapped, and it SHALL set Sensitive to False if the client does not provide it. A client that creates a key without setting either has made a key that any authorised client can read back in plaintext. Many servers let administrators override this by policy; check that yours does.

Which operations matter?

KMIP 2.1 defines 57 client to server operations and 5 server to client operations. Most deployments use a small core:

OperationWhat it doesLifecycle effect
Create, Create Key PairServer generates a key or key pairPre-Active, or Active if the Activation Date is past
RegisterClient hands the server an existing objectPre-Active or Active
LocateSearch by attributes; returns identifiersNone
Get, Get AttributesReturn the object (optionally wrapped) or its attributesGet sets Fresh to False
ActivateMake a Pre-Active object ActivePre-Active to Active
RevokeStop protection use, with a reasonActive to Deactivated, or Compromised
DestroyDestroy key material, keep metadataPre-Active or Deactivated to Destroyed
Re-keyGenerate a replacement symmetric keyNew key, linked to the old one
Encrypt, Decrypt, Sign, MACServer performs the operation; key stays on the serverNone
Discover Versions, QueryAsk what the server supportsNone

Four details from the specification shape real scripts:

  • Destroy only works on Pre-Active or Deactivated objects, and metadata SHALL be retained. An Active key must be revoked first, as the PyKMIP client documentation also notes.
  • Re-key moves the name. The replacement takes the old key's Name, gets a Replaced Key link back, and the old key gets a Replacement Object link. The specification says Re-key SHOULD only be performed once on a given key. An Offset sets the gap between the new key's Initial Date and Activation Date; without one, the old key's dates are copied, which is rarely what a rotation wants.
  • Locate returns newest first, and an empty filter matches everything. Without access control on Locate, any authenticated client can enumerate identifiers.
  • Get can wrap. A Key Wrapping Specification in the request returns the key encrypted under a wrapping key; with Sensitive True, wrapping is mandatory.

How does the KMIP key lifecycle map to NIST SP 800-57?

KMIP 2.1 says its states correspond to NIST SP 800-57 Part 1. The current revision, Revision 5 (May 2020), describes six key states across four phases: pre-operational, operational, post-operational and destroyed.

SP 800-57 Part 1 Rev. 5 stateKMIP 2.1 stateHow a KMIP object gets there
Pre-activationPre-ActiveCreate or Register without a past Activation Date
ActiveActiveActivate, the Activation Date arriving, or moving that date to now
SuspendedNo separate stateApproximate with Usage Limits, leases or server policy
DeactivatedDeactivatedDeactivation Date arriving, or Revoke with a reason other than compromise
CompromisedCompromisedRevoke with reason Compromised
DestroyedDestroyed or Destroyed CompromisedDestroy from Pre-Active or Deactivated; Destroy from Compromised

SP 800-57 Rev. 5 says metadata such as state history may be kept after destruction, and that a compromise found after destruction must be recorded. KMIP models this with Destroyed Compromised: a Revoke with reason Compromised moves a Destroyed object there, and its compromised status SHOULD be retained for audit.

KMIP allows exactly ten transitions. Two rules catch people out:

  1. Deactivated keys can still decrypt, under conditions. They SHALL NOT apply protection, and SHOULD only process protected data under extraordinary circumstances with special permission. Rotation needs a plan for data under the old key, which our post on whether rotating a KMS key re-encrypts your data covers for another system.
  2. State is never written directly. Modify Attribute SHALL NOT change State; only Activate, Revoke, Destroy, dates and server processes do.

Worked example: cryptoperiod dates

SP 800-57 separates the originator usage period (applying protection) from the recipient usage period (processing protected data). KMIP's dates map onto it. Suppose a data key has an Activation Date of 1 January, a Protect Stop Date of 31 March and a Deactivation Date of 30 June. From January to March it encrypts and decrypts. From April to June a correct client refuses to encrypt with it but still decrypts. On 30 June the server moves it to Deactivated, and decryption then needs special permission. These dates are illustrative; choose real periods from your policy and SP 800-57's guidance per key type.

What are profiles and conformance clauses?

Almost everything in the specification is optional, so profiles make it testable. A profile names a subset of objects, attributes and operations, an authentication suite and mandatory test cases. A product conforms to a profile, not to "KMIP". The 2.1 profiles include:

Profile familyWhat it covers
Baseline Client and ServerThe minimum; 13 mandatory baseline test cases in 2.1
Complete ServerThe whole specification
HTTPS, XML, JSONAlternative encodings
Symmetric and Asymmetric Key LifecycleCreate through Destroy for each key type
Symmetric Key Foundry for FIPS 140Basic, intermediate and advanced key generation servers
CryptographicServer side operations and random number services
Storage Array with Self-Encrypting Drives, Tape Library, AES XTSStorage use cases
Quantum SafeQuantum safe algorithms
PKCS#11Carrying PKCS #11 calls over KMIP

Test cases are concrete request and response pairs, with a documented list of permitted variations such as identifiers and timestamps.

Why interoperability problems still happen

  • Version gaps. A client that hard codes one version and never calls Discover Versions breaks when the server drops that version.
  • Server policy everywhere. The specification repeatedly defers to "server policy": when Destroy takes effect, whether a past Activation Date is accepted, what Locate returns and who may do what.
  • Optional format conversion. A server must return a key in its registered format; other conversions MAY be supported.
  • Extensions. Clients that depend on another product's extension tags or attributes are no longer portable.
  • Locate limits. Without Maximum Items, a server MAY return everything or impose its own cap.
  • TLS mismatch. Non overlapping cipher suites fail before a KMIP byte moves.
  • Identity mapping. Two servers can derive different identities from the same certificate, so ownership works on one and fails on the other.

The cure: pin protocol versions, profiles and the authentication suite in requirements, run the profile test cases against the exact pair of products, and document server policy beside the client configuration.

How do you secure a KMIP deployment?

A KMIP server holds the keys to everything its clients encrypt. Treat it like a certificate authority: few hardened hosts, a narrow network path and an audit trail someone reads.

Mutual TLS with one identity per client

  • Give every client its own certificate. A shared certificate makes every host one identity, defeats ownership checks and makes revocation all or nothing.
  • Require the client authentication Extended Key Usage. The PyKMIP server checks for it by default and closes the connection if it is missing.
  • Use a dedicated private CA for KMIP, trusted only for this purpose, with lifetimes short enough that rotation is routine. Test that a revoked client certificate is refused.
  • Prefer TLS 1.3 and forward secret suites.

Ownership and access control

  • Ownership. PyKMIP's documentation describes the common model: objects are owned by the identity that created or registered them.
  • Per operation permissions. PyKMIP policies map each object type and operation to Allow All, Allow Owner or Disallow All, and treat anything uncovered as Disallow All. Look for an equivalent in any server.
  • Groups, not shared certificates, for clusters that need the same keys.
  • Restrict Locate and Get Attributes, since enumeration leaks names and groups.
  • Separate administrators from clients, with stronger authentication for administration.

Key export and wrapping

Set Extractable to False for keys used only through server side operations. Set Sensitive to True for keys delivered to clients so Get returns them wrapped. Watch Never Extractable, Always Sensitive and Fresh in audits, and verify any server policy that changes the defaults with Get Attributes on a new key.

Audit logging

The Log operation lets a client write into the server log; the client chooses the content, so it is not an audit trail. Server records should capture time, client identity, source address, operation, object identifier, result and revocation reason. Ship them to storage the server's administrators cannot alter, and alert on bursts of Get or Locate, on Destroy, on Revoke with reason Compromised and on authentication failures.

Availability, backup and network

A down key server stops every client that fetches keys at boot; a lost key database makes everything encrypted under it unrecoverable. Run at least two nodes, back up the database and the server's master key separately, encrypt backups and test restores. Expose port 5696 only to the client networks that need it, with administration on a separate management network.

Use NIST's design questions

NIST SP 800-130 (August 2013) lists documentation requirements for designing a cryptographic key management system: roles, keys and metadata, functions, policies and controls. NIST SP 800-152 (October 2015) turns it into a profile for US federal systems. Walking through SP 800-130's topics against your server's documentation quickly finds gaps in ownership, backup, audit and recovery. Auditors usually test the NIST SP 800-53 SC-12 key management control.

KMIP vs PKCS #11 vs cloud KMS APIs vs platform key stores

KMIPPKCS #11Cloud KMS APIsPlatform key stores
What it isWire protocol between client and key serverC API for a token or HSMA provider's HTTPS API for keys it hostsOperating system or language APIs for local keys
ScopeFull lifecycle across many clientsOperations and objects on one token or HSMLifecycle and operations inside one providerLocal storage and use
TransportTTLV over mutual TLS on 5696; optional HTTPS, JSON, XMLIn process library callsHTTPS with the provider's signing schemeLocal calls
Typical clientsStorage arrays, tape, databases, hypervisors, backupCode signing, TLS servers, CAs, SSHCloud applications and the provider's servicesDesktop and mobile apps
Key export modelExtractable and Sensitive; Get returns plaintext or wrappedPer object sensitive and extractable attributesUsually no export of provider generated keys; imports arrive wrappedUsually non exportable when hardware backed
Standard bodyOASIS KMIP TCOASIS PKCS 11 TCNone; each provider's ownEach platform's own

They stack: a KMIP server may keep its keys in an HSM reached through PKCS #11, and KMIP 2.1 has a profile for carrying PKCS #11 calls over KMIP. See our guide to HSMs, firmware signing keys in an HSM with PKCS #11 and environment variables versus a KMS.

Step by step: a KMIP lab with an open source server and client

This lab uses PyKMIP, an Apache 2.0 licensed Python KMIP client and server from the OpenKMIP project. PyKMIP's documentation says its server is for testing and demonstration only and should not be used in production, which makes it right for learning and client testing and wrong for real keys.

PyPI lists PyKMIP 0.11.0, uploaded 9 September 2026 and requiring Python 3.8 or later, while the GitHub releases page still shows v0.10.0 (February 2020) as the latest tagged release, so check both before pinning. Run everything on a disposable virtual machine.

Step 1: environment

mkdir -p ~/kmip-lab/{pki,policies,data} && cd ~/kmip-lab
python3 -m venv .venv && . .venv/bin/activate
pip install "PyKMIP==0.11.0"

Pin and record the version: a KMIP client library is a dependency like any other and belongs in your SBOM.

Step 2: lab CA and certificates

cd ~/kmip-lab/pki
openssl req -x509 -newkey rsa:3072 -sha256 -days 30 -nodes \
  -keyout ca.key -out ca.pem -subj "/CN=kmip-lab-ca"

openssl req -newkey rsa:3072 -sha256 -nodes \
  -keyout server.key -out server.csr -subj "/CN=localhost"
printf "subjectAltName=DNS:localhost,IP:127.0.0.1\nextendedKeyUsage=serverAuth\n" > server.ext
openssl x509 -req -in server.csr -CA ca.pem -CAkey ca.key -CAcreateserial \
  -days 30 -sha256 -extfile server.ext -out server.pem

printf "extendedKeyUsage=clientAuth\n" > client.ext
for id in app1 app2; do
  openssl req -newkey rsa:3072 -sha256 -nodes -keyout $id.key -out $id.csr -subj "/CN=$id"
  openssl x509 -req -in $id.csr -CA ca.pem -CAkey ca.key -CAcreateserial \
    -days 30 -sha256 -extfile client.ext -out $id.pem
done
openssl x509 -in app1.pem -noout -ext extendedKeyUsage

The PyKMIP server uses the subject common name as the client identity, so these are app1 and app2.

Step 3: server configuration

PyKMIP reads /etc/pykmip/server.conf by default. These settings come from its server documentation; replace /home/you with your home directory.

[server]
hostname=127.0.0.1
port=5696
certificate_path=/home/you/kmip-lab/pki/server.pem
key_path=/home/you/kmip-lab/pki/server.key
ca_path=/home/you/kmip-lab/pki/ca.pem
auth_suite=TLS1.2
policy_path=/home/you/kmip-lab/policies
enable_tls_client_auth=True
logging_level=INFO
database_path=/home/you/kmip-lab/data/pykmip.db

The documentation lists Basic and TLS1.2 for auth_suite, and warns that deleting the database file loses the stored objects for good, so keep it out of /tmp. The log defaults to /var/log/pykmip/server.log.

Step 4: an owner only policy

PyKMIP loads JSON policies from policy_path while running. Save this as ~/kmip-lab/policies/owner_only.json, checking the layout against the example policy in the documentation for your version:

{
  "owner_only": {
    "preset": {
      "SYMMETRIC_KEY": {
        "CREATE": "ALLOW_OWNER",
        "GET": "ALLOW_OWNER",
        "GET_ATTRIBUTES": "ALLOW_OWNER",
        "LOCATE": "ALLOW_OWNER",
        "ACTIVATE": "ALLOW_OWNER",
        "REVOKE": "ALLOW_OWNER",
        "DESTROY": "ALLOW_OWNER",
        "REKEY": "ALLOW_OWNER"
      }
    }
  }
}

Step 5: start the server and test client authentication

sudo mkdir -p /var/log/pykmip && sudo chown "$USER" /var/log/pykmip
pykmip-server

In a second terminal:

# Expect a handshake failure: no client certificate
openssl s_client -connect 127.0.0.1:5696 -CAfile ~/kmip-lab/pki/ca.pem -brief </dev/null

# Expect success with app1's certificate
openssl s_client -connect 127.0.0.1:5696 -CAfile ~/kmip-lab/pki/ca.pem \
  -cert ~/kmip-lab/pki/app1.pem -key ~/kmip-lab/pki/app1.key -brief </dev/null

If the first command succeeds, client authentication is not enforced; fix that before going further.

Step 6: client configuration

Save as ~/kmip-lab/pykmip.conf, one block per identity, then copy the block as [app2] with app2's files:

[app1]
host=127.0.0.1
port=5696
certfile=/home/you/kmip-lab/pki/app1.pem
keyfile=/home/you/kmip-lab/pki/app1.key
ca_certs=/home/you/kmip-lab/pki/ca.pem
cert_reqs=CERT_REQUIRED

PyKMIP's example also shows username and password fields. They are optional; keep passwords out of files you copy around.

Step 7: create, register, activate, fetch

The calls below are the documented ProxyKmipClient methods. Set kmip_version explicitly rather than relying on a default.

# kmip_lab.py: lab only
import os
from kmip.pie import client, objects
from kmip import enums

CONF = os.path.expanduser("~/kmip-lab/pykmip.conf")
M = enums.CryptographicUsageMask

def connect(name):
    return client.ProxyKmipClient(config=name, config_file=CONF,
                                  kmip_version=enums.KMIPVersion.KMIP_2_0)

with connect("app1") as c:
    k1 = c.create(enums.CryptographicAlgorithm.AES, 256,
                  operation_policy_name="owner_only",
                  name="orders-db-master",
                  cryptographic_usage_mask=[M.ENCRYPT, M.DECRYPT])  # mask 0xC
    k2 = c.register(objects.SymmetricKey(
        enums.CryptographicAlgorithm.AES, 256, os.urandom(32),
        masks=[M.ENCRYPT, M.DECRYPT], name="legacy-import"))
    c.activate(k1)
    c.activate(k2)
    print(c.get_attributes(k1, ["State", "Cryptographic Usage Mask"]))
    key = c.get(k1)   # works only because Extractable defaulted to True
    print(k1, type(key).__name__, len(key.value), "bytes")

with connect("app2") as c:
    try:
        c.get(k1)
        print("WARNING: app2 read app1's key; policy not applied")
    except Exception as e:
        print("app2 refused as expected:", e)

Keyword names for masks and attribute lists can differ between PyKMIP versions; if a call raises TypeError, check the client documentation for the version you pinned.

Step 8: rotate, retire and destroy

with connect("app1") as c:
    new_id = c.rekey(uid=k1, offset=60)   # new key activates 60 s after creation
    print(c.get_attributes(new_id, ["Name", "State", "Link"]))
    print(c.get_attributes(k1, ["Name", "State", "Link"]))
    c.revoke(enums.RevocationReasonCode.CESSATION_OF_OPERATION, k1)
    c.destroy(k1)                         # fails if k1 were still Active
    print(c.get_attributes(k1, ["State"]))   # metadata survives

The replacement takes over the name orders-db-master, and the two keys are linked. Applications should find their key by name with locate, which returns the newest match first, rather than caching identifiers.

Warning before adapting this anywhere real: Destroy is irreversible for key material. First confirm no data is protected only by that key, then print the identifier's Name, State and Link and check by eye that it is the old key, not the replacement.

Step 9: review the log and tear down

grep -E "Get|Locate|Revoke|Destroy|denied|failed" /var/log/pykmip/server.log | tail -n 50

You should see each operation tied to app1 or app2, the refused app2 request, the Revoke and the Destroy. If you cannot answer "which identity fetched this key, when, and from where" from a production server's log, fix that first. Then delete the virtual machine, ~/kmip-lab, /etc/pykmip and /var/log/pykmip, including the lab CA key.

Common mistakes

Shared client certificates. One certificate on every host means one identity: ownership checks mean nothing, logs cannot tell hosts apart, and revoking one host revokes all.

Trusting the export defaults. In KMIP 2.1, Extractable defaults to True and Sensitive to False. Set both deliberately and verify with Get Attributes.

No backup of the key server, or untested restores. A lost key database means lost data. Back up the database and master key separately, encrypt the backups, keep them off site and restore on a schedule.

Ignoring key states. Encrypting with a Deactivated key, calling Destroy on Active keys, or rotating without ever deactivating the old key all treat state as a label rather than a rule.

Rotating without a data plan. Re-key does not re-encrypt anything; data under the old key still needs it.

Treating the Log operation as an audit trail. Clients choose what Log writes. Audit evidence must come from the server.

Claiming conformance without a version and profile. Specify protocol versions, profiles and authentication suite, and test the actual pair of products.

FAQ

What is KMIP used for?

It lets products that encrypt data, such as storage arrays, tape libraries, databases, hypervisors and backup software, use a central key server that creates, stores, rotates, revokes and destroys keys and records who used them.

What port does KMIP use?

TCP port 5696, registered with IANA for KMIP in July 2011 and required by the KMIP 2.1 Basic Authentication Suite.

Is KMIP the same as PKCS #11?

No. PKCS #11 is a C API an application calls to use a token or HSM in process. KMIP is a network protocol between a client and a key server. A KMIP server may use PKCS #11 to reach its HSM.

What is TTLV in KMIP?

Tag, Type, Length, Value: a 3 byte tag, 1 byte type, 4 byte length and a value padded to a multiple of 8 bytes. Structures nest other items.

What is the latest version of KMIP?

KMIP 2.1, an OASIS Standard since 14 December 2020. KMIP 3.0 reached Committee Specification Draft 02 on 7 May 2026 and is not yet a standard.

Does KMIP require mutual TLS?

Under the KMIP 2.1 Basic Authentication Suite, yes, for all operations except automated client provisioning.

How does key rotation work in KMIP?

Re-key creates a linked replacement that takes over the old key's name. You then revoke the old key, re-encrypt or retire data that depends on it, and destroy it.

Can a KMIP server return keys in plaintext?

Yes, if Extractable is True, Sensitive is False and the access policy allows the Get. Sensitive True forces wrapping; Extractable False blocks retrieval.

Is there an open source KMIP server I can use?

PyKMIP includes one, but its documentation says it is for testing and demonstration only. For production, use a supported server, ideally HSM backed, and check which versions and profiles it has passed.

Why software supply chain hygiene still matters here

KMIP is a protocol, and the keys it carries live on servers and HSMs you do not build. But every KMIP client and integration is software made of open source parts, from TLS libraries to KMIP client libraries pinned in your projects, and a flaw in one of them can expose the channel that carries your keys.

Fix it without waiting for upstream

Whatever the vulnerability, most of the risk sits in two gaps. The first is the time between a fix being published and that fix actually running in your production builds. The second, and worse, is the time before any fix exists at all, while a maintainer works out a patch and a release schedule. Waiting through both gaps is a habit, not a requirement. Safeguard gives teams three ways to close them.

1. Autonomous remediation: pull requests, not tickets

When a fixed version exists, Safeguard's Griffin models open a tested, policy gated pull request that moves the affected dependency to the safe version. You can run it on one repository or in bulk across every project that carries the vulnerable version. Remediation categories include dependencies, licenses, security posture and findings, and each one is set separately. Reachability analysis ranks the vulnerable code paths your application actually calls first, so the first pull requests you merge are the ones that matter most. Autonomous remediation ships switched off, with every category set to Manual, so your team decides how much runs on its own and what still needs a human approval.

2. Gold Open Source: the safe version in seconds, free

gold.safeguard.sh is free and needs no login. Search any CVE or package to see affected and fixed versions, CVSS, EPSS, CISA KEV status and a recommended safe version, or use the "Am I affected?" checker. The same data is available through a free read API, README status badges and RSS threat feeds.

3. Gold Registry: start from components that are already fixed

Gold Registry provides hardened, drop in replacements for upstream packages and container images. Every Gold artifact is held continuously to zero exploitable critical or high CVEs and a completed license check, with signed build provenance (signed with Safeguard's key and verifiable with cosign, SLSA Build Level 3 as the design target) and a public evidence page you can hand to an auditor. An artifact loses its Gold badge if it regresses. Teams can point their own package directory at the registry so hardened equivalents resolve without changing how developers install anything.

When upstream has no fix yet, or will not ship one, Safeguard first works to get the fix accepted upstream. If the issue is severe or upstream will not move, Safeguard builds a fork, fixes the vulnerability there and publishes a hardened Gold build, so you are not stuck on a maintainer's release schedule. You can also request a hardened, compatibility tested build of a specific package. Ask which packages it covers before you plan around it.

Your situationWhat to use
A fixed version existsAutonomous remediation opens the upgrade pull request; Gold Open Source confirms the safe version
You need to know today whether you are affectedGold Open Source lookup and "Am I affected?" checker, free and without login
You want vulnerable versions to stop shippingSafeguard policies and gates in CI
Upstream has no fix yet, or will not ship oneA custom Gold request; fork and patch
You want to start clean on new projectsPull hardened components and images from Gold Registry

One honest limit: when the vulnerable code lives in a vendor appliance, a hosted service or an operating system runtime you do not build yourself, the fix still has to come from that vendor or distribution. The steps above apply to the open source dependencies and container images you build and ship, which is where most teams carry the largest and least tracked share of their exposure.

See how Safeguard would help

To be plain about the fit: Safeguard is not a key manager, does not speak KMIP, does not hold or rotate keys and does not audit your key server's configuration or logs. Where it helps is the software around them. It scans repositories, container images and SBOM files for dependencies, matches them against vulnerability data and shows which projects contain a given component and version, including the KMIP client, TLS and cryptography libraries inside what you build. Gold Open Source at gold.safeguard.sh gives free CVE intelligence with affected and fixed versions for those components.

The first demo is a real CLI session. Asked to fix a lodash CVE, the assistant reads the finding and advisory, asks before any command that changes something, edits package.json to lodash 4.17.21, runs npm install and npm test with your approval, prints a summary and pushes nothing. The same flow applies when a service that talks to your key server pins an outdated TLS or KMIP client library.

Click through it at your own pace, or open it full screen.

The second demo sets up the local runner on your own machine, approves it with its device code, then scans from the terminal. Key management integrations often live in internal repositories and images that never leave the build network, and the runner scans them where they are built.

Click through it at your own pace, or open it full screen.

The third demo connects Claude to the Safeguard MCP server with OAuth and lets you choose which tools Claude can use. It is a way to ask which of your projects carry a given cryptography or TLS library version on the day an advisory lands, with tool permissions you set.

Click through it at your own pace, or open it full screen.

To try the CLI, download Safeguard and follow the CLI documentation.

Quick check

A client creates an AES key over KMIP 2.1 without setting Extractable or Sensitive. Can another authorised client read it in plaintext with Get?

Yes, unless server policy overrides the defaults. KMIP 2.1 sets Extractable to True and Sensitive to False when the client is silent, so Get can return the plaintext key to any client the access policy allows.

Your rotation script calls Destroy on a key that is still Active. What happens?

The request fails. KMIP only allows Destroy in the Pre-Active or Deactivated state, so the key must be revoked first.

How many bytes does a KMIP Integer item occupy on the wire?

Sixteen: 8 bytes of header (3 byte tag, 1 byte type, 4 byte length), 4 bytes of value and 4 bytes of padding.

Sources

Last reviewed: 25 October 2026. KMIP 3.0 is still a draft; check the OASIS KMIP TC page for its current status.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.