public final class KmsMasterKey extends MasterKey<KmsMasterKey> implements KmsMethods
AwsCrypto.
This component is not multi-Region key aware, and will treat every AWS KMS identifier as regionally isolated.
| Modifier and Type | Method and Description |
|---|---|
void |
addGrantToken(String grantToken)
Adds
grantToken to the list of grantTokens sent to KMS when this class calls it. |
DataKey<KmsMasterKey> |
decryptDataKey(CryptoAlgorithm algorithm,
Collection<? extends EncryptedDataKey> encryptedDataKeys,
Map<String,String> encryptionContext)
Iterates through
encryptedDataKeys and returns the first one which can be successfully
decrypted. |
DataKey<KmsMasterKey> |
encryptDataKey(CryptoAlgorithm algorithm,
Map<String,String> encryptionContext,
DataKey<?> dataKey)
Returns a new copy of the provided
dataKey which is protected by this MasterKey
for use with algorithm and associated with the provided encryptionContext. |
DataKey<KmsMasterKey> |
generateDataKey(CryptoAlgorithm algorithm,
Map<String,String> encryptionContext)
|
List<String> |
getGrantTokens()
Returns the grantTokens which this object sends to KMS when calling it.
|
String |
getKeyId() |
String |
getProviderId() |
void |
setGrantTokens(List<String> grantTokens)
Sets the
grantTokens which should be submitted to KMS when calling it. |
canProvide, equals, getDefaultProviderId, getMasterKey, getMasterKeysForEncryption, hashCode, toStringbuildCannotDecryptDksException, buildCannotDecryptDksException, buildCannotDecryptDksException, getMasterKeypublic String getProviderId()
getProviderId in class MasterKey<KmsMasterKey>public String getKeyId()
getKeyId in class MasterKey<KmsMasterKey>public DataKey<KmsMasterKey> generateDataKey(CryptoAlgorithm algorithm, Map<String,String> encryptionContext)
MasterKeyDataKey which is protected by this MasterKey for use with
algorithm and associated with the provided encryptionContext.generateDataKey in class MasterKey<KmsMasterKey>public void setGrantTokens(List<String> grantTokens)
KmsMethodsgrantTokens which should be submitted to KMS when calling it.setGrantTokens in interface KmsMethodspublic List<String> getGrantTokens()
KmsMethodsgetGrantTokens in interface KmsMethodspublic void addGrantToken(String grantToken)
KmsMethodsgrantToken to the list of grantTokens sent to KMS when this class calls it.addGrantToken in interface KmsMethodspublic DataKey<KmsMasterKey> encryptDataKey(CryptoAlgorithm algorithm, Map<String,String> encryptionContext, DataKey<?> dataKey)
MasterKeydataKey which is protected by this MasterKey
for use with algorithm and associated with the provided encryptionContext.encryptDataKey in class MasterKey<KmsMasterKey>public DataKey<KmsMasterKey> decryptDataKey(CryptoAlgorithm algorithm, Collection<? extends EncryptedDataKey> encryptedDataKeys, Map<String,String> encryptionContext) throws UnsupportedProviderException, AwsCryptoException
MasterKeyProviderencryptedDataKeys and returns the first one which can be successfully
decrypted.decryptDataKey in class MasterKeyProvider<KmsMasterKey>nullUnsupportedProviderException - if the encryptedDataKey is associated with an
unsupported providerCannotUnwrapDataKeyException - if the encryptedDataKey cannot be decryptedAwsCryptoExceptionCopyright © 2023. All rights reserved.