## net.i2p.data
Class SessionKey

    java.lang.Object
      net.i2p.data.DataStructureImpl
          net.i2p.data.SimpleDataStructure
              net.i2p.data.SessionKey

All Implemented Interfaces:
  DataStructure

    public class SessionKey

extends SimpleDataStructure

Defines the SessionKey as defined by the I2P data structure spec. A session key is 32byte Integer.

Author:
  jrandom

Field Summary
`static SessionKey` `INVALID_KEY`
`static int` `KEYSIZE_BYTES`

Fields inherited from class net.i2p.data.SimpleDataStructure
`_data, _length`

Constructor Summary
`SessionKey()`
`SessionKey(byte[] data)`

Method Summary
`Object` `getPreparedKey()` retrieve an internal representation of the session key, as known by the AES engine used.
`int` `length()` The legal length of the byte array in this data structure
`void` `setData(byte[] data)` caveat: this method isn't synchronized with the preparedKey, so don't try to *change* the key data after already doing some encryption/decryption (or if you do change it, be sure this object isn't mid decrypt)
`void` `setPreparedKey(Object obj)`

Methods inherited from class net.i2p.data.SimpleDataStructure
`calculateHash, equals, fromBase64, fromByteArray, getData, hashCode, readBytes, toBase64, toByteArray, toString, writeBytes`

Methods inherited from class net.i2p.data.DataStructureImpl
`read`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### KEYSIZE_BYTES

    public static final int KEYSIZE_BYTES

See Also:
  Constant Field Values

### INVALID_KEY

    public static final SessionKey INVALID_KEY

Constructor Detail

### SessionKey

    public SessionKey()

### SessionKey

    public SessionKey(byte[] data)

Method Detail

### length

    public int length()

  Description copied from class: `SimpleDataStructure`
  The legal length of the byte array in this data structure

  Specified by:
    `length` in class `SimpleDataStructure`

### setData

    public void setData(byte[] data)

  caveat: this method isn't synchronized with the preparedKey, so don't try to *change* the key data after already doing some encryption/decryption (or if you do change it, be sure this object isn't mid decrypt)

  Overrides:
    `setData` in class `SimpleDataStructure`
  Parameters:
    `data` - of correct length, or null

### getPreparedKey

    public Object getPreparedKey()

  retrieve an internal representation of the session key, as known by the AES engine used. this can be reused safely

### setPreparedKey

    public void setPreparedKey(Object obj)