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,