【问题标题】:SharpSVN - Server certificate verification failedSharpSVN - 服务器证书验证失败
【发布时间】:2013-06-17 04:28:07
【问题描述】:

我使用 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

据我所见: 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?
    }

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

【问题讨论】:

    标签: c# certificate commit sharpsvn


    【解决方案1】:

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

        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
        }
    

    【讨论】:

    • 确保您还查看“E”的另一个参数并检查。这允许 所有 SSL 证书(也过期、撤销等)
    猜你喜欢
    • 2011-07-07
    • 2018-10-20
    • 1970-01-01
    • 2016-09-23
    • 2015-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多