コード例 #1
0
        public void Test256Signature2()
        {
            var helper = new Sha256SignatureHelper("");

            Assert.IsTrue(helper.VerifySignature(helper.Sign(), ""));

            var helper2 = new Sha256SignatureHelper("HelloMom");

            Assert.IsTrue(helper2.VerifySignature(helper2.Sign(), ""));
            Assert.IsTrue(helper2.VerifySignature(helper2.Sign()));
            Assert.IsFalse(helper2.VerifySignature(helper2.Sign().ToUpperInvariant(), ""));
        }
コード例 #2
0
        public void Test256Signature1()
        {
            var helper = new Sha256SignatureHelper("");

            var signature = helper.Sign("freddy", "got", "fingered");

            Assert.IsTrue(helper.VerifySignature(signature, "freddy", "got", "fingered"));
            Assert.IsFalse(helper.VerifySignature(signature, "Freddy", "got", "fingered"));
        }
コード例 #3
0
        public void Test256Signature3()
        {
            var helper = new Sha256SignatureHelper("123");

            var signature = helper.Sign("freddy", "got", "fingered");

            try
            {
                helper.VerifySignature(null, "freddy", "got", "fingered");
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is ArgumentOutOfRangeException);
                return;
            }

            Assert.Fail();
        }