Exemple #1
0
        public void ShouldImportParameters()
        {
            RSAParameters parameters = MyRSA.GenerateKeyPair(512);
            MyRSA         myRsa      = new MyRSA(parameters);

            Assert.AreEqual(parameters, myRsa.ExportParameters());
        }
Exemple #2
0
        public void ShouldGenerateKeyOfSpecifiedLength()
        {
            int keyLength = 512;

            for (int i = 0; i < 10; i++) // Repeat 10 times to ensure correct output because of randomness
            {
                RSAParameters rsaParameters = MyRSA.GenerateKeyPair(keyLength);
                Assert.AreEqual(keyLength, rsaParameters.Modulus.Length * 8);
            }
        }