Package org.bouncycastle.cert.plants
Class MTCSignatureVerifierProvider
- java.lang.Object
-
- org.bouncycastle.cert.plants.MTCSignatureVerifierProvider
-
- All Implemented Interfaces:
ContentVerifierProvider
public class MTCSignatureVerifierProvider extends java.lang.Object implements ContentVerifierProvider
Single-cosignerContentVerifierProvideradapter for MTC verification.Wraps a single
MTCCosignerVerifierso it can be plugged into the generic BC operator surface that accepts aContentVerifierProvider. 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[], org.bouncycastle.cert.plants.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()returnsfalseandgetAssociatedCertificate()returnsnull.- See Also:
MTCCosignerVerifier
-
-
Constructor Summary
Constructors Constructor Description MTCSignatureVerifierProvider(MTCCertAuth ca, MTCCosignerVerifier verifier)Certificate-mode constructor — see class javadoc.MTCSignatureVerifierProvider(MTCCosignerVerifier verifier)Manual-mode constructor — see class javadoc.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentVerifierget(org.bouncycastle.asn1.x509.AlgorithmIdentifier verifierAlgorithmIdentifier)Return a ContentVerifier that matches the passed in algorithm identifier,X509CertificateHoldergetAssociatedCertificate()Return the associated certificate if there is one.booleanhasAssociatedCertificate()Return whether or not this verifier has a certificate associated with it.
-
-
-
Constructor Detail
-
MTCSignatureVerifierProvider
public MTCSignatureVerifierProvider(MTCCosignerVerifier verifier)
Manual-mode constructor — see class javadoc.
-
MTCSignatureVerifierProvider
public MTCSignatureVerifierProvider(MTCCertAuth ca, MTCCosignerVerifier verifier)
Certificate-mode constructor — see class javadoc. Use this when passing the provider toX509CertificateHolder.isSignatureValid(ContentVerifierProvider).
-
-
Method Detail
-
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
public X509CertificateHolder 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
-
-