public ContentInfo verify(ContentInfo signedMessage, Date date) {
        final SignedData signedData = SignedData.getInstance(signedMessage.getContent());
        final X509Certificate cert = certificate(signedData);
        certificateVerifier.verify(cert, date);

        final X500Name name = X500Name.getInstance(cert.getIssuerX500Principal().getEncoded());
        try {
            final CMSSignedData cms = new CMSSignedData(signedMessage);
            cms.verifySignatures(signerId -> {
                if (!name.equals(signerId.getIssuer())) {
                    throw new VerificationException("Issuer does not match certificate");
                }
                if (!cert.getSerialNumber().equals(signerId.getSerialNumber())) {
                    throw new VerificationException("Serial number does not match certificate");
                }
                return new JcaSignerInfoVerifierBuilder(digestProvider).setProvider(bcProvider).build(cert);
            });
        } catch (CMSException e) {
            throw new VerificationException("Could not verify CMS", e);
        }
        return signedData.getEncapContentInfo();
    }
@Test
    public void shouldThrowExceptionIfSignatureIsIncorrect() throws Exception {
        final byte[] data = fixture();
        data[2183]++;
        final ContentInfo signedMessage = ContentInfo.getInstance(data);

        thrown.expect(VerificationException.class);
        thrown.expectMessage("Could not verify CMS");
        new CmsVerifier(new CertificateVerifier.None()).verify(signedMessage);
    }