添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Show hidden characters

how to store a public and private key in a single-string and later use it in encrypt/decrypt logic

what i had in mind is this

const publicKey = "";
const encryptedData = crypto.publicEncrypt(
		key: Buffer.from(publicKey),
......

tried using this but got error : Error: error:0909006C:PEM routines:get_name:no start line

Hi @sohamkamani,
I am new in node.js. Can you please share your package.json file or let me know what module to be installed via npm to make your code working. What module to install for - const crypto = require("crypto")? When I searched https://www.npmjs.com/ for crypto, I didn't find anything matching exactly. Please share the URL of the module name in npmjs.com if possible.