Skip to content

Instantly share code, notes, and snippets.

@ashishb888
Created November 11, 2019 12:15
Show Gist options
  • Save ashishb888/2e1b0d04e17cc55c3c50f62224249afd to your computer and use it in GitHub Desktop.
Save ashishb888/2e1b0d04e17cc55c3c50f62224249afd to your computer and use it in GitHub Desktop.
Java HTTPS connection with SSL certificate
Get SSL certificate from server (Site URL). You can refer below URL
https://www.shellhacks.com/get-ssl-certificate-from-server-site-url-export-download/
Use Java's keytool utility to add downloaded certificate to Java's keystore
keytool -importcert -file <path-of-certificate> -keystore <keystore-file> -alias <certificate-alias>
i.e. keytool -importcert -file E:\certs\some-site.cer -keystore "E:\sw\jdk1.8.0_112\jre\lib\security\cacerts" -alias "some-site"
Now you will be able to access HTTPS URLs
Common issues when downloading dependencies from repositories URLs
https://repo.maven.apache.org/maven2/
https://www.gridgainsystems.com/nexus/content/repositories/external/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment