mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-19 15:39:09 +00:00
8308453: Convert JKS test keystores in test/jdk/javax/net/ssl/etc to PKCS12
Reviewed-by: weijun
This commit is contained in:
parent
b3126b6e44
commit
1696603ccd
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 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
|
||||
@ -438,13 +438,11 @@ public class ResumeTLS13withSNI {
|
||||
private static TrustManagerFactory makeTrustManagerFactory(String tsPath,
|
||||
char[] pass) throws GeneralSecurityException, IOException {
|
||||
TrustManagerFactory tmf;
|
||||
KeyStore ts = KeyStore.getInstance("JKS");
|
||||
|
||||
try (FileInputStream fsIn = new FileInputStream(tsPath)) {
|
||||
ts.load(fsIn, pass);
|
||||
tmf = TrustManagerFactory.getInstance("SunX509");
|
||||
tmf.init(ts);
|
||||
}
|
||||
KeyStore ts = KeyStore.getInstance(new File(tsPath), pass);
|
||||
tmf = TrustManagerFactory.getInstance("SunX509");
|
||||
tmf.init(ts);
|
||||
|
||||
return tmf;
|
||||
}
|
||||
|
||||
@ -463,13 +461,11 @@ public class ResumeTLS13withSNI {
|
||||
private static KeyManagerFactory makeKeyManagerFactory(String ksPath,
|
||||
char[] pass) throws GeneralSecurityException, IOException {
|
||||
KeyManagerFactory kmf;
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
|
||||
try (FileInputStream fsIn = new FileInputStream(ksPath)) {
|
||||
ks.load(fsIn, pass);
|
||||
kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, pass);
|
||||
}
|
||||
KeyStore ks = KeyStore.getInstance(new File(ksPath), pass);
|
||||
kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, pass);
|
||||
|
||||
return kmf;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -179,8 +179,8 @@ public class SSLCtxAccessToSessCtx {
|
||||
|
||||
sslctx = SSLContext.getInstance("TLS");
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(keyFilename), passwd.toCharArray());
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyFilename),
|
||||
passwd.toCharArray());
|
||||
kmf.init(ks, passwd.toCharArray());
|
||||
sslctx.init(kmf.getKeyManagers(), null, null);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -315,10 +315,9 @@ public class SessionCacheSizeTests {
|
||||
|
||||
sslctx = SSLContext.getInstance("TLS");
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
try (FileInputStream fis = new FileInputStream(keyFilename)) {
|
||||
ks.load(fis, passwd.toCharArray());
|
||||
}
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyFilename),
|
||||
passwd.toCharArray());
|
||||
|
||||
kmf.init(ks, passwd.toCharArray());
|
||||
sslctx.init(kmf.getKeyManagers(), null, null);
|
||||
sslssf = (SSLServerSocketFactory) sslctx.getServerSocketFactory();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -342,8 +342,8 @@ public class SessionTimeOutTests {
|
||||
|
||||
sslctx = SSLContext.getInstance("TLS");
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(keyFilename), passwd.toCharArray());
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyFilename),
|
||||
passwd.toCharArray());
|
||||
kmf.init(ks, passwd.toCharArray());
|
||||
sslctx.init(kmf.getKeyManagers(), null, null);
|
||||
sslssf = (SSLServerSocketFactory) sslctx.getServerSocketFactory();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -264,8 +264,8 @@ public class B8025710 {
|
||||
HttpServer() throws Exception {
|
||||
super("HttpServer Thread");
|
||||
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(keystorefile), passphrase.toCharArray());
|
||||
KeyStore ks = KeyStore.getInstance(new File(keystorefile),
|
||||
passphrase.toCharArray());
|
||||
KeyManagerFactory factory = KeyManagerFactory.getInstance("SunX509");
|
||||
factory.init(ks, passphrase.toCharArray());
|
||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -28,8 +28,9 @@
|
||||
* @modules java.base/sun.security.provider
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
import java.security.KeyStore;
|
||||
import java.security.cert.CertificateException;
|
||||
@ -38,7 +39,6 @@ import java.util.Base64;
|
||||
|
||||
import sun.security.provider.X509Factory;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
public class BadPem {
|
||||
|
||||
@ -49,8 +49,8 @@ public class BadPem {
|
||||
String alias = "dummy";
|
||||
|
||||
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||
KeyStore keyStore = KeyStore.getInstance("JKS");
|
||||
keyStore.load(new FileInputStream(ks), pass.toCharArray());
|
||||
KeyStore keyStore = KeyStore.getInstance(new File(ks),
|
||||
pass.toCharArray());
|
||||
byte[] cert = keyStore.getCertificate(alias).getEncoded();
|
||||
|
||||
// 8074935
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
@ -29,6 +29,7 @@
|
||||
* @run main/othervm -Xshare:off -Xmx1024m BigCRL
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.security.KeyStore;
|
||||
@ -49,8 +50,8 @@ public class BigCRL {
|
||||
String pass = "passphrase";
|
||||
String alias = "dummy";
|
||||
|
||||
KeyStore keyStore = KeyStore.getInstance("JKS");
|
||||
keyStore.load(new FileInputStream(ks), pass.toCharArray());
|
||||
KeyStore keyStore = KeyStore.getInstance(new File(ks),
|
||||
pass.toCharArray());
|
||||
Certificate signerCert = keyStore.getCertificate(alias);
|
||||
byte[] encoded = signerCert.getEncoded();
|
||||
X509CertImpl signerCertImpl = new X509CertImpl(encoded);
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -190,9 +190,8 @@ public class main
|
||||
System.setProperty("javax.net.ssl.trustStore", testRoot
|
||||
+ "/../../../../javax/net/ssl/etc/truststore");
|
||||
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(testRoot
|
||||
+ "/../../../../javax/net/ssl/etc/truststore"),
|
||||
KeyStore ks = KeyStore.getInstance(new File(testRoot
|
||||
+ "/../../../../javax/net/ssl/etc/truststore"),
|
||||
"passphrase".toCharArray());
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, "passphrase".toCharArray());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.ServerSocket;
|
||||
@ -146,10 +146,9 @@ public class ClientHelloRead {
|
||||
|
||||
ctx = SSLContext.getInstance("TLS");
|
||||
kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
ks = KeyStore.getInstance("JKS");
|
||||
ks = KeyStore.getInstance(new File(System.getProperty(
|
||||
"javax.net.ssl.keyStore")), passphrase);
|
||||
|
||||
ks.load(new FileInputStream(System.getProperty(
|
||||
"javax.net.ssl.keyStore")), passphrase);
|
||||
kmf.init(ks, passphrase);
|
||||
ctx.init(kmf.getKeyManagers(), null, null);
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ import javax.net.ssl.SSLEngineResult;
|
||||
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
|
||||
import javax.net.ssl.SSLHandshakeException;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.KeyStore;
|
||||
@ -101,13 +102,10 @@ public class TestBadDNForPeerCA {
|
||||
|
||||
public TestBadDNForPeerCA() throws Exception {
|
||||
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
KeyStore ts = KeyStore.getInstance("JKS");
|
||||
|
||||
char[] passphrase = passwd.toCharArray();
|
||||
|
||||
ks.load(new FileInputStream(keyStoreFile), passphrase);
|
||||
ts.load(new FileInputStream(keyStoreFile), passphrase);
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyStoreFile), passphrase);
|
||||
KeyStore ts = KeyStore.getInstance(new File(keyStoreFile), passphrase);
|
||||
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, passphrase);
|
||||
|
||||
@ -37,6 +37,7 @@ import javax.net.ssl.SSLEngineResult;
|
||||
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
|
||||
import javax.net.ssl.SSLHandshakeException;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.KeyStore;
|
||||
@ -124,13 +125,10 @@ public class TestBadDNForPeerCA12 {
|
||||
|
||||
public TestBadDNForPeerCA12() throws Exception {
|
||||
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
KeyStore ts = KeyStore.getInstance("JKS");
|
||||
|
||||
char[] passphrase = passwd.toCharArray();
|
||||
|
||||
ks.load(new FileInputStream(keyStoreFile), passphrase);
|
||||
ts.load(new FileInputStream(keyStoreFile), passphrase);
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyStoreFile), passphrase);
|
||||
KeyStore ts = KeyStore.getInstance(new File(keyStoreFile), passphrase);
|
||||
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, passphrase);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
@ -173,16 +173,10 @@ public class SSLSocketSSLEngineCloseInbound {
|
||||
*/
|
||||
public SSLSocketSSLEngineCloseInbound(String protocol) throws Exception {
|
||||
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
KeyStore ts = KeyStore.getInstance("JKS");
|
||||
|
||||
char[] passphrase = "passphrase".toCharArray();
|
||||
|
||||
try (FileInputStream keyFile = new FileInputStream(keyFilename);
|
||||
FileInputStream trustFile = new FileInputStream(trustFilename)) {
|
||||
ks.load(keyFile, passphrase);
|
||||
ts.load(trustFile, passphrase);
|
||||
}
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyFilename), passphrase);
|
||||
KeyStore ts = KeyStore.getInstance(new File(trustFilename), passphrase);
|
||||
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, passphrase);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -41,6 +41,8 @@ public class GetPeerHost {
|
||||
String testRoot = System.getProperty("test.src", ".");
|
||||
System.setProperty("javax.net.ssl.trustStore", testRoot
|
||||
+ "/../../../../javax/net/ssl/etc/truststore");
|
||||
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12");
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", "passphrase");
|
||||
GetPeerHostServer server = new GetPeerHostServer();
|
||||
server.start();
|
||||
GetPeerHostClient client =
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -49,12 +49,10 @@ class GetPeerHostServer extends Thread
|
||||
try {
|
||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
char[] passphrase = "passphrase".toCharArray();
|
||||
String testRoot = System.getProperty("test.src", ".");
|
||||
ks.load(new FileInputStream(testRoot
|
||||
+ "/../../../../javax/net/ssl/etc/keystore"),
|
||||
passphrase);
|
||||
KeyStore ks = KeyStore.getInstance(new File(testRoot
|
||||
+ "/../../../../javax/net/ssl/etc/keystore"), passphrase);
|
||||
kmf.init(ks, passphrase);
|
||||
ctx.init(kmf.getKeyManagers(), null, null);
|
||||
ServerSocketFactory ssf = ctx.getServerSocketFactory();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -254,13 +254,10 @@ public class HelloExtensionsTest {
|
||||
|
||||
SSLEngine ssle;
|
||||
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
KeyStore ts = KeyStore.getInstance("JKS");
|
||||
|
||||
char[] passphrase = "passphrase".toCharArray();
|
||||
|
||||
ks.load(new FileInputStream(keyFile), passphrase);
|
||||
ts.load(new FileInputStream(trustFile), passphrase);
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyFile), passphrase);
|
||||
KeyStore ts = KeyStore.getInstance(new File(trustFile), passphrase);
|
||||
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, passphrase);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
@ -71,8 +71,7 @@ public class PreferredKey {
|
||||
"/" + keyStoreFile;
|
||||
char [] password = passwd.toCharArray();
|
||||
|
||||
ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(keyFilename), password);
|
||||
ks = KeyStore.getInstance(new File(keyFilename), password);
|
||||
kmf = KeyManagerFactory.getInstance("NewSunX509");
|
||||
kmf.init(ks, password);
|
||||
km = (X509KeyManager) kmf.getKeyManagers()[0];
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -70,8 +70,7 @@ public class SelectOneKeyOutOfMany {
|
||||
* Setup the tests.
|
||||
*/
|
||||
kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(keyFilename), passphrase);
|
||||
ks = KeyStore.getInstance(new File(keyFilename), passphrase);
|
||||
kmf.init(ks, passphrase);
|
||||
km = (X509KeyManager) kmf.getKeyManagers()[0];
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
@ -192,13 +192,11 @@ public class CertRequestOverflow {
|
||||
"/" + trustStoreFile;
|
||||
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(keyFilename), cpasswd);
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyFilename), cpasswd);
|
||||
kmf.init(ks, cpasswd);
|
||||
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
|
||||
KeyStore ts = KeyStore.getInstance("JKS");
|
||||
ts.load(new FileInputStream(trustFilename), cpasswd);
|
||||
KeyStore ts = KeyStore.getInstance(new File(trustFilename), cpasswd);
|
||||
tmf.init(ts);
|
||||
|
||||
TrustManager tms[] = tmf.getTrustManagers();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
@ -65,8 +65,7 @@ public class CheckNullEntity {
|
||||
"/" + trustStoreFile;
|
||||
char[] passphrase = "passphrase".toCharArray();
|
||||
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(trustFilename), passphrase);
|
||||
KeyStore ks = KeyStore.getInstance(new File(trustFilename), passphrase);
|
||||
|
||||
for (Enumeration e = ks.aliases() ; e.hasMoreElements() ;) {
|
||||
String alias = (String)e.nextElement();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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
|
||||
@ -181,13 +181,11 @@ public class X509ExtendedTMEnabled {
|
||||
"/" + trustStoreFile;
|
||||
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
ks.load(new FileInputStream(keyFilename), cpasswd);
|
||||
KeyStore ks = KeyStore.getInstance(new File(keyFilename), cpasswd);
|
||||
kmf.init(ks, cpasswd);
|
||||
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
|
||||
KeyStore ts = KeyStore.getInstance("JKS");
|
||||
ts.load(new FileInputStream(trustFilename), cpasswd);
|
||||
KeyStore ts = KeyStore.getInstance(new File(trustFilename), cpasswd);
|
||||
tmf.init(ts);
|
||||
|
||||
TrustManager tms[] = tmf.getTrustManagers();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user