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

public class GarlicMessageParserextends 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.
  • Field Details

    • _log

      private final Log _log
      Logger for this class.
    • _context

      private final RouterContext _context
      The router context the parser runs in.
    • MAX_CLOVES

      private static final int MAX_CLOVES
      Huge limit just to reduce chance of trouble. Typ. usage is 3. As of 0.9.12. Was 255.
      See Also:
  • Constructor Details

    • GarlicMessageParser

      public GarlicMessageParser(RouterContext context)
      Create a garlic message parser.
      Parameters:
      context - the router context
  • Method Details

    • getGarlicCloves

      CloveSet getGarlicCloves(GarlicMessage message, PrivateKey encryptionKey, SessionKeyManager skm)
      Supports ELGAMAL_2048, ECIES_X25519, and PQ.
      Parameters:
      message - the garlic message to decrypt
      encryptionKey - an ElGamal or ECIES_X25519 key
      skm - use tags from this session key manager
      Returns:
      null on error
    • getGarlicCloves

      CloveSet getGarlicCloves(GarlicMessage message, PrivateKey elgKey, PrivateKey ecKey, SessionKeyManager skm)
      Supports both ELGAMAL_2048 and ECIES_X25519.
      Parameters:
      message - the garlic message to decrypt
      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
    • readCloveSet

      public CloveSet readCloveSet(byte[] data, int offset) throws DataFormatException
      ElGamal only.
      Parameters:
      data - the raw data to read from
      offset - where in data to start
      Returns:
      non-null, throws on all errors
      Throws:
      DataFormatException - if the data is malformed