Package net.i2p.crypto
Class AESEngine
java.lang.Object
net.i2p.crypto.AESEngine
- Direct Known Subclasses:
CryptixAESEngine
Dummy wrapper for AES cipher operation.
Warning - most methods UNUSED.
See CryptixAESEngine overrides for the real thing.
-
Field Summary
Fields -
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.voiddecryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] rv, int outIndex) This just copies payload to rv, see extension for the real thing.voidencrypt(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.voidencryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] out, int outIndex) This just copies payload to out, see extension for the real thing.static final byte[]getPadding(I2PAppContext context, int curSize, long minPaddedSize) Return random bytes for padding the data to a mod 16 size so that it is at least minPaddedSize Public for ElGamalAESEngine.static final intgetPaddingSize(int curSize, long minPaddedSize) Return size for padding the data to a mod 16 size so that it is at least minPaddedSize Public for ElGamalAESEngine.byte[]safeDecrypt(byte[] payload, SessionKey sessionKey, byte[] iv) Deprecated.unusedbyte[]safeEncrypt(byte[] payload, SessionKey sessionKey, byte[] iv, int paddedSize) Deprecated.unused
-
Field Details
-
_log
-
_context
-
-
Constructor Details
-
AESEngine
-
-
Method Details
-
encrypt
public void encrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length) Encrypt the payload with the session key- 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- IV for CBC, must be 16 byteslength- how much data to encrypt
-
encrypt
public void encrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int ivOffset, int length) Encrypt the payload with the session key. This just copies payload to out, see extension for the real thing.- 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- IV for CBClength- how much data to encrypt
-
safeEncrypt
@Deprecated public byte[] safeEncrypt(byte[] payload, SessionKey sessionKey, byte[] iv, int paddedSize) Deprecated.unusedEncrypt the SHA-256 Hash of the IV, the 4 byte length, and the payload, with random padding up to the paddedSize, rounded up to the next multiple of 16.- Parameters:
iv- IV for CBC, must be 16 bytespaddedSize- minimum size of the output- Returns:
- null on error
-
safeDecrypt
Deprecated.unusedSee safeEncrypt() for description. WARNING - no check for maximum length here, OOM DOS possible, fix it if you're going to use this.- Parameters:
iv- IV for CBC, must be 16 bytes- Returns:
- null on error
-
decrypt
public void decrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length) Decrypt the data with the session key- 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- IV for CBClength- how much data to decrypt
-
decrypt
public void decrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int ivOffset, int length) Decrypt the data with the session key. This just copies payload to out, see extension for the real thing.- 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- IV for CBClength- how much data to decrypt
-
encryptBlock
public void encryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] out, int outIndex) This just copies payload to out, see extension for the real thing.- Parameters:
sessionKey- unused
-
decryptBlock
public void decryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] rv, int outIndex) This just copies payload to rv, see extension for the real thing.- Parameters:
payload- encrypted datasessionKey- private session key
-
getPadding
Return random bytes for padding the data to a mod 16 size so that it is at least minPaddedSize Public for ElGamalAESEngine. Not a public API, not for external use.- Since:
- 0.9.38 moved from ElGamalAESEngine
-
getPaddingSize
public static final int getPaddingSize(int curSize, long minPaddedSize) Return size for padding the data to a mod 16 size so that it is at least minPaddedSize Public for ElGamalAESEngine. Not a public API, not for external use.- Since:
- 0.9.38 moved from ElGamalAESEngine
-