8322766: Micro bench SSLHandshake should use default algorithms

Reviewed-by: djelinski
This commit is contained in:
John Jiang 2024-01-03 08:27:42 +00:00
parent 9ab29f8dcd
commit 06dd735342
2 changed files with 9 additions and 8 deletions

View File

@ -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
@ -80,11 +80,12 @@ public class SSLHandshake {
KeyStore ks = TestCertificates.getKeyStore();
KeyStore ts = TestCertificates.getTrustStore();
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
KeyManagerFactory kmf = KeyManagerFactory.getInstance(
KeyManagerFactory.getDefaultAlgorithm());
kmf.init(ks, new char[0]);
TrustManagerFactory tmf =
TrustManagerFactory.getInstance("SunX509");
TrustManagerFactory tmf = TrustManagerFactory.getInstance(
TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ts);
SSLContext sslCtx = SSLContext.getInstance(tlsVersion);

View File

@ -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
@ -115,12 +115,12 @@ class TestCertificates {
private TestCertificates() {}
public static KeyStore getKeyStore() throws GeneralSecurityException, IOException {
KeyStore result = KeyStore.getInstance("JKS");
KeyStore result = KeyStore.getInstance(KeyStore.getDefaultType());
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)));
@ -135,7 +135,7 @@ class TestCertificates {
}
public static KeyStore getTrustStore() throws GeneralSecurityException, IOException {
KeyStore result = KeyStore.getInstance("JKS");
KeyStore result = KeyStore.getInstance(KeyStore.getDefaultType());
result.load(null, null);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate rootcaCert = cf.generateCertificate(