pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 478 forks source link

Pact verification is failing while validating provider endpoint with .pfx certificate #1394

Open PRABAREPO opened 3 years ago

PRABAREPO commented 3 years ago

Pact verification is failing while validating provider endpoint with pfx certification

Below section is part of Pact verification section in my POM.xml :

image

When I do pact verification using "mvn pact:verify" command in command prompt, I am getting below error message.

Request Failed - PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259) at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:642)

Could anyone help on this ?

uglyog commented 3 years ago

Can you provide the version of the JVM you are using?

uglyog commented 3 years ago

The trustStore must be a Java trust store (JKS format), you can't use a certificate. You can create a JKS keystore and import the PFX file into it. See https://blogs.oracle.com/blogbypuneeth/steps-to-create-a-jks-keystore-from-pfx-file