Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSSL.SSL.WantReadError #13

Open
edsonitk opened this issue Feb 20, 2017 · 0 comments
Open

OpenSSL.SSL.WantReadError #13

edsonitk opened this issue Feb 20, 2017 · 0 comments

Comments

@edsonitk
Copy link

Hi,

I'm trying to use pyopenssl with ndg and the following error occurs in con.getresponse():

Error
Raise WantReadError ()
OpenSSL.SSL.WantReadError

Code:

from OpenSSL import crypto , SSL
from ndg.httpsclient.https import HTTPSConnection

pkcs12 = crypto.load_pkcs12(open('certi.pfx', 'rb').read(), 'pass')
certi = crypto.dump_certificate( crypto.FILETYPE_PEM , pkcs12.get_certificate() )
key = crypto.dump_privatekey( crypto.FILETYPE_PEM , pkcs12.get_privatekey() )

cert_openssl = crypto.load_certificate(crypto.FILETYPE_PEM, certi)
key_openssl = crypto.load_privatekey(crypto.FILETYPE_PEM, key)
ctx = SSL.Context(SSL.SSLv23_METHOD)
ctx.use_certificate(cert_openssl)
ctx.use_privatekey(key_openssl)

con = HTTPSConnection('server', port=443, ssl_context=ctx)
con.connect()
con.request( b'POST', b'/' + cURL.encode('utf-8'), xml_soap.encode('utf-8'), header)

resp = con.getresponse()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant