public interface EncryptionHandler
Provides methods for encrypting plaintexts and decrypting ciphertexts.
Modifier and Type | Method and Description |
---|---|
byte[] |
decryptCiphertext(Key contentEncryptionKey,
byte[] initialisationVector,
byte[] ciphertext,
byte[] authenticationTag,
byte[] additionalAuthenticatedData)
Decrypts the ciphertext with the Content Encryption Key, using the initialisation vector and additional
authenticated data, following the steps defined by the EncryptionHandler JweAlgorithm.
|
default Key |
decryptContentEncryptionKey(Key key,
byte[] encryptedContentEncryptionKey)
Deprecated.
Use
decryptContentEncryptionKey(Key, byte[], JweHeader) instead. |
default Key |
decryptContentEncryptionKey(Key key,
byte[] encryptedContentEncryptionKey,
JweHeader header)
Decrypts the Content Encryption Key (CEK) following the appropriate steps defined by the EncryptionHandler
JweAlgorithm.
|
JweEncryption |
encryptPlaintext(Key contentEncryptionKey,
byte[] initialisationVector,
byte[] plaintext,
byte[] additionalAuthenticatedData)
Encrypts the plaintext with the Content Encryption Key, using the initialisation vector and additional
authenticated data, following the steps defined by the EncryptionHandler JweAlgorithm.
|
byte[] |
generateInitialisationVector()
Generates a random JWE Initialisation Vector of the correct size for the encryption algorithm, if the
EncryptionHandler JweAlgorithm does not required an initialisation vector then the initialisation vector will
be an empty octet sequence.
|
default byte[] |
generateJWEEncryptedKey(Key key,
Key contentEncryptionKey)
Deprecated.
Use
generateJWEEncryptedKey(Key, Key, JweHeader) instead. |
default byte[] |
generateJWEEncryptedKey(Key key,
Key contentEncryptionKey,
JweHeader header)
Generates the Content Encryption Key (CEK) following the appropriate steps defined by the EncryptionHandler
JweAlgorithm.
|
Key |
getContentEncryptionKey()
Creates a Content Encryption Key (CEK) following the appropriate steps defined by the EncryptionHandler
JweAlgorithm.
|
Key getContentEncryptionKey()
See points 1, 2, 3 in Section 5.1 of the JWE Specification.
default byte[] generateJWEEncryptedKey(Key key, Key contentEncryptionKey, JweHeader header)
See points 4, 5, 6 in Section 5.1 of the JWE Specification.
key
- The key to use to encrypt the Content Encryption Key, if the EncryptionHandler JweAlgorithm requires.contentEncryptionKey
- The Content Encryption Key (CEK).header
- The JWE header.@Deprecated default byte[] generateJWEEncryptedKey(Key key, Key contentEncryptionKey)
generateJWEEncryptedKey(Key, Key, JweHeader)
instead.See points 4, 5, 6 in Section 5.1 of the JWE Specification.
key
- The key to use to encrypt the Content Encryption Key, if the EncryptionHandler JweAlgorithm requires.contentEncryptionKey
- The Content Encryption Key (CEK).byte[] generateInitialisationVector()
See points 9 in Section 5.1 of the JWE Specification.
JweEncryption encryptPlaintext(Key contentEncryptionKey, byte[] initialisationVector, byte[] plaintext, byte[] additionalAuthenticatedData)
See points 15, 16 in Section 5.1 of the JWE Specification.
contentEncryptionKey
- The Content Encryption Key.initialisationVector
- The Initialisation Vector.plaintext
- The plaintext to encrypt.additionalAuthenticatedData
- An array of bytes representing the additional authenticated data.default Key decryptContentEncryptionKey(Key key, byte[] encryptedContentEncryptionKey, JweHeader header)
See points 9, 10 in Section 5.2 of the JWE Specification.
key
- The private key pair to the public key that encrypted the JWT.encryptedContentEncryptionKey
- The encrypted Content Encryption Key.header
- The JWE header.@Deprecated default Key decryptContentEncryptionKey(Key key, byte[] encryptedContentEncryptionKey)
decryptContentEncryptionKey(Key, byte[], JweHeader)
instead.See points 9, 10 in Section 5.2 of the JWE Specification.
key
- The private key pair to the public key that encrypted the JWT.encryptedContentEncryptionKey
- The encrypted Content Encryption Key.byte[] decryptCiphertext(Key contentEncryptionKey, byte[] initialisationVector, byte[] ciphertext, byte[] authenticationTag, byte[] additionalAuthenticatedData)
See points 14, 15 in Section 5.2 of the JWE Specification.
contentEncryptionKey
- The Content Encryption Key.initialisationVector
- The Initialisation Vector.ciphertext
- The ciphertext to decrypt.authenticationTag
- The authentication tag.additionalAuthenticatedData
- An array of bytes representing the additional authenticated data.Copyright 2010-2022 ForgeRock AS.