public void RsaStringTest1() { var rs = new RsaDecrypter(31); var rc = new RsaCrypter(rs.OpenKey); const string m = "qwerty"; var c = rc.Crypt(m); var md = rs.Decrypt(c); Assert.AreEqual(m, md); }
public void RsaRandomTest1() { var rs = new RsaDecrypter(31); var rc = new RsaCrypter(rs.OpenKey); var r = new Random(); for (var i = 0; i < 100; i++) { var m = new BigInteger(r.Next(1, 10000)); Assert.AreEqual(m, rs.Decrypt(rc.Crypt(m))); } }