Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        public void KeyGenerationTest()
        {
            var keyM = new RSACryptService(512, _encode);

            for (int i = 0; i < 5; i++)
            {
                KeyModel generateKey = keyM.GenerateKey();
                bool eCorrect = generateKey.E >= 3;
                bool nCorrect = generateKey.N >= 9;
                bool dCorrect = generateKey.D > 0;

                Assert.True(dCorrect);
                Assert.True(nCorrect);
                Assert.True(eCorrect);

            }
        }