简体   繁体   中英

Creating a TLS1.2 connection to http server in Java

As a client I want to create a TLS1.2 connection to a URL (SOAP Endpoint) in Java.

I have been provided with a PFX file and a password for that file.

I am not sure whether I need to import the PFX file into the truststore or a keystore and how to do this?

What does the code look like to create the connection?

This question is similar but doesn't address how to get the pfx file into the java key system:

Java HttpsURLConnection and TLS 1.2

I did successfully manage to run:

keytool -importkeystore -srckeystore client.pfx -srcstorestype pkcs12 
-destkeystore clientcert.jks -deststoretype jks

Which has made a clientcert.jks

Ultimately I will be doing mutual TLS with the server, but as a starting point answers to these question will be helpful.

I have the server certificate too.

如果您过去没有加载密钥库,则可以查看本文 ,其中描述了如何在URL连接上设置SSL上下文。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM