public class Encrypter extends Object
| Constructor and Description |
|---|
Encrypter(byte[] bytephrase,
byte[] salt,
int iterationCount)
Constructor from passphrase, salt and iteration spec.
|
Encrypter(char[] passphrase)
Constructor from passphrase.
|
Encrypter(char[] passphrase,
byte[] salt)
Constructor from passphrase.
|
Encrypter(Cipher eCipher)
Constructor from secret key.
|
Encrypter(Key key,
String algorithm)
Constructor from secret key.
|
Encrypter(Key key,
String algorithm,
AlgorithmParameterSpec paramSpec)
Constructor from secret key.
|
Encrypter(Key key,
String algorithm,
byte[] salt,
int iterationCount)
Constructor from secret key.
|
Encrypter(String passphrase)
Constructor from passphrase.
|
Encrypter(String passphrase,
byte[] salt)
Constructor from passphrase.
|
Encrypter(String passPhrase,
byte[] salt,
int iterationCount)
Constructor from passphrase, salt and iteration spec.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
encrypt(byte[] bytes)
Encrypt a byte array
|
String |
encrypt(String str)
Takes a single String as an argument and returns an encrypted version
of that string.
|
String |
getAlgorithm()
Returns the algorithm.
|
AlgorithmParameterSpec |
getAlgorithmParameterSpec()
Returns the algorithmParameterSpec.
|
public Encrypter(Cipher eCipher)
eCipher - the cipher to be usedpublic Encrypter(Key key, String algorithm) throws EncryptionException
key - the secret key to be usedalgorithm - algorithm (key's algorithm will be used if NULL)NoSuchPaddingException - when encrypting algorithm cannot be generatedNoSuchAlgorithmException - when encrypting algorithm cannot be generatedInvalidKeyException - when encrypting algorithm cannot be generatedInvalidAlgorithmParameterException - when encrypting algorithm cannot be generatedEncryptionExceptionpublic Encrypter(Key key, String algorithm, AlgorithmParameterSpec paramSpec) throws EncryptionException
key - the secret key to be usedalgorithm - algorithm (key's algorithm will be used if NULL)paramSpec - parameters to the encrypting algorithm (will be generated if NULL)NoSuchPaddingException - when encrypting algorithm cannot be generatedNoSuchAlgorithmException - when encrypting algorithm cannot be generatedInvalidKeyException - when encrypting algorithm cannot be generatedInvalidAlgorithmParameterException - when encrypting algorithm cannot be generatedEncryptionExceptionpublic Encrypter(Key key, String algorithm, byte[] salt, int iterationCount) throws EncryptionException
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 encryptionNoSuchPaddingException - when encrypting algorithm cannot be generatedNoSuchAlgorithmException - when encrypting algorithm cannot be generatedInvalidKeyException - when encrypting algorithm cannot be generatedInvalidAlgorithmParameterException - when encrypting algorithm cannot be generatedEncryptionExceptionpublic Encrypter(byte[] bytephrase,
byte[] salt,
int iterationCount)
throws EncryptionException,
UnsupportedEncodingException
bytephrase - passphrase to be usedsalt - salt to be usediterationCount - number of iterations for encryptionEncryptionException - when encrypting algorithm cannot be generatedUnsupportedEncodingExceptionpublic Encrypter(char[] passphrase)
throws EncryptionException
passphrase - passphrase to be usedEncryptionException - when encrypting algorithm cannot be generatedpublic Encrypter(char[] passphrase,
byte[] salt)
throws EncryptionException
passphrase - passphrase to be usedEncryptionException - when encrypting algorithm cannot be generatedpublic Encrypter(String passphrase) throws EncryptionException
passphrase - passphrase to be usedEncryptionException - when encrypting algorithm cannot be generatedpublic Encrypter(String passphrase, byte[] salt) throws EncryptionException
passphrase - passphrase to be usedEncryptionException - when encrypting algorithm cannot be generatedpublic Encrypter(String passPhrase, byte[] salt, int iterationCount) throws EncryptionException
passPhrase - passphrase to be usedsalt - salt to be usediterationCount - number of iterations for encryptionEncryptionException - when encrypting algorithm cannot be generatedpublic String getAlgorithm()
public AlgorithmParameterSpec getAlgorithmParameterSpec()
public String encrypt(String str) throws EncryptionException
str - string to be encryptedString encrypted version of the provided StringEncryptionExceptionpublic byte[] encrypt(byte[] bytes)
throws EncryptionException
bytes - bytes to be encryptedbyte encrypted version of the provided arrayEncryptionExceptionCopyright © 2014. All rights reserved.