예제 #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());
 }