I am using Hybrid-Crypto.js for playing around with public/private key encryption. This function creates a random PEM-formatted RSA keypair
// Generate 2048 bit RSA key pair
rsa.generateKeypair(function(keypair) {
// Callback function receives new 2048 bit keypair as an argument
var publicKey = keypair.publicKey;
var privateKey = keypair.privateKey;
}, 2048); // Key size
However, I would like to create a keypair derived from email and password like being known from openpgp.js
var options = {
userIds: [{ name: 'Alicee', email: '[email protected]' }],
numBits: 2048,
passphrase: 'secretttoo'
};
var publicKeyAlice;
var privateKeyAlice;
openpgp.generateKey(options).then(key => {
privateKeyAlice = key.privateKeyArmored;
publicKeyAlice = key.publicKeyArmored;
console.log('Key generated');
});
Is there a way to create PEM/RSA keypairs like PGP-keys from fixed sources such that every time the same keypair gets created when the same inputs (email/password) is entered?