Search code examples
c#sslsharpsvncertificate-authority

How do I use a custom Certificate Authority in SharpSvn without installing the certificate


I am trying to access a subversion repository using SharpSvn. The repository is only available via https and the machine uses its own private certificate authority (don't worry about the security here, I trust the authority).

I have the Certificate Authority's public root certificate, however due to user access rights I cannot install the certificate into the certificate store.

If I use subversion directly, I can add:

servers:global:ssl-authority-files=/path/to/cacert.crt
servers:groups:myhost=myhostsdns.com

either as command line objects or to the config file.

How do I set these options in SharpSvn so that I can use the cacert.crt file so that I don't get "certificate verification failed" when I try to access my repository, and I don't have to just ignore the error?

Many thanks


Solution

  • How is it that it's only after you ask the question that you realize the answer?

    I solved this by setting the configuration options on the SvnClient object as such:

    SvnClient _svnClient = new SvnClient();
    _svnClient.Configuration.SetOption("servers", "global", "ssl-authority-files", "/path/to/cacert.crt");
    _svnClient.Configuration.SetOption("servers", "groups", "myhost", "myhostsdns.com");
    

    Apologies on the self help, hope it helps the next person.