Using this snippet from The Random Engineer from OpenSSL.crypto import load_pkcs12, FILETYPE_PEM, FILETYPE_ASN1 with open('cert.p12', 'rb') as f: c = f.read() p = load_pkcs12(c, 'passphrase') certificate = p.get_certificate() private_key = p.get_privatekey() # Where type is FILETYPE_PEM or FILETYPE_ASN1 (for DER). type_ = FILETYPE_PEM prvkey = OpenSSL.crypto.dump_privatekey(type_, private_key) cert = OpenSSL.crypto.dump_certificate(type_, certificate)
and a little later I use headers = {"username": "password"} context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.load_cert_chain(cert, prvkey, password=password) context.verify_mode = ssl.CERT_REQUIRED context.check_hostname = True conn = httplib.HTTPSConnection(target_url, port=442, context=oontext) conn.request("POST", "/to/this/place", xml, headers) response = conn.getresponse() data = response.read() I can 'see' the content of prvkey and cert with a raise NameError BUT this line context.load_cert_chain(cert, prvkey, password=password) throws an I/O error ErrNo36 file name too long and I have no idea why can anyone shed some light on this please? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d284d7f3-fd42-47ec-ad4b-6efe5d52d490%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.