Package net.i2p.crypto
Class CryptixAESEngine
java.lang.Object
net.i2p.crypto.AESEngine
net.i2p.crypto.CryptixAESEngine
Wrapper for AES cypher operation using Cryptix's Rijndael implementation. Implements
CBC with a 16 byte IV.
Problems:
Only supports data of size mod 16 bytes - no inherent padding.
- Author:
- jrandom, thecrypto
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length) Decrypt the data with the session keyvoiddecrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int ivOffset, int length) Decrypt the data with the session key.final voiddecryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] rv, int outIndex) decrypt exactly 16 bytes of data with the session key providedvoidencrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length) Encrypt the payload with the session keyvoidencrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int ivOffset, int length) Encrypt the payload with the session key.final voidencryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] out, int outIndex) encrypt exactly 16 bytes using the session keyMethods inherited from class net.i2p.crypto.AESEngine
getPadding, getPaddingSize, safeDecrypt, safeEncrypt
-
Constructor Details
-
CryptixAESEngine
-
-
Method Details
-
encrypt
public void encrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length) Description copied from class:AESEngineEncrypt the payload with the session key- Overrides:
encryptin classAESEngine- Parameters:
payload- data to be encryptedpayloadIndex- index into the payload to start encryptingout- where to store the resultoutIndex- where in out to start writingsessionKey- private esession key to encrypt toiv- must be 16 byteslength- must be a multiple of 16
-
encrypt
public void encrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int ivOffset, int length) Description copied from class:AESEngineEncrypt the payload with the session key. This just copies payload to out, see extension for the real thing.- Overrides:
encryptin classAESEngine- Parameters:
payload- data to be encryptedpayloadIndex- index into the payload to start encryptingout- where to store the resultoutIndex- where in out to start writingsessionKey- private esession key to encrypt toiv- must be 16 byteslength- must be a multiple of 16
-
decrypt
public void decrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length) Description copied from class:AESEngineDecrypt the data with the session key- Overrides:
decryptin classAESEngine- Parameters:
payload- data to be decryptedpayloadIndex- index into the payload to start decryptingout- where to store the cleartextoutIndex- where in out to start writingsessionKey- private session key to decrypt toiv- 16 byteslength- must be a multiple of 16 (will overrun to next mod 16 if not)
-
decrypt
public void decrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int ivOffset, int length) Description copied from class:AESEngineDecrypt the data with the session key. This just copies payload to out, see extension for the real thing.- Overrides:
decryptin classAESEngine- Parameters:
payload- data to be decryptedpayloadIndex- index into the payload to start decryptingout- where to store the cleartextoutIndex- where in out to start writingsessionKey- private session key to decrypt toiv- 16 bytes starting at ivOffsetlength- must be a multiple of 16 (will overrun to next mod 16 if not)
-
encryptBlock
public final void encryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] out, int outIndex) encrypt exactly 16 bytes using the session key- Overrides:
encryptBlockin classAESEngine- Parameters:
payload- plaintext data, 16 bytes starting at inIndexsessionKey- private session keyout- out parameter, 16 bytes starting at outIndex
-
decryptBlock
public final void decryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] rv, int outIndex) decrypt exactly 16 bytes of data with the session key provided- Overrides:
decryptBlockin classAESEngine- Parameters:
payload- encrypted data, 16 bytes starting at inIndexsessionKey- private session keyrv- out parameter, 16 bytes starting at outIndex
-