ro.raducora.utils.encryption.key
Class RC4EncryptionKey
java.lang.Object
|
+--ro.raducora.utils.encryption.key.StreamEncryptionKey
|
+--ro.raducora.utils.encryption.key.RC4EncryptionKey
- All Implemented Interfaces:
- java.lang.Cloneable
- public class RC4EncryptionKey
- extends StreamEncryptionKey
- Author:
- Radu Coravu
|
Method Summary |
byte[] |
decrypt(byte[] toDecrypt,
int offset,
int length)
Decrypt. |
byte[] |
encrypt(byte[] toEncrypt,
int offset,
int length)
Encrypt. |
boolean |
isExplicitlySet()
|
void |
reset()
Init Ciphers |
void |
setKey(java.lang.String key)
Set the key. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RC4EncryptionKey
public RC4EncryptionKey()
reset
public void reset()
- Init Ciphers
- Specified by:
reset in class StreamEncryptionKey
setKey
public void setKey(java.lang.String key)
throws java.security.InvalidKeyException
- Set the key.
- Specified by:
setKey in class StreamEncryptionKey
- Parameters:
key - the String
java.security.InvalidKeyException
isExplicitlySet
public boolean isExplicitlySet()
- Specified by:
isExplicitlySet in class StreamEncryptionKey
- Returns:
- true if key explicitly set.
encrypt
public byte[] encrypt(byte[] toEncrypt,
int offset,
int length)
- Encrypt.
- Specified by:
encrypt in class StreamEncryptionKey
- Parameters:
toEncrypt - bytes to encryptoffset - where to beginlength - how many bytes to process
- Returns:
- the encrypted array(could be different size than input because of
padding)
decrypt
public byte[] decrypt(byte[] toDecrypt,
int offset,
int length)
- Decrypt.
- Specified by:
decrypt in class StreamEncryptionKey
- Parameters:
toDecrypt - bytes to decryptoffset - where to beginlength - how many bytes to process
- Returns:
- the decrypted array(could be different size than input because of
padding removal)
© Copyright Radu Coravu 2002 - 2004.