Package net.i2p.crypto
Class AESEngine
java.lang.Object
net.i2p.crypto.AESEngine
- Direct Known Subclasses:
CryptixAESEngine
public class AESEngine extends Object
Dummy wrapper for AES cipher operation.
Warning - most methods UNUSED.
See CryptixAESEngine overrides for the real thing.
-
Field Summary
Fields Modifier and Type Field Description protected I2PAppContext
_context
protected Log
_log
-
Constructor Summary
Constructors Modifier Constructor Description protected
AESEngine(I2PAppContext ctx)
-
Method Summary
Modifier and Type Method Description void
decrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length)
Decrypt the data with the session keyvoid
decrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int ivOffset, int length)
Decrypt the data with the session key.void
decryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] rv, int outIndex)
This just copies payload to rv, see extension for the real thing.void
encrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length)
Encrypt the payload with the session keyvoid
encrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int ivOffset, int length)
Encrypt the payload with the session key.void
encryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] out, int outIndex)
This just copies payload to out, see extension for the real thing.static 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 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.byte[]
safeDecrypt(byte[] payload, SessionKey sessionKey, byte[] iv)
Deprecated.unusedbyte[]
safeEncrypt(byte[] payload, SessionKey sessionKey, byte[] iv, int paddedSize)
Deprecated.unused
-
Field Details
-
Constructor Details
-
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:
paddedSize
- minimum size of the outputiv
- IV for CBC, must be 16 bytes- 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
-