@peculiar/asn1-mtc
v2.11.0
Published
ASN.1 schema and TLS-encoded proof structures for Merkle Tree Certificates defined in draft-ietf-plants-merkle-tree-certs.
Readme
@peculiar/asn1-mtc
ASN.1 schema and TLS-encoded proof structures for Merkle Tree Certificates defined in draft-ietf-plants-merkle-tree-certs.
Use the exported classes with @peculiar/asn1-schema helpers such as AsnConvert, AsnParser, and AsnSerializer to parse or serialize DER-encoded data defined by the referenced specification.
MTCProof is not DER. It is carried in a certificate's signatureValue in the TLS presentation language with no ASN.1 wrapping, so it is parsed with MTCProof.parse rather than through AsnConvert.
Installation
npm install @peculiar/asn1-mtcOverview
import { AsnConvert } from "@peculiar/asn1-schema";
import { MTCCertificationAuthority, MTCProof, decodeSerialNumber } from "@peculiar/asn1-mtc";
// Critical extension in an MTC CA certificate
const ca = AsnConvert.parse(extnValue, MTCCertificationAuthority);
// Proof in a subscriber certificate's signatureValue
const proof = MTCProof.parse(signatureValue, { hashSize: 32 });
console.log(proof.start, proof.end, proof.isLandmarkRelative);
// Serial number encodes the issuance log and entry index
const { logNumber, index } = decodeSerialNumber(serialNumber);
