public class MTCSignatureVerifierProvider extends java.lang.Object implements ContentVerifierProvider
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:
MTCSignatureVerifierProvider(MTCCosignerVerifier))
— get(AlgorithmIdentifier) returns the wrapped verifier
directly. Callers drive cosignature verification themselves: write the
MTCCosignedMessage bytes through
ContentVerifier.getOutputStream() and call
ContentVerifier.verify(byte[]) with the cosigner's
signature.MTCSignatureVerifierProvider(MTCCertAuth, MTCCosignerVerifier))
— get(AlgorithmIdentifier) returns a wrapping verifier that
integrates with
certHolder.isSignatureValid(provider) for an MTC certificate:
ContentVerifier.getOutputStream().ContentVerifier.verify(byte[]) receives the MTCProof
bytes (the cert's signatureValue), reparses them,
recomputes the subtree hash via
MerkleTreeCertificateValidator.computeSubtreeHash(byte[], byte[], org.bouncycastle.cert.plants.MerkleTreeHash),
builds the MTCCosignedMessage for the MTCSignature whose
cosigner_id matches the wrapped verifier's
MTCCosignerVerifier.getCosignerId() (signatures naming
any other cosigner are unrecognized and ignored), and returns
true if that cosignature verifies. This matches
single-cosigner deployments — a multi-cosigner /
minCosignatures > 1 policy should continue to use
MerkleTreeCertificateValidator.The adapter has no associated certificate;
hasAssociatedCertificate() returns false and
getAssociatedCertificate() returns null.
MTCCosignerVerifier| Constructor and Description |
|---|
MTCSignatureVerifierProvider(MTCCertAuth ca,
MTCCosignerVerifier verifier)
Certificate-mode constructor — see class javadoc.
|
MTCSignatureVerifierProvider(MTCCosignerVerifier verifier)
Manual-mode constructor — see class javadoc.
|
| Modifier and Type | Method and Description |
|---|---|
ContentVerifier |
get(org.bouncycastle.asn1.x509.AlgorithmIdentifier verifierAlgorithmIdentifier)
Return a ContentVerifier that matches the passed in algorithm identifier,
|
X509CertificateHolder |
getAssociatedCertificate()
Return the associated certificate if there is one.
|
boolean |
hasAssociatedCertificate()
Return whether or not this verifier has a certificate associated with it.
|
public MTCSignatureVerifierProvider(MTCCosignerVerifier verifier)
public MTCSignatureVerifierProvider(MTCCertAuth ca, MTCCosignerVerifier verifier)
X509CertificateHolder.isSignatureValid(ContentVerifierProvider).public boolean hasAssociatedCertificate()
ContentVerifierProviderhasAssociatedCertificate in interface ContentVerifierProviderpublic X509CertificateHolder getAssociatedCertificate()
ContentVerifierProvidergetAssociatedCertificate in interface ContentVerifierProviderpublic ContentVerifier get(org.bouncycastle.asn1.x509.AlgorithmIdentifier verifierAlgorithmIdentifier)
ContentVerifierProviderget in interface ContentVerifierProviderverifierAlgorithmIdentifier - the algorithm and parameters required.