public final class Rijndael_Algorithm
extends java.lang.Object
Constructor and Description |
---|
Rijndael_Algorithm() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
blockDecrypt(byte[] in,
int inOffset,
java.lang.Object sessionKey)
Convenience method to decrypt exactly one block of plaintext, assuming
Rijndael's default block size (128-bit).
|
static byte[] |
blockDecrypt(byte[] in,
int inOffset,
java.lang.Object sessionKey,
int blockSize)
Decrypt exactly one block of ciphertext.
|
static byte[] |
blockEncrypt(byte[] in,
int inOffset,
java.lang.Object sessionKey)
Convenience method to encrypt exactly one block of plaintext, assuming
Rijndael's default block size (128-bit).
|
static byte[] |
blockEncrypt(byte[] in,
int inOffset,
java.lang.Object sessionKey,
int blockSize)
Encrypt exactly one block of plaintext.
|
static int |
blockSize() |
static int |
getRounds(int keySize,
int blockSize)
Return The number of rounds for a given Rijndael's key and block sizes.
|
static void |
main(java.lang.String[] args) |
static java.lang.Object |
makeKey(byte[] k)
Convenience method to expand a user-supplied key material into a
session key, assuming Rijndael's default block size (128-bit).
|
static java.lang.Object |
makeKey(byte[] k,
int blockSize)
Expand a user-supplied key material into a session key.
|
static boolean |
self_test()
A basic symmetric encryption/decryption test.
|
public static int getRounds(int keySize, int blockSize)
keySize
- The size of the user key material in bytes.blockSize
- The desired block size in bytes.public static byte[] blockDecrypt(byte[] in, int inOffset, java.lang.Object sessionKey)
in
- The ciphertext.inOffset
- Index of in from which to start considering data.sessionKey
- The session key to use for decryption.public static byte[] blockDecrypt(byte[] in, int inOffset, java.lang.Object sessionKey, int blockSize)
in
- The ciphertext.inOffset
- Index of in from which to start considering data.sessionKey
- The session key to use for decryption.blockSize
- The block size in bytes of this Rijndael.public static byte[] blockEncrypt(byte[] in, int inOffset, java.lang.Object sessionKey)
in
- The plaintext.inOffset
- Index of in from which to start considering data.sessionKey
- The session key to use for encryption.public static byte[] blockEncrypt(byte[] in, int inOffset, java.lang.Object sessionKey, int blockSize)
in
- The plaintext.inOffset
- Index of in from which to start considering data.sessionKey
- The session key to use for encryption.blockSize
- The block size in bytes of this Rijndael.public static int blockSize()
public static void main(java.lang.String[] args)
public static java.lang.Object makeKey(byte[] k) throws java.security.InvalidKeyException
k
- The 128/192/256-bit user-key to use.java.security.InvalidKeyException
- If the key is invalid.public static java.lang.Object makeKey(byte[] k, int blockSize) throws java.security.InvalidKeyException
k
- The 128/192/256-bit user-key to use.blockSize
- The block size in bytes of this Rijndael.java.security.InvalidKeyException
- If the key is invalid.public static boolean self_test()