Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- X509Certificate rootCertificate = ...;
- X509Certificate intermediateCertificate = ...;
- X509Certificate myPublicCertificate = ...;
- KeyStore myPrivateKey = ...;
- KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
- keyManagerFactory.init(myPrivateKey, "password");
- SSLContext context = SSLContext.getInstance("TLSv1.2");
- context.init(keyManagerFactory.getKeyManagers(), null, new SecureRandom());
- SSLSocketFactory socketFactory = context.getSocketFactory();
- HttpsURLConnection.setDefaultSSLSocketFactory(socketFactory);
- URL url = new URL(urlPath);
- HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
- *** ServerHelloDone
- Warning: no suitable certificate found - continuing without client authentication
- *** Certificate chain
- <Empty>
- ***
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement