From cf16c8af492632c75267678b6da889732ee2a82d Mon Sep 17 00:00:00 2001 From: Jackson Roberts Date: Wed, 25 Feb 2026 21:40:35 -0600 Subject: [PATCH] pkcs1 err --- src/modules/credentials/generateSecureValue.ts | 6 +++++- src/modules/credentials/readSecureValue.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/credentials/generateSecureValue.ts b/src/modules/credentials/generateSecureValue.ts index 3b584a1..9565ba9 100644 --- a/src/modules/credentials/generateSecureValue.ts +++ b/src/modules/credentials/generateSecureValue.ts @@ -7,7 +7,11 @@ export const generateSecureValue = (content: string) => { const hash = Password.hash(content); // Parse the PKCS#1 PEM key into a proper KeyObject - const publicKey = crypto.createPublicKey(secureValuesPublicKey); + const publicKey = crypto.createPublicKey({ + key: secureValuesPublicKey, + format: "pem", + type: "pkcs1", + }); // Encrypt the content using the .secureValues.pub public key const encrypted = crypto.publicEncrypt( diff --git a/src/modules/credentials/readSecureValue.ts b/src/modules/credentials/readSecureValue.ts index dda7548..1010831 100644 --- a/src/modules/credentials/readSecureValue.ts +++ b/src/modules/credentials/readSecureValue.ts @@ -3,7 +3,11 @@ import crypto from "crypto"; import { secureValuesPrivateKey } from "../../constants"; import GenericError from "../../Errors/GenericError"; -const privateKey = crypto.createPrivateKey(secureValuesPrivateKey); +const privateKey = crypto.createPrivateKey({ + key: secureValuesPrivateKey, + format: "pem", + type: "pkcs1", +}); export const readSecureValue = ( encryptedContent: string,