How do I use a Maven 2 repository protected using SSL and a wildcard/self-signed certificate?

StackOverflow https://stackoverflow.com/questions/924968

  •  06-09-2019
  •  | 
  •  

Question

I am trying to use a Maven 2 repository via SSL secured with a self-signed certificate. I followed the instructions at HTTPS and Self-Signed Certificates in Java but I doesn't to work.

I think its because the certificate is a wild-card certificate. So I wonder if I should be doing something different to import the wild-card certificate?

Was it helpful?

Solution

The issue was not the use of a wild-card certificate after all. I had to import the CA certificate I used to sign the server certificate into the jssecacerts keystore rather than cacerts:

keytool -keystore %JAVA_HOME%\jre\lib\security\jssecacerts -import -file cacert.pem

OTHER TIPS

Rather the tampering with the certificates for all java applications, generate a separate certificate file that only maven uses, and then use MAVEN_OPTS to set the -D parameter.

-Djavax.net.ssl.trustStore=/private/${ACCOUNT}/java/keystore.pks -Djavax.net.ssl.trustStorePassword=${PASSWORD}

See: https://developer.cloudbees.com/bin/view/DEV/Maven+with+untrusted+SSL+Certificates

  • try using -Djavax.net.debug=ssl as that page suggests and include the output
  • validate your assumption that the problem is the wildcard - try it against a non-wildcard self-signed certification
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top