public void testSHA1WithRSAEncapsulatedParser() throws Exception { MimeBodyPart res = generateEncapsulatedRsa("SHA1withRSA", msg); SMIMESignedParser s = new SMIMESignedParser( new JcaDigestCalculatorProviderBuilder().setProvider(BC).build(), res); FileBackedMimeBodyPart content = (FileBackedMimeBodyPart) s.getContent(); verifyMessageBytes(msg, content); content.dispose(); verifySigners(s.getCertificates(), s.getSignerInfos()); s.close(); }
public void testSHA1WithRSAEncapsulatedParserAndFile() throws Exception { File tmp = File.createTempFile("bcTest", ".mime"); MimeBodyPart res = generateEncapsulatedRsa("SHA1withRSA", msg); SMIMESignedParser s = new SMIMESignedParser( new JcaDigestCalculatorProviderBuilder().setProvider(BC).build(), res, tmp); FileBackedMimeBodyPart content = (FileBackedMimeBodyPart) s.getContent(); verifyMessageBytes(msg, s.getContent()); verifySigners(s.getCertificates(), s.getSignerInfos()); assertTrue(tmp.exists()); s.close(); content.dispose(); assertFalse(tmp.exists()); }