Exemple #1
0
        public static void Test(string key, string msg, string mac)
        {
            var a = new HmacSha256();

            using (var k = Key.Import(a, key.DecodeHex(), KeyBlobFormat.RawSymmetricKey))
            {
                var m = msg.DecodeHex();

                var expected = mac.DecodeHex();
                var actual   = a.Sign(k, m, expected.Length);

                Assert.Equal(expected, actual);
                Assert.True(a.TryVerify(k, m, expected));
            }
        }