public class KmsClient extends Object
| Constructor and Description |
|---|
KmsClient(RestClient rest_client)
Instantiate a new Kmip client using a
RestClient |
KmsClient(String server_url,
Optional<String> api_key)
Instantiate a new KmipClient with DEFAULT_CONNECT_TIMEOUT and
DEFAULT_READ_TIMEOUT
|
| Modifier and Type | Method and Description |
|---|---|
DecryptedData |
coverCryptDecrypt(String userDecryptionKeyUniqueIdentifier,
byte[] encryptedData)
Decrypt the data in the KMS using the given User Decryption Key The
encryptedData should be made of 3 parts: -
the length of the encrypted header as a u32 in big endian format (4 bytes) -
the header - the AES GCM encrypted
content
|
DecryptedData |
coverCryptDecrypt(String userDecryptionKeyUniqueIdentifier,
byte[] encryptedData,
byte[] authenticationData)
Decrypt the data in the KMS using the given User Decryption Key The
encryptedData should be made of 3 parts: -
the length of the encrypted header as a u32 in big endian format (4 bytes) -
the header - the AES GCM encrypted
content
|
byte[] |
coverCryptEncrypt(String publicMasterKeyUniqueIdentifier,
byte[] plaintext,
String encryptionPolicy)
Encrypt data in the KMS using the given encryption policy and Public Master
Key.
|
byte[] |
coverCryptEncrypt(String publicMasterKeyUniqueIdentifier,
byte[] plaintext,
String encryptionPolicy,
byte[] authenticationData)
Encrypt data in the KMS using the given encryption policy and Public Master
Key.
|
byte[] |
coverCryptEncrypt(String publicMasterKeyUniqueIdentifier,
byte[] plaintext,
String encryptionPolicy,
byte[] authenticationData,
byte[] headerMetaData)
Encrypt data in the KMS using the given encryption policy and Public Master
Key.
|
String[] |
createCoverCryptMasterKeyPair(Policy policy)
Generate inside the KMS, a master private and public key pair for the
Policy |
String |
createCoverCryptUserDecryptionKey(AccessPolicy accessPolicy,
String privateMasterKeyUniqueIdentifier)
Create a User Decryption Key for the given
AccessPolicy in the KMS |
String |
createCoverCryptUserDecryptionKey(String accessPolicy,
String privateMasterKeyUniqueIdentifier)
Create a User Decryption Key for the given
AccessPolicy expressed as
a boolean expression |
String |
destroyKey(String uniqueIdentifier)
Destroy a key in the KMS which makes it unavailable to use in the KMS to
perform
coverCryptEncrypt(String, byte[], String) or
coverCryptDecrypt(String, byte[], Optional)
operations. |
String |
importCoverCryptPrivateMasterKey(String uniqueIdentifier,
PrivateKey privateMasterKey,
boolean replaceExisting)
Import a Private Master Key in the KMS
|
String |
importCoverCryptPublicMasterKey(String uniqueIdentifier,
PublicKey publicMasterKey,
boolean replaceExisting)
Import a Public Master Key in the KMS
|
String |
importCoverCryptUserDecryptionKey(String uniqueIdentifier,
PrivateKey userDecryptionKey,
boolean replaceExisting)
Import a User Decryption Key in the KMS
|
PrivateKey |
retrieveCoverCryptPrivateMasterKey(String privateMasterKeyUniqueIdentifier)
Retrieve the Master Private Key from the KMS
|
PublicKey |
retrieveCoverCryptPublicMasterKey(String publicMasterKeyUniqueIdentifier)
Retrieve the Master Public Key from the KMS
|
PrivateKey |
retrieveCoverCryptUserDecryptionKey(String userDecryptionKeyUniqueIdentifier)
Retrieve a User Decryption Key from the KMS
|
String |
revokeKey(String keyUniqueIdentifier)
Revoke a key in the KMS which makes it unavailable to use in the KMS to
perform
coverCryptEncrypt(String, byte[], String) or
coverCryptDecrypt(String, byte[], Optional)
operations. |
String |
rotateCoverCryptAttributes(String privateMasterKeyUniqueIdentifier,
String[] policyAttributes)
Rotate the given policy attributes.
|
public KmsClient(String server_url, Optional<String> api_key)
server_url - the REST Server URL e.g. http://localhost:9000api_key - he optional API Key to use to authenticatepublic KmsClient(RestClient rest_client)
RestClientrest_client - the RestClientpublic String[] createCoverCryptMasterKeyPair(Policy policy) throws CloudproofException
Policypolicy - the Key PolicyCloudproofException - if the creation failspublic PrivateKey retrieveCoverCryptPrivateMasterKey(String privateMasterKeyUniqueIdentifier) throws CloudproofException
privateMasterKeyUniqueIdentifier - the key UIDCloudproofException - if the retrieval failspublic String importCoverCryptPrivateMasterKey(String uniqueIdentifier, PrivateKey privateMasterKey, boolean replaceExisting) throws CloudproofException
uniqueIdentifier - the UID of the keyprivateMasterKey - the keyreplaceExisting - if a key exists under this UID, replace itCloudproofException - if the import failspublic PublicKey retrieveCoverCryptPublicMasterKey(String publicMasterKeyUniqueIdentifier) throws CloudproofException
publicMasterKeyUniqueIdentifier - the key UIDCloudproofException - if the retrieval failspublic String importCoverCryptPublicMasterKey(String uniqueIdentifier, PublicKey publicMasterKey, boolean replaceExisting) throws CloudproofException
uniqueIdentifier - the UID of the keypublicMasterKey - the keyreplaceExisting - if a key exists under this UID, replace itCloudproofException - if the import failspublic String createCoverCryptUserDecryptionKey(String accessPolicy, String privateMasterKeyUniqueIdentifier) throws CloudproofException
AccessPolicy expressed as
a boolean expressionaccessPolicy - the AccessPolicy as a stringprivateMasterKeyUniqueIdentifier - the UID of the Master Private KeyCloudproofException - if the creation failspublic String createCoverCryptUserDecryptionKey(AccessPolicy accessPolicy, String privateMasterKeyUniqueIdentifier) throws CloudproofException
AccessPolicy in the KMSaccessPolicy - the AccessPolicyprivateMasterKeyUniqueIdentifier - the UID of the Master Private KeyCloudproofException - if the creation failspublic PrivateKey retrieveCoverCryptUserDecryptionKey(String userDecryptionKeyUniqueIdentifier) throws CloudproofException
userDecryptionKeyUniqueIdentifier - the key UIDCloudproofException - if the retrieval failspublic String importCoverCryptUserDecryptionKey(String uniqueIdentifier, PrivateKey userDecryptionKey, boolean replaceExisting) throws CloudproofException
uniqueIdentifier - the UID of the keyuserDecryptionKey - the keyreplaceExisting - if a key exists under this UID, replace itCloudproofException - if the import failspublic byte[] coverCryptEncrypt(String publicMasterKeyUniqueIdentifier, byte[] plaintext, String encryptionPolicy) throws CloudproofException
publicMasterKeyUniqueIdentifier - the UID of the Public Keyplaintext - the data to encryptencryptionPolicy - the encryption policy as a boolean
expressionCloudproofException - if the encryption failspublic byte[] coverCryptEncrypt(String publicMasterKeyUniqueIdentifier, byte[] plaintext, String encryptionPolicy, byte[] authenticationData) throws CloudproofException
publicMasterKeyUniqueIdentifier - the UID of the Public Keyplaintext - the data to encryptencryptionPolicy - the encryption policy as a boolean
expressionauthenticationData - the authentication data used in the
AEAD of the symmetric schemeCloudproofException - if the encryption failspublic byte[] coverCryptEncrypt(String publicMasterKeyUniqueIdentifier, byte[] plaintext, String encryptionPolicy, byte[] authenticationData, byte[] headerMetaData) throws CloudproofException
publicMasterKeyUniqueIdentifier - the UID of the Public Keyplaintext - the data to encryptencryptionPolicy - the encryption policy as a boolean
expressionauthenticationData - the authentication data used in the
AEAD of the symmetric schemeheaderMetaData - Metadata to encrypt within the headerCloudproofException - if the encryption failspublic DecryptedData coverCryptDecrypt(String userDecryptionKeyUniqueIdentifier, byte[] encryptedData) throws CloudproofException
userDecryptionKeyUniqueIdentifier - the key UIDencryptedData - the cipher textCloudproofException - if the decryption failspublic DecryptedData coverCryptDecrypt(String userDecryptionKeyUniqueIdentifier, byte[] encryptedData, byte[] authenticationData) throws CloudproofException
userDecryptionKeyUniqueIdentifier - the key UIDencryptedData - the cipher textauthenticationData - the data to use in the
authentication of the symmetric
schemeCloudproofException - if the decryption failspublic String rotateCoverCryptAttributes(String privateMasterKeyUniqueIdentifier, String[] policyAttributes) throws CloudproofException
Policy when
Master Keys are createdprivateMasterKeyUniqueIdentifier - the UID of the private master keypolicyAttributes - the array of CoverCrypt attributesCloudproofException - if the revocation failspublic String revokeKey(String keyUniqueIdentifier) throws CloudproofException
coverCryptEncrypt(String, byte[], String) or
coverCryptDecrypt(String, byte[], Optional)
operations. keyUniqueIdentifier - the UID of the key to revokeCloudproofException - if the revocation failspublic String destroyKey(String uniqueIdentifier) throws CloudproofException
coverCryptEncrypt(String, byte[], String) or
coverCryptDecrypt(String, byte[], Optional)
operations. uniqueIdentifier - the UID of the key to revokeCloudproofException - if the destruction failsCopyright © 2023. All rights reserved.