Class CertificateValidator


  • public final class CertificateValidator
    extends Object
    A collection of static methods that validate signing certificates (public keys) and verify signature correctness.
    • Method Detail

      • validateCertificate

        public static boolean validateCertificate​(org.bouncycastle.openpgp.PGPSignature signature,
                                                  org.bouncycastle.openpgp.PGPPublicKeyRing signingKeyRing,
                                                  Policy policy)
                                           throws SignatureValidationException
        Check if the signing key was eligible to create the provided signature. That entails: - Check, if the primary key is being revoked via key-revocation signatures. - Check, if the keys user-ids are revoked or not bound. - Check, if the signing subkey is revoked or expired. - Check, if the signing key is not capable of signing
        Parameters:
        signature - signature
        signingKeyRing - signing key ring
        policy - validation policy
        Returns:
        true if the signing key was eligible to create the signature
        Throws:
        SignatureValidationException - in case of a validation constraint violation
      • validateCertificateAndVerifyUninitializedSignature

        public static boolean validateCertificateAndVerifyUninitializedSignature​(org.bouncycastle.openpgp.PGPSignature signature,
                                                                                 InputStream signedData,
                                                                                 org.bouncycastle.openpgp.PGPPublicKeyRing signingKeyRing,
                                                                                 Policy policy,
                                                                                 Date validationDate)
                                                                          throws SignatureValidationException
        Validate the given signing key and then verify the given signature while parsing out the signed data. Uninitialized means that no signed data has been read and the hash generators state has not yet been updated.
        Parameters:
        signature - uninitialized signature
        signedData - input stream containing signed data
        signingKeyRing - key ring containing signing key
        policy - validation policy
        validationDate - date of validation
        Returns:
        true if the signature is valid, false otherwise
        Throws:
        SignatureValidationException - for validation constraint violations
      • validateCertificateAndVerifyInitializedSignature

        public static boolean validateCertificateAndVerifyInitializedSignature​(org.bouncycastle.openpgp.PGPSignature signature,
                                                                               org.bouncycastle.openpgp.PGPPublicKeyRing verificationKeys,
                                                                               Policy policy)
                                                                        throws SignatureValidationException
        Validate the signing key and the given initialized signature. Initialized means that the signatures hash generator has already been updated by reading the signed data completely.
        Parameters:
        signature - initialized signature
        verificationKeys - key ring containing the verification key
        policy - validation policy
        Returns:
        true if the signature is valid, false otherwise
        Throws:
        SignatureValidationException - in case of a validation constraint violation