-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
Rfc4231HmacTests.cs
40 lines (36 loc) · 1.57 KB
/
Rfc4231HmacTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Test.Cryptography;
using Xunit;
namespace System.Security.Cryptography.Tests
{
public abstract class Rfc4231HmacTests<THmacTrait> : HmacTests<THmacTrait> where THmacTrait : IHmacTrait
{
private static readonly byte[][] s_testKeys4231 =
{
null,
ByteUtils.RepeatByte(0x0b, 20),
ByteUtils.AsciiBytes("Jefe"),
ByteUtils.RepeatByte(0xaa, 20),
ByteUtils.HexToByteArray("0102030405060708090a0b0c0d0e0f10111213141516171819"),
ByteUtils.HexToByteArray("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c"),
ByteUtils.RepeatByte(0xaa, 131),
ByteUtils.RepeatByte(0xaa, 131),
};
private static readonly byte[][] s_testData4231 =
{
null,
ByteUtils.AsciiBytes("Hi There"),
ByteUtils.AsciiBytes("what do ya want for nothing?"),
ByteUtils.RepeatByte(0xdd, 50),
ByteUtils.RepeatByte(0xcd, 50),
ByteUtils.AsciiBytes("Test With Truncation"),
ByteUtils.AsciiBytes("Test Using Larger Than Block-Size Key - Hash Key First"),
ByteUtils.AsciiBytes("This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm."),
};
protected Rfc4231HmacTests(byte[][] testMacs) :
base(s_testKeys4231, s_testData4231, testMacs)
{
}
}
}