Package com.google.crypto.tink.aead
Class KmsAeadKeyManager
- java.lang.Object
-
- com.google.crypto.tink.aead.KmsAeadKeyManager
-
public final class KmsAeadKeyManager extends java.lang.ObjectThis key manager produces new instances ofAeadthat forwards encrypt/decrypt requests to a key residing in a remote KMS.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static KeyTemplatecreateKeyTemplate(java.lang.String keyUri)static voidregister(boolean newKeyAllowed)
-
-
-
Method Detail
-
register
public static void register(boolean newKeyAllowed) throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
createKeyTemplate
public static KeyTemplate createKeyTemplate(java.lang.String keyUri)
Returns a newKeyTemplatethat can generate aKmsAeadKeywhose key is pointing tokeyUri. Keys generated by this key template use the RAW output prefix to make them compatible with the remote KMS' encrypt/decrypt operations.It requires that a
KmsClientthat can handlekeyUriis registered. Avoid registering it more than once.Note: Unlike other templates, when you call
KeysetHandle#generateNewwith this template, Tink does not generate new key material, but only creates a reference to the remote key.It is often not necessary to use this function. Instead of registering a
KmsClient, and creating anAeadusingKeysetHandle.generateNew(KmsAeadKeyManager.createKeyTemplate(keyUri)).getPrimitive(RegistryConfiguration.get(), Aead.class), you can create theAeaddirectly usingkmsClient.getAead(kekUri), without registering anyKmsClient.
-
-