Package net.sf.jstuff.core.security
Class AESEncryptor
java.lang.Object
net.sf.jstuff.core.security.AESEncryptor
Encrypts byte arrays and serializable objects with passphrase-derived AES-GCM keys.
- Author:
- Sebastian Thomschke
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]<T extends Serializable>
Tdeserialize(byte[] data, String passphrase) byte[]seal(Serializable object, String passphrase) byte[]serialize(Serializable object, String passphrase) <T extends Serializable>
Tunseal(AESEncryptor.AESSealedObject object, String passphrase)
-
Constructor Details
-
AESEncryptor
public AESEncryptor(byte[] keySalt) -
AESEncryptor
-
-
Method Details
-
decrypt
- Parameters:
data- first 12 bytes of the array expected to be the initialization vector- Throws:
SecurityException
-
deserialize
-
encrypt
- Returns:
- first 12 bytes of the array are the initialization vector
- Throws:
SecurityException
-
seal
public AESEncryptor.AESSealedObject seal(Serializable object, String passphrase) throws SecurityException - Throws:
SecurityException
-
serialize
-
unseal
public <T extends Serializable> T unseal(AESEncryptor.AESSealedObject object, String passphrase) throws SecurityException - Throws:
SecurityException
-