我正在尝试通过空手道关闭SSL证书验证。目前,我遇到了错误:
foreach (var type in db.Model.GetEntityTypes())
{
foreach (var property in type.GetProperties())
{
var defaultValue = property.Relational().DefaultValue;
}
}
javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到到请求目标的有效证书路径
答案 0 :(得分:3)
我遇到了类似的情况,为了解决这个问题,我添加了
karate.configure('ssl', true);
在karate-config.js文件中,让空手道知道全局跳过SSL认证验证。
我还必须添加一个http-core依赖项
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.13</version>
</dependency>
答案 1 :(得分:1)
首先在空手道中关闭SSL证书验证:
* configure ssl = true
并在pom.xml中添加以下依赖项。我这样做可以解决我的问题:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
答案 2 :(得分:0)
答案 3 :(得分:0)
对我来说,以下方法有效:
在karate-config.js文件中定义密钥库:
// get system property keystore
var keystore = karate.properties['keystore'];
if (!keystore) {
keystore = 'C:/Program Files/keystore/certificateName.pfx';
}
// get system property keystorepwd
var keystorepwd = karate.properties['keystorepwd'];
if (!keystorepwd) {
keystorepwd = '00000';
}
在.feature文件中的背景中的行下方定义:
configure ssl = { keyStore: #("file:"+keystore), keyStorePassword: #(keystorepwd),
keyStoreType: 'pkcs12' }