개발

pfx 파일을 pem파일로 변환시키자

빠빠담 2021. 7. 26. 15:57
반응형

 

프로젝트 막바지 ssl을 고객사에서 전달해 줬는데 IIS용으로 전달해 주었다.

압축을 풀어보니 crt 파일과 pfx 파일이 있다...

안에 데이터가 바이너리 형식인 것으로 보아 cert와 key를 묶어 하나의 바이너리 파일로 만든것 같다.

pfx는 처음 보는 확장자여서 pem으로 변환시켜 Nginx 에 적용시켜 주었다.

 

openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem

위 명령어로 cert 파일을 뽑아낸다

가 뜨는 경우 암호를 입력해주자

 

openssl pkcs12 -in filename.pfx -nocerts -out key.pem

위 명령어로 key 파일을 뽑아낸다.

기존 암호와 함께 새로 뽑아내는 key의 암호를 설정한다.

 

        listen       443 ssl;
        server_name  domain.com;
 
 
        ssl_certificate      /usr/local/nginx/cert.pem;
        ssl_certificate_key  /usr/local/nginx/key.pem;
        ssl_password_file    /usr/local/password.txt;

Nginx는 위와같이 설정해주자.

 

 

 

 

아래 사이트를 참고하였다.

 

https://www.xolphin.com/support/Certificate_conversions/Convert_pfx_file_to_pem_file

 

Convert pfx file to pem file

Convert pfx file to pem file Conversion to a combined PEM file To convert a PFX file to a PEM file that contains both the certificate and private key, the following command needs to be used: # openssl pkcs12 -in filename.pfx -out cert.pem -nodes Conversion

www.xolphin.com

 

 

반응형

'개발' 카테고리의 다른 글

Slack Webhook  (0) 2021.12.26
큰 단위의 설계만이 설계가 아니다.  (0) 2021.09.04
sed - ipv4 찾아 현재 pub ip로 변경  (0) 2021.07.19
Java - GC  (0) 2021.02.16
FFMPEG - to mp4  (0) 2021.01.17