Skip to content

Commit b62028d

Browse files
author
gm2552
committed
Adding fix for HSM decryption bug in BouncyCastle library.
1 parent 92af08a commit b62028d

10 files changed

Lines changed: 1123 additions & 6 deletions

pom.xml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<artifactId>agent</artifactId>
66
<name>Direct Project Security And Trust Agent</name>
7-
<version>6.1-SNAPSHOT</version>
7+
<version>6.0.1-SNAPSHOT</version>
88
<description>Direct Project Security And Trust Agent</description>
99
<inceptionYear>2010</inceptionYear>
1010
<url>https://github.com/DirectProjectJavaRI/agent</url>
@@ -55,11 +55,23 @@
5555
<groupId>org.nhind</groupId>
5656
<artifactId>direct-policy</artifactId>
5757
<version>6.0</version>
58+
<exclusions>
59+
<exclusion>
60+
<groupId>org.bouncycastle</groupId>
61+
<artifactId>bcprov-jdk15on</artifactId>
62+
</exclusion>
63+
</exclusions>
5864
</dependency>
5965
<dependency>
6066
<groupId>org.nhind</groupId>
6167
<artifactId>direct-common</artifactId>
62-
<version>6.0</version>
68+
<version>6.0</version>
69+
<exclusions>
70+
<exclusion>
71+
<groupId>org.bouncycastle</groupId>
72+
<artifactId>bcprov-jdk15on</artifactId>
73+
</exclusion>
74+
</exclusions>
6375
</dependency>
6476
<dependency>
6577
<groupId>org.nhind</groupId>
@@ -99,18 +111,30 @@
99111
</dependency>
100112
<dependency>
101113
<groupId>org.bouncycastle</groupId>
102-
<artifactId>bcprov-jdk15on</artifactId>
114+
<artifactId>bcprov-debug-jdk15on</artifactId>
103115
<version>1.60</version>
104116
</dependency>
105117
<dependency>
106118
<groupId>org.bouncycastle</groupId>
107119
<artifactId>bcmail-jdk15on</artifactId>
108-
<version>1.60</version>
120+
<version>1.60</version>
121+
<exclusions>
122+
<exclusion>
123+
<groupId>org.bouncycastle</groupId>
124+
<artifactId>bcprov-jdk15on</artifactId>
125+
</exclusion>
126+
</exclusions>
109127
</dependency>
110128
<dependency>
111129
<groupId>org.bouncycastle</groupId>
112130
<artifactId>bcpkix-jdk15on</artifactId>
113-
<version>1.60</version>
131+
<version>1.60</version>
132+
<exclusions>
133+
<exclusion>
134+
<groupId>org.bouncycastle</groupId>
135+
<artifactId>bcprov-jdk15on</artifactId>
136+
</exclusion>
137+
</exclusions>
114138
</dependency>
115139
<dependency>
116140
<groupId>dnsjava</groupId>

src/main/java/org/nhindirect/stagent/cryptography/SMIMECryptographerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
7878
import org.nhindirect.stagent.NHINDException;
7979
import org.nhindirect.stagent.SignatureValidationException;
8080
import org.nhindirect.stagent.cert.X509CertificateEx;
81+
import org.nhindirect.stagent.cryptography.bc.DirectJceKeyTransEnvelopedRecipient;
8182
import org.nhindirect.stagent.mail.Message;
8283
import org.nhindirect.stagent.mail.MimeEntity;
8384
import org.nhindirect.stagent.mail.MimeError;
@@ -497,7 +498,7 @@ public MimeEntity decrypt(MimeEntity encryptedEntity, Collection<X509Certificate
497498
if (recipient == null)
498499
continue;
499500

500-
final JceKeyTransEnvelopedRecipient recip = new JceKeyTransEnvelopedRecipient(decryptCert.getPrivateKey());
501+
final JceKeyTransEnvelopedRecipient recip = new DirectJceKeyTransEnvelopedRecipient(decryptCert.getPrivateKey());
501502
recip.setProvider(CryptoExtensions.getJCESensitiveProviderName());
502503
recip.setContentProvider(CryptoExtensions.getJCEProviderName());
503504

0 commit comments

Comments
 (0)