1

I have installed openSSl with cygwin and generated self singed certifikate like this

openssl genrsa -out server.key 2048

openssl req -new -key server.key -out csr.pem

openssl x509 -req -in csr.pem -signkey server.key -out cert.pem

i tried to test if i was succesfull so i created a basic tls connection with node

var tls=require("tls");
var fs=require("fs");
var serverOptions={
    key:fs.readFileSync('C:/cygwin64/home/Matej/csr.pem'),
    cert:fs.readFileSync('C:/cygwin64/home/Matej/cert.pem')
}
var server=tls.createServer(serverOptions);
server.listen(4001)

but it threw error

        c.context.setKey(options.key);
                  ^
Error: error:0906D06C:PEM routines:PEM_read_bio:no start line

i quite dont understand what does the erron mean. Did i generated the key/certifikate wrong?

I tried looking here but my pem files does not contain ^M .My cert looks like

-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- and csr

-----BEGIN CERTIFICATE REQUEST----- ... -----END CERTIFICATE REQUEST-----

Community
  • 1
  • 1
Darlyn
  • 4,715
  • 12
  • 40
  • 90
  • 1
    The key should be `server.key` and not `csr.pem` – aghidini Sep 14 '15 at 18:24
  • possible duplicate of [OpenSSL: PEM routines:PEM\_read\_bio:no start line:pem\_lib.c:703:Expecting: TRUSTED CERTIFICATE](http://stackoverflow.com/questions/20837161/openssl-pem-routinespem-read-biono-start-linepem-lib-c703expecting-truste) – Pawel Gumiela Sep 14 '15 at 18:25
  • that link does not solve my problem – Darlyn Sep 14 '15 at 18:48

0 Answers0