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)
Generates a new
DataKey
which is protected by this
MasterKey
for use with
algorithm
and associated with the provided
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, toString
buildCannotDecryptDksException, buildCannotDecryptDksException, buildCannotDecryptDksException, getMasterKey
protected JceMasterKey(String providerName, String keyId, JceKeyCipher jceKeyCipher)
public static JceMasterKey getInstance(SecretKey key, String provider, String keyId, String wrappingAlgorithm)
Returns a JceMasterKey
backed by the symmetric key key
using wrappingAlgorithm
. Currently "AES/GCM/NoPadding
" is the only supported value for symmetric wrappingAlgorithm
s.
key
- key used to wrap/unwrap (encrypt/decrypt) DataKey
s
provider
-
keyId
-
wrappingAlgorithm
-
public 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
. Currently only RSA algorithms are supported for asymmetric
wrappingAlgorithm
s. 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)
Generates a new
DataKey
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)
Returns a new copy of the provided
dataKey
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
Iterates through encryptedDataKeys
and returns the first one which can be successfully decrypted.
decryptDataKey
in class MasterKeyProvider<JceMasterKey>
null
UnsupportedProviderException
- if the encryptedDataKey
is associated with an unsupported provider
CannotUnwrapDataKeyException
- if the encryptedDataKey
cannot be decrypted
AwsCryptoException
Copyright © 2023. All rights reserved.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4