convert PKCS#1 keys to PKCS#8 at load time
This commit is contained in:
@@ -6,12 +6,8 @@ export const generateSecureValue = (content: string) => {
|
||||
// Generate a hash of the content
|
||||
const hash = Password.hash(content);
|
||||
|
||||
// Parse the PKCS#1 PEM key into a proper KeyObject
|
||||
const publicKey = crypto.createPublicKey({
|
||||
key: secureValuesPublicKey,
|
||||
format: "pem",
|
||||
type: "pkcs1",
|
||||
});
|
||||
// Parse the PEM key into a proper KeyObject
|
||||
const publicKey = crypto.createPublicKey(secureValuesPublicKey);
|
||||
|
||||
// Encrypt the content using the .secureValues.pub public key
|
||||
const encrypted = crypto.publicEncrypt(
|
||||
|
||||
@@ -3,11 +3,7 @@ import crypto from "crypto";
|
||||
import { secureValuesPrivateKey } from "../../constants";
|
||||
import GenericError from "../../Errors/GenericError";
|
||||
|
||||
const privateKey = crypto.createPrivateKey({
|
||||
key: secureValuesPrivateKey,
|
||||
format: "pem",
|
||||
type: "pkcs1",
|
||||
});
|
||||
const privateKey = crypto.createPrivateKey(secureValuesPrivateKey);
|
||||
|
||||
export const readSecureValue = (
|
||||
encryptedContent: string,
|
||||
|
||||
Reference in New Issue
Block a user