fix: disable DES-CBC for Node v18
This commit is contained in:
parent
057b7c481f
commit
1ebf9006e6
|
@ -30,7 +30,10 @@ export class SubtleCrypto extends core.SubtleCrypto {
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region DES
|
//#region DES
|
||||||
this.providers.set(new DesCbcProvider());
|
const ciphers = crypto.getCiphers();
|
||||||
|
if (ciphers.includes("des-cbc")) {
|
||||||
|
this.providers.set(new DesCbcProvider());
|
||||||
|
}
|
||||||
this.providers.set(new DesEde3CbcProvider());
|
this.providers.set(new DesEde3CbcProvider());
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
|
@ -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", () => {
|
||||||
|
|
Reference in New Issue