Class AzureKmsAead
java.lang.Object
io.confluent.kafka.schemaregistry.encryption.azure.AzureKmsAead
- All Implemented Interfaces:
com.google.crypto.tink.Aead
A
Aead that forwards encryption/decryption requests to a key in AZURE KMS.
Unlike AWS KMS and GCP KMS, Azure Key Vault addresses wrap/unwrap by an explicit key version
and does not embed that version in the ciphertext it returns. When encryptTarget is set
(see AzureKmsDriver.ENCRYPT_AZURE_KEY_VERSION_SAVE), encrypt(byte[], byte[]) makes its output
self-describing by prepending the exact version that produced it:
azure:v1:<32-character key version>:<raw ciphertext bytes>.
decrypt(byte[], byte[]) always checks for this prefix regardless of the current
encryptTarget, since a DEK wrapped while the toggle was on must remain decryptable even after
it is turned back off.
-
Constructor Summary
ConstructorsConstructorDescriptionAzureKmsAead(com.azure.security.keyvault.keys.cryptography.CryptographyClient defaultClient, com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm algorithm) ConstructorAzureKmsAead(com.azure.security.keyvault.keys.cryptography.CryptographyClient defaultClient, com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm algorithm, Supplier<Map.Entry<com.azure.security.keyvault.keys.cryptography.CryptographyClient, String>> encryptTarget, Function<String, com.azure.security.keyvault.keys.cryptography.CryptographyClient> clientFactory) -
Method Summary
-
Constructor Details
-
AzureKmsAead
public AzureKmsAead(com.azure.security.keyvault.keys.cryptography.CryptographyClient defaultClient, com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm algorithm) Constructor- Parameters:
defaultClient- - kms clientalgorithm- - algorithm
-
AzureKmsAead
public AzureKmsAead(com.azure.security.keyvault.keys.cryptography.CryptographyClient defaultClient, com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm algorithm, Supplier<Map.Entry<com.azure.security.keyvault.keys.cryptography.CryptographyClient, String>> encryptTarget, Function<String, com.azure.security.keyvault.keys.cryptography.CryptographyClient> clientFactory) - Parameters:
defaultClient- used when encrypting withencryptTargetunset, and when decrypting ciphertext with no embedded version prefixalgorithm- algorithmencryptTarget- if non-null, resolved lazily (not untilencrypt(byte[], byte[])is actually called) to determine the client and version (the entry's key and value, respectively) to prefix new output with. May throwAzureKmsClient.RuntimeAzureKmsExceptionto surface a checkedGeneralSecurityExceptionfrom resolution.clientFactory- builds aCryptographyClientfor an arbitrary version, used bydecrypt(byte[], byte[])to target whichever version is embedded in already-wrapped ciphertext, which may differ from whateverencryptTargetcurrently resolves to. Consulted bydecryptregardless of whetherencryptTargetis set, so may benullonly ifencryptTargetis alsonulland no already-prefixed ciphertext will ever be presented to this Aead.
-
-
Method Details
-
encrypt
- Specified by:
encryptin interfacecom.google.crypto.tink.Aead- Throws:
GeneralSecurityException
-
decrypt
- Specified by:
decryptin interfacecom.google.crypto.tink.Aead- Throws:
GeneralSecurityException
-