티스토리 툴바

 

 

Notice»

Recent Trackback»

Archive»

« 2012/05 »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

https 인증서 & SSL

분류없음 | 2011/08/25 13:03 | Posted by 똘똘이뚱뚱이아빠
예전에 프로젝트를 진행하다가 회사 TV Portal의 인증서를 내가 직접 만들고 setup해야하는 일이 발생했었다. :-(...

SSL과 https에 대해서 원론 적인 내용을 fully 이해하고 있는 것은 아니지만..

잊어 먹지 않기 위한 끄적 거림을.. ^^..

 *  Network Packet capture & analyzer.
   * http://www.wireshark.org 에 있는 SW가 제일 좋은 듯...

 * TCP Layer에서의 Packet의 흐름 분석을 누가 한것..
   * http://www.moserware.com/2009/06/first-few-milliseconds-of-https.html 

 *  Secure sockets layer에 대한 IBM의 글.
   * http://publib.boulder.ibm.com/infocenter/tivihelp/v2r1/index.jsp?topic=%2Fcom.ibm.itame2.doc_5.1%2Fss7aumst18.htm 
   * 원론이 잘 적혀 있는 것 같음 :-) 
 
 * 관련 Link들.
   * http://en.wikipedia.org/wiki/Transport_Layer_Security
   * http://www.semicomplete.com/blog/geekery/ssl-latency.html

* OPEN SSL을 사용한 인증서 만드는 script.

 * root 인증서
   * openssl req -newkey rsa:2048 -sha1 -keyout rootkey_2k.pem -out rootreq_2k.pem -config root_2k.cnf  
     - 2048 bit key로 sha1을 사용해서 우선 root CA를 위한 key를 만든다.
   *  openssl x509 -req -in rootreq_2k.pem -days 7300 -sha1 -extfile root_2k.cnf -extensions certificate_extensions -signkey rootkey_2k.pem -text > rootcert_2k.pem
      - 이렇게 하면 우선 기본 적인 root 인증서가 생성됨.
   * format 변환 
      - 이놈의 바닥도 회사마다 SW마다 원하는 format이 틀려서..
        - PEM을 PFX format으로 바꾸는..
          : openssl pkcs12 -inkey rootkey_2k.pem -in rootcert_2k.pem -export -out rootcert_2k.pfx 
        - PEM을 DER format으로 바꾸는..
          : openssl x509 -in rootcert_2k.pem -inform PEM -out rootcert_2k.cer -outform DER

 * client or web server 인증서.
   * openssl req -newkey rsa:2048 -sha1 -keyout clientkey_2k.pem -out clientreq_2k.pem -config client_2k.cnf -reqexts req_extensions
     - 우선 key를 만든다..
   *  openssl rsa -in clientkey_2k.pem -out clientkey_2k.pem 
     - 요 단계는 인증서 교환시에 비밀번호를 안물어보기 위해서 :-)
   *  openssl x509 -req -in clientreq_2k.pem -days 7300 -sha1 -extfile client_2k.cnf -extensions certificate_extensions -CA ../2048bit-root/rootcert_2k.pem -CAkey ../2048bit-root/rootkey_2k.pem -CAcreateserial -text > clientcert_2k.pem 
     - 인증서를 만든다.
   * format 변환  (pem to p12)
    * openssl pkcs12 -export -in clientcert_2k.pem -inkey clientkey_2k.pem -certfile ../2048bit-root/rootcert_2k.pem -out  clientcert_2k.p12 
    * openssl pkcs12 -in clientcert_2k.p12 -out ccert_2k.pem -nodes
    * openssl pkcs12 -export -in ccert_2k.pem -out ccert_2k.p12 -nodes
    * openssl pkcs12 -info -in ccert_2k.p12 -nodes 

 * cnf 파일 관련.
  - 이거도 귀찮은데 우선 client인증서와 web server 인증서의 차이만을..
  - web server인증서 만드는데 이 part를 몰라서 한 이틀 헤맸었음.
    아래에서 파란색이 key point임. :-)
  - client 인증서용 part
[ certificate_extensions ]
basicConstraints = CA:false
nsCertType = client
nsComment  = "OpenSSL Generated Certificate"
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer:always 

  - web server 인증서용 part
[ certificate_extensions ]
basicConstraints = CA:false
nsCertType = server
keyUsage                = digitalSignature, keyEncipherment
extendedKeyUsage        = serverAuth, nsSGC, msSGC
nsComment = "OpenSSL Certificate for HumaxTvPortal SSL Web Server"
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always
저작자 표시 비영리 변경 금지
크리에이티브 커먼즈 라이선스
Creative Commons License