Encryption/decryption of text using ciphers.
Note: The author of this class is by far not a security expert. The chosen implementation has been primarily gathered from examples in the javax.crypto Javadoc and from discussions on StackOverflow. See also here for a more detailed explanation on the selected security algorithms.| Constructor and description |
|---|
Encryption
(javax.crypto.Cipher ecipher, javax.crypto.Cipher dcipher) |
| Type | Name and description |
|---|---|
static Encryption |
createEncryption(char[] passphrase)Creates a new Encryption instance that uses password-based encryption (PBE). |
java.lang.String |
decrypt(java.lang.String string)Decrypts the given text. |
java.lang.String |
encrypt(java.lang.String string)Encrypts the given text. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Creates a new Encryption instance that uses password-based encryption (PBE). The algorithm used to create the secret key is PBEWithMD5AndDES.
passphrase - the passphrase to apply when creating the secret keyDecrypts the given text.
string - the text to decryptEncrypts the given text.
string - the text to encrypt