the code looks right to me. (i asked that question a while ago in
stackoverflow
http://stackoverflow.com/questions/11804202/how-to-setup-a-ssl-cert-in-express-js-server-now
)
Hmm or you can try fs.readFileSync("....") without toString()
On Tue, Jan 8, 2013 at 4:11 AM, vaibhav mande <[email protected]>wrote:
>
> Hello,
>
> I Am trying to implement node server with https, but facing some
> problems.
>
> This is what I have done so far :-
>
> I submitted csr to geotrust and got crt and intermediate bundle crt.
>
> My current node.js code :-
>
> var fs = require('fs');
> var privateKey =
> fs.readFileSync('/path_to_certificate/xxx.doamin.com.key').toString();
> var certificate =
> fs.readFileSync('/path_to_certificate/xxx.domain.com.crt').toString();
> var cacert =
> fs.readFileSync('/path_to_certificate/xxx.domain.com.gd_bundle.crt').toString();
>
> var express = require('express')
> , io = require('socket.io')
> , app = express()
> , server = require('https').createServer({key: privateKey, cert:
> certificate, ca:cacert}, app);
> , io = io.listen(server)
>
> server.listen(PORT);
>
> app.get('/', function (req, res){
> fs.readFile(__dirname + '/socket_loader.html',
> function (err, data){
> if (err){
> res.writeHead(500);
> return res.end('Error loading socket loader.html');
> }
> res.writeHead(200);
> res.end(data);
> });
> });
>
> When I Am trying to connect using curl, this is the error I get :-
>
> # curl -vsk https://xxx.domain.com:PORT
> * About to connect() to xxx.domain.com port 'PORT' (#0)
> * Trying xx.xx.xx.xx... connected
> * Connected to xxx.domain.com (xx.xx.xx.xx) port 'PORT' (#0)
> * Initializing NSS with certpath: sql:/etc/pki/nssdb
> * warning: ignoring value of ssl.verifyhost
> * NSS error -5938
> * Closing connection #0
> * SSL connect error
>
> Any help on this matter will be appreciated.
> Thank you,
> Vaibhav Mande
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en