hmac: round generate algorithm length

This commit is contained in:
microshine 2020-04-18 23:17:36 +03:00
parent e24525f71d
commit 65ae70ac68
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import { HmacCryptoKey } from "./key";
export class HmacProvider extends core.HmacProvider { export class HmacProvider extends core.HmacProvider {
public async onGenerateKey(algorithm: HmacKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey> { public async onGenerateKey(algorithm: HmacKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey> {
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(); const key = new HmacCryptoKey();
key.algorithm = { key.algorithm = {
...algorithm as any, ...algorithm as any,