
if java-home/lib/security/jssecacerts is a valid file, trusted certificates are loaded from here. If set, but the file does not exist, no truststore is used. a file specified by the system property. Where does a Java client load trusted certificates from?Ī Java client program loads trusted certificates from the following locations, in this order: Oracle has a good reference defining keystores and truststores. There are two kinds of key or certificate storage files used by Oracle Java. Use either: SSLCertificateFile "example.pem" (Optional) Extract pem (certificate) from ".p12" keystore file ( this is same as step 2, but openssl spits out more verbose contents ): openssl pkcs12 -nokeys -in example.p12 -out example.pemĮxtract unencrypted private key file from ".p12" keystore file: openssl pkcs12 -nocerts -nodes -in example.p12 -out example.keyĬonfiguring SSL Server Certificates Sonatype NexusĬonfiguring Nexus and Reverse Proxies Eclipse Jetty (Optional) List and verify new keystore file contents: keytool -list -keystore example.p12 -storetype PKCS12 Generate PEM encoded public certificate file using keytool: keytool -exportcert -keystore keystore.jks -alias -rfc > example.certĬonvert our Java specific keystore binary".jks" file to a widely compatible PKCS12 keystore ".p12" file: keytool -importkeystore -srckeystore keystore.jks -destkeystore example.p12 -deststoretype PKCS12
ext 'SAN=DNS:,DNS:,DNS:,DNS:Output: keystore.jks dname 'CN=*., OU=Sonatype, O=Sonatype, L=Unspecified, ST=Unspecified, C=US' \ keyalg RSA -keysize 2048 -validity 5000 -keypass password \
Generate public private key pair using keytool: keytool -genkeypair -keystore keystore.jks -storepass password -alias \ Openssl is needed only when creating certificates for use in a reverse proxy such as Apache or nginx. The following steps use Oracle Java 7+ keytool ( Unix/ Windows) to generate self-signed server certificates which can be used with Sonatype server products. Generating Self Signed Server TLS Certificates Otherwise, a self-signed certificate still ensures that communication over HTTPS is encrypted.įor long term server use, Sonatype recommends getting a certificate signed by a CA. These types of certificates are considered untrustworthy because the certificate identity has not been signed/verified by a third party certificate authority (CA). Self-signed server TLS certificates are useful for testing server TLS configuration or for personal use when encrypting communication over HTTP. Transport Layer Security (TLS) Self-Signed Certificates