public void testCodePlexCode() { var machineCertStore = new X509Store(StoreLocation.LocalMachine); machineCertStore.Open(OpenFlags.ReadOnly); var certs = machineCertStore.Certificates.Find(X509FindType.FindByThumbprint, "ce51edf145eea7ed912b2b5099554f68175273c7", true); var cryptCert = certs[0]; machineCertStore.Close(); var x = new X509Cryptography(cryptCert, true); var y = x.EncryptString("testing this sring da mama"); var z = x.DecryptString(y); }
public void TestHugeCryptography() { var stBytes = System.IO.File.ReadAllBytes(@"D:\thakali\Scribble\files for test\googleDump.txt"); var st = getContent();//getStringFromBytes(stBytes); var machineCertStore = new X509Store(StoreLocation.LocalMachine); machineCertStore.Open(OpenFlags.ReadOnly); var certs = machineCertStore.Certificates.Find(X509FindType.FindByThumbprint, "ce51edf145eea7ed912b2b5099554f68175273c7", true); var cryptCert = certs[0]; machineCertStore.Close(); var x = new X509Cryptography(cryptCert, true); var y = x.EncryptString(st); var z = x.DecryptString(y); Assert.AreEqual(st, z); st = getContent(true); x = new X509Cryptography(cryptCert, true); y = x.EncryptString(st); z = x.DecryptString(y); Assert.AreEqual(st, z); }