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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSimpleEncryptor(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 keyPurposeto lise in the encrypted object.stableId- The key id to list in the encrypted object.
-
-
Method Details
-
getType
Description copied from interface:JsonEncryptorReturns the type of cryptographic representation that this JSON encryptor supports. Expressed in thetypeproperty of aJsonCryptoobject.- Specified by:
getTypein interfaceJsonEncryptor- Returns:
- The type.
-
encrypt
Description copied from interface:JsonEncryptorEncrypts the specified value.- Specified by:
encryptin interfaceJsonEncryptor- Parameters:
value- the JSON value to be encrypted.- Returns:
- the encrypted value.
- Throws:
JsonCryptoException- if the encryptor fails to encrypt the value.
-