feat: integrate webcrypto-liner for legacy algorithm support in S/MIME handling

This commit is contained in:
Linus Rath
2026-03-18 14:29:29 +01:00
parent 84abfe79dd
commit 8a2ef5a6c5
6 changed files with 281 additions and 12 deletions
+3 -5
View File
@@ -8,6 +8,7 @@
import * as pkijs from 'pkijs';
import * as asn1js from 'asn1js';
import type { SmimeKeyRecord } from './types';
import { getLinerCryptoEngine } from './crypto-engine';
export interface DecryptionInput {
/** Raw CMS EnvelopedData bytes (DER) */
@@ -359,11 +360,8 @@ async function decryptWithKey(
const certAsn1 = asn1js.fromBER(keyRecord.certificate);
const cert = new pkijs.Certificate({ schema: certAsn1.result });
const cryptoEngine = new pkijs.CryptoEngine({
crypto: crypto,
subtle: crypto.subtle,
name: 'webcrypto',
});
// Use webcrypto-liner engine for legacy algorithm support (e.g. 3DES)
const cryptoEngine = getLinerCryptoEngine();
const result = await envelopedData.decrypt(
recipientIndex,