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. UNUSED unless i2p.encryption = off See CryptixAESEngine for the real thing.

### Field Summary

Fields
`protected I2PAppContext` `_context`
`protected Log` `_log`

### Constructor Summary

Constructors
Constructor and Description
`AESEngine(I2PAppContext ctx)`

### Method Summary

Methods
`void` `decrypt(byte[] payload, int payloadIndex, byte[] out, int outIndex, SessionKey sessionKey, byte[] iv, int length)` Decrypt the data with the session key
`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.
`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 key
`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.
`void` `encryptBlock(byte[] payload, int inIndex, SessionKey sessionKey, byte[] out, int outIndex)` This just copies payload to out, see extension for the real thing.
`byte[]` `safeDecrypt(byte[] payload, SessionKey sessionKey, byte[] iv)`
`byte[]` `safeEncrypt(byte[] payload, SessionKey sessionKey, byte[] iv, int paddedSize)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### _log

    protected final Log _log

#### _context

    protected final I2PAppContext _context

### Constructor Detail

#### AESEngine

    public AESEngine(I2PAppContext ctx)

### Method Detail

#### 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 encrypted
  `payloadIndex` - index into the payload to start encrypting
  `out` - where to store the result
  `outIndex` - where in out to start writing
  `sessionKey` - private esession key to encrypt to
  `iv` - IV for CBC
  `length` - 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 encrypted
  `payloadIndex` - index into the payload to start encrypting
  `out` - where to store the result
  `outIndex` - where in out to start writing
  `sessionKey` - private esession key to encrypt to
  `iv` - IV for CBC
  `length` - how much data to encrypt

#### safeEncrypt

    public byte[] safeEncrypt(byte[] payload,
                     SessionKey sessionKey,
                     byte[] iv,
                     int paddedSize)

#### safeDecrypt

    public byte[] safeDecrypt(byte[] payload,
                     SessionKey sessionKey,
                     byte[] iv)

#### 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 decrypted
  `payloadIndex` - index into the payload to start decrypting
  `out` - where to store the cleartext
  `outIndex` - where in out to start writing
  `sessionKey` - private session key to decrypt to
  `iv` - IV for CBC
  `length` - 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 decrypted
  `payloadIndex` - index into the payload to start decrypting
  `out` - where to store the cleartext
  `outIndex` - where in out to start writing
  `sessionKey` - private session key to decrypt to
  `iv` - IV for CBC
  `length` - 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 data
  `sessionKey` - private session key