public static OpenSslX509ToMonoX509 ( OpenSSL.X509 cert ) : Mono.Security.X509.X509Certificate | ||
cert | OpenSSL.X509 | |
Результат | Mono.Security.X509.X509Certificate |
/// <summary>Override to review certificate validation decisions.</summary> protected bool RemoteCertificateValidation(object sender, X509Certificate cert, X509Chain chain, int depth, VerifyResult result) { try { _ch.Verify(OpenSslCertificateHandler.OpenSslX509ToMonoX509(cert), default(ISender)); } catch { return(false); } return(result == VerifyResult.X509_V_OK || result == VerifyResult.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT); }
public void ValidityTest() { var osch = new OpenSslCertificateHandler(); RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(512); byte[] blob = rsa.ExportCspBlob(false); RSACryptoServiceProvider rsa_pub = new RSACryptoServiceProvider(); rsa_pub.ImportCspBlob(blob); string ID = "brunet:node:PXYSWDL5SZDHDDXJKZCLFENOP2KZDMBU"; CertificateMaker cm = new CertificateMaker("US", "UFL", "ACIS", "David Wolinsky", "*****@*****.**", rsa_pub, ID); Certificate cert_0 = cm.Sign(cm, rsa); osch.AddSignedCertificate(cert_0.X509); osch.AddCACertificate(cert_0.X509); var ocert = OpenSslCertificateHandler.OpenSslX509ToMonoX509(osch.LocalCertificate); Assert.AreEqual(cert_0.X509.RawData, ocert.RawData, "local check"); Assert.IsTrue(CertificateHandler.Verify(ocert, ID), "Valid"); }