public class Decrypter extends Object
| Constructor and Description |
|---|
Decrypter(byte[] bytephrase,
byte[] salt,
int iterationCount)
Constructor from bytephrase, salt and iteration spec.
|
Decrypter(char[] passPhrase)
Constructor from passphrase.
|
Decrypter(char[] passPhrase,
byte[] salt)
Constructor from passphrase.
|
Decrypter(Cipher dCipher)
Constructor from secret key.
|
Decrypter(Key key,
String algorithm)
Constructor from secret key.
|
Decrypter(Key key,
String algorithm,
AlgorithmParameterSpec paramSpec)
Constructor from secret key.
|
Decrypter(Key key,
String algorithm,
byte[] salt,
int iterationCount)
Constructor from secret key.
|
Decrypter(String passPhrase)
Constructor from passphrase.
|
Decrypter(String passPhrase,
byte[] salt)
Constructor from passphrase.
|
Decrypter(String passPhrase,
byte[] salt,
int iterationCount)
Constructor from passphrase, salt and iteration spec.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] bytes)
Decrypt a byte array
|
String |
decrypt(String str)
Takes a single string as an argument and returns an decrypted version
of that string.
|
String |
getAlgorithm()
Returns the algorithm.
|
AlgorithmParameterSpec |
getAlgorithmParameterSpec()
Returns the algorithmParameterSpec.
|
public Decrypter(Cipher dCipher)
dCipher - the cipher to be usedpublic Decrypter(Key key, String algorithm) throws DecryptionException
key - the secret key to be usedalgorithm - algorithm (key's algorithm will be used if NULL)NoSuchPaddingException - when decrypting algorithm cannot be generatedNoSuchAlgorithmException - when decrypting algorithm cannot be generatedInvalidKeyException - when decrypting algorithm cannot be generatedInvalidAlgorithmParameterException - when decrypting algorithm cannot be generatedDecryptionExceptionpublic Decrypter(Key key, String algorithm, AlgorithmParameterSpec paramSpec) throws DecryptionException
key - the secret key to be usedalgorithm - algorithm (key's algorithm will be used if NULL)paramSpec - parameters to the decrypting algorithm (will be generated if NULL)NoSuchPaddingException - when decrypting algorithm cannot be generatedNoSuchAlgorithmException - when decrypting algorithm cannot be generatedInvalidKeyException - when decrypting algorithm cannot be generatedInvalidAlgorithmParameterException - when decrypting algorithm cannot be generatedDecryptionExceptionpublic Decrypter(Key key, String algorithm, byte[] salt, int iterationCount) throws DecryptionException
key - the secret key to be usedalgorithm - algorithm (key's algorithm will be used if NULL)salt - salt to be usediterationCount - number of iterations for decryptionNoSuchPaddingException - when decrypting algorithm cannot be generatedNoSuchAlgorithmException - when decrypting algorithm cannot be generatedInvalidKeyException - when decrypting algorithm cannot be generatedInvalidAlgorithmParameterException - when decrypting algorithm cannot be generatedDecryptionExceptionpublic Decrypter(byte[] bytephrase,
byte[] salt,
int iterationCount)
throws DecryptionException
bytephrase - bytephrase to be usedsalt - salt to be usediterationCount - number of iterations for decryptionInvalidKeySpecException - when key cannot be generatedNoSuchPaddingException - when decrypting algorithm cannot be generatedNoSuchAlgorithmException - when decrypting algorithm cannot be generatedInvalidKeyException - when decrypting algorithm cannot be generatedInvalidAlgorithmParameterException - when decrypting algorithm cannot be generatedDecryptionExceptionpublic Decrypter(char[] passPhrase)
throws DecryptionException
passPhrase - passphrase to be usedDecryptionException - when decrypting algorithm cannot be generatedpublic Decrypter(char[] passPhrase,
byte[] salt)
throws DecryptionException
passPhrase - passphrase to be usedDecryptionException - when decrypting algorithm cannot be generatedpublic Decrypter(String passPhrase) throws DecryptionException
passPhrase - passphrase to be usedDecryptionException - when decrypting algorithm cannot be generatedpublic Decrypter(String passPhrase, byte[] salt) throws DecryptionException
passPhrase - passphrase to be usedDecryptionException - when decrypting algorithm cannot be generatedpublic Decrypter(String passPhrase, byte[] salt, int iterationCount) throws DecryptionException
passPhrase - passphrase to be usedsalt - salt to be usediterationCount - number of iterations for decryptionInvalidKeySpecException - when key cannot be generatedNoSuchPaddingException - when decrypting algorithm cannot be generatedNoSuchAlgorithmException - when decrypting algorithm cannot be generatedInvalidKeyException - when decrypting algorithm cannot be generatedInvalidAlgorithmParameterException - when decrypting algorithm cannot be generatedDecryptionExceptionpublic String getAlgorithm()
public AlgorithmParameterSpec getAlgorithmParameterSpec()
public String decrypt(String str) throws DecryptionException
str - string to be decryptedstring decrypted version of the provided StringDecryptionExceptionpublic byte[] decrypt(byte[] bytes)
throws DecryptionException
bytes - bytes to be decryptedbyte decrypted version of the provided arrayDecryptionExceptionCopyright © 2014. All rights reserved.