diff --git a/mail/src/test/java/org/bouncycastle/mail/smime/test/SMIMEToolkitTest.java b/mail/src/test/java/org/bouncycastle/mail/smime/test/SMIMEToolkitTest.java index 4d6c013104..54cb4b9c8a 100644 --- a/mail/src/test/java/org/bouncycastle/mail/smime/test/SMIMEToolkitTest.java +++ b/mail/src/test/java/org/bouncycastle/mail/smime/test/SMIMEToolkitTest.java @@ -44,6 +44,7 @@ import org.bouncycastle.mail.smime.SMIMESigned; import org.bouncycastle.mail.smime.SMIMESignedGenerator; import org.bouncycastle.mail.smime.SMIMEToolkit; +import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; import org.bouncycastle.openssl.jcajce.JcaPKIXIdentityBuilder; import org.bouncycastle.operator.OperatorCreationException; import org.bouncycastle.operator.bc.BcDigestCalculatorProvider; @@ -261,12 +262,14 @@ public void testSignedMessageVerificationEncapsulatedWithPKIXIdentity() MimeBodyPart res = gen.generateEncapsulated(msg); - Assert.assertTrue(toolkit.isValidSignature(res, new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(identity.getCertificate()))); + // TODO: certificate has expired + JcaPEMKeyConverter keyConverter = new JcaPEMKeyConverter(); + Assert.assertTrue(toolkit.isValidSignature(res, new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(keyConverter.getPublicKey(identity.getCertificate().getSubjectPublicKeyInfo())))); MimeMessage body = makeMimeMessage(res); - Assert.assertTrue(toolkit.isValidSignature(body, new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(identity.getCertificate()))); - Assert.assertTrue(toolkit.isValidSignature(body, new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(identity.getX509Certificate()))); + Assert.assertTrue(toolkit.isValidSignature(body, new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(keyConverter.getPublicKey(identity.getCertificate().getSubjectPublicKeyInfo())))); + Assert.assertTrue(toolkit.isValidSignature(body, new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(identity.getX509Certificate().getPublicKey()))); } public void testEncryptedMimeBodyPart()