Skip to content

Instantly share code, notes, and snippets.

@xmpf
Created December 5, 2021 17:34
Show Gist options
  • Save xmpf/11a3ccb2586416b27a0a67ab3e3e9ae9 to your computer and use it in GitHub Desktop.
Save xmpf/11a3ccb2586416b27a0a67ab3e3e9ae9 to your computer and use it in GitHub Desktop.
Generate Private and Public key using Node
// $ npm install node-rsa
const NodeRSA = require('node-rsa');
const keyPair = new NodeRSA({b: 512}).generateKeyPair();
const publicKey = keyPair.exportKey('public')
const privateKey = keyPair.exportKey('private')
console.log(publicKey);
console.log("\n\n");
console.log(privateKey);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment