Class AESCrypt
- java.lang.Object
-
- org.apache.wicket.core.util.crypt.AbstractJceCrypt
-
- org.apache.wicket.core.util.crypt.AESCrypt
-
- All Implemented Interfaces:
ICrypt
public class AESCrypt extends AbstractJceCrypt
AES basedICrypt
encrypt and decrypt strings such as passwords or URL segments. Based on http://stackoverflow.com/a/992413- See Also:
ICrypt
-
-
Constructor Summary
Constructors Constructor Description AESCrypt(SecretKey secretKey, String algorithm, ISecureRandomSupplier randomSupplier)
ConstructorAESCrypt(SecretKey secretKey, ISecureRandomSupplier randomSupplier)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
decrypt(byte[] encrypted)
Decrypts an encrypted byte array.protected byte[]
encrypt(byte[] plainBytes)
Encrypts the given text into a byte array.-
Methods inherited from class org.apache.wicket.core.util.crypt.AbstractJceCrypt
decryptUrlSafe, encryptUrlSafe, setKey
-
-
-
-
Constructor Detail
-
AESCrypt
public AESCrypt(SecretKey secretKey, ISecureRandomSupplier randomSupplier)
Constructor- Parameters:
secretKey
- TheSecretKey
to use to initialize theCipher
.randomSupplier
- TheISecureRandomSupplier
to use to generate random values.
-
AESCrypt
public AESCrypt(SecretKey secretKey, String algorithm, ISecureRandomSupplier randomSupplier)
Constructor- Parameters:
secretKey
- TheSecretKey
to use to initialize theCipher
.algorithm
- The cipher algorithm to use, for example "AES/CBC/PKCS5Padding".randomSupplier
- TheISecureRandomSupplier
to use to generate random values.
-
-
Method Detail
-
decrypt
protected byte[] decrypt(byte[] encrypted)
Description copied from class:AbstractJceCrypt
Decrypts an encrypted byte array.- Specified by:
decrypt
in classAbstractJceCrypt
- Parameters:
encrypted
- byte array to decrypt- Returns:
- the decrypted text
-
encrypt
protected byte[] encrypt(byte[] plainBytes)
Description copied from class:AbstractJceCrypt
Encrypts the given text into a byte array.- Specified by:
encrypt
in classAbstractJceCrypt
- Parameters:
plainBytes
- text to encrypt- Returns:
- the string encrypted
-
-