SharpSVN - Server certificate verification failed
Asked Answered
H

1

7

I use SharpSVN and I add a folder to the subversion. Then I try to commit it and I get this exception:

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

As far as I see here: Server certificate verification failed

..it seems that I must use a --trust-server-cert option, but I don't see this anywhere in the arguments of SvnCommitArgs.

Also, I have found this: How do I use a custom Certificate Authority in SharpSvn without installing the certificate

..where I see this:

client.Configuration.SetOption(...)

But I don't know what settings I must provide to make it commit without problems.

Has anyone done anything similar?

EDIT: I have also tried doing this:

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

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

But I don't understand what I must do inside the handler to accept the certificate... :(

Hipparch answered 20/6, 2013 at 10:41 Comment(0)
H
13

OK. I solved this problem and now I get an other error. What you need to do is this:

    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
    }
Hipparch answered 20/6, 2013 at 12:5 Comment(1)
Make sure you also look at the other argument of "E" and check. This allows all SSL certs (also expired, revoked etc)Maladroit

© 2022 - 2024 — McMap. All rights reserved.