Skip to content

Commit

Permalink
8322766: Micro bench SSLHandshake would use modern algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshajiang committed Dec 29, 2023
1 parent 2a59243 commit 56404ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions test/micro/org/openjdk/bench/java/security/SSLHandshake.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -80,11 +80,11 @@ public void init() throws Exception {
KeyStore ks = TestCertificates.getKeyStore();
KeyStore ts = TestCertificates.getTrustStore();

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

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

SSLContext sslCtx = SSLContext.getInstance(tlsVersion);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -115,12 +115,12 @@ class TestCertificates {
private TestCertificates() {}

public static KeyStore getKeyStore() throws GeneralSecurityException, IOException {
KeyStore result = KeyStore.getInstance("JKS");
KeyStore result = KeyStore.getInstance("PKCS12");
result.load(null, null);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate serverCert = cf.generateCertificate(
new ByteArrayInputStream(
TestCertificates.SERVER_CERT.getBytes(StandardCharsets.ISO_8859_1)));
SERVER_CERT.getBytes(StandardCharsets.ISO_8859_1)));
Certificate caCert = cf.generateCertificate(
new ByteArrayInputStream(
CA_CERT.getBytes(StandardCharsets.ISO_8859_1)));
Expand All @@ -135,7 +135,7 @@ public static KeyStore getKeyStore() throws GeneralSecurityException, IOExceptio
}

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

0 comments on commit 56404ff

Please sign in to comment.