public class PasswordEncryption
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_CHARSET |
static java.lang.String |
DEFAULT_CIPHER_NAME |
static java.lang.Integer |
DEFAULT_ITERATION_COUNT |
static java.lang.String |
DEFAULT_SECRETE_KEY_ENCRYPTION |
static java.lang.String |
DEFAULT_SECRETE_KEY_FACTORY |
static java.lang.Integer |
DEFAULT_SECRETE_KEY_LENGTH
Stronger with 256, but causes problem with Oracle JVM
|
static java.lang.Integer |
DEFAULT_SECRETE_KEY_LENGTH_RESTRICTED |
Constructor and Description |
---|
PasswordEncryption(char[] password)
This is up to the caller to clear the passed array.
|
PasswordEncryption(char[] password,
byte[] passwordSalt,
byte[] initializationVector)
This is up to the caller to clear the passed array.
|
Modifier and Type | Method and Description |
---|---|
void |
decrypt(java.io.InputStream encryptedIn,
java.io.OutputStream decryptedOut) |
java.lang.String |
decryptAsString(java.io.InputStream in)
Closes the input stream
|
void |
encrypt(java.io.InputStream decryptedIn,
java.io.OutputStream encryptedOut) |
byte[] |
encryptString(java.lang.String str) |
protected java.lang.String |
getCipherName() |
protected javax.crypto.Cipher |
getDcipher() |
protected javax.crypto.Cipher |
getEcipher() |
protected java.lang.Integer |
getIterationCount() |
protected java.security.Key |
getKey() |
protected java.lang.Integer |
getKeyLength() |
protected java.lang.String |
getSecretKeyEncryption() |
protected java.lang.String |
getSecretKeyFactoryName() |
protected void |
initKeyAndCiphers(char[] password,
byte[] passwordSalt,
byte[] initializationVector) |
void |
setCipherName(java.lang.String cipherName) |
void |
setIterationCount(java.lang.Integer iterationCount) |
void |
setSecreteKeyEncryption(java.lang.String secreteKeyEncryption) |
void |
setSecreteKeyFactoryName(java.lang.String secreteKeyFactoryName) |
void |
setSecreteKeyLength(java.lang.Integer keyLength) |
void |
setSecurityProviderName(java.lang.String securityProviderName) |
public static final java.lang.Integer DEFAULT_ITERATION_COUNT
public static final java.lang.Integer DEFAULT_SECRETE_KEY_LENGTH
public static final java.lang.Integer DEFAULT_SECRETE_KEY_LENGTH_RESTRICTED
public static final java.lang.String DEFAULT_SECRETE_KEY_FACTORY
public static final java.lang.String DEFAULT_SECRETE_KEY_ENCRYPTION
public static final java.lang.String DEFAULT_CIPHER_NAME
public static final java.lang.String DEFAULT_CHARSET
public PasswordEncryption(char[] password)
public PasswordEncryption(char[] password, byte[] passwordSalt, byte[] initializationVector)
protected void initKeyAndCiphers(char[] password, byte[] passwordSalt, byte[] initializationVector) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public void encrypt(java.io.InputStream decryptedIn, java.io.OutputStream encryptedOut) throws java.io.IOException
java.io.IOException
public void decrypt(java.io.InputStream encryptedIn, java.io.OutputStream decryptedOut) throws java.io.IOException
java.io.IOException
public byte[] encryptString(java.lang.String str)
public java.lang.String decryptAsString(java.io.InputStream in)
protected java.security.Key getKey()
protected javax.crypto.Cipher getEcipher()
protected javax.crypto.Cipher getDcipher()
protected java.lang.Integer getIterationCount()
protected java.lang.Integer getKeyLength()
protected java.lang.String getSecretKeyFactoryName()
protected java.lang.String getSecretKeyEncryption()
protected java.lang.String getCipherName()
public void setIterationCount(java.lang.Integer iterationCount)
public void setSecreteKeyLength(java.lang.Integer keyLength)
public void setSecreteKeyFactoryName(java.lang.String secreteKeyFactoryName)
public void setSecreteKeyEncryption(java.lang.String secreteKeyEncryption)
public void setCipherName(java.lang.String cipherName)
public void setSecurityProviderName(java.lang.String securityProviderName)
Copyright © 2007–2020. All rights reserved.