如何使用 net/http 验证 ruby 中的 SSL 证书链
如何使用网络在 ruby 中验证 https://processing.ukash.com/ 等网站的证书/http?
https = Net::HTTP.new('processing.ukash.com', 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
到目前为止有效,但我现在如何验证它是否是正确的证书?我从 Firefox 中保存了证书,但生成的 .pem 文件中有许多证书,而 net/http 似乎不喜欢它。
How can I verify the certificates of a site like https://processing.ukash.com/ in ruby with net/http?
https = Net::HTTP.new('processing.ukash.com', 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
Works so far, but how do I verify that it's the right cert now? I saved the certificate from within firefox, but the resulting .pem file has many certificates in it and net/http doesn't seem to like it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自我的代码片段集合:
希望这有帮助吗?
From my code snippets collection:
Hope this helps?
为了完整起见,也为了我未来的我,这是我用这个制作的一个小宝石: https: //github.com/jarthod/ssl-test
For the sake of completeness and for my future me, this is a small gem I made out of this: https://github.com/jarthod/ssl-test