Skip to content

Commit bdbdfdb

Browse files
author
duke
committed
Backport 06dd73534271874eff008b8d3027f4ce49b136b3
1 parent d0949c8 commit bdbdfdb

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

test/micro/org/openjdk/bench/java/security/SSLHandshake.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -80,11 +80,12 @@ public void init() throws Exception {
8080
KeyStore ks = TestCertificates.getKeyStore();
8181
KeyStore ts = TestCertificates.getTrustStore();
8282

83-
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
83+
KeyManagerFactory kmf = KeyManagerFactory.getInstance(
84+
KeyManagerFactory.getDefaultAlgorithm());
8485
kmf.init(ks, new char[0]);
8586

86-
TrustManagerFactory tmf =
87-
TrustManagerFactory.getInstance("SunX509");
87+
TrustManagerFactory tmf = TrustManagerFactory.getInstance(
88+
TrustManagerFactory.getDefaultAlgorithm());
8889
tmf.init(ts);
8990

9091
SSLContext sslCtx = SSLContext.getInstance(tlsVersion);

test/micro/org/openjdk/bench/java/security/TestCertificates.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -115,12 +115,12 @@ class TestCertificates {
115115
private TestCertificates() {}
116116

117117
public static KeyStore getKeyStore() throws GeneralSecurityException, IOException {
118-
KeyStore result = KeyStore.getInstance("JKS");
118+
KeyStore result = KeyStore.getInstance(KeyStore.getDefaultType());
119119
result.load(null, null);
120120
CertificateFactory cf = CertificateFactory.getInstance("X.509");
121121
Certificate serverCert = cf.generateCertificate(
122122
new ByteArrayInputStream(
123-
TestCertificates.SERVER_CERT.getBytes(StandardCharsets.ISO_8859_1)));
123+
SERVER_CERT.getBytes(StandardCharsets.ISO_8859_1)));
124124
Certificate caCert = cf.generateCertificate(
125125
new ByteArrayInputStream(
126126
CA_CERT.getBytes(StandardCharsets.ISO_8859_1)));
@@ -135,7 +135,7 @@ public static KeyStore getKeyStore() throws GeneralSecurityException, IOExceptio
135135
}
136136

137137
public static KeyStore getTrustStore() throws GeneralSecurityException, IOException {
138-
KeyStore result = KeyStore.getInstance("JKS");
138+
KeyStore result = KeyStore.getInstance(KeyStore.getDefaultType());
139139
result.load(null, null);
140140
CertificateFactory cf = CertificateFactory.getInstance("X.509");
141141
Certificate rootcaCert = cf.generateCertificate(

0 commit comments

Comments
 (0)