سؤال

I'm looking for some sample code that would read from the JKS and issue an HTTPS request with SSL and it doesn't use a third party library. I've only seen samples using libraries such as Axis.j

هل كانت مفيدة؟

المحلول

Just use an HTTPS URL, with an HttpsURLConnection or even HttpURLConnection. Java will do the rest. No 3rd-party libraries required.

If you need to use a custom truststore, set the system property javax.net.ssl.trustStore.

Similarly, if you need to use a keystore, i.e. if the server is requesting client authentication, set the system properties javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top