Exemplo n.º 1
0
        public void SizingTest1()
        {
            string expected = string.Empty;

            for (int i = 1; i < 260; i++)
            {
                expected = new string(Faker.Lorem.Letters(i).ToArray());
                _testContext.WriteLine($"[{expected.Length}]: {expected}");

                try
                {
                    using (var cg = new AsymmetricCryptoHelper(PrivateKey))
                    {
                        var ct = cg.Encrypt(expected);
                        var pt = cg.Decrypt(ct);
                        Assert.AreEqual(expected, pt);
                    }
                } catch (ArgumentOutOfRangeException ex)
                {
                    _testContext.WriteLine($"{ex.Message}");
                    break;
                }
            }
            _testContext.WriteLine($"Maximim Length {expected.Length - 1}");
        }
Exemplo n.º 2
0
        public void SimpleTest2()
        {
            string expected = "The whole house is spinning because of a tornado.";

            _testContext.WriteLine($"[{expected.Length}]: {expected}");

            using (var cg = new AsymmetricCryptoHelper(PrivateKey))
            {
                var ct = cg.Encrypt(expected);
                var pt = cg.Decrypt(ct);
                Assert.AreEqual(expected, pt);
            }
        }
Exemplo n.º 3
0
        public void SimpleTest1()
        {
            string expected = "xyz";

            _testContext.WriteLine($"[{expected.Length}]: {expected}");

            using (var cg = new AsymmetricCryptoHelper(PrivateKey))
            {
                var ct = cg.Encrypt(expected);
                var pt = cg.Decrypt(ct);
                Assert.AreEqual(expected, pt);
            }
        }