PHP SSL 证书指纹
我需要在网页中显示 SSL 证书的指纹。 PHP 中可以吗?该函数
openssl_x509_parse
不返回 SHA1 和 MD5 指纹。 如何解决这个问题? 谢谢。
I need display in web page fingerprints of SSL Certificate.
Is it possible in PHP? The function
openssl_x509_parse
doesn't return SHA1 and MD5 fingerprints.
How resolve this problem?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我认为您可以使用以下代码生成 SHA 指纹:
I think you can generate the SHA fingerprint with the following code:
这是一个更好的解决方案:
Here is a better solution:
从 PHP 5.6 开始,您可以使用
openssl_x509_fingerprint()
:该函数当前未记录,但这将在发布时修复;这是函数签名:
From PHP 5.6 onwards, you can use
openssl_x509_fingerprint()
:The function is currently undocumented, but this will be fixed at release time; this is the function signature:
我猜最简单的方法是通过系统调用 openssl 是的
,我知道,这并不是一种干净的方法 - 然而,这是我能想到的唯一方法! !!
I'd guess the easiest way is going to be to call openssl through system
And yes, I know, this is nothing like a clean way of doing this - however, it's the only one I can think of of the top of my head!!!
根据您的信息,我用 PHP 编写了一个小型证书查看器
使用作为烘焙您自己的查看器的起点。
Based on your information, I wrote a tiny certificate viewer in PHP
Use as your starting point to bake your own viewer.