de.innovationgate.utils
SymmetricEncryptionEngine
insteadpublic class DESEncrypter extends java.lang.Object
Usage:
Modifier and Type | Class and Description |
---|---|
static class |
DESEncrypter.PersistentKeyException
Deprecated.
thrown when a key cannot be written or restored from filesystem
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SYSPROP_DESENCRYPTER_ALGORITHM
Deprecated.
|
Constructor and Description |
---|
DESEncrypter()
Deprecated.
constructs a DESEncrypter
init or init(File) must be called before use
|
Modifier and Type | Method and Description |
---|---|
byte[] |
decrypt(java.lang.String str)
Deprecated.
Decrypts the given string to original bytes
|
java.lang.String |
decryptString(java.lang.String str)
Deprecated.
Decrypts a string encrypted with
encryptString(String) |
java.lang.String |
encrypt(byte[] input)
Deprecated.
Encrypts the given bytes to a string
|
java.lang.String |
encryptString(java.lang.String str)
Deprecated.
Encrypts a string based on its UTF-8 bytes values
|
java.lang.String |
getAlgorithm()
Deprecated.
|
javax.crypto.Cipher |
getDcipher()
Deprecated.
Returns the decryption cipher
|
javax.crypto.Cipher |
getEcipher()
Deprecated.
Returns the encryption cipher
|
java.security.Key |
getKey()
Deprecated.
Returns the key instance used for encryption/decryption
|
void |
init()
Deprecated.
Initializes the DESEncrypter with a temporarily generated key
|
void |
init(java.io.File keyFile)
Deprecated.
Initializes the DESEncrypter reading a encryption key from a file.
|
void |
init(java.io.InputStream in)
Deprecated.
Initializes the DESEncrypter reading a encryption key from an input stream.
|
void |
init(java.security.Key key)
Deprecated.
Initializes the DESEncrypter using the given key instance
|
void |
init(java.lang.String keyStr)
Deprecated.
Initializes the DESEncrypter using the MD5 hash of a custom string key as encryption key.
|
void |
initObfuscation()
Deprecated.
Initializes the DESEncrypter using an obfuscation key
|
void |
writeCodeFile(java.io.File codeFile)
Deprecated.
Stores the encryption key to a file in a platform-independent manner.
|
public static final java.lang.String SYSPROP_DESENCRYPTER_ALGORITHM
public DESEncrypter()
public java.lang.String getAlgorithm()
public void init() throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public void init(java.io.InputStream in) throws DESEncrypter.PersistentKeyException, java.security.GeneralSecurityException, java.io.IOException
writeCodeFile(File)
)in
- The input stream to read fromDESEncrypter.PersistentKeyException
java.security.GeneralSecurityException
java.io.IOException
public void init(java.lang.String keyStr) throws java.io.UnsupportedEncodingException, java.security.GeneralSecurityException
keyStr
- The key stringjava.io.UnsupportedEncodingException
java.security.GeneralSecurityException
public void initObfuscation() throws DESEncrypter.PersistentKeyException, java.security.GeneralSecurityException, java.io.IOException
DESEncrypter.PersistentKeyException
java.security.GeneralSecurityException
java.io.IOException
public void init(java.io.File keyFile) throws java.security.GeneralSecurityException, DESEncrypter.PersistentKeyException
keyFile
- The key filejava.security.GeneralSecurityException
DESEncrypter.PersistentKeyException
public void init(java.security.Key key) throws java.security.GeneralSecurityException
key
- java.security.GeneralSecurityException
public java.lang.String encrypt(byte[] input) throws java.io.UnsupportedEncodingException
input
- The bytes to encryptjava.io.UnsupportedEncodingException
public byte[] decrypt(java.lang.String str)
str
- The encrypted stringpublic java.lang.String decryptString(java.lang.String str) throws java.io.UnsupportedEncodingException
encryptString(String)
str
- java.io.UnsupportedEncodingException
public java.lang.String encryptString(java.lang.String str) throws java.io.UnsupportedEncodingException
str
- java.io.UnsupportedEncodingException
public java.security.Key getKey()
public javax.crypto.Cipher getDcipher()
public javax.crypto.Cipher getEcipher()
public void writeCodeFile(java.io.File codeFile) throws java.io.IOException
codeFile
- The key file to writejava.io.IOException