Class KeyOperations
AuthenticatedKeyManagementSdk.keys().
Request and response bodies are the generated models of the Key Management contract, so every
member an operation accepts can be set. A refused call throws KeyManagementSdkException
carrying the RFC 9457 problem; classify on
KeyManagementSdkException.getProblemType().
OrchestrationKeyRequest request = new OrchestrationKeyRequest()
.kid("payments-signing-key")
.kty("ML-DSA")
.algorithm("ML-DSA-65");
OrchestrationKeyResponse created = sdk.keys().create(request);
-
Method Summary
Modifier and TypeMethodDescriptionanalyzeKeystore(Path keystore, String metadata, SecretChars password) Analyses a keystore without importing anything (POST /tenants/{t}/keys/import-keystore/analyze).voidArchives a key (POST /tenants/{t}/keys/{kid}/archive); an archived key can then be requested for destruction.create(OrchestrationKeyRequest request) Creates a key (POST /tenants/{t}/keys).Exports a key's public part (GET /tenants/{t}/keys/{kid}/export).Reads one key (GET /tenants/{t}/keys/{kid}).importKey(KeyImportRequest request) Imports one key (POST /tenants/{t}/keys/import-key).importKeystore(Path keystore, String metadata, SecretChars password) Imports the private keys and trusted certificates of a PKCS#12 or JKS keystore (POST /tenants/{t}/keys/import-keystore).Reads which lifecycle causes the key admits for a revocation or a suspension (GET /tenants/{t}/keys/{kid}/lifecycle-cause-verdicts).list(KeyListQuery query) Lists the tenant's keys (GET /tenants/{t}/keys).voidreactivate(String kid) Reactivates a suspended key (POST /tenants/{t}/keys/{kid}/reactivate).voidrevoke(String kid, RevokeKeyRequest request) Revokes a key (POST /tenants/{t}/keys/{kid}/revoke).Reads the tenant's supported algorithm catalogue (GET /tenants/{t}/supported-algorithms).voidsuspend(String kid, SuspendKeyRequest request) Suspends a key (POST /tenants/{t}/keys/{kid}/suspend).voidupdate(String kid, AdminKeyMergePatchRequest patch) Updates a key's metadata with a JSON merge patch (PATCH /tenants/{t}/keys/{kid}).
-
Method Details
-
list
Lists the tenant's keys (GET /tenants/{t}/keys).- Parameters:
query- the filters and page; must not benull(KeyListQuery.firstPage()for the server's defaults)- Returns:
- one page of keys
- Throws:
KeyManagementSdkException- when the Admin API refuses the call
-
get
Reads one key (GET /tenants/{t}/keys/{kid}).- Parameters:
kid- the key identifier; must not benull- Returns:
- the key, with its lifecycle status (a destroyed key reads
deleted_logical) - Throws:
KeyManagementSdkException- when the key does not exist in the tenant (404) or the call is refused
-
create
Creates a key (POST /tenants/{t}/keys).A Key ID that belonged to a destroyed key of this tenant is never reused: the Admin API answers 409 with problem type
…/key-id-retired.- Parameters:
request- the key to create; must not benull- Returns:
- the created key
- Throws:
KeyManagementSdkException- when the request is invalid (400), the Key ID is taken or retired (409), the algorithm is refused by policy (422), or the call is refused otherwise
-
update
Updates a key's metadata with a JSON merge patch (PATCH /tenants/{t}/keys/{kid}).A change that weakens the key (a later expiry, a higher usage limit, making it exportable) waits for quorum approval when the tenant's quorum policy gates key weakening: the call then throws
QuorumApprovalPendingExceptionand nothing changes until people approve it in the Admin Console.- Parameters:
kid- the key identifier; must not benullpatch- the members to change; must not benull- Throws:
QuorumApprovalPendingException- when the change waits for quorum approvalKeyManagementSdkException- when the call is refused
-
importKey
Imports one key (POST /tenants/{t}/keys/import-key).- Parameters:
request- the key to import; must not benull- Returns:
- the imported key's public representation
- Throws:
KeyManagementSdkException- when the call is refused (a retired Key ID is 409…/key-id-retired)
-
importKeystore
Imports the private keys and trusted certificates of a PKCS#12 or JKS keystore (POST /tenants/{t}/keys/import-keystore).The keystore password travels as the raw bytes of the
passwordpart, read frompasswordand wiped after the request; it is never written to a file or a log.- Parameters:
keystore- the keystore file; must not benullmetadata- the import metadata JSON document (the Key IDs and policies to give the imported entries, as the import contract defines it); must not benullpassword- the keystore password, ornullfor an unprotected keystore- Returns:
- the import outcome per entry
- Throws:
KeyManagementSdkException- when the keystore cannot be read or the call is refused
-
analyzeKeystore
public KeystoreAnalysisResponse analyzeKeystore(Path keystore, String metadata, SecretChars password) Analyses a keystore without importing anything (POST /tenants/{t}/keys/import-keystore/analyze).- Parameters:
keystore- the keystore file; must not benullmetadata- the import metadata JSON document; must not benullpassword- the keystore password, ornullfor an unprotected keystore- Returns:
- what an import would do with each entry
- Throws:
KeyManagementSdkException- when the keystore cannot be read or the call is refused
-
export
Exports a key's public part (GET /tenants/{t}/keys/{kid}/export).- Parameters:
kid- the key identifier; must not benull- Returns:
- the exported public key and its metadata
- Throws:
KeyManagementSdkException- when the call is refused
-
lifecycleCauseVerdicts
Reads which lifecycle causes the key admits for a revocation or a suspension (GET /tenants/{t}/keys/{kid}/lifecycle-cause-verdicts).- Parameters:
kid- the key identifier; must not benull- Returns:
- the verdict per cause
- Throws:
KeyManagementSdkException- when the call is refused
-
supportedAlgorithms
Reads the tenant's supported algorithm catalogue (GET /tenants/{t}/supported-algorithms).- Parameters:
query- the filters; must not benull(SupportedAlgorithmQuery.all()for the whole catalogue)- Returns:
- the matching algorithms
- Throws:
KeyManagementSdkException- when the call is refused
-
suspend
Suspends a key (POST /tenants/{t}/keys/{kid}/suspend).- Parameters:
kid- the key identifier; must not benullrequest- the suspension cause and reason; must not benull- Throws:
KeyManagementSdkException- when the call is refused
-
reactivate
Reactivates a suspended key (POST /tenants/{t}/keys/{kid}/reactivate).- Parameters:
kid- the key identifier; must not benull- Throws:
KeyManagementSdkException- when the call is refused
-
revoke
Revokes a key (POST /tenants/{t}/keys/{kid}/revoke).- Parameters:
kid- the key identifier; must not benullrequest- the revocation cause and reason; must not benull- Throws:
KeyManagementSdkException- when the call is refused
-
archive
Archives a key (POST /tenants/{t}/keys/{kid}/archive); an archived key can then be requested for destruction.- Parameters:
kid- the key identifier; must not benull- Throws:
KeyManagementSdkException- when the call is refused
-