net.i2p.router.message

## Class GarlicMessageParser

- java.lang.Object
- - net.i2p.router.message.GarlicMessageParser

-     public class GarlicMessageParser
      extends Object

  Read a GarlicMessage, decrypt it, and return the resulting CloveSet. Thread-safe, does not contain any state. Public as it's now in the RouterContext.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GarlicMessageParser(RouterContext context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) CloveSet` | `getGarlicCloves(GarlicMessage message, PrivateKey elgKey, PrivateKey ecKey, SessionKeyManager skm)` Supports both ELGAMAL_2048 and ECIES_X25519.
    `(package private) CloveSet` | `getGarlicCloves(GarlicMessage message, PrivateKey encryptionKey, SessionKeyManager skm)` Supports ELGAMAL_2048, ECIES_X25519, and PQ
    `CloveSet` | `readCloveSet(byte[] data, int offset)` ElGamal only

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

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

- - ### Constructor Detail

    - #### GarlicMessageParser

          public GarlicMessageParser(RouterContext context)

  - ### Method Detail

    - #### getGarlicCloves

          CloveSet getGarlicCloves(GarlicMessage message,
                                   PrivateKey elgKey,
                                   PrivateKey ecKey,
                                   SessionKeyManager skm)

      Supports both ELGAMAL_2048 and ECIES_X25519.
      Parameters:
        `elgKey` - must be ElG OR PQ, non-null
        `ecKey` - must be EC, non-null
        `skm` - use tags from this session key manager
      Returns:
        null on error

    - #### getGarlicCloves

          CloveSet getGarlicCloves(GarlicMessage message,
                                   PrivateKey encryptionKey,
                                   SessionKeyManager skm)

      Supports ELGAMAL_2048, ECIES_X25519, and PQ
      Parameters:
        `encryptionKey` - either type TODO need both for muxed
        `skm` - use tags from this session key manager
      Returns:
        null on error

    - #### readCloveSet

          public CloveSet readCloveSet(byte[] data,
                                       int offset)
                                throws DataFormatException

      ElGamal only
      Parameters:
        `offset` - where in data to start
      Returns:
        non-null, throws on all errors
      Throws:
        `DataFormatException`