How do you verify an RSA SHA1 signature in pyOpenSSL

孤街醉人 提交于 2019-12-12 23:18:30

问题


I tried installing M2Crypto and facing problems. I don't want to force my customers to use such libraries which are difficult to install. So, I thought I would give pyOpenSSL a try. I am able to get the public key from pem certificate but am not able to find any way to verify the signature.


回答1:


You simply can't do this with pyOpenSSL. It is a very limited wrapper around openssl library. But I have a guess what's wrong with building M2Crypto on your host. Try running:

export SWIG_FEATURES=-I/usr/include/openssl

before trying to install M2Crypto.




回答2:


I believe that what you want is the code from this blog entry (it's mine):

http://www.v13.gr/blog/?p=303

As you can see you have to use DER to handle the certificate and get the appropriate parts. That took me a considerable amount of effort and days so let me know whether it worked for you too.



来源:https://stackoverflow.com/questions/1471037/how-do-you-verify-an-rsa-sha1-signature-in-pyopenssl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!