Class MTCCosignedMessage


  • public final class MTCCosignedMessage
    extends java.lang.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:
    MTCSignatureVerifier, MTCCosignerVerifier
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] encode​(byte[] logId, long start, long end, byte[] subtreeHash, byte[] cosignerId)
      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.
      static byte[] encode​(byte[] logId, long timestamp, long start, long end, byte[] subtreeHash, byte[] cosignerId)
      Encodes a CosignedMessage in the wire format defined by Section 5.3.1.
      static byte[] encode​(MTCLog log, byte[] subtreeHash, byte[] cosignerId)
      Equivalent to encode(byte[], long, long, byte[], byte[]) taking the log ID and subtree window from an MTCLog.
      static byte[] encode​(MTCLog log, long timestamp, byte[] subtreeHash, byte[] cosignerId)
      Equivalent to encode(byte[], long, long, long, byte[], byte[]) taking the log ID and subtree window from an MTCLog.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • encode

        public static byte[] encode​(byte[] logId,
                                    long start,
                                    long end,
                                    byte[] subtreeHash,
                                    byte[] cosignerId)
                             throws java.io.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:
        java.io.IOException
      • encode

        public static byte[] encode​(MTCLog log,
                                    byte[] subtreeHash,
                                    byte[] cosignerId)
                             throws java.io.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:
        java.io.IOException
      • encode

        public static byte[] encode​(MTCLog log,
                                    long timestamp,
                                    byte[] subtreeHash,
                                    byte[] cosignerId)
                             throws java.io.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:
        java.io.IOException
      • encode

        public static byte[] encode​(byte[] logId,
                                    long timestamp,
                                    long start,
                                    long end,
                                    byte[] subtreeHash,
                                    byte[] cosignerId)
                             throws java.io.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:
        java.io.IOException