cert-utils v1.2.0
npm install #1.2.0
const certUtils = require('cert-utils');
certUtils.der(cert)
Convert a certificate to DER format.
certUtils.der(
fs.readFileSync('cert.pem')
).then(cert => {
console.log(cert); // <= `cert` is a Buffer object
});
certUtils.req(options)
Generate a CSR in either PEM or DER format.
Options:
key: string|buffer
The private key in PEM formatformat: string?
The output format (defaults toPEM
)domain: string?
The validated domain, overridesdomains
domains: string|array?
The validated domain(s)subject: object?
The details embedded in the CSR, all keys are optional stringsemail
country
state
city
company
division
certUtils.req({
key: fs.readFileSync('key.pem'),
domain: 'example.com',
subject: {
email: '[email protected]',
country: 'US',
state: 'CA',
city: 'Palo Alto',
company: 'Google',
}
}).then(csr => {
console.log(csr); // <= `csr` is a Buffer object
});