コード例 #1
0
        public void DecodeTrue()
        {
            var rsa = new RSACryptoServiceProvider();
            rsa.FromXmlString(PublicKey);

            var claims = Convert.FromBase64String("eyJVc2VySWQiOjEsIlVzZXJuYW1lIjoiamFja2FudG9ubyJ9");
            var signer = new RS384Signer();
            var signature = Convert.FromBase64String("et1p/56+cnDuPMcdu7RLisLUhhNKKZcFBlotPXqZfHD02Rbuv7oYjCrQeP/r8/ChxRsrE55nrFN1Na+tpvx6zNzItoPq9/OTrfF763DsOV+g2N62/EjXX7dzskUjl6llWE+Ff5DAiVDjD8TXBkEO16QkAAH6XW6ESNMw4aQBx/E=");

            Assert.True(signer.Verify(claims, rsa, signature));
        }
コード例 #2
0
        public void DecodeFalse()
        {
            var rsa = new RSACryptoServiceProvider();
            rsa.FromXmlString(PublicKey);

            var claims = Convert.FromBase64String("eyJVc2VySWQiOjEsIlVzZXJuYW1lIjoiamFja2FudG9ubyJ9");
            var signer = new RS384Signer();
            var signature = new byte[] { 1, 2, 4, 5 };

            Assert.False(signer.Verify(claims, rsa, signature));
        }