![](/img/trans.png)
[英]With golang how can I generate a rsa certificates then export the private key to a pfx file and the public key to a cer file
[英]How to generate a PKCSs#12 file given private key and certificate in Golang?
我有一個 base64 編碼的私鑰和公共證書。 我的要求是從中創建一個密鑰庫。 根據我的分析,Golang 中沒有這樣的 API 來創建它。 另一種方法是生成一個 PKCSs#12 格式的文件,它是一個密鑰庫。
如果有,請告訴我解決方案。
包crypto/pkcs12
提供了一些讀取 PKCS#12 文件的基本功能(它是從Azure/go-pkcs12
導入的,但目前沒有辦法編寫它們。
目前推薦的解決方案是使用 OpenSSL。
$ openssl pkcs12 -export -inkey private.key -in certificate.pem -certfile intermediates.crt -out certificate.pfx
還有go-pkcs12但不清楚你應該如何處理結果[]byte
(寫它們,我猜?),特別是因為你不能提供別名。 所以我想正如 Simone 所說,我們應該堅持使用openssl pkcs12
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.