diff --git a/src/runtime/node/rsaes.ts b/src/runtime/node/rsaes.ts index e9eb3be9bc..7462097054 100644 --- a/src/runtime/node/rsaes.ts +++ b/src/runtime/node/rsaes.ts @@ -1,4 +1,6 @@ import { KeyObject, publicEncrypt, constants, privateDecrypt } from 'node:crypto' +import { deprecate } from 'node:util' + import type { RsaEsDecryptFunction, RsaEsEncryptFunction } from '../interfaces.d' import checkKeyLength from './check_key_length.js' import { isCryptoKey } from './webcrypto.js' @@ -14,6 +16,11 @@ const checkKey = (key: KeyObject, alg: string) => { checkKeyLength(key, alg) } +const RSA1_5 = deprecate( + () => constants.RSA_PKCS1_PADDING, + 'The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.', +) + const resolvePadding = (alg: string) => { switch (alg) { case 'RSA-OAEP': @@ -22,7 +29,7 @@ const resolvePadding = (alg: string) => { case 'RSA-OAEP-512': return constants.RSA_PKCS1_OAEP_PADDING case 'RSA1_5': - return constants.RSA_PKCS1_PADDING + return RSA1_5() default: return undefined }