gpt4 book ai didi

c# - SharpSVN - 服务器证书验证失败

转载 作者:太空狗 更新时间:2023-10-29 21:13:22 27 4
gpt4 key购买 nike

我使用 SharpSVN 并在 subversion 中添加了一个文件夹。然后我尝试提交它并得到这个异常:

SharpSvn.SvnRepositoryIOException:“https://sth.com/svn/blah/Documents”的选项:服务器证书验证失败:证书已过期,为不同主机名颁发的证书,颁发者不受信任

据我所见: Server certificate verification failed

..看来我必须使用 --trust-server-cert 选项,但我在 SvnCommitArgs 的参数中看不到这个。

此外,我还发现了这个: How do I use a custom Certificate Authority in SharpSvn without installing the certificate

..我在哪里看到这个:

client.Configuration.SetOption(...)

但我不知道我必须提供哪些设置才能使其顺利提交。

有没有人做过类似的事情?

编辑:我也试过这样做:

client.Authentication.SslServerTrustHandlers += new EventHandler<SharpSvn.Security.SvnSslServerTrustEventArgs>(Authentication_SslServerTrustHandlers);

void Authentication_SslServerTrustHandlers(object sender, SharpSvn.Security.SvnSslServerTrustEventArgs e)
{
// Accept ceritificate here?
}

但我不明白我必须在处理程序中做什么才能接受证书...:(

最佳答案

好的。我解决了这个问题,现在又出现了另一个错误。你需要做的是:

    client.Authentication.SslServerTrustHandlers += new EventHandler<SharpSvn.Security.SvnSslServerTrustEventArgs>(Authentication_SslServerTrustHandlers);
void Authentication_SslServerTrustHandlers(object sender, SharpSvn.Security.SvnSslServerTrustEventArgs e)
{
// Look at the rest of the arguments of E, whether you wish to accept

// If accept:
e.AcceptedFailures = e.Failures;
e.Save = true; // Save acceptance to authentication store
}

关于c# - SharpSVN - 服务器证书验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17211545/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com