Beispiel #1
0
        public void CorrectDecode(string data, string p, string q, string e)
        {
            var(item1, item2) = RSA.CreateKeys(new MyBigInteger(p), new MyBigInteger(q), new MyBigInteger(e));
            var decryptedMsg = RSA.Decrypt(new MyBigInteger(data), item1);
            var encryptedMsg = RSA.Encrypt(decryptedMsg, item2);

            CollectionAssert.AreEqual(data, encryptedMsg.ToString());
        }
Beispiel #2
0
        public void ClosedKeysTest(string p, string q, string e, string k1, string k2)
        {
            var key1 = new MyBigInteger(k1);
            var key2 = new MyBigInteger(k2);

            var(item1, item2) = RSA.CreateKeys(new MyBigInteger(p), new MyBigInteger(q), new MyBigInteger(e));
            Assert.AreEqual(key1, item2.Item1);
            Assert.AreEqual(key2, item2.Item2);
        }