Skip to content

Commit

Permalink
Use default algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshajiang committed Dec 30, 2023
1 parent 56404ff commit b0c2fcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions test/micro/org/openjdk/bench/java/security/SSLHandshake.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ public void init() throws Exception {
KeyStore ks = TestCertificates.getKeyStore();
KeyStore ts = TestCertificates.getTrustStore();

KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX");
KeyManagerFactory kmf = KeyManagerFactory.getInstance(
KeyManagerFactory.getDefaultAlgorithm());
kmf.init(ks, new char[0]);

TrustManagerFactory tmf =
TrustManagerFactory.getInstance("PKIX");
TrustManagerFactory tmf = TrustManagerFactory.getInstance(
TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ts);

SSLContext sslCtx = SSLContext.getInstance(tlsVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class TestCertificates {
private TestCertificates() {}

public static KeyStore getKeyStore() throws GeneralSecurityException, IOException {
KeyStore result = KeyStore.getInstance("PKCS12");
KeyStore result = KeyStore.getInstance(KeyStore.getDefaultType());
result.load(null, null);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate serverCert = cf.generateCertificate(
Expand All @@ -135,7 +135,7 @@ public static KeyStore getKeyStore() throws GeneralSecurityException, IOExceptio
}

public static KeyStore getTrustStore() throws GeneralSecurityException, IOException {
KeyStore result = KeyStore.getInstance("PKCS12");
KeyStore result = KeyStore.getInstance(KeyStore.getDefaultType());
result.load(null, null);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate rootcaCert = cf.generateCertificate(
Expand Down

0 comments on commit b0c2fcc

Please sign in to comment.