Package org.forgerock.json.crypto.simple
Class SimpleEncryptor
java.lang.Object
org.forgerock.json.crypto.simple.SimpleEncryptor
- All Implemented Interfaces:
JsonEncryptor
Encrypts a JSON value into an
x-simple-encryption
type $crypto
JSON object.-
Field Summary
-
Constructor Summary
ConstructorDescriptionSimpleEncryptor
(String cipher, Key key, String alias) Constructs a new simple encryptor for the specified cipher, key and alias.Constructor. -
Method Summary
-
Field Details
-
TYPE
The type of cryptographic representation that this encryptor supports.- See Also:
-
-
Constructor Details
-
SimpleEncryptor
Constructs a new simple encryptor for the specified cipher, key and alias.- Parameters:
cipher
- the cipher to encrypt with.key
- the key to encrypt with.alias
- the key alias to list in the encrypted object.
-
SimpleEncryptor
public SimpleEncryptor(String cipher, Key key, Purpose<? extends CryptoKey> purpose, String stableId) Constructor.- Parameters:
cipher
- The cipher to encrypt with.key
- The key to encrypt with.purpose
- The keyPurpose
to lise in the encrypted object.stableId
- The key id to list in the encrypted object.
-
-
Method Details
-
getType
Description copied from interface:JsonEncryptor
Returns the type of cryptographic representation that this JSON encryptor supports. Expressed in thetype
property of aJsonCrypto
object.- Specified by:
getType
in interfaceJsonEncryptor
- Returns:
- The type.
-
encrypt
Description copied from interface:JsonEncryptor
Encrypts the specified value.- Specified by:
encrypt
in interfaceJsonEncryptor
- Parameters:
value
- the JSON value to be encrypted.- Returns:
- the encrypted value.
- Throws:
JsonCryptoException
- if the encryptor fails to encrypt the value.
-