-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.stale
Description
I cannot use ursa
anymore at node v10. So I'm trying to move to native crypto.
But the problem is, native crypto seems not support create public key from components.
So, why don't you support create public key from components method?
- ursa can create public key like this,
const ursa = require('ursa');
// modulus should be a base64/base64Url string
const modulus = new Buffer(modulusStr, 'base64');
// exponent should be base64/base64url
const exponent = new Buffer('AQAB', 'base64');
const pubKey = ursa.createPublicKeyFromComponents(modulus, exponent);
console.info(pubKey.toPublicPem('utf8'));
// ------BEGIN PUBLIC KEY------
// ...
- node-rsa way
const nodeRSA = require('node-rsa');
const key = new nodeRSA();
const modulus = new Buffer(modulusStr, 'base64');
const exponent = new Buffer('AQAB', 'base64');
const pubKey = key.importKey({ n: modulus, e: exponent }, 'components-public');
console.info(pubKey.exportKey('pkcs8-public-pem'));
// ------BEGIN PUBLIC KEY------
// ...
heycalmdown, YunzheZJU, willclarktech, christianhaller3000, PlusMa and 2 more
Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.stale