public abstract class AbstractEncryptFactory extends java.lang.Object implements EncryptFactory
EMPTY_BYTES
Constructor and Description |
---|
AbstractEncryptFactory() |
Modifier and Type | Method and Description |
---|---|
protected javax.crypto.Cipher |
createCipher()
Create the cipher.
|
protected javax.crypto.spec.SecretKeySpec |
createKey()
Create the key.
|
protected javax.crypto.SecretKeyFactory |
createSecretKeyFactory()
Create the secret key factory.
|
byte[] |
decryptBytes(java.lang.String s)
Decrypt the text to bytes.
|
byte[] |
encryptBytes(byte[] bytes)
Encrypt the bytes.
|
protected int |
getIterationCount()
Get the iteration count.
|
protected int |
getKeyLength()
Get the key length.
|
protected abstract char[] |
getPw()
Get the password.
|
protected abstract byte[] |
getSalt()
Get the salt.
|
protected byte[] |
getSalt(boolean b)
Get the salt.
|
protected java.lang.String |
getSecretKeyAlgorithm()
Get the the name of the secret-key algorithm.
|
protected java.lang.String |
getSeparatorText()
Get the separator text.
|
boolean |
isAddUserName()
Determines if adding the user name to the salt.
|
void |
setAddUserName(boolean b)
Set if adding the user name to the salt.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decrypt, decryptChars, encrypt, encrypt, encrypt, encrypt, getBytes, getBytes, getBytes, getCharset
protected javax.crypto.Cipher createCipher() throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
- if the cipher could not be created.protected javax.crypto.spec.SecretKeySpec createKey() throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
- if the key could not be created.protected javax.crypto.SecretKeyFactory createSecretKeyFactory() throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
- if the secret key factory could not be
created.public byte[] decryptBytes(java.lang.String s)
EncryptFactory
decryptBytes
in interface EncryptFactory
s
- the text.public byte[] encryptBytes(byte[] bytes)
EncryptFactory
encryptBytes
in interface EncryptFactory
bytes
- the bytes.protected int getIterationCount()
protected int getKeyLength()
protected abstract char[] getPw()
protected abstract byte[] getSalt()
protected byte[] getSalt(boolean b)
b
- true to add the user name to the salt, false otherwise.protected java.lang.String getSecretKeyAlgorithm()
protected java.lang.String getSeparatorText()
public boolean isAddUserName()
public void setAddUserName(boolean b)
b
- true if adding the user name to the salt, false otherwise.