title: Error while creating self-signed SSL certificate
body: <p>I tried to create a self-signed certificate based on the instructions in the link in <a href="https://stackoverflow.com/questions/39913842/security-key-and-cert-for-mosca-mqtt-broker">Security key and cert for mosca MQTT broker</a>. </p>
  
  <pre><code>$ openssl genrsa -des3 -out tls-key.pem 1024 (works fine)
  
  $ openssl req -new -key tlk-key -out server.csr (returns error)
  </code></pre>
  
  <p>The error looks like this on cygwin;</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>On Ubuntu 16.04, the error looks like this; </p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>I tried with cygwin and Ubuntu. Can anyone advise what went wrong?</p>
  
  <p>EDIT:
  I tried the command below after getting the answer from Steffen Ullrich. It still returns an error.</p>
  
  <pre><code>$ openssl req -new -key tlk-key.pem -out server.csr
  </code></pre>
  
  <blockquote>
    <p>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</p>
  </blockquote>