Ejemplo n.º 1
0
        public void EncryptDecryptTest()
        {
            var service = new RSACryptService(1024,_encode);
            const string testString = "rsa is complete";
            var key = new KeyModel {D = 44273, E = 65537, N = 49163};
            var encryptData = service.Encrypt(testString, key);
            string decryptString = service.Decrypt(encryptData, key);

            Assert.AreEqual(testString,decryptString);
        }
Ejemplo n.º 2
0
        public void FullTest()
        {
            var cryptService = new RSACryptService(100, _encode);
            for (int i = 0; i < 10; i++)
            {
                KeyModel generateKey = cryptService.GenerateKey();
                const string testString = "rsa is complete";
                var encryptData = cryptService.Encrypt(testString, generateKey);
                string decryptString = cryptService.Decrypt(encryptData, generateKey);

                Assert.AreEqual(testString, decryptString);
            }
        }