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

public class CloveSetextends Object
The unwrapped result of decrypting a GarlicMessage: an array of GarlicCloves plus the outer certificate, message ID, and expiration.

For ElGamal-encrypted messages the certificate/ID/expiration are serialized inside the clove set; for ECIES-encrypted messages they are synthesized with Certificate.NULL_CERT at construction time.

  • Field Details

    • _cloves

      private final GarlicClove[] _cloves
      The cloves carried in the set.
    • _cert

      private final Certificate _cert
      Certificate accompanying the cloves, if any.
    • _msgId

      private final long _msgId
      Message id of the set.
    • _expiration

      private final long _expiration
      When the set stops being valid, in ms.
  • Constructor Details

    • CloveSet

      public CloveSet(GarlicClove[] cloves, Certificate cert, long msgId, long expiration)
      Create a new CloveSet.
      Parameters:
      cloves - non-null, all entries non-null
      cert - non-null
      msgId - the message ID
      expiration - the expiration time
  • Method Details

    • getCloveCount

      public int getCloveCount()
      Get the number of cloves.
      Returns:
      the clove count
    • getClove

      public GarlicClove getClove(int index)
      Get the clove at the specified index.
      Parameters:
      index - the zero-based position within the garlic message
      Returns:
      the clove at the given index
      Throws:
      ArrayIndexOutOfBoundsException - if the index is out of range
    • getCertificate

      public Certificate getCertificate()
      Get the certificate.
      Returns:
      the certificate that signed this garlic message
    • getMessageId

      public long getMessageId()
      Get the message ID.
      Returns:
      the 64-bit clove message ID
    • getExpiration

      public long getExpiration()
      Get the expiration.
      Returns:
      the expiration time
    • toString

      public String toString()
      Overrides:
      toString in class Object