<p>Has anyone successfully used the "golang.org/x/crypto/pkcs12" sub-repository to successfully decode a pkcs#12 file?</p>
<p>I've been experimenting using golang and openssl and can't get the golang pkcs12.Decode() to interoperate with openssl pkcs#12 encoding - it fails complaining there are more than two (3) safe bags in the data.</p>
<p>Has anyone successfully been able to use the Decode() function?</p>
<pre><code> pfxData, err := ioutil.ReadFile("final_result.pfx")
if err != nil {
fmt.Printf("failed to read file: %s\n", err)
os.Exit(1)
}
// Attempt to Decode the file:
// func Decode(pfxData []byte, password string) (privateKey interface{}, certificate *x509.Certificate, err error)
_, _, err = pkcs_spc.Decode(pfxData, "foobar")
if err != nil {
fmt.Printf("Decode failed: %s\n", err)
os.Exit(1)
}
</code></pre>
<hr/>**评论:**<br/><br/>nyoungman: <pre><p>Hi,
There is an open issue to allow decoding of multiple certificates: <a href="https://github.com/golang/go/issues/14015" rel="nofollow">https://github.com/golang/go/issues/14015</a></p>
<p>I intend to prepare a CL in the coming week. For the moment you could try using the ToPEM API.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传