1

I've purchased a Comodo SSL certificate to make SSL server with express. I have these files.

AddTrustExternalCARoot.crt COMODORSAAddTrustCA.crt COMODORSADomainValidationSecureServerCA.crt mysite.com.key mysite.com.csr mysite_com.crt 

According to a lot of documents I need .pem files. But nobody is saying what is that .pem files?

var options = { key: fs.readFileSync('/key.pem'), cert: fs.readFileSync('/cert.pem'), ca: fs.readFileSync('/ca.pem') }; 

It'd be great if there is a tutorial.

3
  • possible duplicate of How to force SSL / https in Express.js (this answer specifically) Commented Nov 4, 2014 at 19:47
  • According to that answer I need to create new certrequest.csr. But I already bought my Comodo SSL with mysite.com.csr Commented Nov 4, 2014 at 20:11
  • This answer may be more helpful: stackoverflow.com/q/991758 Commented Nov 4, 2014 at 21:05

2 Answers 2

1

Try this answer. PEM is just a format than other SSL formats, and is very common.

Comodo may have already provided you a .pem file, but just named it .crt.
OR you may be able to request a .pem file in place of a DER-formatted file.
OR, you can use OpenSSL to convert from one format to another.

openssl rsa -inform DER -outform PEM -in mysite.com.key -out mysite.com.key.pem openssl x509 -inform DER -outform PEM -in mysite.com.crt -out mysite.com.crt.pem 
Sign up to request clarification or add additional context in comments.

Comments

0

Simply start ssl OR simple way to use PEM NPM

var https = require('https'), connect = require('connect'), fs = require("fs"); var port = 3000; var options = { key: fs.readFileSync('/key.pem'), cert: fs.readFileSync('/cert.pem'), ca: fs.readFileSync('/ca.pem') }; var app = express(); /* express setting */ server = require('https').createServer(options, app), server.listen(port); 

PEM npm is easiest way to start node server with SSL like

$> npm install pem var https = require('https'), pem = require('pem'), express = require('express'); pem.createCertificate({days:1, selfSigned:true}, function(err, keys){ var app = express(); https.createServer({key: keys.serviceKey, cert: keys.certificate}, app).listen(443); }); 

1 Comment

I didn't understand PEM NPM, can you a little explain? thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.