Package fr.dyade.aaa.common.crypto
Class AESGCMTools
- java.lang.Object
-
- fr.dyade.aaa.common.crypto.CryptoTool
-
- fr.dyade.aaa.common.crypto.AESGCMTools
-
- All Implemented Interfaces:
Crypto
public class AESGCMTools extends CryptoTool
-
-
Field Summary
Fields Modifier and Type Field Description private Stringalgorithmprivate static intGCM_TAG_LENGTHprivate GCMParameterSpeciv-
Fields inherited from class fr.dyade.aaa.common.crypto.CryptoTool
key
-
-
Constructor Summary
Constructors Constructor Description AESGCMTools(String password, String salt, String nonce, int iterationCount, int keyLength)AESGCMTools(String algorithm, String password, String salt, String nonce, int iterationCount, int keyLength)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CryptocreateCrypto(String algorithm, String password, String salt, String iv, int iterationCount, int keyLength)(package private) CiphergetCipher(int mode)(package private) CiphergetCipher(int mode, byte[] nonce)
-
-
-
Field Detail
-
GCM_TAG_LENGTH
private static final int GCM_TAG_LENGTH
- See Also:
- Constant Field Values
-
algorithm
private String algorithm
-
iv
private GCMParameterSpec iv
-
-
Constructor Detail
-
AESGCMTools
public AESGCMTools(String password, String salt, String nonce, int iterationCount, int keyLength) throws NoSuchAlgorithmException, InvalidKeySpecException
- Parameters:
password-salt- A salt is a unique, randomly generated string that is added to each password as part of the hashing process.nonce- A nonce or an initialization vector is a random value chosen at encryption time and meant to be used only once.iterationCount-keyLength-- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecException
-
AESGCMTools
public AESGCMTools(String algorithm, String password, String salt, String nonce, int iterationCount, int keyLength) throws NoSuchAlgorithmException, InvalidKeySpecException
-
-
Method Detail
-
getCipher
Cipher getCipher(int mode) throws GeneralSecurityException
- Specified by:
getCipherin classCryptoTool- Throws:
GeneralSecurityException
-
getCipher
Cipher getCipher(int mode, byte[] nonce) throws GeneralSecurityException
- Specified by:
getCipherin classCryptoTool- Throws:
GeneralSecurityException
-
createCrypto
public static Crypto createCrypto(String algorithm, String password, String salt, String iv, int iterationCount, int keyLength) throws NoSuchAlgorithmException, InvalidKeySpecException
-
-