- 출처: https://blusky10.tistory.com/352 참조함
- 개인키 생성
openssl genrsa -out private.key 2048
- 개인키로 공개키 생성
openssl rsa -in private.key -pubout -out public.key
- CSR 생성 (Certificate Signing Request - 인증서 서명 요청)
openssl req -new -key private.key -out private.csr
- CRT 인증서 만들기
-
openssl req -x509 -days 365 -key private.key -in private.csr -out mycommoncrt.crt -days 365
-
openssl x509 -in mycommoncrt.crt -out mycommonpem.pem -outform PEM
-
mycommonpem.pem 과 private.key 가 필요하다!!!
-
openssl genrsa 1024 > private.pem
-
openssl req -x509 -new -key private.pem > public.pem
-
한 뒤, 두 파일을 생성하는 방법도 있다
const https = require('https');
const options = {
key: fs.readFileSync( "./private.key", "utf8" ),
cert: fs.readFileSync( "./mycommonpem.pem", "utf8" )
};
var server = https.createServer(options,function (요청, 응답) { (//이하 생략....```