示例#1
0
 public void SignData04()
 {
     RSA rSA;
     byte[] bs;
     rSA = new RSA();
     bs = rSA.SignData(null, rSA.GetPrivateKey());
 }
示例#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);
     }
 }
示例#3
0
 public void EncryptData04()
 {
     RSA rSA;
     string s;
     rSA = new RSA();
     s = rSA.EncryptData(null, rSA.GetPrivateKey());
 }