fix: disable DES-CBC for Node v18

This commit is contained in:
microshine 2023-03-21 20:04:52 +01:00
parent 057b7c481f
commit 1ebf9006e6
2 changed files with 12 additions and 4 deletions

View File

@ -30,7 +30,10 @@ export class SubtleCrypto extends core.SubtleCrypto {
//#endregion //#endregion
//#region DES //#region DES
const ciphers = crypto.getCiphers();
if (ciphers.includes("des-cbc")) {
this.providers.set(new DesCbcProvider()); this.providers.set(new DesCbcProvider());
}
this.providers.set(new DesEde3CbcProvider()); this.providers.set(new DesEde3CbcProvider());
//#endregion //#endregion

View File

@ -1,5 +1,6 @@
import assert from "assert"; import assert from "node:assert";
import process from "process"; import nodeCrypto from "node:crypto";
import process from "node:process";
import { WebcryptoTest } from "@peculiar/webcrypto-test"; import { WebcryptoTest } from "@peculiar/webcrypto-test";
import { Convert } from "pvtsutils"; import { Convert } from "pvtsutils";
import * as core from "webcrypto-core"; import * as core from "webcrypto-core";
@ -10,7 +11,11 @@ const nodeMajorVersion = parseInt(/^v(\d+)/.exec(process.version)![1], 10);
const crypto = new Crypto(); const crypto = new Crypto();
WebcryptoTest.check(crypto as any, {}); const ciphers = nodeCrypto.getCiphers();
WebcryptoTest.check(crypto as any, {
DESCBC: !ciphers.includes("des-cbc"),
});
context("Crypto", () => { context("Crypto", () => {
context("getRandomValues", () => { context("getRandomValues", () => {