public class SessionKey extends SimpleDataStructure
SessionKey provides symmetric encryption capabilities for I2P communications:
Key Generation:
I2PAppContext.keyGenerator().generateSessionKey()Usage Patterns:
Security Considerations:
Performance Features:
Integration:
Constants:
KEYSIZE_BYTES - Standard 32-byte key lengthINVALID_KEY - All-zero key for invalid/placeholder useBest Practices:
| Modifier and Type | Field and Description |
|---|---|
static SessionKey | INVALID_KEYA key with all zeroes in the data |
static int | KEYSIZE_BYTESKey size in bytes (32). |
_data| Constructor and Description |
|---|
SessionKey() |
SessionKey(byte[] data)Key data. |
| Modifier and Type | Method and Description |
|---|---|
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)Sets the data. |
void | setPreparedKey(Object obj)Set the internal prepared AES key representation. |
calculateHash, equals, fromBase64, fromByteArray, getData, hashCode, read, readBytes, toBase64, toByteArray, toString, writeBytespublic static final SessionKey INVALID_KEY
public static final int KEYSIZE_BYTES
public SessionKey()
public SessionKey(byte[] data)
data - the key datapublic Object getPreparedKey()
public int length()
length in class SimpleDataStructurepublic void setData(byte[] data)
setData in class SimpleDataStructuredata - 32 bytes, or nullIllegalArgumentException - if data is not the legal number of bytes (but null is ok)RuntimeException - if data already set.public void setPreparedKey(Object obj)
obj - the prepared key object