예제 #1
0
파일: MyRSATests.cs 프로젝트: AvaPL/E-media
        public void ShouldImportParameters()
        {
            RSAParameters parameters = MyRSA.GenerateKeyPair(512);
            MyRSA         myRsa      = new MyRSA(parameters);

            Assert.AreEqual(parameters, myRsa.ExportParameters());
        }
예제 #2
0
파일: MyRSATests.cs 프로젝트: AvaPL/E-media
        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);
            }
        }