Class MTCCosignedMessage

java.lang.Object
org.bouncycastle.cert.plants.MTCCosignedMessage

public final class MTCCosignedMessage extends Object
Wire encoder for the CosignedMessage struct defined by Section 5.3.1 of draft-ietf-plants-merkle-tree-certs:
struct {
    uint8 label[12] = "subtree/v1\n\0";
    opaque cosigner_name<1..2^8-1>;
    uint64 timestamp;
    opaque log_origin<1..2^8-1>;
    uint64 start;
    uint64 end;
    HashValue subtree_hash;
} CosignedMessage;

cosigner_name and log_origin are the ASCII strings "oid/1.3.6.1.4.1." + <dotted-decimal trust anchor ID>, constructed from the binary trust anchor IDs supplied by the caller.

See Also:
  • Method Details

    • encode

      public static byte[] encode(byte[] logId, long start, long end, byte[] subtreeHash, byte[] cosignerId) throws IOException
      Equivalent to encode(byte[], long, long, long, byte[], byte[]) with timestamp == 0, which is the only value permitted inside an MTCProof cosigner signature per Section 6.1 of the draft.
      Throws:
      IOException
    • encode

      public static byte[] encode(MTCLog log, byte[] subtreeHash, byte[] cosignerId) throws IOException
      Equivalent to encode(byte[], long, long, byte[], byte[]) taking the log ID and subtree window from an MTCLog. Convenient for issuer-side code that already carries an MTCLog object.
      Throws:
      IOException
    • encode

      public static byte[] encode(MTCLog log, long timestamp, byte[] subtreeHash, byte[] cosignerId) throws IOException
      Equivalent to encode(byte[], long, long, long, byte[], byte[]) taking the log ID and subtree window from an MTCLog. Use the non-MTCProof case where a non-zero timestamp is required.
      Throws:
      IOException
    • encode

      public static byte[] encode(byte[] logId, long timestamp, long start, long end, byte[] subtreeHash, byte[] cosignerId) throws IOException
      Encodes a CosignedMessage in the wire format defined by Section 5.3.1.
      Parameters:
      logId - binary trust anchor ID of the log
      timestamp - POSIX timestamp (zero inside an MTCProof; non-zero elsewhere)
      start - subtree start index
      end - subtree end index
      subtreeHash - hash of the subtree
      cosignerId - binary trust anchor ID of the cosigner
      Returns:
      the encoded CosignedMessage bytes
      Throws:
      IOException