|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openuat.util.SimpleBlockCipher
public class SimpleBlockCipher
This class implements a simple interface to a block cipher (AES/Rijndael) with as little parameters as possible.
| Field Summary | |
|---|---|
static int |
BlockByteLength
The current block size of the used cipher in bytes. |
java.lang.String |
instanceId
This may be set to distinguish multiple instances running on the same machine. |
static int |
KeyByteLength
The current length in byte of the key. |
| Constructor Summary | |
|---|---|
SimpleBlockCipher(boolean useJSSE)
Construct the simple block cipher object. |
|
| Method Summary | |
|---|---|
byte[] |
decrypt(byte[] cipherText,
int numMessageBits,
byte[] sharedKey)
Decrypt the cipher text message with the shared key set in the constructor. |
byte[] |
encrypt(byte[] plainText,
int numMessageBits,
byte[] sharedKey)
Encrypt the plain text message with the shared key set in the constructor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int KeyByteLength
public static final int BlockByteLength
public java.lang.String instanceId
| Constructor Detail |
|---|
public SimpleBlockCipher(boolean useJSSE)
useJSSE - If set to true, the JSSE API with the default JCE provider of the JVM will be used
for cryptographic operations. If set to false, an internal copy of the Bouncycastle
Lightweight API classes will be used.| Method Detail |
|---|
public byte[] encrypt(byte[] plainText,
int numMessageBits,
byte[] sharedKey)
throws InternalApplicationException
plainText - The message to encrypt. It must contain exactly as many bits
as specified in the numMessageBits parameter in the constructor.numMessageBits - The number of bits to use of this message. If set to -1,
will use all bits from plainText.sharedKey - The key to use for encryption. It must be of length KeyByteLength.
InternalApplicationException
public byte[] decrypt(byte[] cipherText,
int numMessageBits,
byte[] sharedKey)
throws InternalApplicationException
cipherText - The cipher text to decrypt. It must be either one block long
or the number of blocks necessary to encrypt numMessageBits plus one block
for the IV.numMessageBits - The number of bits to extract from cipherText after decrypting.sharedKey - The key to use for encryption. It must be of length KeyByteLength.
InternalApplicationException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||