pkcs1 err
This commit is contained in:
@@ -7,7 +7,11 @@ export const generateSecureValue = (content: string) => {
|
|||||||
const hash = Password.hash(content);
|
const hash = Password.hash(content);
|
||||||
|
|
||||||
// Parse the PKCS#1 PEM key into a proper KeyObject
|
// 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
|
// Encrypt the content using the .secureValues.pub public key
|
||||||
const encrypted = crypto.publicEncrypt(
|
const encrypted = crypto.publicEncrypt(
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import crypto from "crypto";
|
|||||||
import { secureValuesPrivateKey } from "../../constants";
|
import { secureValuesPrivateKey } from "../../constants";
|
||||||
import GenericError from "../../Errors/GenericError";
|
import GenericError from "../../Errors/GenericError";
|
||||||
|
|
||||||
const privateKey = crypto.createPrivateKey(secureValuesPrivateKey);
|
const privateKey = crypto.createPrivateKey({
|
||||||
|
key: secureValuesPrivateKey,
|
||||||
|
format: "pem",
|
||||||
|
type: "pkcs1",
|
||||||
|
});
|
||||||
|
|
||||||
export const readSecureValue = (
|
export const readSecureValue = (
|
||||||
encryptedContent: string,
|
encryptedContent: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user