2013-06-20 15 views
6

Uso SharpSVN e aggiungo una cartella alla subversion. Poi cerco di commetterlo e ottengo questa eccezione:SharpSVN - Verifica del certificato del server non riuscita

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

Per quanto mi vedo qui: Server certificate verification failed

..è sembra che devo utilizzare un'opzione --trust-server-cert, ma I don' Lo vediamo ovunque negli argomenti di SvnCommitArgs.

Inoltre, ho trovato questo: How do I use a custom Certificate Authority in SharpSvn without installing the certificate

..dove vedo questo:

client.Configuration.SetOption(...) 

Ma io non so che cosa impostazioni devo fornire per rendere più commettere senza problemi.

Qualcuno ha fatto qualcosa di simile?

EDIT: Ho anche provato a fare questo:

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

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

Ma io non capisco cosa devo fare all'interno del gestore di accettare il certificato ... :(

risposta

10

OK .. ho risolto questo problema e ora ottengo un altro errore Quello che dovete fare è questo:

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 
    } 
+1

assicurarsi che si guarda anche l'altro argomento di "E" e controllare. Questo consente * tutti i certificati SSL * (anche scaduti, revocati ecc.) –

Problemi correlati