public class Abe extends Object
| Constructor and Description |
|---|
Abe(RestClient rest_client,
Specifications abeSpecifications) |
| Modifier and Type | Method and Description |
|---|---|
String[] |
createMasterKeyPair(Policy policy)
Generate inside the KMS, a master private and public key pair for the
Policy |
String |
createUserDecryptionKey(AccessPolicy accessPolicy,
String privateMasterKeyUniqueIdentifier)
Create a User Decryption Key for the given
AccessPolicy in the KMS |
String |
destroy(String uniqueIdentifier)
Destroy a key in the KMS which makes it unavailable to use in the KMS to perform
kmsEncrypt(String, byte[], Attr[]) or kmsDecrypt(String, byte[]) operations. |
String |
importPrivateMasterKey(String uniqueIdentifier,
PrivateKey privateMasterKey,
boolean replaceExisting)
Import a Private Master Key in the KMS
|
String |
importPublicMasterKey(String uniqueIdentifier,
PublicKey publicMasterKey,
boolean replaceExisting)
Import a Public Master Key in the KMS
|
String |
importUserDecryptionKey(String uniqueIdentifier,
PrivateKey userDecryptionKey,
boolean replaceExisting)
Import a User Decryption Key in the KMS
|
byte[] |
kmsDecrypt(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
|
byte[] |
kmsDecrypt(String userDecryptionKeyUniqueIdentifier,
byte[] encryptedData,
Optional<byte[]> uid)
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[] |
kmsEncrypt(String publicMasterKeyUniqueIdentifier,
byte[] data,
Attr[] attributes)
Encrypt data in the KMS using the given Policy Attributes (@see
Attr) and Public Master Key. |
byte[] |
kmsEncrypt(String publicMasterKeyUniqueIdentifier,
byte[] data,
Attr[] attributes,
Optional<byte[]> uid)
Encrypt data in the KMS using the given Policy Attributes (@see
Attr) and Public Master Key. |
PrivateKey |
retrievePrivateMasterKey(String privateMasterKeyUniqueIdentifier)
Retrieve the Master Private Key from the KMS
|
PublicKey |
retrievePublicMasterKey(String publicMasterKeyUniqueIdentifier)
Retrieve the Master Public Key from the KMS
|
PrivateKey |
retrieveUserDecryptionKey(String userDecryptionKeyUniqueIdentifier)
Retrieve a User Decryption Key from the KMS
|
String |
revokeAttributes(String privateMasterKeyUniqueIdentifier,
Attr[] policyAttributes)
Revoke the given policy attributes.
|
String |
revokeKey(String keyUniqueIdentifier)
Revoke a key in the KMS which makes it unavailable to use in the KMS to perform
kmsEncrypt(String, byte[], Attr[]) or kmsDecrypt(String, byte[]) operations. |
public Abe(RestClient rest_client, Specifications abeSpecifications)
public String[] createMasterKeyPair(Policy policy) throws CosmianException
Policypolicy - the Key PolicyCosmianException - if the creation failspublic PrivateKey retrievePrivateMasterKey(String privateMasterKeyUniqueIdentifier) throws CosmianException
privateMasterKeyUniqueIdentifier - the key UIDCosmianException - if the retrieval failspublic String importPrivateMasterKey(String uniqueIdentifier, PrivateKey privateMasterKey, boolean replaceExisting) throws CosmianException
uniqueIdentifier - the UID of the keyprivateMasterKey - the keyreplaceExisting - if a key exists under this UID, replace itCosmianException - if the import failspublic PublicKey retrievePublicMasterKey(String publicMasterKeyUniqueIdentifier) throws CosmianException
publicMasterKeyUniqueIdentifier - the key UIDCosmianException - if the retrieval failspublic String importPublicMasterKey(String uniqueIdentifier, PublicKey publicMasterKey, boolean replaceExisting) throws CosmianException
uniqueIdentifier - the UID of the keypublicMasterKey - the keyreplaceExisting - if a key exists under this UID, replace itCosmianException - if the import failspublic String createUserDecryptionKey(AccessPolicy accessPolicy, String privateMasterKeyUniqueIdentifier) throws CosmianException
AccessPolicy in the KMSaccessPolicy - the AccessPolicyprivateMasterKeyUniqueIdentifier - the UID of the Master Private KeyCosmianException - if the creation failspublic PrivateKey retrieveUserDecryptionKey(String userDecryptionKeyUniqueIdentifier) throws CosmianException
userDecryptionKeyUniqueIdentifier - the key UIDCosmianException - if the retrieval failspublic String importUserDecryptionKey(String uniqueIdentifier, PrivateKey userDecryptionKey, boolean replaceExisting) throws CosmianException
uniqueIdentifier - the UID of the keyuserDecryptionKey - the keyreplaceExisting - if a key exists under this UID, replace itCosmianException - if the import failspublic byte[] kmsEncrypt(String publicMasterKeyUniqueIdentifier, byte[] data, Attr[] attributes) throws CosmianException
Attr) and Public Master Key. The data is
encrypted using an hybrid encryption scheme + AÉS 256 GCM. No Metadata is added to the header and no resource uid
is used in the AES AEAD scheme. The generated cipher text is 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 contentpublicMasterKeyUniqueIdentifier - the UID of the Public Keydata - the data to encryptattributes - the Policy AttributesCosmianException - if the encryption failspublic byte[] kmsEncrypt(String publicMasterKeyUniqueIdentifier, byte[] data, Attr[] attributes, Optional<byte[]> uid) throws CosmianException
Attr) and Public Master Key. The data is
encrypted using an hybrid encryption scheme + AÉS 256 GCM. The uid is used in the authentication of the AES GCM
scheme. If supplied it will be saved encrypted as part of the header The generated cipher text is 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
contentpublicMasterKeyUniqueIdentifier - the UID of the Public Keydata - the data to encryptattributes - the Policy Attributesuid - the UID uses in the AEAD of the symmetric schemeCosmianException - if the encryption failspublic byte[] kmsDecrypt(String userDecryptionKeyUniqueIdentifier, byte[] encryptedData) throws CosmianException
userDecryptionKeyUniqueIdentifier - the key UIDencryptedData - the cipher textCosmianException - if the decryption failspublic byte[] kmsDecrypt(String userDecryptionKeyUniqueIdentifier, byte[] encryptedData, Optional<byte[]> uid) throws CosmianException
userDecryptionKeyUniqueIdentifier - the key UIDencryptedData - the cipher textuid - the resource uid to use in the authentication of the symmetric schemeCosmianException - if the decryption failspublic String revokeAttributes(String privateMasterKeyUniqueIdentifier, Attr[] policyAttributes) throws CosmianException
Policy when
Master Keys are createdprivateMasterKeyUniqueIdentifier - the UID of the private master keypolicyAttributes - the array of AttrCosmianException - if the revocation failspublic String revokeKey(String keyUniqueIdentifier) throws CosmianException
kmsEncrypt(String, byte[], Attr[]) or kmsDecrypt(String, byte[]) operations. keyUniqueIdentifier - the UID of the key to revokeCosmianException - if the revocation failspublic String destroy(String uniqueIdentifier) throws CosmianException
kmsEncrypt(String, byte[], Attr[]) or kmsDecrypt(String, byte[]) operations. uniqueIdentifier - the UID of the key to revokeCosmianException - if the destruction failsCopyright © 2022. All rights reserved.