Pergunta

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... :(

Foi útil?

Solução

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
    }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top