Example #1
0
        public void TestComputeSignatureShareEmptyCommitmentSecret()
        {
            var signatureService = new MultiSignature(_sepSecp256K1);

            byte[] commitmentSecret = new byte[0];
            byte[] challenge        = Digests.Sha3("dummy challenge".ToHexEncodedByteArray());
            byte[] privateKey       = new Participant("Alice").PrivateKey;

            var exception = Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                                        signatureService.ComputeSignatureShare(challenge, privateKey, commitmentSecret));

            Console.WriteLine(exception.Message);
            Assert.IsTrue(exception.Message.StartsWith("[commitmentSecret] cannot be less than or equal to 0."));
        }
Example #2
0
        public void TestComputeSignatureShareNullPrivateKey()
        {
            var signatureService = new MultiSignature(_sepSecp256K1);

            byte[] challenge        = Digests.Sha3("dummy challenge".ToHexEncodedByteArray());
            byte[] privateKey       = null;
            byte[] commitmentSecret = signatureService.ComputeCommitmentSecret();

            var exception = Assert.Throws <ArgumentNullException>(() =>
                                                                  signatureService.ComputeSignatureShare(challenge, privateKey, commitmentSecret));

            Console.WriteLine(exception.Message);
            Assert.IsTrue(exception.Message.StartsWith("[privateKey] cannot be Null."));
        }