Class AESGCMNoPadding
java.lang.Object
org.codehaus.plexus.components.secdispatcher.internal.cipher.AESGCMNoPadding
- All Implemented Interfaces:
Cipher
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecrypts the encrypted text with password and returns clear text result.Encrypts the clear text data with password and returns result.private static SecretKey
getAESKeyFromPassword
(char[] password, byte[] salt) private static byte[]
getRandomNonce
(int numBytes)
-
Field Details
-
CIPHER_ALG
- See Also:
-
TAG_LENGTH_BIT
private static final int TAG_LENGTH_BIT- See Also:
-
IV_LENGTH_BYTE
private static final int IV_LENGTH_BYTE- See Also:
-
SALT_LENGTH_BYTE
private static final int SALT_LENGTH_BYTE- See Also:
-
PBE_ITERATIONS
private static final int PBE_ITERATIONS- See Also:
-
PBE_KEY_SIZE
private static final int PBE_KEY_SIZE- See Also:
-
KEY_FACTORY
- See Also:
-
KEY_ALGORITHM
- See Also:
-
-
Constructor Details
-
AESGCMNoPadding
public AESGCMNoPadding()
-
-
Method Details
-
encrypt
Description copied from interface:Cipher
Encrypts the clear text data with password and returns result. No argument is allowed to benull
.- Specified by:
encrypt
in interfaceCipher
- Throws:
CipherException
- if encryption failed (is unexpected to happen, as it would mean that Java Runtime lacks some Crypto elements).
-
decrypt
Description copied from interface:Cipher
Decrypts the encrypted text with password and returns clear text result. No argument is allowed to benull
.- Specified by:
decrypt
in interfaceCipher
- Throws:
CipherException
- if decryption failed. It may happen as withCipher.encrypt(String, String)
due Java Runtime lacking some Crypto elements (less likely). Most likely decrypt will fail due wrong provided password or maybe corrupted encrypted text.
-
getRandomNonce
- Throws:
NoSuchAlgorithmException
-
getAESKeyFromPassword
private static SecretKey getAESKeyFromPassword(char[] password, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException
-