net.i2p.crypto
public final class CryptixRijndael_Algorithm extends Object
Rijndael was written by Vincent Rijmen and Joan Daemen.
Portions of this code are Copyright © 1997, 1998
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
Modifier and Type | Field and Description |
---|---|
(package private) static int[] |
_alog |
(package private) static int |
_BLOCK_SIZE |
(package private) static int |
_debuglevel |
(package private) static PrintWriter |
_err |
(package private) static boolean |
_IN |
(package private) static int[] |
_log |
(package private) static String |
_NAME |
(package private) static boolean |
_OUT |
(package private) static byte[] |
_rcon |
(package private) static boolean |
_RDEBUG |
(package private) static byte[] |
_S |
(package private) static int[][][] |
_shifts |
(package private) static byte[] |
_Si |
(package private) static int[] |
_T1 |
(package private) static int[] |
_T2 |
(package private) static int[] |
_T3 |
(package private) static int[] |
_T4 |
(package private) static int[] |
_T5 |
(package private) static int[] |
_T6 |
(package private) static int[] |
_T7 |
(package private) static int[] |
_T8 |
(package private) static boolean |
_TRACE |
(package private) static int[] |
_U1 |
(package private) static int[] |
_U2 |
(package private) static int[] |
_U3 |
(package private) static int[] |
_U4 |
Constructor and Description |
---|
CryptixRijndael_Algorithm() |
Modifier and Type | Method and Description |
---|---|
static void |
blockDecrypt(byte[] in,
byte[] result,
int inOffset,
int outOffset,
Object sessionKey)
Convenience method to decrypt exactly one block of plaintext, assuming
Rijndael's default block size (128-bit).
|
static void |
blockDecrypt(byte[] in,
byte[] result,
int inOffset,
int outOffset,
Object sessionKey,
int blockSize)
Decrypt exactly one block of ciphertext.
|
static void |
blockEncrypt(byte[] in,
byte[] result,
int inOffset,
int outOffset,
Object sessionKey)
Convenience method to encrypt exactly one block of plaintext, assuming
Rijndael's default block size (128-bit).
|
static void |
blockEncrypt(byte[] in,
byte[] result,
int inOffset,
int outOffset,
Object sessionKey,
int blockSize)
Encrypt exactly one block of plaintext.
|
static int |
blockSize() |
(package private) static void |
debug(String s) |
static int |
getRounds(int keySize,
int blockSize)
Return The number of rounds for a given Rijndael's key and block sizes.
|
static void |
main(String[] args) |
static 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 Object |
makeKey(byte[] k,
int blockSize)
Expand a user-supplied key material into a session key.
|
static Object |
makeKey(byte[] k,
int blockSize,
CryptixAESKeyCache.KeyCacheEntry keyData) |
(package private) static int |
mul(int a,
int b) |
(package private) static int |
mul4(int a,
byte[] b) |
static boolean |
self_test()
A basic symmetric encryption/decryption test.
|
(package private) static void |
trace(boolean in,
String s) |
(package private) static void |
trace(String s) |
static final String _NAME
static final boolean _IN
static final boolean _OUT
static final boolean _RDEBUG
static final int _debuglevel
static final PrintWriter _err
static final boolean _TRACE
static final int _BLOCK_SIZE
static final int[] _alog
static final int[] _log
static final byte[] _S
static final byte[] _Si
static final int[] _T1
static final int[] _T2
static final int[] _T3
static final int[] _T4
static final int[] _T5
static final int[] _T6
static final int[] _T7
static final int[] _T8
static final int[] _U1
static final int[] _U2
static final int[] _U3
static final int[] _U4
static final byte[] _rcon
static final int[][][] _shifts
static void debug(String s)
static void trace(boolean in, String s)
static void trace(String s)
static final int mul(int a, int b)
static final int mul4(int a, byte[] b)
public static final Object makeKey(byte[] k) throws InvalidKeyException
k
- The 128/192/256-bit user-key to use.InvalidKeyException
- If the key is invalid.public static final void blockEncrypt(byte[] in, byte[] result, int inOffset, int outOffset, Object sessionKey)
in
- The plaintext.result
- The resulting ciphertext.inOffset
- Index of in from which to start considering data.sessionKey
- The session key to use for encryption.public static final void blockDecrypt(byte[] in, byte[] result, int inOffset, int outOffset, Object sessionKey)
in
- The ciphertext.result
- The resulting ciphertextinOffset
- Index of in from which to start considering data.sessionKey
- The session key to use for decryption.public static boolean self_test()
public static final int blockSize()
public static final Object makeKey(byte[] k, int blockSize) throws InvalidKeyException
k
- The 128/192/256-bit user-key to use.blockSize
- The block size in bytes of this Rijndael.InvalidKeyException
- If the key is invalid.public static final Object makeKey(byte[] k, int blockSize, CryptixAESKeyCache.KeyCacheEntry keyData) throws InvalidKeyException
InvalidKeyException
public static final void blockEncrypt(byte[] in, byte[] result, int inOffset, int outOffset, Object sessionKey, int blockSize)
in
- The plaintext.result
- The resulting ciphertext.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 final void blockDecrypt(byte[] in, byte[] result, int inOffset, int outOffset, Object sessionKey, int blockSize)
in
- The ciphertext.result
- The resulting 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 final 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 void main(String[] args)