示例#1
0
 public void VerifyData05()
 {
     RSA rSA;
     rSA = new RSA();
     byte[] bs = new byte[0];
     byte[] bs1 = new byte[0];
     byte[] bs2 = new byte[0];
     rSA.VerifyData(bs, bs1, (byte[])null, bs2);
 }
示例#2
0
 public void TestSignAndVerify()
 {
     for (int i = 0; i < 100; i++)
     {
         RSA rSA;
         rSA = new RSA();
         string data = TestInfrastructure.GetRandomString(TestInfrastructure.RandomGen.Next(1, 1000));
         Encoding enc = Encoding.Unicode;
         byte[] signature = rSA.SignData(enc.GetBytes(data), rSA.GetPrivateKey());
         byte[] mod = Methods.HexStringToByteArray(Methods.ExtractPublicKey(rSA.GetPublicKey()));
         byte[] exp = Methods.HexStringToByteArray(Methods.ExtractExponent(rSA.GetPublicKey()));
         rSA.VerifyData(enc.GetBytes(data), signature, mod, exp);
     }
 }