Dexus / pem

Create private keys and certificates with node.js
Other
570 stars 129 forks source link

RSA PRIVATE KEY not found from openssl output #346

Closed anthonyvercolano closed 1 year ago

anthonyvercolano commented 2 years ago

Using a nodejs script to create a self signed cert on a windows 11 machine. Have installed openssl 3.0.5

Have:

  certOptions.config = [
    '[req]',
    'req_extensions = v3_req',
    'distinguished_name = req_distinguished_name',
    'x509_extensions = v3_ca',
    '[req_distinguished_name]',
    'commonName = ' + commonName,
    '[v3_req]',
    'basicConstraints = critical, CA:true'
  ].join('\n');

invoked pem.createCertificate(certOptions, function(err,cert) {...}) The err.message is:

RSA PRIVATE KEY not found from openssl output:
---stdout---
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCquk7hP6hpIOv0
: Deleted most of the key so that hopefully this doesn't get tagged as a posted secret.
-----END PRIVATE KEY-----

---stderr---

This works on my mac. Fails on my windows (and a customers windows box). Using Node 16.17.0

Uzlopak commented 1 year ago

Duplicate of #316

kolserdav commented 1 year ago

The same error with OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022)

tkurki commented 1 year ago

A potential replacement for self signed cert generation: https://www.npmjs.com/package/devcert

Uzlopak commented 1 year ago

I replaced pem with self-cert.

Dexus commented 1 year ago

This should now fixed by release of 1.14.7 https://www.npmjs.com/package/pem/v/1.14.7 Thanks to @diegoholiveira and @misi