Class AesBytesEncryptor
- java.lang.Object
-
- org.springframework.security.crypto.encrypt.AesBytesEncryptor
-
- All Implemented Interfaces:
BytesEncryptor
public final class AesBytesEncryptor extends java.lang.Object implements BytesEncryptor
Encryptor that uses AES encryption.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAesBytesEncryptor.CipherAlgorithm
-
Constructor Summary
Constructors Constructor Description AesBytesEncryptor(java.lang.String password, java.lang.CharSequence salt)AesBytesEncryptor(java.lang.String password, java.lang.CharSequence salt, BytesKeyGenerator ivGenerator)AesBytesEncryptor(java.lang.String password, java.lang.CharSequence salt, BytesKeyGenerator ivGenerator, AesBytesEncryptor.CipherAlgorithm alg)AesBytesEncryptor(javax.crypto.SecretKey secretKey, BytesKeyGenerator ivGenerator, AesBytesEncryptor.CipherAlgorithm alg)Constructs an encryptor that uses AES encryption.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decrypt(byte[] encryptedBytes)Decrypt the byte array.byte[]encrypt(byte[] bytes)Encrypt the byte array.
-
-
-
Constructor Detail
-
AesBytesEncryptor
public AesBytesEncryptor(java.lang.String password, java.lang.CharSequence salt)
-
AesBytesEncryptor
public AesBytesEncryptor(java.lang.String password, java.lang.CharSequence salt, BytesKeyGenerator ivGenerator)
-
AesBytesEncryptor
public AesBytesEncryptor(java.lang.String password, java.lang.CharSequence salt, BytesKeyGenerator ivGenerator, AesBytesEncryptor.CipherAlgorithm alg)
-
AesBytesEncryptor
public AesBytesEncryptor(javax.crypto.SecretKey secretKey, BytesKeyGenerator ivGenerator, AesBytesEncryptor.CipherAlgorithm alg)Constructs an encryptor that uses AES encryption.- Parameters:
secretKey- the secret (symmetric) keyivGenerator- the generator used to generate the initialization vector. If null, then a default algorithm will be used based on the providedAesBytesEncryptor.CipherAlgorithmalg- theAesBytesEncryptor.CipherAlgorithmto be used
-
-
Method Detail
-
encrypt
public byte[] encrypt(byte[] bytes)
Description copied from interface:BytesEncryptorEncrypt the byte array.- Specified by:
encryptin interfaceBytesEncryptor
-
decrypt
public byte[] decrypt(byte[] encryptedBytes)
Description copied from interface:BytesEncryptorDecrypt the byte array.- Specified by:
decryptin interfaceBytesEncryptor
-
-