public class KmsMasterKeyProvider extends MasterKeyProvider<KmsMasterKey> implements KmsMethods
MasterKeys backed by the AWS Key Management Service. This object is regional and
if you want to use keys from multiple regions, you'll need multiple copies of this object.| Modifier and Type | Class and Description |
|---|---|
static class |
KmsMasterKeyProvider.Builder |
static interface |
KmsMasterKeyProvider.RegionalClientSupplier |
| Constructor and Description |
|---|
KmsMasterKeyProvider()
Deprecated.
The default region set by this constructor is subject to change. Use the builder method to construct
instances of this class for better control.
|
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentials creds)
Deprecated.
The default region set by this constructor is subject to change. Use the builder method to construct
instances of this class for better control.
|
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds)
Deprecated.
The default region set by this constructor is subject to change. Use the builder method to construct
instances of this class for better control.
|
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds,
com.amazonaws.regions.Region region,
com.amazonaws.ClientConfiguration clientConfiguration,
List<String> keyIds)
Returns an instance of this object with the supplied configuration and credentials.
|
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds,
com.amazonaws.regions.Region region,
com.amazonaws.ClientConfiguration clientConfiguration,
String keyId)
Returns an instance of this object with the supplied configuration and credentials.
|
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds,
String keyId)
Deprecated.
The default region set by this constructor is subject to change. Use the builder method to construct
instances of this class for better control.
|
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentials creds,
String keyId)
Deprecated.
The default region set by this constructor is subject to change. Use the builder method to construct
instances of this class for better control.
|
KmsMasterKeyProvider(com.amazonaws.services.kms.AWSKMS kms,
com.amazonaws.regions.Region region,
List<String> keyIds)
Deprecated.
This constructor modifies the passed-in KMS client by setting its region. This functionality may be
removed in future releases. Use the builder to construct instances of this class instead.
|
KmsMasterKeyProvider(String keyId)
Deprecated.
The default region set by this constructor is subject to change. Use the builder method to construct
instances of this class for better control.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addGrantToken(String grantToken)
Deprecated.
This method is inherently not thread safe. Use
withGrantTokens(List) or
KmsMasterKey.setGrantTokens(List) instead. KmsMasterKeyProviders constructed using the builder
will throw an exception on attempts to modify the list of grant tokens. |
static KmsMasterKeyProvider.Builder |
builder() |
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. |
String |
getDefaultProviderId()
Returns "aws-kms"
|
List<String> |
getGrantTokens()
Returns the grantTokens which this object sends to KMS when calling it.
|
KmsMasterKey |
getMasterKey(String provider,
String keyId)
Returns the specified
MasterKey if possible. |
List<KmsMasterKey> |
getMasterKeysForEncryption(MasterKeyRequest request)
Returns all CMKs provided to the constructor of this object.
|
void |
setGrantTokens(List<String> grantTokens)
Deprecated.
This method is inherently not thread safe. Use
KmsMasterKey.setGrantTokens(List) instead.
KmsMasterKeyProviders constructed using the builder will throw an exception on attempts to modify the
list of grant tokens. |
KmsMasterKeyProvider |
withGrantTokens(List<String> grantTokens)
Returns a new
KmsMasterKeyProvider that is configured identically to this one, except with the given list
of grant tokens. |
KmsMasterKeyProvider |
withGrantTokens(String... grantTokens)
Returns a new
KmsMasterKeyProvider that is configured identically to this one, except with the given list
of grant tokens. |
buildCannotDecryptDksException, buildCannotDecryptDksException, buildCannotDecryptDksException, canProvide, getMasterKey@Deprecated public KmsMasterKeyProvider()
Regions.DEFAULT_REGION.@Deprecated public KmsMasterKeyProvider(String keyId)
keyId (if specified). Data will be protected with
keyId as appropriate.
The default region will be set to that of the given key ID, or to the AWS SDK default region if a bare key ID or
alias is passed.@Deprecated public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentials creds, String keyId)
keyId (if specified). Data will be protected with keyId as
appropriate.@Deprecated public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds, String keyId)
keyId (if specified). Data will be protected with keyId as
appropriate.
The default region will be set to that of the given key ID, or to the AWS SDK default region if a bare key ID or
alias is passed.@Deprecated public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentials creds)
Regions.DEFAULT_REGION.@Deprecated public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds)
Regions.DEFAULT_REGION.public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds,
com.amazonaws.regions.Region region,
com.amazonaws.ClientConfiguration clientConfiguration,
String keyId)
keyId will be used to protect data.public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds,
com.amazonaws.regions.Region region,
com.amazonaws.ClientConfiguration clientConfiguration,
List<String> keyIds)
keyIds will be used to protect data.@Deprecated public KmsMasterKeyProvider(com.amazonaws.services.kms.AWSKMS kms, com.amazonaws.regions.Region region, List<String> keyIds)
keyIds will be used to
protect data.public static KmsMasterKeyProvider.Builder builder()
public String getDefaultProviderId()
getDefaultProviderId in class MasterKeyProvider<KmsMasterKey>public KmsMasterKey getMasterKey(String provider, String keyId) throws UnsupportedProviderException, NoSuchMasterKeyException
MasterKeyProviderMasterKey if possible.getMasterKey in class MasterKeyProvider<KmsMasterKey>UnsupportedProviderException - if this object cannot return MasterKeys associated with the given
providerNoSuchMasterKeyException - if this object cannot find (and thus construct) the MasterKey associated
with keyIdpublic List<KmsMasterKey> getMasterKeysForEncryption(MasterKeyRequest request)
getMasterKeysForEncryption in class MasterKeyProvider<KmsMasterKey>public DataKey<KmsMasterKey> decryptDataKey(CryptoAlgorithm algorithm, Collection<? extends EncryptedDataKey> encryptedDataKeys, Map<String,String> encryptionContext) throws 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 decryptedAwsCryptoException@Deprecated public void setGrantTokens(List<String> grantTokens)
KmsMasterKey.setGrantTokens(List) instead.
KmsMasterKeyProviders constructed using the builder will throw an exception on attempts to modify the
list of grant tokens.KmsMethodsgrantTokens which should be submitted to KMS when calling it.setGrantTokens in interface KmsMethodspublic List<String> getGrantTokens()
KmsMethodsgetGrantTokens in interface KmsMethods@Deprecated public void addGrantToken(String grantToken)
withGrantTokens(List) or
KmsMasterKey.setGrantTokens(List) instead. KmsMasterKeyProviders constructed using the builder
will throw an exception on attempts to modify the list of grant tokens.KmsMethodsgrantToken to the list of grantTokens sent to KMS when this class calls it.addGrantToken in interface KmsMethodspublic KmsMasterKeyProvider withGrantTokens(List<String> grantTokens)
KmsMasterKeyProvider that is configured identically to this one, except with the given list
of grant tokens. The grant token list in the returned provider is immutable (but can be further overridden by
invoking withGrantTokens again).grantTokens - public KmsMasterKeyProvider withGrantTokens(String... grantTokens)
KmsMasterKeyProvider that is configured identically to this one, except with the given list
of grant tokens. The grant token list in the returned provider is immutable (but can be further overridden by
invoking withGrantTokens again).grantTokens - Copyright © 2018. All rights reserved.