Program 기타

Code Signing 만들기 (OpenSSL 이용)

홍사훈     0건     314회

본문

## 작업절차 요약

1. Root CA생성 (key 개인키, crt 인증서파일)

  > openssl.exe req -x509 -sha256 -newkey rsa:4096 -keyout ca.key -out ca.crt -days 3650 -nodes

2. Intermediate CA생성 (key 개인키, csr 중앙 인증파일생성을 위한 요청파일)

  > openssl.exe req -new  -sha256 -newkey rsa:4096 -keyout inter-ca.key -out inter-ca.csr
3. Root CA로 부터 Intermediate CA를 발급
  > openssl.exe x509 -req -sha256 -days 3650 -CA ca.crt -CAkey ca.key -set_serial 1 -in inter-ca.csr -out inter-ca.crt
4.개인키, 루트인증서 등을 모두 담겨있는 pfx 파일생성
  > openssl.exe pkcs12 –export –out Certification.pfx –inkey inter-ca.key –in inter-ca.crt

----------------------------

## OpenSSL 다운로드 및 설치 

  1. https://slproweb.com/products/Win32OpenSSL.html 에서 사용OS에 맞는 OpenSSL다운로

 

## 모든 작업은 관리자로 실행된 Command창을 이용합니다.  

  1. [Win]+[R] 키를 눌러 실행창을 실행합니다.

  2. cmd 를 입력하고, [Shift]+[Ctrl]+[Enter]키를 누르면, 관리자로 Command가 실행됩니다.

  3. 작업하기 쉽게 OpenSSL이 설치된 경로를 Path에 추가합니다.

    c:\Windows\system32> path = %path%;C:\Program Files\OpenSSL-Win64\bin; 

 

## 루트(Root CA) 인증서와 개인키 생성

●\> openssl.exe req -x509 -sha256 -newkey rsa:4096 -keyout ca.key -out ca.crt -days 3650 -nodes

    Country Name (2 letter code) [AU] : KR

    State or Province Name (full name) [Some-State] : Seoul

    Locality Name (eg, city) []: Songpa-gu

    Organization Name (eg, company) [Internet Widgits Pty Ltd]: OOSoft Inc

    Organizational Unit Name (eg, section) []:

    Common Name (e.g. server FQDN or YOUR name) []: OOSoft Root CA

    Email Address []:


## 중간 인증 (Intermediate CA) 인증서와 개인키 생성

  1. Intermediate CA생성 (key 개인키, csr 중앙 인증파일생성을 위한 요청파일) 

●\> openssl.exe req -new -sha256 -newkey rsa:4096 -keyout inter-ca.key -out inter-ca.csr 

    Enter PEM pass phrase : <<PEM 패스워드 입력>>

    Verifying - Enter PEM pass phrase:

    -----

    Country Name (2 letter code) [AU] : KR

    State or Province Name (full name) [Some-State] : Seoul

    Locality Name (eg, city) [] : Songpa-gu

    Organization Name (eg, company) [Internet Widgits Pty Ltd] : OOSoft Inc (Intermediate)

    Organizational Unit Name (eg, section) [] :

    Common Name (e.g. server FQDN or YOUR name) [] : OOSoft Intermediate CA

    Email Address []:


    Please enter the following 'extra' attributes to be sent with your certificate request

    A challenge password [] : 

    An optional company name [] : Company

 

  2. Root CA로 부터 Intermediate CA를 발급

●\> openssl.exe x509 -req -sha256 -days 3650 -CA ca.crt -CAkey ca.key -set_serial 1 -in inter-ca.csr -out inter-ca.crt

    Certificate request self-signature ok

    subject=C=KR, ST=Seoul, L=Songpa-go, O=Sub-OO Soft, CN=Sub-OO Certification


## 코드사이닝(code signing)을 위한 pfx파일 생성

●\> openssl.exe pkcs12 –export –out Cert.pfx –inkey inter-ca.key –in inter-ca.crt

    Enter pass phrase for sub-ca.key: <<PEM 패스워드 입력>>

    Enter Export Password : <<pfx에 사용될 패스워드 입력>>

    Verifying – Enter Export Password:


## signtool을 이용한 코드 사이닝(code signing)

●\> signtool sign /f Cert.pfx /p pfx_패스워드 /fd SHA256 /td SHA256 /tr http://timestamp.digicert.com 실행파일.exe

    Done Adding Additional Store

    Successfully signed: 실행파일.exe


## 코드사이닝 입력 정보

[C] Country Name (2 letter code) [AU] : KR

   AR:Argentina    AT:Austria      AU:Australia    BE:Belgium      BR:Brazil      CA:Canada   CH:Switzerland

   CL:Chile        CN:China        CZ:Czech Republic               DE:Germany     DK:Denmark  EG:Egypt        

   ES:Spain        EU:Europe (special status in ISO-3166)          FI:Finland     FR:France   GB:United Kingdom

   GR:Greece       HK:Hong Kong    HU:Hungary      ID:Indonesia    IE:Ireland     IL:Israel   IN:India

   IS:Iceland      IT:Italy        JP:Japan        KR:South Korea  LU:Luxembourg  MX:Mexico   MY:Malaysia

   NL:Netherlands  NO:Norway       NZ:New Zealand  PL:Poland       PT:Portugal    RU:Russia   SA:Saudi Arabia

   SE:Sweden       SG:Singapore    SK:Slovakia     TH:Thailand     TR:Turkey      US:United States

   ZA:South Africa

[S] State or Province Name (full name) [Some-State] : Seoul

[L] Locality Name (eg, city) []: Songpa-gu

[O] Organization Name (eg, company) [Internet Widgits Pty Ltd]: OO Soft

[OU] Organizational Unit Name (eg, section) []:

[CN] Common Name (e.g. server FQDN or YOUR name) []: OO Certification

[E] Email Address []:

등록된 댓글이 없습니다.



Copyrightⓡ1996~2025, sahoon.com All Rights Reserved.