How to use a specialized certificate authority in SharpSvn without installing a certificate

I am trying to access the subversion repository using SharpSvn. The repository is accessible only through https, and the machine uses its own certification authority (do not worry about security here, I trust the authority).

I have a public certificate authority root certificate, but due to user permissions I cannot install the certificate in 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 in a configuration file.

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

Thank you very much

0
source share
2 answers

How does this happen only after you ask the question that you understand the answer?

I solved this by setting the configuration parameters to 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"); 

I apologize for self-help, I hope this helps the next person.

+1
source

Turning to a comment by Burt Heyben (above):

 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 } 
0
source

Source: https://habr.com/ru/post/947728/


All Articles