diff --git a/jaxrs/jboss-modules/build-wf8.xml b/jaxrs/jboss-modules/build-wf8.xml
index 58314be..70b4b98 100755
--- a/jaxrs/jboss-modules/build-wf8.xml
+++ b/jaxrs/jboss-modules/build-wf8.xml
@@ -53,8 +53,11 @@
-->
-
-
+
+
+
+
diff --git a/jaxrs/jboss-modules/build.xml b/jaxrs/jboss-modules/build.xml
index 810a002..eea8358 100755
--- a/jaxrs/jboss-modules/build.xml
+++ b/jaxrs/jboss-modules/build.xml
@@ -53,8 +53,11 @@
-->
-
-
+
+
+
+
diff --git a/jaxrs/jboss-modules/pom.xml b/jaxrs/jboss-modules/pom.xml
index 37f9fb6..752ec3e 100755
--- a/jaxrs/jboss-modules/pom.xml
+++ b/jaxrs/jboss-modules/pom.xml
@@ -40,7 +40,11 @@
org.bouncycastle
- bcprov-jdk16
+ bcprov-jdk15on
+
+
+ org.bouncycastle
+ bcmail-jdk15on
org.codehaus.jackson
@@ -87,10 +91,6 @@
jackson-module-jaxb-annotations
- org.bouncycastle
- bcmail-jdk16
-
-
org.jboss.resteasy
jaxrs-api
${project.version}
diff --git a/jaxrs/jboss-modules/src/main/resources/modules/org/bouncycastle/main/module.xml b/jaxrs/jboss-modules/src/main/resources/modules/org/bouncycastle/main/module.xml
index d0ec17b..8f5b63e 100644
--- a/jaxrs/jboss-modules/src/main/resources/modules/org/bouncycastle/main/module.xml
+++ b/jaxrs/jboss-modules/src/main/resources/modules/org/bouncycastle/main/module.xml
@@ -21,13 +21,18 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-
+
+
+
+
+
+
diff --git a/jaxrs/jboss-modules/src/main/resources/modules/org/jboss/resteasy/resteasy-crypto/main/module.xml b/jaxrs/jboss-modules/src/main/resources/modules/org/jboss/resteasy/resteasy-crypto/main/module.xml
index 87d8c8e..46c0996 100644
--- a/jaxrs/jboss-modules/src/main/resources/modules/org/jboss/resteasy/resteasy-crypto/main/module.xml
+++ b/jaxrs/jboss-modules/src/main/resources/modules/org/jboss/resteasy/resteasy-crypto/main/module.xml
@@ -35,5 +35,6 @@
+
diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml
index e124ce6..f05421e 100755
--- a/jaxrs/pom.xml
+++ b/jaxrs/pom.xml
@@ -18,6 +18,7 @@
2.1
5.1.0.Final
1.0.1.Final
+ 1.1.1
3.0.6.RELEASE
1.8
1.1
@@ -26,6 +27,8 @@
3.6.4.Final
4.0.7.Final
1.7.5
+ 1.52
+ 1.5.3
1.0.0.Final
1.0.0.Final
1.0.0.Final
@@ -168,7 +171,11 @@
jaxb-impl
${dep.jaxb-impl.version}
-
+
+ com.sun.mail
+ javax.mail
+ ${dep.com.sun.mail.version}
+
com.sun.xml.stream
sjsxp
@@ -223,7 +230,7 @@
javax.activation
activation
- 1.1
+ ${dep.javax.activation.version}
@@ -352,13 +359,18 @@
org.bouncycastle
- bcprov-jdk16
- 1.46
+ bcprov-jdk15on
+ ${dep.bc.version}
+
+
+ org.bouncycastle
+ bcmail-jdk15on
+ ${dep.bc.version}
org.bouncycastle
- bcmail-jdk16
- 1.46
+ bcpkix-jdk15on
+ ${dep.bc.version}
net.oauth.core
diff --git a/jaxrs/security/jose-jwt/pom.xml b/jaxrs/security/jose-jwt/pom.xml
index 0f3b035..81e777f 100755
--- a/jaxrs/security/jose-jwt/pom.xml
+++ b/jaxrs/security/jose-jwt/pom.xml
@@ -33,7 +33,7 @@
org.bouncycastle
- bcprov-jdk16
+ bcprov-jdk15on
org.jboss.resteasy
diff --git a/jaxrs/security/keystone/keystone-as7-modules/lib.xml b/jaxrs/security/keystone/keystone-as7-modules/lib.xml
index d25fdc5..3108fe8 100644
--- a/jaxrs/security/keystone/keystone-as7-modules/lib.xml
+++ b/jaxrs/security/keystone/keystone-as7-modules/lib.xml
@@ -70,7 +70,7 @@
diff --git a/jaxrs/security/keystone/keystone-core/pom.xml b/jaxrs/security/keystone/keystone-core/pom.xml
index afc95f0..dfd95b8 100755
--- a/jaxrs/security/keystone/keystone-core/pom.xml
+++ b/jaxrs/security/keystone/keystone-core/pom.xml
@@ -80,6 +80,14 @@
${project.version}
test
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
+ org.bouncycastle
+ bcmail-jdk15on
+
diff --git a/jaxrs/security/keystone/keystone-core/src/test/java/org/jboss/resteasy/test/keystone/TokenTest.java b/jaxrs/security/keystone/keystone-core/src/test/java/org/jboss/resteasy/test/keystone/TokenTest.java
index 8d1f2e6..146353d 100755
--- a/jaxrs/security/keystone/keystone-core/src/test/java/org/jboss/resteasy/test/keystone/TokenTest.java
+++ b/jaxrs/security/keystone/keystone-core/src/test/java/org/jboss/resteasy/test/keystone/TokenTest.java
@@ -1,13 +1,16 @@
package org.jboss.resteasy.test.keystone;
import junit.framework.Assert;
-import org.bouncycastle.cms.CMSException;
-import org.bouncycastle.cms.CMSProcessable;
-import org.bouncycastle.cms.CMSProcessableByteArray;
-import org.bouncycastle.cms.CMSSignedData;
-import org.bouncycastle.cms.CMSSignedDataGenerator;
-import org.bouncycastle.cms.SignerInformation;
+import org.bouncycastle.cert.jcajce.JcaCertStore;
+import org.bouncycastle.cms.*;
+import org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder;
+import org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoVerifierBuilder;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.operator.ContentSigner;
+import org.bouncycastle.operator.OperatorCreationException;
+import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
+import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder;
+import org.bouncycastle.util.Store;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.keystone.client.SkeletonKeyAdminClient;
@@ -49,10 +52,9 @@ import java.security.PrivateKey;
import java.security.Security;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
+import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import static org.jboss.resteasy.test.TestPortProvider.generateBaseUrl;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
@@ -267,21 +269,26 @@ public class TokenTest
System.out.println("Base64.size: " + Base64.encodeBytes(signed).length());
SignerInformation signer = (SignerInformation)data.getSignerInfos().getSigners().iterator().next();
- System.out.println("valid: " + signer.verify(cert, "BC"));
+ System.out.println("valid: " + signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(cert.getPublicKey())));
client.close();
}
- private static byte[] p7s(PrivateKey priv, X509Certificate storecert, CertStore certs, byte[] contentbytes) throws CertStoreException, CMSException, NoSuchAlgorithmException, NoSuchProviderException, IOException
- {
+ private static byte[] p7s(PrivateKey priv, X509Certificate storecert, CertStore certs, byte[] contentbytes) throws CertStoreException, CMSException, NoSuchAlgorithmException, NoSuchProviderException, IOException, OperatorCreationException, CertificateEncodingException {
CMSSignedDataGenerator signGen = new CMSSignedDataGenerator();
- signGen.addSigner(priv, (X509Certificate)storecert, CMSSignedDataGenerator.DIGEST_SHA512);
- //signGen.addCertificatesAndCRLs(certs);
- CMSProcessable content = new CMSProcessableByteArray(contentbytes);
+ ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(priv);
+
+ signGen.addSignerInfoGenerator(
+ new JcaSignerInfoGeneratorBuilder(
+ new JcaDigestCalculatorProviderBuilder().setProvider("BC").build())
+ .build(sha1Signer, storecert));
+
+ CMSTypedData content = new CMSProcessableByteArray(contentbytes);
+
+ CMSSignedData signedData = signGen.generate(content, true);
- CMSSignedData signedData = signGen.generate(content, true, "BC");
return signedData.getEncoded();
}
diff --git a/jaxrs/security/resteasy-crypto/pom.xml b/jaxrs/security/resteasy-crypto/pom.xml
index d9a23cb..598c7b1 100755
--- a/jaxrs/security/resteasy-crypto/pom.xml
+++ b/jaxrs/security/resteasy-crypto/pom.xml
@@ -52,15 +52,15 @@
org.bouncycastle
- bcprov-jdk16
+ bcprov-jdk15on
org.bouncycastle
- bcmail-jdk16
+ bcmail-jdk15on
- javax.mail
- mail
+ com.sun.mail
+ javax.mail
org.apache.james
diff --git a/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/EnvelopedInputImpl.java b/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/EnvelopedInputImpl.java
index a2bf663..0bc140e 100644
--- a/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/EnvelopedInputImpl.java
+++ b/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/EnvelopedInputImpl.java
@@ -2,6 +2,8 @@ package org.jboss.resteasy.security.smime;
import org.bouncycastle.cms.RecipientInformation;
import org.bouncycastle.cms.RecipientInformationStore;
+import org.bouncycastle.cms.jcajce.JceKeyTransEnvelopedRecipient;
+import org.bouncycastle.cms.jcajce.JceKeyTransRecipient;
import org.bouncycastle.cms.jcajce.JceKeyTransRecipientId;
import org.bouncycastle.mail.smime.SMIMEEnveloped;
import org.bouncycastle.mail.smime.SMIMEUtil;
@@ -158,8 +160,9 @@ public class EnvelopedInputImpl implements EnvelopedInput
RecipientInformationStore recipients = m.getRecipientInfos();
RecipientInformation recipient = recipients.get(recId);
+ JceKeyTransRecipient pKeyRecp = new JceKeyTransEnvelopedRecipient(pKey);
- decrypted = SMIMEUtil.toMimeBodyPart(recipient.getContent(pKey, "BC"));
+ decrypted = SMIMEUtil.toMimeBodyPart(recipient.getContent(pKeyRecp));
}
catch (Exception e1)
{
diff --git a/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/MultipartSignedInputImpl.java b/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/MultipartSignedInputImpl.java
index 18a214a..1ce2c63 100644
--- a/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/MultipartSignedInputImpl.java
+++ b/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/MultipartSignedInputImpl.java
@@ -2,6 +2,7 @@ package org.jboss.resteasy.security.smime;
import org.bouncycastle.cms.SignerInformation;
import org.bouncycastle.cms.SignerInformationStore;
+import org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoVerifierBuilder;
import org.bouncycastle.mail.smime.SMIMESigned;
import org.jboss.resteasy.util.GenericType;
@@ -157,7 +158,7 @@ public class MultipartSignedInputImpl implements SignedInput
SignerInformationStore signers = signed.getSignerInfos();
SignerInformation signer = (SignerInformation) signers.getSigners().iterator().next();
- return signer.verify(publicKey, "BC");
+ return (signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(publicKey)));
}
diff --git a/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/PKCS7SignatureInput.java b/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/PKCS7SignatureInput.java
index 06b81ed..a25c892 100644
--- a/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/PKCS7SignatureInput.java
+++ b/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/PKCS7SignatureInput.java
@@ -3,6 +3,8 @@ package org.jboss.resteasy.security.smime;
import org.bouncycastle.cms.CMSException;
import org.bouncycastle.cms.CMSSignedData;
import org.bouncycastle.cms.SignerInformation;
+import org.bouncycastle.cms.SignerInformationVerifier;
+import org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoVerifierBuilder;
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import org.jboss.resteasy.util.Base64;
import org.jboss.resteasy.util.GenericType;
@@ -206,7 +208,9 @@ public class PKCS7SignatureInput
for (Object info : data.getSignerInfos().getSigners())
{
SignerInformation signer = (SignerInformation)info;
- if (signer.verify(certificate, "BC"))
+
+
+ if (signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(certificate)))
{
return true;
}
@@ -218,7 +222,7 @@ public class PKCS7SignatureInput
for (Object info : data.getSignerInfos().getSigners())
{
SignerInformation signer = (SignerInformation)info;
- if (signer.verify(publicKey, "BC"))
+ if (signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(publicKey)))
{
return true;
}
diff --git a/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/PKCS7SignatureWriter.java b/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/PKCS7SignatureWriter.java
index 4571a06..ffc1c0f 100644
--- a/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/PKCS7SignatureWriter.java
+++ b/jaxrs/security/resteasy-crypto/src/main/java/org/jboss/resteasy/security/smime/PKCS7SignatureWriter.java
@@ -1,10 +1,13 @@
package org.jboss.resteasy.security.smime;
-import org.bouncycastle.cms.CMSException;
-import org.bouncycastle.cms.CMSProcessable;
-import org.bouncycastle.cms.CMSProcessableByteArray;
-import org.bouncycastle.cms.CMSSignedData;
-import org.bouncycastle.cms.CMSSignedDataGenerator;
+import org.bouncycastle.cert.jcajce.JcaCertStore;
+import org.bouncycastle.cms.*;
+import org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder;
+import org.bouncycastle.operator.ContentSigner;
+import org.bouncycastle.operator.OperatorCreationException;
+import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
+import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder;
+import org.bouncycastle.util.Store;
import org.jboss.resteasy.security.BouncyIntegration;
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import org.jboss.resteasy.spi.WriterException;
@@ -24,6 +27,7 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
+import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
/**
@@ -70,8 +74,7 @@ public class PKCS7SignatureWriter implements MessageBodyWriter
}
}
- public static byte[] sign(Providers providers, SignedOutput out) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, CMSException
- {
+ public static byte[] sign(Providers providers, SignedOutput out) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, CMSException, OperatorCreationException, CertificateEncodingException {
ByteArrayOutputStream bodyOs = new ByteArrayOutputStream();
MessageBodyWriter writer = providers.getMessageBodyWriter(out.getType(), out.getGenericType(), null, out.getMediaType());
if (writer == null)
@@ -82,11 +85,19 @@ public class PKCS7SignatureWriter implements MessageBodyWriter
bodyHeaders.add("Content-Type", out.getMediaType().toString());
writer.writeTo(out.getEntity(), out.getType(), out.getGenericType(), null, out.getMediaType(), bodyHeaders, bodyOs);
CMSSignedDataGenerator signGen = new CMSSignedDataGenerator();
- signGen.addSigner(out.getPrivateKey(), (X509Certificate)out.getCertificate(), CMSSignedDataGenerator.DIGEST_SHA1);
- //signGen.addCertificatesAndCRLs(certs);
- CMSProcessable content = new CMSProcessableByteArray(bodyOs.toByteArray());
- CMSSignedData signedData = signGen.generate(content, true, "BC");
+
+ ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(out.getPrivateKey());
+
+ signGen.addSignerInfoGenerator(
+ new JcaSignerInfoGeneratorBuilder(
+ new JcaDigestCalculatorProviderBuilder().setProvider("BC").build())
+ .build(sha1Signer, out.getCertificate()));
+
+ CMSTypedData content = new CMSProcessableByteArray(bodyOs.toByteArray());
+
+ CMSSignedData signedData = signGen.generate(content, true);
+
return signedData.getEncoded();
}
}
diff --git a/jaxrs/security/resteasy-crypto/src/test/java/org/jboss/resteasy/test/security/smime/EnvelopedTest.java b/jaxrs/security/resteasy-crypto/src/test/java/org/jboss/resteasy/test/security/smime/EnvelopedTest.java
index a4d711d..b3fe3c9 100644
--- a/jaxrs/security/resteasy-crypto/src/test/java/org/jboss/resteasy/test/security/smime/EnvelopedTest.java
+++ b/jaxrs/security/resteasy-crypto/src/test/java/org/jboss/resteasy/test/security/smime/EnvelopedTest.java
@@ -6,9 +6,7 @@ import org.bouncycastle.cms.CMSException;
import org.bouncycastle.cms.RecipientId;
import org.bouncycastle.cms.RecipientInformation;
import org.bouncycastle.cms.RecipientInformationStore;
-import org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder;
-import org.bouncycastle.cms.jcajce.JceKeyTransRecipientId;
-import org.bouncycastle.cms.jcajce.JceKeyTransRecipientInfoGenerator;
+import org.bouncycastle.cms.jcajce.*;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.mail.smime.SMIMEEnveloped;
import org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator;
@@ -129,7 +127,8 @@ public class EnvelopedTest
OutputEncryptor encryptor = new JceCMSContentEncryptorBuilder(CMSAlgorithm.DES_EDE3_CBC)
.setProvider("BC")
.build();
- gen.addKeyTransRecipient(cert);
+
+ gen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(cert).setProvider("BC"));
//
// generate a MimeBodyPart object which encapsulates the content
@@ -218,8 +217,9 @@ public class EnvelopedTest
RecipientInformationStore recipients = m.getRecipientInfos();
RecipientInformation recipient = recipients.get(recId);
+ JceKeyTransRecipient pKeyRecp = new JceKeyTransEnvelopedRecipient(privateKey);
- return SMIMEUtil.toMimeBodyPart(recipient.getContent(privateKey, "BC"));
+ return SMIMEUtil.toMimeBodyPart(recipient.getContent(pKeyRecp));
}
diff --git a/jaxrs/security/resteasy-crypto/src/test/java/org/jboss/resteasy/test/security/smime/SignedTest.java b/jaxrs/security/resteasy-crypto/src/test/java/org/jboss/resteasy/test/security/smime/SignedTest.java
index 63f84e7..f8ee26e 100644
--- a/jaxrs/security/resteasy-crypto/src/test/java/org/jboss/resteasy/test/security/smime/SignedTest.java
+++ b/jaxrs/security/resteasy-crypto/src/test/java/org/jboss/resteasy/test/security/smime/SignedTest.java
@@ -4,6 +4,7 @@ import org.bouncycastle.cms.SignerInfoGenerator;
import org.bouncycastle.cms.SignerInformation;
import org.bouncycastle.cms.SignerInformationStore;
import org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder;
+import org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoVerifierBuilder;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.mail.smime.SMIMESigned;
import org.bouncycastle.mail.smime.SMIMESignedGenerator;
@@ -135,7 +136,7 @@ public class SignedTest
SignerInformationStore signers = signed.getSignerInfos();
Assert.assertEquals(1, signers.size());
SignerInformation signer = (SignerInformation) signers.getSigners().iterator().next();
- Assert.assertTrue(signer.verify(cert.getPublicKey(), "BC"));
+ Assert.assertTrue(signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(cert.getPublicKey())));
}
@Test
diff --git a/jaxrs/security/skeleton-key-idm/skeleton-key-core/pom.xml b/jaxrs/security/skeleton-key-idm/skeleton-key-core/pom.xml
index 83242d7..5b1ec94 100755
--- a/jaxrs/security/skeleton-key-idm/skeleton-key-core/pom.xml
+++ b/jaxrs/security/skeleton-key-idm/skeleton-key-core/pom.xml
@@ -46,6 +46,19 @@
junit
test
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
+ org.bouncycastle
+ bcmail-jdk15on
+
+
+ org.jboss.resteasy
+ resteasy-jackson-provider
+ ${project.version}
+