public final class CryptoStreamGCMImpl extends CryptoStreamFactoryJ8Template
CryptoParametersJ8.TYPES_IMPL#ALGORITHM_J8_GCM for encryption which
should be sufficent for most applications.
The implementation also supplies a default password in the case that
the programmer don't want to have additional hassles. It is easy to
reengineer the password being used but much better than a hard-coded
password in the application.CryptoParametersJ8.TYPES GCM.| Modifier and Type | Field and Description |
|---|---|
protected static int |
IV_SIZE |
algorithm, count, instances, providerName, PROVIDERNAME, salt, SALT_SIZE| Constructor and Description |
|---|
CryptoStreamGCMImpl()
Constructor
|
CryptoStreamGCMImpl(byte[] salt)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
createCipher(InputStream is,
int mode,
char[] password)
Create a Cipher.
|
protected Key |
createKey(char[] password,
byte[] salt)
Create a AES/GCM key.
|
generateSalt, getAlgorithm, getCount, getInputStream, getInputStream, getInputStream, getInputStream, getInstance, getInstance, getInstance, getOutputStream, getOutputStream, getOutputStream, getProviderName, getSalt, getSmartInputStream, getSmartInputStream, getType, resetInstances, setAlgorithm, setCount, setProviderName, setSalt, setTypeprotected static final int IV_SIZE
public CryptoStreamGCMImpl()
throws GeneralSecurityException
GeneralSecurityException - - wraps NoSuchAlgorithmExceptionpublic CryptoStreamGCMImpl(byte[] salt)
salt - the salt for the GCM algorithmprotected Key createKey(char[] password, byte[] salt) throws GeneralSecurityException
createKey in class CryptoStreamFactoryJ8Templatepassword - the password to use.salt - if provided this is used, otherweise CryptoStreamFactoryJ8Template.getSalt().GeneralSecurityException - if creating the key failedprotected byte[] createCipher(InputStream is, int mode, char[] password) throws GeneralSecurityException, IOException
GCMParameterSpeccreateCipher in class CryptoStreamFactoryJ8Templatemode - the cipher modepassword - the passwordis - the input streamGeneralSecurityException - if creating a cipher failedIOException - creating a cipher failedCopyright © 2008–2020 The Apache Software Foundation. All rights reserved.