2010年6月1日 星期二

P12 與 host.pem 和 cert.pem

我們可以有兩種對 key 作法:
1. 將 key.pem 與 hostcert.pem 合成 P12
2. 將 P12 拆成 key.pem 與 hostcert.pem


A. 將 key.pem 與 hostcert.pem 合成 p12
I. 會要求輸入 key.pem passwd
II. 會需要 P12 Export passwd
openssl pkcs12 -export -chain \
-inkey $keyPath/hostkey.pem \
-in $keyPath/hostcert.pem \
-out $keyPath/host.p12 \
-CApath /etc/grid-security/certificates/ \
-name "vt-004"



B. 將 P12 拆成 key.pem 與 hostcert.pem
I 會要輸入 P12 Import passwd
2. 要求建立新的 key.pem passwd
$ openssl pkcs12 -in xxxx.pfx(p12) -clcerts -nokeys -out usercert.pem
$ openssl pkcs12 -in xxxx.pfx(p12) -nocerts -out userkey.pem


C. 可以用 openssl 看 certficate 資訊
{{{
openssl x509 -in 06B3.crt -noout -text

}}}
Note:
1. 有時在將 key 合成 p12 時, 會不用輸入 key passwd(ie. PC host key)
2. 而 P12 被合成有時也可以不要 Export passwd

沒有留言:

張貼留言