|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.vt.middleware.crypt.pbe.AbstractEncryptionScheme
public abstract class AbstractEncryptionScheme
Abstract base class for password-based encryption schemes based on salt data and iterated hashing as the basis of the key derivation function.
NOTE: Classes derived from this class are not thread safe. In particular, care should be take to prevent multiple threads from performing encryption and/or decryption concurrently.
| Field Summary | |
|---|---|
protected SymmetricAlgorithm |
cipher
Cipher used for encryption and decryption. |
| Constructor Summary | |
|---|---|
AbstractEncryptionScheme()
|
|
| Method Summary | |
|---|---|
byte[] |
decrypt(char[] password,
byte[] ciphertext)
Decrypts the given ciphertext bytes into a byte array of plaintext using a decryption key based on the given password. |
void |
decrypt(char[] password,
InputStream in,
OutputStream out)
Decrypts the data in the given ciphertext input stream into plaintext in the output stream. |
byte[] |
encrypt(char[] password,
byte[] plaintext)
Encrypts the given plaintext bytes into a byte array of ciphertext using an encryption key derived from the password. |
void |
encrypt(char[] password,
InputStream in,
OutputStream out)
Encrypts the data in the given plaintext input stream into ciphertext in the output stream. |
protected abstract void |
initCipher(char[] password)
Initializes the cipher with the given PBE derived key bytes. |
protected void |
setCipher(SymmetricAlgorithm alg)
Sets the symmetric algorithm cipher. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected SymmetricAlgorithm cipher
| Constructor Detail |
|---|
public AbstractEncryptionScheme()
| Method Detail |
|---|
public byte[] encrypt(char[] password,
byte[] plaintext)
throws CryptException
encrypt in interface EncryptionSchemepassword - Basis for encryption.plaintext - Input plaintext bytes.
CryptException - On encryption errors.
public void encrypt(char[] password,
InputStream in,
OutputStream out)
throws CryptException,
IOException
Base64FilterOutputStream or HexFilterOutputStream to produce ciphertext in
the output stream in an encoded string repreprestation.
encrypt in interface EncryptionSchemepassword - Basis for encryption.in - Input stream of plaintext.out - Output stream of ciphertext.
CryptException - On encryption errors.
IOException - On stream read/write errors.
public byte[] decrypt(char[] password,
byte[] ciphertext)
throws CryptException
decrypt in interface EncryptionSchemepassword - Basis for encryption.ciphertext - Input ciphertext bytes.
CryptException - On decryption errors.
public void decrypt(char[] password,
InputStream in,
OutputStream out)
throws CryptException,
IOException
Base64FilterInputStream or HexFilterInputStream to consume ciphertext in
an encoded string representation.
decrypt in interface EncryptionSchemepassword - Basis for encryption.in - Input stream of ciphertext.out - Output stream of plaintext.
CryptException - On decryption errors.
IOException - On stream read/write errors.protected void setCipher(SymmetricAlgorithm alg)
alg - Symmetric algorithm instance.protected abstract void initCipher(char[] password)
password - PBE password.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||