我有一个tornado服务器,它提供了一个https连接和一个我用这种方式生成的自签名证书:
openssl genrsa -out privatekey.pem 1024
openssl req -new -key privatekey.pem -out certrequest.csr
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
服务器代码如下:
^{pr2}$我希望有一个python客户机连接到服务器并检查服务器是否是正确的服务器(我通过它的证书猜测)。 目前,我做了一个简单的客户:
import httplib
HOSTNAME='localhost'
conn = httplib.HTTPSConnection(HOSTNAME)
conn.putrequest('GET','/')
conn.endheaders()
response = conn.getresponse()
print response.read()
你建议我怎么做(客户机稍后将成为移动应用程序我只使用python进行原型设计)?在
谢谢。在
客户机无法确保服务器说出了真相。您可以为创建自签名证书谷歌. 在
如果您也控制客户端(比如在android或iphone应用程序中),您可以将自签名证书添加到可信证书存储区。在
很好地解释了here for an Android app
相关问题 更多 >
编程相关推荐