Skip to content

Commit 1bc26db

Browse files
committed
get ssl working
1 parent 827a5c3 commit 1bc26db

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@
157157
<artifactId>bcprov-jdk18on</artifactId>
158158
<version>${bouncycastle.version}</version>
159159
</dependency>
160+
<dependency>
161+
<groupId>org.bouncycastle</groupId>
162+
<artifactId>bctls-jdk18on</artifactId>
163+
<version>${bouncycastle.version}</version>
164+
</dependency>
160165
<!--
161166
Pin Byte Buddy for test-time Mockito instrumentation on newer JVMs (e.g. Java 21).
162167
This does NOT add a runtime dependency; it only manages the version used by modules.

sdk/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@
171171
<artifactId>bcprov-jdk18on</artifactId>
172172
<scope>test</scope>
173173
</dependency>
174+
<dependency>
175+
<groupId>org.bouncycastle</groupId>
176+
<artifactId>bctls-jdk18on</artifactId>
177+
<scope>test</scope>
178+
</dependency>
174179
<!-- Testing Dependencies -->
175180
<dependency>
176181
<groupId>org.junit.jupiter</groupId>
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.opentdf.platform.sdk;
22

33
import org.bouncycastle.jce.provider.BouncyCastleProvider;
4+
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider;
45
import org.junit.jupiter.api.extension.BeforeAllCallback;
56
import org.junit.jupiter.api.extension.ExtensionContext;
67

@@ -14,13 +15,8 @@ public class CryptoProviderSetupExtension implements BeforeAllCallback {
1415
@Override
1516
public synchronized void beforeAll(ExtensionContext extensionContext) {
1617
if (this.securityProvider == null) {
17-
var existingProviders = Security.getProviders();
18-
Arrays.asList(existingProviders).stream().map(Provider::getName).forEach(Security::removeProvider);
19-
if (Security.getProviders().length != 0) {
20-
throw new IllegalStateException("unable to remove all providers");
21-
}
22-
23-
Security.addProvider(this.securityProvider = new BouncyCastleProvider());
18+
Security.insertProviderAt(this.securityProvider = new BouncyCastleProvider(), 1);
19+
Security.insertProviderAt(new BouncyCastleJsseProvider(), 2);
2420
}
2521
}
2622
}

sdk/src/test/java/io/opentdf/platform/sdk/SDKBuilderTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ void sdkServicesSetup(boolean useSSLPlatform, boolean useSSLIDP) throws Exceptio
161161

162162
HeldCertificate rootCertificate = new HeldCertificate.Builder()
163163
.certificateAuthority(0)
164+
.rsa2048()
164165
.build();
165166
String localhost = InetAddress.getByName("localhost").getCanonicalHostName();
166167
HeldCertificate serverCertificate = new HeldCertificate.Builder()
167168
.addSubjectAlternativeName(localhost)
168-
.commonName("CN=localhost")
169+
.rsa2048()
170+
.commonName("localhost")
169171
.signedBy(rootCertificate)
170172
.build();
171173

0 commit comments

Comments
 (0)