项目作者: NeverOddOrEven

项目描述 :
Generate a self-signed openssl certificate valid for localhost, IP v4 127.0.0.1, and IP v6 ::1.
高级语言: JavaScript
项目地址: git://github.com/NeverOddOrEven/self-signed-ssl.git
创建时间: 2018-05-14T16:09:47Z
项目社区:https://github.com/NeverOddOrEven/self-signed-ssl

开源协议:

下载


Create a self-signed certificate

I frequently have to google instructions for how to generate SSL certs. Therefore, I created this repository to remove one more obstacle to properly securing endpoints.

This configuration generates a certificate valid for localhost, IP v4 127.0.0.1, and IP v6 ::1.

Usage

From your shell:

  1. ./generate.sh

Commands

Create a self-signed localhost certificate

  1. mkdir -p output
  2. openssl req -config cert.config -new -x509 \
  3. -sha256 -newkey rsa:2048 -nodes \
  4. -keyout output/localhost.key.pem -days 365 \
  5. -out output/localhost.cert.pem

Show the certificate details

  1. openssl x509 -in output/localhost.cert.pem -text -noout

Create a signing request

  1. openssl req -config cert.config -new -sha256 -newkey rsa:2048 -nodes \
  2. -keyout output/localhost.key.pem -days 365 -out output/localhost.req.pem

Testing

Start a simple NodeJs server and call with curl, passing the self-signed cert to validate HTTPS.

  1. ./test.sh

Credit

Go to the original Stack Overflow question.