예제 #1
0
        public void DecodeTrue()
        {
            var signer = new HS256Signer();
            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("98fW0aTrMnLlTUi69YerOjzSg2HrqTJO7czWQwf5E64=");

            Assert.True(signer.Verify(claims, key, checksum));
        }
예제 #2
0
        public void DecodeFalse()
        {
            var signer = new HS256Signer();
            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));
        }