|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnu.studer.gradle.credentials.domain.Encryption
public final class Encryption
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 Summary | |
|---|---|
Encryption(javax.crypto.Cipher ecipher,
javax.crypto.Cipher dcipher)
|
|
| Method Summary | |
|---|---|
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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Encryption(javax.crypto.Cipher ecipher,
javax.crypto.Cipher dcipher)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityException| Method Detail |
|---|
public java.lang.String encrypt(java.lang.String string)
string - the text to encrypt
public java.lang.String decrypt(java.lang.String string)
string - the text to decrypt
public static Encryption createEncryption(char[] passphrase)
passphrase - the passphrase to apply when creating the secret key
java.lang.RuntimeException - with wrapped GeneralSecurityException in case of crypto-related exceptions
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||