Ajay
Ajay

Reputation: 604

Generate a valid private/public key pair

I generated rsa key pair using below commands (tested on both Mac and Linux)

openssl genrsa -out private_key.pem 2048
openssl rsa -pubout -in private_key.pem -out public_key.pem

I sent private key to CloudFront to get a signed cookie but I got below error from CloudFront:

node:internal/crypto/sig:131
  const ret = this[kHandle].sign(data, format, type, passphrase, rsaPadding,
                            ^

Error: error:0909006C:PEM routines:get_name:no start line
    at Sign.sign (node:internal/crypto/sig:131:29)

I validated the private key on https://www.sslchecker.com/certdecoder and got Not a proper format or SSL file is corrupted. I verified a key generated on https://cryptotools.net/rsagen but that is also not accepted.

How to generate a private key correctly?

Upvotes: 1

Views: 1345

Answers (1)

DmitriKonnov
DmitriKonnov

Reputation: 41

Check here chapter 2, page 3-5. Maybe this error is down to missing line:

https://www.rfc-editor.org/rfc/rfc7468

Upvotes: 0

Related Questions