Class AESCrypt
java.lang.Object
org.apache.wicket.core.util.crypt.AbstractJceCrypt
org.apache.wicket.core.util.crypt.AESCrypt
- All Implemented Interfaces:
ICrypt
AES based
ICrypt
encrypt and decrypt strings such as passwords or URL segments.
Based on http://stackoverflow.com/a/992413- See Also:
-
Constructor Summary
ConstructorDescriptionAESCrypt
(SecretKey secretKey, String algorithm, ISecureRandomSupplier randomSupplier) ConstructorAESCrypt
(SecretKey secretKey, ISecureRandomSupplier randomSupplier) Constructor -
Method Summary
Methods inherited from class org.apache.wicket.core.util.crypt.AbstractJceCrypt
decryptUrlSafe, encryptUrlSafe
-
Constructor Details
-
AESCrypt
Constructor- Parameters:
secretKey
- TheSecretKey
to use to initialize theCipher
.randomSupplier
- TheISecureRandomSupplier
to use to generate random values.
-
AESCrypt
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 Details
-
decrypt
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
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
-