Example #1
0
        public void SchnorrNonLinkableAllowTest()
        {
            for (int i = 0; i < 64; i++)
            {
                byte[] x1 = SchnorrNonLinkable.GenerateRandomScalar();
                byte[] x2 = SchnorrNonLinkable.GenerateRandomScalar();

                ECPoint P1 = ECCurve.Secp256r1.G * x1;
                ECPoint P2 = ECCurve.Secp256r1.G * x2;

                Random rnd   = new Random(i);
                int    iRand = rnd.Next(2);

                if (iRand == 0)
                {
                    SchnorrSignatureType sig = SchnorrNonLinkable.Generate(x1, P1, P2, 0);

                    SchnorrNonLinkable.Verify(P1, P2, sig).Should().Be(true);
                }
                else
                {
                    SchnorrSignatureType sig = SchnorrNonLinkable.Generate(x2, P1, P2, 1);

                    SchnorrNonLinkable.Verify(P1, P2, sig).Should().Be(true);
                }
            }
        }
Example #2
0
        public void SchnorrNonLinkableNotAllowTest01()
        {
            byte[] x1 = SchnorrNonLinkable.GenerateRandomScalar();
            byte[] x2 = SchnorrNonLinkable.GenerateRandomScalar();

            ECPoint P1 = ECCurve.Secp256r1.G * x1;
            ECPoint P2 = ECCurve.Secp256r1.G * x2;

            SchnorrSignatureType sig = SchnorrNonLinkable.Generate(x1, P1, P2, 1);

            SchnorrNonLinkable.Verify(P1, P2, sig).Should().Be(false);
        }