Reputation: 28090
I tried to create a self-signed certificate based on the instructions in the link in Security key and cert for mosca MQTT broker.
$ openssl genrsa -des3 -out tls-key.pem 1024 (works fine)
$ openssl req -new -key tlk-key -out server.csr (returns error)
The error looks like this on cygwin;
Error opening Private Key tlk-key 6870300:error:02001002:system library:fopen:No such file or directory:bss_file.c:391:fopen('tlk-key','rb') 6870300:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:393: unable to load Private Key
On Ubuntu 16.04, the error looks like this;
Error opening Private Key tlk-key 140137729443480:error:02001002:system library:fopen:No such file or directory:bss_file.c:398:fopen('tlk-key','r') 140137729443480:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:400: unable to load Private Key
I tried with cygwin and Ubuntu. Can anyone advise what went wrong?
EDIT: I tried the command below after getting the answer from Steffen Ullrich. It still returns an error.
$ openssl req -new -key tlk-key.pem -out server.csr
Error opening Private Key tlk-key.pem 6870300:error:02001002:system library:fopen:No such file or directory:bss_file.c:391:fopen('tlk-key.pem','rb') 6870300:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:393: unable to load Private Key
Upvotes: 2
Views: 13818
Reputation: 123531
You create the key file tls-key.pem
but then try to use the non-existing file tlk-key
instead of the file you've created:
$ openssl genrsa -des3 -out tls-key.pem 1024 (works fine)
^^^^^^^^^^^^
$ openssl req -new -key tlk-key -out server.csr (returns error)
^^^^^^^
Upvotes: 2