code: public static boolean verify(SignerInformation signer,
          CertifiedPublicKey certKey, BcContentVerifierProviderBuilder contentVerifierProviderBuilder,
          DigestFactory digestProvider) throws CMSException
      {
          if (certKey == null) {
              throw new CMSException("No certified key for proceeding to signature validation.");
          }
  
          return signer.verify(
              new SignerInformationVerifier(
                  new DefaultCMSSignatureAlgorithmNameGenerator(),
                  new DefaultSignatureAlgorithmIdentifierFinder(),
                  contentVerifierProviderBuilder.build(certKey),
                  (DigestCalculatorProvider) digestProvider));
      }
docs: Verify a CMS signature.
  
  @param signer the signer to verify.
  @param certKey the certified public key of the signer.
  @param contentVerifierProviderBuilder a builder of content provider.
  @param digestProvider a digest provider.
  @return true if the signature is verified and the certificate was valid at the time of signature.
  @throws CMSException if the verifier is unable to create appropriate ContentVerifiers or DigestCalculators.