|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.security.RSAKey
An RSAKey holds either a private or public key and will also perform encryption/decryption operations. No data as to whether it is private or public is stored here, you can place that in a higher level object if needed.
Note that due to the nature of this encryption calling decrypt() on data generated by encrypt() on the same key will not yield the original text. With this type of encryption you can only use a key to decrypt the data encrypted by its public/private counterpart.
Use the class RSA to generate a new pair of keys.
| Field Summary | |
protected BigInteger |
exp
|
protected BigInteger |
value
|
| Constructor Summary | |
protected |
RSAKey()
|
|
RSAKey(byte[] encodedBytes,
int offset,
int length)
This creates the key from the bytes as encoded by encodeBytes. |
| Method Summary | |
byte[] |
decrypt(byte[] encrypted,
int offset,
int length)
Decrypt the data as encrypted by this key's counterpart. |
int |
encodeBytes(ByteArray dest)
Used to store the key in a stream of bytes. |
byte[] |
encrypt(byte[] data,
int offset,
int length)
Encrypt the provided data. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
protected BigInteger exp
protected BigInteger value
| Constructor Detail |
protected RSAKey()
public RSAKey(byte[] encodedBytes,
int offset,
int length)
throws StreamCorruptedException
| Method Detail |
public int encodeBytes(ByteArray dest)
encodeBytes in interface ByteEncodabledest - The destination ByteArray, or null to determine the number of bytes needed to encode.
public byte[] encrypt(byte[] data,
int offset,
int length)
throws IOException
encrypt in interface EncryptionKeyIOException
public byte[] decrypt(byte[] encrypted,
int offset,
int length)
throws IOException
decrypt in interface EncryptionKeyIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||