Easy-RSA Node.js
This module is for easier creation of CA and signing certificates with Node.js without create persistent files and oriented to storing in database.
How this works
To generate a new CA is very simple
const EasyRSA = require('@darkmaper/easyrsa-node');
const easyrsa = new EasyRSA({
country: "US",
province: "California",
city: "San Francisco",
org: "Example Organization",
email: "example@email.com",
ou: "Organizationar Unit Example",
cn: 'ChangeMe',
digest: 'sha256',
dn: 'cn_only',
keySize: 2048,
caExpire: 3650,
crlDays: 180,
certExpire: 825,
algo: 'rsa'
});
easyrsa.build_ca('testing','password').then((res) => {
console.log(res.privateKey, res.certificate);
});
import EasyRSA from '@darkmaper/easyrsa-node';
const easyrsa = new EasyRSA({
country: "US",
province: "California",
city: "San Francisco",
org: "Example Organization",
email: "example@email.com",
ou: "Organizationar Unit Example",
cn: 'ChangeMe',
digest: 'sha256',
dn: 'cn_only',
keySize: 2048,
caExpire: 3650,
crlDays: 180,
certExpire: 825,
algo: 'rsa'
});
easyrsa.build_ca('testing','password').then((res) => {
console.log(res.privateKey, res.certificate);
})
The output is the private key of CA and its certificate.