November 4, 2009
wangprince
在天空部落發表於12:08:17 |
電腦與網際網路
鼓勵此網誌:0
之前在寫一些加解密程式,其中用到數位信封的東西,
數位信封
|
為了要能在程式內使用pfx檔的 publick key 和 private key,所以就要先將它們extract出來....
還好openssl幫上一點忙了
這裡定義了PFX跟PEM檔案的意義
|
If you want to extract private key from a pfx file and write it to PEM file
openssl.exe pkcs12 -in publicAndprivate.pfx -nocerts -out privateKey.pemIf you want to extract the certificate file (the signed public key) from the pfx file
openssl.exe pkcs12 -in publicAndprivate.pfx -clcerts -nokeys -out publicCert.pemTo remove the password from the private key file.
openssl.exe rsa -in privateKey.pem -out private.pem
This is required as, at the time of exporting privateKey, you have added a password to the private key to secure it. If you left the password with it, it will keep asking the password as any application tries to access it.
| 延伸閱讀: |
























































