주 메뉴 열기

wwiki β

Openssl

Jhkim (토론 | 기여)님의 2020년 3월 25일 (수) 03:22 판 (pfx)

목차

개인키 생성

genrsa -out private.key 1024

비밀번호 제거

openssl rsa -in key.pem.orig -out key.pem

개인키로 파일 암복호화

openssl rsautl -encrypt -inkey public.pem -pubin -in file.txt -out file.ssl;

openssl rsautl -decrypt -inkey private.pem -in file.ssl -out decrypted.txt

공개키 생성

openssl rsa -in private.key -out public.key -pubout -outform derwriting

PEM포맷으로 생성

openssl rsa -in private.key -out public.key -pubout

인증서

인증서 생성

private.key로 만든 인증서

일반적으로 윈도우에서 .crt파일로 생성하고 리눅스등에서 .pem으로 생성하기도 한다.

openssl req -new -x509 -days 365 -key private.key -out cert.crt -config C:\openssl\ssl\openssl.cnf

국가코드: KR

인증서의 내용

인증서는 pem포맷으로 윈도우의 경우 crt확장자를 인증서로 인식한다. 더블클릭하면 발급대상과 발급자가 있으며, 자세히를 보면 버전, 서명 알고리즘, 유효기간, 주체, 공개키 등이 있다.

인증서 내용 보기
$ openssl x509 -text -noout -in localhost.crt
웹서버용 인증서

Let's Encrypt certificate

pfx

MS에서 사용하는 personal information exchange syntax standard(개인정보 교환 구문 표준)인 pkcs12포맷의 확장자

인증서와 개인키로 생성

crt(pem포맷의 인증서)와 key(pem포맷의 개인키)로부터 생성

  openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

인증서로 생성

cer 인증서 생성

openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes

개인키 추출

$ openssl.exe pkcs12 -in my.pfx -nocerts -nodes -out private.key

SSL/TLS client program

$ openssl s_client
$ openssl s_client -showcerts -connect wiki.wnote.ga:443