Add optional test param 'wrappedKey' to test helper
This commit is contained in:
parent
79e553d06c
commit
53b8ab534c
|
@ -89,6 +89,7 @@ context("AES", () => {
|
|||
name: "AES-CBC",
|
||||
iv: Buffer.from("1234567890abcdef"),
|
||||
} as AesCbcParams,
|
||||
wrappedKey: Convert.FromHex("c630c4bf95977db13f386cc950b18e98521d54c4fda0ba15b2884d2695638bd9"),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -74,6 +74,7 @@ export interface ITestWrapKeyAction extends ITestAction {
|
|||
key: IImportKeyParams | IImportKeyPairParams;
|
||||
algorithm: Algorithm;
|
||||
wKey: IImportKeyParams;
|
||||
wrappedKey?: BufferSource;
|
||||
}
|
||||
|
||||
export interface ITestImportAction extends IImportKeyParams, ITestAction {
|
||||
|
@ -336,6 +337,10 @@ export function testCrypto(crypto: Crypto, params: ITestParams[]) {
|
|||
|
||||
const wrappedKey = await crypto.subtle.wrapKey(action.wKey.format, wKey, key.publicKey, action.algorithm);
|
||||
|
||||
if (action.wrappedKey) {
|
||||
assert.equal(Convert.ToHex(wrappedKey), Convert.ToHex(action.wrappedKey));
|
||||
}
|
||||
|
||||
const unwrappedKey = await crypto.subtle.unwrapKey(
|
||||
action.wKey.format,
|
||||
wrappedKey,
|
||||
|
|
Reference in New Issue