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.| Constructor and Description |
|---|
KmsMasterKeyProvider()
Returns an instance of this object with default settings, default credentials, and configured
to talk to the
Regions.DEFAULT_REGION. |
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentials creds)
Returns an instance of this object with default settings and configured to talk to the
Regions.DEFAULT_REGION. |
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds)
Returns an instance of this object with default settings and configured to talk to the
Regions.DEFAULT_REGION. |
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)
Returns an instance of this object with default settings configured to speak to the region
specified by
keyId (if specified). |
KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentials creds,
String keyId)
Returns an instance of this object with default settings configured to speak to the region
specified by
keyId (if specified). |
KmsMasterKeyProvider(com.amazonaws.services.kms.AWSKMS kms,
com.amazonaws.regions.Region region,
List<String> keyIds)
Returns an instance of this object with the supplied client and region; the client will be
configured to use the provided region.
|
KmsMasterKeyProvider(String keyId)
Returns an instance of this object with default settings and credentials configured to speak
to the region specified by
keyId (if specified). |
| 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. |
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.
|
com.amazonaws.regions.Region |
getRegion() |
void |
setCustomEndpoint(String regionName,
String endPoint)
Configures this provider to use a custom endpoint.
|
void |
setGrantTokens(List<String> grantTokens)
Sets the
grantTokens which should be submitted to KMS when calling it. |
void |
setRegion(com.amazonaws.regions.Region region)
Set the AWS region of the AWS KMS service for access to the master key.
|
buildCannotDecryptDksException, buildCannotDecryptDksException, buildCannotDecryptDksException, canProvide, getMasterKeypublic KmsMasterKeyProvider()
Regions.DEFAULT_REGION.public KmsMasterKeyProvider(String keyId)
keyId (if specified). Data will be protected with
keyId as appropriate.public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentials creds,
String keyId)
keyId (if specified). Data will be protected with keyId as
appropriate.public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentialsProvider creds,
String keyId)
keyId (if specified). Data will be protected with keyId as
appropriate.public KmsMasterKeyProvider(com.amazonaws.auth.AWSCredentials creds)
Regions.DEFAULT_REGION.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.public KmsMasterKeyProvider(com.amazonaws.services.kms.AWSKMS kms,
com.amazonaws.regions.Region region,
List<String> keyIds)
keyIds will be used to
protect data.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 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 decryptedAwsCryptoExceptionpublic 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 void setCustomEndpoint(String regionName, String endPoint)
Region object
to null, and instructs the internal KMS client to use the specified endPoint
and regionName.public void setRegion(com.amazonaws.regions.Region region)
AWSKMSClientregion - string containing the region.public com.amazonaws.regions.Region getRegion()
Copyright © 2017. All rights reserved.