Class MTCContentSigner
- All Implemented Interfaces:
ContentSigner
ContentSigner that emits an MTC signatureValue
(an encoded MTCProof) for an EE Merkle Tree certificate per
Section 6.1 of draft-ietf-plants-merkle-tree-certs.
The signer is plugged into the standard
X509v3CertificateBuilder.build(ContentSigner) flow. As the TBSCertificate
DER bytes stream out of the builder into getOutputStream(), this
class captures them; when getSignature() is invoked it:
- Derives the
MerkleTreeCertEntryleaf hash and climbs one Merkle level using the single-siblinginclusionProofviaMerkleTreeCertificateValidator.computeSubtreeHash(byte[], byte[], MerkleTreeHash). - Delegates to
MTCCosigner.cosignSubtree(MTCLog, byte[])to produce the cosigner'sMTCSignature. - Wraps the inclusion proof and the cosigner signature in an
MTCProofand returns its TLS wire encoding.
This is the simple-case binding used by the worked examples: a
standalone certificate (Section 6.2 of the draft) over the minimal
subtree [0, 2) — the EE's log entry at index 0, one sibling leaf at
index 1, and a single-node inclusion proof — carrying one cosigner
signature. Issuers with multi-level inclusion proofs or multiple cosigners
should compose the MTCCosigner, MTCProof and
MerkleTreeHash primitives directly; landmark-relative certificates
(Section 6.3, no signatures) are built via
LandmarkCertificateManager.buildLandmarkCertificate(long, long, TBSCertificateLogEntry, SubjectPublicKeyInfo, MerkleTreePrimitives.SubtreeInfo, List, MerkleTreeHash).
-
Constructor Summary
ConstructorsConstructorDescriptionMTCContentSigner(MTCLog log, byte[] inclusionProof, MTCCosigner cosigner) The cosigner's identity is taken fromMTCCosigner.getCosignerId()— the CA-as-cosigner case is just aMTCCosignerconstructed withlog.getCa().getCaId()as its cosigner ID (Section 5.3 of the draft). -
Method Summary
Modifier and TypeMethodDescriptionorg.bouncycastle.asn1.x509.AlgorithmIdentifierReturn the algorithm identifier describing the signature algorithm and parameters this signer generates.Returns a stream that will accept data for the purpose of calculating a signature.byte[]Returns a signature based on the current data written to the stream, since the start or the last call to getSignature().
-
Constructor Details
-
MTCContentSigner
The cosigner's identity is taken fromMTCCosigner.getCosignerId()— the CA-as-cosigner case is just aMTCCosignerconstructed withlog.getCa().getCaId()as its cosigner ID (Section 5.3 of the draft). Witnesses, regulators, federated peers or any other entity with a distinct trust anchor ID work via the same constructor by constructing the cosigner with their own ID.- Parameters:
log- issuance log + subtree window[log.getStart(), log.getEnd())— also supplies the CA (viaMTCLog.getCa()) and therefore the hash function and log IDinclusionProof- the single sibling leaf hash that, combined with the EE's leaf hash, yields the subtree hash — same bytes that land in the resulting MTCProofcosigner- cosigner driver bound to its trust anchor ID, signature algorithm and key
-
-
Method Details
-
getAlgorithmIdentifier
public org.bouncycastle.asn1.x509.AlgorithmIdentifier getAlgorithmIdentifier()Description copied from interface:ContentSignerReturn the algorithm identifier describing the signature algorithm and parameters this signer generates.- Specified by:
getAlgorithmIdentifierin interfaceContentSigner- Returns:
- algorithm oid and parameters.
-
getOutputStream
Description copied from interface:ContentSignerReturns a stream that will accept data for the purpose of calculating a signature. Use org.bouncycastle.util.io.TeeOutputStream if you want to accumulate the data on the fly as well.- Specified by:
getOutputStreamin interfaceContentSigner- Returns:
- an OutputStream
-
getSignature
public byte[] getSignature()Description copied from interface:ContentSignerReturns a signature based on the current data written to the stream, since the start or the last call to getSignature().- Specified by:
getSignaturein interfaceContentSigner- Returns:
- bytes representing the signature.
-