From 65ae70ac68f5e9c44c80c8619c8651b15a34c4dd Mon Sep 17 00:00:00 2001 From: microshine Date: Sat, 18 Apr 2020 23:17:36 +0300 Subject: [PATCH] hmac: round generate algorithm length --- src/mechs/hmac/hmac.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mechs/hmac/hmac.ts b/src/mechs/hmac/hmac.ts index 40de998..f2267cd 100644 --- a/src/mechs/hmac/hmac.ts +++ b/src/mechs/hmac/hmac.ts @@ -7,7 +7,7 @@ import { HmacCryptoKey } from "./key"; export class HmacProvider extends core.HmacProvider { public async onGenerateKey(algorithm: HmacKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise { - const length = algorithm.length || this.getDefaultLength((algorithm.hash as Algorithm).name); + const length = (algorithm.length || this.getDefaultLength((algorithm.hash as Algorithm).name)) >> 3 << 3; const key = new HmacCryptoKey(); key.algorithm = { ...algorithm as any,