你能帮我修m2crypto吗?
下面的代码是返回“HTTP/1.1 403 Forbidden”服务器。 代码中未加载证书和私钥:
from M2Crypto import Rand, SSL, httpslib, threading , BIO , X509 , RSA
ctx = SSL.Context('sslv23')
store = ctx.get_cert_store()
bio = BIO.MemoryBuffer()
bio.write( str( open( 'certi.pem', 'r' ).read() ) )
store.add_x509( X509.load_cert_bio(bio) )
# or
# store.add_x509( X509.load_cert_string( str(open( 'certi.pem', 'r' ).read()) ) )
ctx.set_verify( SSL.verify_none, depth=1 )
ctx.set_info_callback()
h = httpslib.HTTPSConnection( ‘Server’, 443, ssl_context=ctx )
h.set_debuglevel(1)
h.request( 'mysoap' )
当我这么做的时候,它就起作用了:
^{pr2}$谢谢
目前没有回答
相关问题 更多 >
编程相关推荐