Fun with golang, crypt, and pkcs#12 - well not really

polaris · · 933 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Has anyone successfully used the &#34;golang.org/x/crypto/pkcs12&#34; sub-repository to successfully decode a pkcs#12 file?</p> <p>I&#39;ve been experimenting using golang and openssl and can&#39;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(&#34;final_result.pfx&#34;) if err != nil { fmt.Printf(&#34;failed to read file: %s\n&#34;, 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, &#34;foobar&#34;) if err != nil { fmt.Printf(&#34;Decode failed: %s\n&#34;, 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

933 次点击  
加入收藏 微博
3 回复  |  直到
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传