Class GCMSIVCrypter
- java.lang.Object
-
- org.apache.wicket.pageStore.crypt.GCMSIVCrypter
-
- All Implemented Interfaces:
ICrypter
public class GCMSIVCrypter extends Object implements ICrypter
Encryption and decryption implementation using AES-256-GCM-SIV authenticated encryption. This implementation requires Bouncy Castle. It is more secure than theDefaultCrypter
, but also more expensive. Simple measurements have shownDefaultCrypter
to be about 10 to 15 times faster than this implementation. This is likely caused by not-so-optimal implementation of the algorithm in Java by BC. When the JDK gets support for GCM-SIV (https://bugs.openjdk.org/browse/JDK-8256530), this implementation will likely be faster than or about as fast as CBC.
-
-
Constructor Summary
Constructors Constructor Description GCMSIVCrypter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
decrypt(byte[] encrypted, SecretKey key)
byte[]
encrypt(byte[] decrypted, SecretKey key, SecureRandom random)
SecretKey
generateKey(SecureRandom random)
protected Cipher
getCipher()
-
-
-
Constructor Detail
-
GCMSIVCrypter
public GCMSIVCrypter()
-
-
Method Detail
-
getCipher
protected Cipher getCipher() throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
generateKey
public SecretKey generateKey(SecureRandom random)
- Specified by:
generateKey
in interfaceICrypter
-
encrypt
public byte[] encrypt(byte[] decrypted, SecretKey key, SecureRandom random)
-
-