示例#1
0
        public void DecodeTrue()
        {
            var signer = new HS512Signer();
            var key = new byte[] { 237, 77, 131, 121, 90, 110, 35, 231, 70, 26, 39, 55, 158, 159, 179, 231 };
            var claims = Convert.FromBase64String("eyJVc2VySWQiOjEsIlVzZXJuYW1lIjoiamFja2FudG9ubyJ9");
            var checksum = Convert.FromBase64String("SRt68diEk0CbbZWeY02mjlPDP6dV+jXNGcXersJBYP99lpUdTWTWJyp4K6sxvpkX9GrNofTtu9owwL95LZJA/w==");

            Assert.True(signer.Verify(claims, key, checksum));
        }
示例#2
0
        public void DecodeFalse()
        {
            var signer = new HS512Signer();
            var key = new byte[] { 237, 77, 131, 121, 90, 110, 35, 231, 70, 26, 39, 55, 158, 159, 179, 231 };
            var claims = Convert.FromBase64String("eyJVc2VySWQiOjEsIlVzZXJuYW1lIjoiamFja2FudG9ubyJ9");
            var checksum = new byte[] { 1, 2, 3, 4, 5 };

            Assert.False(signer.Verify(claims, key, checksum));
        }