public AddSignedCertificate ( Mono.Security.X509 cert ) : bool | ||
cert | Mono.Security.X509 | |
return | bool |
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"); }
public DtlsOverlordClientServer(bool threaded, bool good_client, bool good_server, double noisy) { var server_ch = new OpenSslCertificateHandler(); if (good_server) { server_ch.AddSignedCertificate(X509); } server_ch.AddCACertificate(X509); Server = new DtlsOverlord(Rsa, server_ch, PType); ServerIn = new MockDataHandler(); Server.Subscribe(ServerIn, null); var client_ch = new OpenSslCertificateHandler(); if (good_client) { client_ch.AddCACertificate(X509); } client_ch.AddSignedCertificate(X509); Client = new DtlsOverlord(Rsa, client_ch, PType); ClientIn = new MockDataHandler(); Client.Subscribe(ClientIn, null); if (threaded) { ToServer = new ThreadedMockSender(null, null, Server, 1, noisy); ToClient = new ThreadedMockSender(ToServer, null, Client, 1, noisy); } else { ToServer = new MockSender(null, null, Server, 1, noisy); ToClient = new MockSender(ToServer, null, Client, 1, noisy); } ToServer.ReturnPath = ToClient; }
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"); }