de.bb.security
Class RC5
java.lang.Object
|
+--de.bb.security.BlockCipher
|
+--de.bb.security.RC5
- public class RC5
- extends BlockCipher
RC5-Cipher
based of RFC-2040
tested on vectors found in this RFC (only Blocksize=8)
|
Constructor Summary |
RC5(int _blocksize)
Create a new instance |
|
Method Summary |
void |
decrypt(byte[] cipherText,
int cipherOff,
byte[] clearText,
int clearOff)
Decrypt one Block of "Blocksize" |
void |
encrypt(byte[] clearText,
int clearOff,
byte[] cipherText,
int cipherOff)
Encrypt one Block of "Blocksize" |
int |
rounds()
Getting rounds of inner RC5 transformation. |
void |
setKey(byte[] keyData)
Setting the key for en/decryption. |
void |
setRounds(int _rounds)
Setting rounds of inner RC5 transformation. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RC5
public RC5(int _blocksize)
throws java.lang.IllegalArgumentException
- Create a new instance
- Parameters:
_blocksize - Size of block in bytes to en/decrypt in one step (default 8)- Throws:
java.lang.IllegalArgumentException - Blocksize can be only 4, 8 or 16.
setRounds
public void setRounds(int _rounds)
throws java.lang.IllegalArgumentException
- Setting rounds of inner RC5 transformation.
- Parameters:
_rounds - min 0, max 255, default 16 (insecure if rounds < 12)- Throws:
java.lang.IllegalArgumentException - 0 < _rounds < 256
rounds
public int rounds()
- Getting rounds of inner RC5 transformation.
setKey
public void setKey(byte[] keyData)
throws java.lang.IllegalArgumentException
- Setting the key for en/decryption.
- Overrides:
setKey in class BlockCipher
- Parameters:
keyData - the key- Throws:
java.lang.IllegalArgumentException - 0 < keylength < 256
encrypt
public void encrypt(byte[] clearText,
int clearOff,
byte[] cipherText,
int cipherOff)
- Encrypt one Block of "Blocksize"
- Overrides:
encrypt in class BlockCipher
- Following copied from class:
de.bb.security.BlockCipher
- Parameters:
clearText - input data which is encryptedclearOff - offset into input datacipherText - output data which is encrypted.cipherOff - offset into output data
decrypt
public void decrypt(byte[] cipherText,
int cipherOff,
byte[] clearText,
int clearOff)
- Decrypt one Block of "Blocksize"
- Overrides:
decrypt in class BlockCipher
- Following copied from class:
de.bb.security.BlockCipher
- Parameters:
cipherText - output data which is encrypted.cipherOff - offset into output dataclearText - input data which is encryptedclearOff - offset into input data