public class JceMasterKey extends MasterKey<JceMasterKey>
MasterKey backed by one (or more) JCE Keys. Instances of this should
 only be acquired using getInstance(SecretKey, String, String, String) or getInstance(PublicKey, PrivateKey, String, String, String).| Modifier | Constructor and Description | 
|---|---|
protected  | 
JceMasterKey(String providerName,
            String keyId,
            JceKeyCipher jceKeyCipher)  | 
| Modifier and Type | Method and Description | 
|---|---|
DataKey<JceMasterKey> | 
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<JceMasterKey> | 
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<JceMasterKey> | 
generateDataKey(CryptoAlgorithm algorithm,
               Map<String,String> encryptionContext)
 | 
static JceMasterKey | 
getInstance(PublicKey wrappingKey,
           PrivateKey unwrappingKey,
           String provider,
           String keyId,
           String wrappingAlgorithm)
Returns a  
JceMasterKey backed by the asymmetric key pair unwrappingKey and
 wrappingKey using wrappingAlgorithm. | 
static JceMasterKey | 
getInstance(SecretKey key,
           String provider,
           String keyId,
           String wrappingAlgorithm)
Returns a  
JceMasterKey backed by the symmetric key key using wrappingAlgorithm. | 
String | 
getKeyId()  | 
String | 
getProviderId()  | 
canProvide, equals, getDefaultProviderId, getMasterKey, getMasterKeysForEncryption, hashCode, toStringbuildCannotDecryptDksException, buildCannotDecryptDksException, buildCannotDecryptDksException, getMasterKeyprotected JceMasterKey(String providerName, String keyId, JceKeyCipher jceKeyCipher)
public static JceMasterKey getInstance(SecretKey key, String provider, String keyId, String wrappingAlgorithm)
JceMasterKey backed by the symmetric key key using wrappingAlgorithm. Currently "AES/GCM/NoPadding" is the only supported value for
 symmetric wrappingAlgorithms.key - key used to wrap/unwrap (encrypt/decrypt) DataKeysprovider - keyId - wrappingAlgorithm - public static JceMasterKey getInstance(PublicKey wrappingKey, PrivateKey unwrappingKey, String provider, String keyId, String wrappingAlgorithm)
JceMasterKey backed by the asymmetric key pair unwrappingKey and
 wrappingKey using wrappingAlgorithm. Currently only RSA algorithms are
 supported for asymmetric wrappingAlgorithms. If unwrappingKey is null
 then the returned JceMasterKey can only be used for encryption.public String getProviderId()
getProviderId in class MasterKey<JceMasterKey>public String getKeyId()
getKeyId in class MasterKey<JceMasterKey>public DataKey<JceMasterKey> 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<JceMasterKey>public DataKey<JceMasterKey> 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<JceMasterKey>public DataKey<JceMasterKey> 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<JceMasterKey>nullUnsupportedProviderException - if the encryptedDataKey is associated with an
     unsupported providerCannotUnwrapDataKeyException - if the encryptedDataKey cannot be decryptedAwsCryptoExceptionCopyright © 2023. All rights reserved.