byte[] contentDigest = (byte[])gen.getGeneratedDigests().get(SMIMESignedGenerator.DIGEST_SHA1);  AttributeTable table = ((SignerInformation)s.getSignerInfos().getSigners().iterator().next()).getSignedAttributes(); Attribute hash = table.get(CMSAttributes.messageDigest);  assertTrue(MessageDigest.isEqual(contentDigest, ((ASN1OctetString)hash.getAttrValues().getObjectAt(0)).getOctets()));
    public void testMimeMultipart()        throws Exception    {        MimeBodyPart m = createMultipartMessage();        List certList = new ArrayList();        certList.add(_signCert);        certList.add(_origCert);        CertStore certs = CertStore.getInstance("Collection",                        new CollectionCertStoreParameters(certList), "BC");        ASN1EncodableVector signedAttrs = generateSignedAttributes();        SMIMESignedGenerator gen = new SMIMESignedGenerator("binary");        gen.addSigner(_signKP.getPrivate(), _signCert, SMIMESignedGenerator.DIGEST_SHA1, new AttributeTable(signedAttrs), null);        gen.addCertificatesAndCRLs(certs);        MimeMultipart mm = gen.generate(m, "BC");        SMIMESigned s = new SMIMESigned(mm);        verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());    }