public void DecodeTrue() { var rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(PublicKey); var claims = Convert.FromBase64String("eyJVc2VySWQiOjEsIlVzZXJuYW1lIjoiamFja2FudG9ubyJ9"); var signer = new RS256Signer(); var signature = Convert.FromBase64String("HudQQQd5QIJREeCqNHcSsUeseKhAPdZMsvhABqDxQNaSe+qJsBzBVujImI5HDp8vQ39J+UapLnacocTLlIJr8rclGoJncpAeXx3D5S8DxB2YdOx8wdpZi+/4eyugwqnGJ4RWcg9EYSHmdC1jH7tllGWe8BRQR7S4CFB4qqqil1o="); Assert.True(signer.Verify(claims, rsa, signature)); }
public void DecodeFalse() { var rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(PublicKey); var claims = Convert.FromBase64String("eyJVc2VySWQiOjEsIlVzZXJuYW1lIjoiamFja2FudG9ubyJ9"); var signer = new RS256Signer(); var signature = new byte[] { 1, 2, 4, 5 }; Assert.False(signer.Verify(claims, rsa, signature)); }