Brian Matthews
Brian Matthews

Reputation: 8596

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

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?

Upvotes: 4

Views: 26081

Answers (3)

java4africa
java4africa

Reputation: 212

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

Upvotes: 2

Brian Matthews
Brian Matthews

Reputation: 8596

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

Upvotes: 10

Robert Munteanu
Robert Munteanu

Reputation: 68328

  • 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

Upvotes: 1

Related Questions