## net.i2p.client.datagram
Class I2PDatagramDissector

    java.lang.Object
      net.i2p.client.datagram.I2PDatagramDissector

    public final class I2PDatagramDissector

extends Object

Class for dissecting I2P repliable datagrams, checking the authenticity of the sender. Note that objects of this class are NOT THREAD SAFE!

Author:
  human

Constructor Summary
`I2PDatagramDissector()` Crate a new I2P repliable datagram dissector.

Method Summary
`Hash` `extractHash()` Extract the hash of the payload of an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), without verifying the datagram signature.
`byte[]` `extractPayload()` Extract the payload carried by an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), without verifying the datagram signature.
`Destination` `extractSender()` Extract the sender of an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), without verifying the datagram signature.
`Hash` `getHash()` Extract the hash of the payload of an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), verifying the datagram signature.
`byte[]` `getPayload()` Get the payload carried by an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), verifying the datagram signature.
`Destination` `getSender()` Get the sender of an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), verifying the datagram signature.
`void` `loadI2PDatagram(byte[] dgram)` Load an I2P repliable datagram into the dissector.
`void` `verifySignature()` Verify the signature of this datagram (previously loaded with the loadI2PDatagram() method)

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

Constructor Detail

### I2PDatagramDissector

    public I2PDatagramDissector()

  Crate a new I2P repliable datagram dissector.

Method Detail

### loadI2PDatagram

    public void loadI2PDatagram(byte[] dgram)
                         throws DataFormatException

  Load an I2P repliable datagram into the dissector.

  Parameters:
    `dgram` - I2P repliable datagram to be loader
  Throws:
    `DataFormatException` - If there's an error in the datagram format

### getPayload

    public byte[] getPayload()
                      throws I2PInvalidDatagramException

  Get the payload carried by an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), verifying the datagram signature.

  Returns:
    A byte array containing the datagram payload
  Throws:
    `I2PInvalidDatagramException` - if the signature verification fails

### getSender

    public Destination getSender()
                          throws I2PInvalidDatagramException

  Get the sender of an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), verifying the datagram signature.

  Returns:
    The Destination of the I2P repliable datagram sender
  Throws:
    `I2PInvalidDatagramException` - if the signature verification fails

### getHash

    public Hash getHash()
                 throws I2PInvalidDatagramException

  Extract the hash of the payload of an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), verifying the datagram signature.

  Returns:
    The hash of the payload of the I2P repliable datagram
  Throws:
    `I2PInvalidDatagramException` - if the signature verification fails

### extractPayload

    public byte[] extractPayload()

  Extract the payload carried by an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), without verifying the datagram signature.

  Returns:
    A byte array containing the datagram payload

### extractSender

    public Destination extractSender()

  Extract the sender of an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), without verifying the datagram signature.

  Returns:
    The Destination of the I2P repliable datagram sender

### extractHash

    public Hash extractHash()

  Extract the hash of the payload of an I2P repliable datagram (previously loaded with the loadI2PDatagram() method), without verifying the datagram signature.

  Returns:
    The hash of the payload of the I2P repliable datagram

### verifySignature

    public void verifySignature()
                         throws I2PInvalidDatagramException

  Verify the signature of this datagram (previously loaded with the loadI2PDatagram() method)

  Throws:
    `I2PInvalidDatagramException` - if the signature is invalid