public abstract class JceKeyCipher extends Object
Modifier and Type | Method and Description |
---|---|
static JceKeyCipher |
aesGcm(SecretKey secretKey)
Returns a new instance of a JceKeyCipher based on the Advanced Encryption Standard in
Galois/Counter Mode.
|
byte[] |
decryptKey(EncryptedDataKey edk,
String keyName,
Map<String,String> encryptionContext)
Decrypts the given encrypted data key.
|
EncryptedDataKey |
encryptKey(byte[] key,
String keyName,
String keyNamespace,
Map<String,String> encryptionContext)
Encrypts the given key, incorporating the given keyName and encryptionContext.
|
static JceKeyCipher |
rsa(PublicKey wrappingKey,
PrivateKey unwrappingKey,
String transformation)
Returns a new instance of a JceKeyCipher based on RSA.
|
public static JceKeyCipher aesGcm(SecretKey secretKey)
secretKey
- The secret key to use for encrypt/decrypt operations.public static JceKeyCipher rsa(PublicKey wrappingKey, PrivateKey unwrappingKey, String transformation)
wrappingKey
- The public key to use for encrypting the key.unwrappingKey
- The private key to use for decrypting the key.transformation
- The transformation.public EncryptedDataKey encryptKey(byte[] key, String keyName, String keyNamespace, Map<String,String> encryptionContext)
key
- The key to encrypt.keyName
- A UTF-8 encoded representing a name for the key.keyNamespace
- A UTF-8 encoded value that namespaces the key.encryptionContext
- A key-value mapping of arbitrary, non-secret, UTF-8 encoded strings
used during encryption and decryption to provide additional authenticated data (AAD).public byte[] decryptKey(EncryptedDataKey edk, String keyName, Map<String,String> encryptionContext) throws GeneralSecurityException
edk
- The encrypted data key.keyName
- A UTF-8 encoded String representing a name for the key.encryptionContext
- A key-value mapping of arbitrary, non-secret, UTF-8 encoded strings
used during encryption and decryption to provide additional authenticated data (AAD).GeneralSecurityException
- If a problem occurred decrypting the key.Copyright © 2023. All rights reserved.