|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.security.Encryptor
ewe.security.Decryptor
A Decryptor implements the Blowfish CBC algorithm to decrypt data as encrypted by an Encryptor. You can use it in two ways:
You can use it as a straight ewe.io.DataProcessor where you provide it with encrypted data bytes and then receive the decrypted plain text. However with this method the data must be padded up to a size that is a multiple of 8 bytes which is the minimum block size of the Decryptor.
You can also use the more powerful decrypt() methods if the data was encrypted by an Encryptor using the encrypt() method. This method adds more advanced capabilities to the encryption, including "salting" the data (adding some randomness to it), optionally compressing the data and optionally signing the data with a private key. All these add to the security of the encrypted data and will also take care of stripping any padding from the encrypted data, thereby ensuring that the decrypted data is the exact length of the original plain text.
| Field Summary |
| Fields inherited from class ewe.security.Encryptor |
digest, ENCRYPT_WITHOUT_COMPRESSION, isDecryptor |
| Constructor Summary | |
Decryptor(byte[] key)
Create a Decryptor using the specified key. |
|
Decryptor(String key)
Create a Decryptor using the specified key. |
|
| Method Summary | |
byte[] |
decrypt(byte[] encryptedData,
int offset,
int length)
Decrypt data that has been encrypted by an Encrytpor with an encrypt() method using this Decryptor object as the decryptor. |
ByteArray |
decrypt(ByteArray dest,
byte[] encryptedData,
int offset,
int length,
Signature signature)
Decrypt data that has been encrypted by an Encrytpor with an encrypt() method using this Decryptor object as the decryptor. |
static ByteArray |
decrypt(DataProcessor processor,
ByteArray dest,
byte[] encryptedData,
int offset,
int length,
Signature signature)
Decrypt data that has been encrypted by an Encrytpor with an encrypt() method using this any DataProcessor object as the decryptor. |
| Methods inherited from class ewe.security.Encryptor |
closeProcess, encrypt, encrypt, encrypt, encrypt, getBlockSize, getMaxBlockSize, makeEncryptorTest, processBlock, reset, stringToKey, testDecryptor |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Constructor Detail |
public Decryptor(String key)
key - a password key.public Decryptor(byte[] key)
key - a key which is a sequence of bytes up to a maximum of MAXKEYLENGTH (448 bits)| Method Detail |
public byte[] decrypt(byte[] encryptedData,
int offset,
int length)
throws StreamCorruptedException
encryptedData - the encrypted data.offset - the start of the encrypted data bytes.length - the number of data bytes.
StreamCorruptedException - if there was an error with the data or if the decryptor
is incorrect.
public ByteArray decrypt(ByteArray dest,
byte[] encryptedData,
int offset,
int length,
Signature signature)
throws StreamCorruptedException
dest - an optional destination ByteArray to hold the decrypted data.encryptedData - the encrypted data.offset - the start of the encrypted data bytes.length - the number of data bytes.signature - an optional Signature object setup with the received or stored signature of
the data as produced by the encrypt() process. If it is not null the Signature will be used
to validate the decrypted data.
StreamCorruptedException - if there was an error with the data or if the decryptor
is incorrect.
public static ByteArray decrypt(DataProcessor processor,
ByteArray dest,
byte[] encryptedData,
int offset,
int length,
Signature signature)
throws StreamCorruptedException
processor - a DataProcessor object to decrypt the data.dest - an optional destination ByteArray to hold the decrypted data.encryptedData - the encrypted data.offset - the start of the encrypted data bytes.length - the number of data bytes.signature - an optional Signature object setup with the received or stored signature of
the data as produced by the encrypt() process. If it is not null the Signature will be used
to validate the decrypted data.
StreamCorruptedException - if there was an error with the data or if the decryptor
is incorrect.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||