Package marauroa.common.crypto
Class SymmetricKey
java.lang.Object
marauroa.common.crypto.SymmetricKey
Symmetric Key crypto
- Author:
- hendrik
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
SymmetricKey
public SymmetricKey(byte[] key)creates a new SymmetricKey- Parameters:
key
- key (at least 128 random bits)
-
-
Method Details
-
encrypt
encrypts data- Parameters:
initialisationVector
- random data of the same length as the keydata
- data to encrypt- Returns:
- encrypted data
- Throws:
GeneralSecurityException
- in case of a security error
-
decrypt
public byte[] decrypt(byte[] initialisationVector, byte[] encrypted) throws GeneralSecurityExceptiondeencrypts data- Parameters:
initialisationVector
- random data of the same length as the keyencrypted
- encrytped data to decrypt- Returns:
- encrypted data
- Throws:
GeneralSecurityException
- in case of a security error
-