How to set up Java VM to use the root certificates (truststore) handled by Mac OS X

You can use the Apple JCA Provider to use the OSX keychain as the java trust store. Just start the JVM with the following system property: -Djavax.net.ssl.trustStoreType=KeychainStore You can set this property for every started JVM using the JAVA_TOOL_OPTIONS environment variable, as described in hagrawal’s answer.

Is it possible to get Java to ignore the “trust store” and just accept whatever SSL certificate it gets?

Working code ( in jdk1.6.0_23) for #1. Imports import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import java.security.cert.X509Certificate; The actual trust all TrustManager code. TrustManager trm = new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } }; SSLContext … Read more

How to create an empty java trust store?

Using keytool, create a random key pair: keytool -genkeypair -alias boguscert -storepass storePassword -keypass secretPassword -keystore emptyStore.keystore -dname “CN=Developer, OU=Department, O=Company, L=City, ST=State, C=CA” then delete it keytool -delete -alias boguscert -storepass storePassword -keystore emptyStore.keystore review its contents: $ keytool -list -keystore emptyStore.keystore -storepass storePassword Keystore type: JKS Keystore provider: SUN Your keystore contains 0 … Read more

How to generate keystore and truststore

I followed This link. 1.Generate keystore(At server): keytool -genkey -alias bmc -keyalg RSA -keystore KeyStore.jks -keysize 2048 2.Generate new ca-cert and ca-key: openssl req -new -x509 -keyout ca-key -out ca-cert 3.Extracting cert/creating cert sign req(csr): keytool -keystore KeyStore.jks -alias bmc -certreq -file cert-file 4.Sign the “cert-file” and cert-signed wil be the new cert: openssl x509 … Read more

Why does java have both the cacerts and jssecacerts files?

From Java™ Secure Socket Extension (JSSE) Reference Guide, TrustManagerFactory uses the following steps to try to find trust material: system property javax.net.ssl.trustStore java-home/lib/security/jssecacerts java-home/lib/security/cacerts (shipped by default) I think this is based on convention over configuration concept. Without extra coding effort, cacert will be used. For extra private CA/Signing certs, a developer either can use … Read more

Specifying trust store information in spring boot application.properties

In case if you need to make a REST call you can use the next way. This will work for outgoing calls through RestTemplate. Declare the RestTemplate bean like this. @Configuration public class SslConfiguration { @Value(“${http.client.ssl.trust-store}”) private Resource keyStore; @Value(“${http.client.ssl.trust-store-password}”) private String keyStorePassword; @Bean RestTemplate restTemplate() throws Exception { SSLContext sslContext = new SSLContextBuilder() .loadTrustMaterial( … Read more