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); } }
public void SignData04() { RSA rSA; byte[] bs; rSA = new RSA(); bs = rSA.SignData(null, rSA.GetPrivateKey()); }
public void SignData02() { RSA rSA; byte[] bs; rSA = new RSA(); byte[] bs1 = new byte[0]; bs = rSA.SignData(bs1, ""); }
public void SignData03() { RSA rSA; byte[] bs; rSA = new RSA(); byte[] bs1 = new byte[0]; bs = rSA.SignData(bs1, (string)null); }
public void SignData01() { RSA rSA; byte[] bs; rSA = new RSA(); byte[] bs1 = new byte[0]; bs = rSA.SignData(bs1, "<invalidxml>"); }