Class SigningCertificateVerifier
java.lang.Object
org.bouncycastle.cms.SigningCertificateVerifier
Checks of the ESS signing-certificate attributes (RFC 2634 sec. 5.4, RFC 5035 sec. 3), which bind the certificate
a signature is verified with into the signed attributes. CAdES requires one of them (RFC 5126 sec. 5.7.3); plain
CMS does not.
A signature value on its own does not commit to the key that verifies it, so anything covering only the value, such
as a CAdES signature time-stamp or a CMS countersignature, covers the signer's certificate and the content only
when the signed attributes carry the certificate's hash and that hash is checked against the certificate the
signature verified under. verifySigningCertificate(SignerInformation, X509CertificateHolder, DigestCalculatorProvider) is that check.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bouncycastle.asn1.ess.ESSCertIDv2[]Return the certificate identifiers the signer's signed attributes carry: the first ESSCertID of a signing-certificate attribute, as an ESSCertIDv2 naming SHA-1, and the first ESSCertIDv2 of a signing-certificate-v2 attribute.static voidverifySigningCertificate(SignerInformation signer, X509CertificateHolder cert, DigestCalculatorProvider digCalcProv) Check that the signer's signed attributes identify the given certificate: a signing-certificate or signing-certificate-v2 attribute must be present, each identifier's hash must be the digest of the certificate's encoding under the algorithm it names, and an issuerSerial, when present, must match the certificate's issuer and serial number.
-
Method Details
-
getSigningCertificateIDs
public static org.bouncycastle.asn1.ess.ESSCertIDv2[] getSigningCertificateIDs(SignerInformation signer) throws CMSException Return the certificate identifiers the signer's signed attributes carry: the first ESSCertID of a signing-certificate attribute, as an ESSCertIDv2 naming SHA-1, and the first ESSCertIDv2 of a signing-certificate-v2 attribute. Both may be present, and RFC 5035 has them evaluated independently.- Parameters:
signer- the signer to inspect.- Returns:
- the identifiers found, empty when the signer carries neither attribute.
- Throws:
CMSException- if an attribute is present but malformed or empty, or appears only among the unsigned attributes, where RFC 5035 sec. 3 forbids it.
-
verifySigningCertificate
public static void verifySigningCertificate(SignerInformation signer, X509CertificateHolder cert, DigestCalculatorProvider digCalcProv) throws CMSException Check that the signer's signed attributes identify the given certificate: a signing-certificate or signing-certificate-v2 attribute must be present, each identifier's hash must be the digest of the certificate's encoding under the algorithm it names, and an issuerSerial, when present, must match the certificate's issuer and serial number. The certificate should be the one the signature was verified with.- Parameters:
signer- the signer to check.cert- the certificate the signature verifies under.digCalcProv- source of digest calculators for the certificate hash.- Throws:
CMSException- if the attribute is absent, malformed or in the wrong place, names a digest that is not acceptable or cannot be calculated, or does not identify the certificate.
-