Class MTCSignatureVerifierProvider
java.lang.Object
org.bouncycastle.cert.plants.MTCSignatureVerifierProvider
- All Implemented Interfaces:
ContentVerifierProvider
Single-cosigner
ContentVerifierProvider adapter for MTC verification.
Wraps a single MTCCosignerVerifier so it can be plugged into the
generic BC operator surface that accepts a ContentVerifierProvider.
The provider has two modes, selected by which constructor is used:
- Manual mode (
MTCSignatureVerifierProvider(MTCCosignerVerifier)) —get(AlgorithmIdentifier)returns the wrapped verifier directly. Callers drive cosignature verification themselves: write theMTCCosignedMessagebytes throughContentVerifier.getOutputStream()and callContentVerifier.verify(byte[])with the cosigner's signature. - Certificate mode
(
MTCSignatureVerifierProvider(MTCCertAuth, MTCCosignerVerifier)) —get(AlgorithmIdentifier)returns a wrapping verifier that integrates withcertHolder.isSignatureValid(provider)for an MTC certificate:- The DER-encoded TBSCertificate is captured from
ContentVerifier.getOutputStream(). ContentVerifier.verify(byte[])receives the MTCProof bytes (the cert'ssignatureValue), reparses them, recomputes the subtree hash viaMerkleTreeCertificateValidator.computeSubtreeHash(byte[], byte[], MerkleTreeHash), builds theMTCCosignedMessagefor the MTCSignature whosecosigner_idmatches the wrapped verifier'sMTCCosignerVerifier.getCosignerId()(signatures naming any other cosigner are unrecognized and ignored), and returnstrueif that cosignature verifies. This matches single-cosigner deployments — a multi-cosigner /minCosignatures > 1policy should continue to useMerkleTreeCertificateValidator.
- The DER-encoded TBSCertificate is captured from
The adapter has no associated certificate;
hasAssociatedCertificate() returns false and
getAssociatedCertificate() returns null.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMTCSignatureVerifierProvider(MTCCertAuth ca, MTCCosignerVerifier verifier) Certificate-mode constructor — see class javadoc.Manual-mode constructor — see class javadoc. -
Method Summary
Modifier and TypeMethodDescriptionget(org.bouncycastle.asn1.x509.AlgorithmIdentifier verifierAlgorithmIdentifier) Return a ContentVerifier that matches the passed in algorithm identifier,Return the associated certificate if there is one.booleanReturn whether or not this verifier has a certificate associated with it.
-
Constructor Details
-
MTCSignatureVerifierProvider
Manual-mode constructor — see class javadoc. -
MTCSignatureVerifierProvider
Certificate-mode constructor — see class javadoc. Use this when passing the provider toX509CertificateHolder.isSignatureValid(ContentVerifierProvider).
-
-
Method Details
-
hasAssociatedCertificate
public boolean hasAssociatedCertificate()Description copied from interface:ContentVerifierProviderReturn whether or not this verifier has a certificate associated with it.- Specified by:
hasAssociatedCertificatein interfaceContentVerifierProvider- Returns:
- true if there is an associated certificate, false otherwise.
-
getAssociatedCertificate
Description copied from interface:ContentVerifierProviderReturn the associated certificate if there is one.- Specified by:
getAssociatedCertificatein interfaceContentVerifierProvider- Returns:
- a holder containing the associated certificate if there is one, null if there is not.
-
get
public ContentVerifier get(org.bouncycastle.asn1.x509.AlgorithmIdentifier verifierAlgorithmIdentifier) Description copied from interface:ContentVerifierProviderReturn a ContentVerifier that matches the passed in algorithm identifier,- Specified by:
getin interfaceContentVerifierProvider- Parameters:
verifierAlgorithmIdentifier- the algorithm and parameters required.- Returns:
- a matching ContentVerifier
-