7

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

SharpSvn.SvnRepositoryIOException: OPTIONS of 'https://sth.com/svn/blah/Documents': Server certificate verification failed: certificate has expired, certificate issued for a different hostname, issuer is not trusted

据我在这里看到: 服务器证书验证失败

..似乎我必须使用一个--trust-server-cert选项,但我在SvnCommitArgs.

另外,我发现了这个: How do I use a custom Certificate Authority in SharpSvn without install 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?
    }

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

4

1 回答 1

13

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

    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
    }
于 2013-06-20T12:05:26.000 回答