Improve HMAC tests
This commit is contained in:
parent
879658d4bf
commit
5b93440ce9
17
test/hmac.ts
17
test/hmac.ts
|
@ -35,6 +35,7 @@ context("HMAC", () => {
|
|||
],
|
||||
sign: [
|
||||
{
|
||||
name: "HMAC-SHA256 with length param which is less than hash size",
|
||||
key: {
|
||||
format: "raw",
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]),
|
||||
|
@ -50,6 +51,22 @@ context("HMAC", () => {
|
|||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
signature: Convert.FromBase64("9yMF9ReX1EhdBWTRjSR+AC21NA05H9W8vx0HZGVmgNc="),
|
||||
},
|
||||
{
|
||||
name: "HMAC-SHA256 without length param",
|
||||
key: {
|
||||
format: "raw",
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]),
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-256",
|
||||
} as HmacImportParams,
|
||||
extractable: false,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
algorithm: { name: "HMAC" },
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
signature: Convert.FromHex("ad05febab44cd369e27433bbf00e63e6271f6a350614bec453f5d0efd6503a31"),
|
||||
},
|
||||
],
|
||||
import: [
|
||||
{
|
||||
|
|
Reference in New Issue