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, toString
buildCannotDecryptDksException, buildCannotDecryptDksException, buildCannotDecryptDksException, getMasterKey
public 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)
MasterKey
DataKey
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)
KmsMethods
grantTokens
which should be submitted to KMS when calling it.setGrantTokens
in interface KmsMethods
public List<String> getGrantTokens()
KmsMethods
getGrantTokens
in interface KmsMethods
public void addGrantToken(String grantToken)
KmsMethods
grantToken
to the list of grantTokens sent to KMS when this class calls it.addGrantToken
in interface KmsMethods
public DataKey<KmsMasterKey> encryptDataKey(CryptoAlgorithm algorithm, Map<String,String> encryptionContext, DataKey<?> dataKey)
MasterKey
dataKey
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
MasterKeyProvider
encryptedDataKeys
and returns the first one which can be successfully
decrypted.decryptDataKey
in class MasterKeyProvider<KmsMasterKey>
null
UnsupportedProviderException
- if the encryptedDataKey
is associated with an
unsupported providerCannotUnwrapDataKeyException
- if the encryptedDataKey
cannot be decryptedAwsCryptoException
Copyright © 2023. All rights reserved.