pyopenssl

Python “pip install ” is failing with AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

痞子三分冷 提交于 2019-11-29 19:42:36
$ sudo pip install --upgrade pyOpenSSL Traceback (most recent call last): File "/usr/local/bin/pip", line 9, in <module> load_entry_point('pip==8.1.1', 'console_scripts', 'pip')() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point return ep.load() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load return self.resolve() File "/usr/lib/python2.7/dist-packages

Sign CSR from client using CA root certificate in python

家住魔仙堡 提交于 2019-11-29 14:17:24
问题 I am new to python and still learning it so my question can be little naive. Please bear with it ;) The problem is client will be sending CSR and I want to sign it with my CA root certificate and return the signed certificate back to client. I have been using this command to do it using command line openssl x509 -req -in device.csr -CA root.pem -CAkey root.key -CAcreateserial -out device.crt -days 500 same thing I want achieve using python. I have come across python library for openssl

Pyopenssl to verify the file signature

一曲冷凌霜 提交于 2019-11-29 12:11:52
I want to verify the downloaded file's signature and cert using pyopenssl, but the documentation is not clear and Google is of no help. I have a root CA cert in user's machine, now when user download the file then I will send a certificate and signature along with it. First I need to verify the certificate with rootCA on machine then I need to verify the signature with file In openssl I can use following to verify the ca cert openssl verify -CAfile <root_pem> <cert_pem> and following to verify the file openssl dgst <algo> -verify <cert_pub_key> -signature <signature> <file> I am looking for

extracting public key from certificate and encrypting data

柔情痞子 提交于 2019-11-29 08:06:26
This is for a homework assignment! I get the server's certificate using get_peer_certificate() and the calling dump_certificate to dump the certificate in a variable. The format is PEM and looks right to me. -----BEGIN CERTIFICATE----- GIBBERISH................ ...................... ........................ -----END CERTIFICATE----- How do I extract the server's public key from this file ('server.pubkey') and encrypt plaintext using RSA algorithm and any python library. At the time of writing this, I am using pyOpenSSL I'd recommend using a more broad crypto library such as M2Crypto which has

How to install OpenSSL for Python

ぐ巨炮叔叔 提交于 2019-11-29 05:02:09
问题 I need to install OpenSSL on my python2.7. I tried $ sudo pip install pyopenssl And I got the following /usr/local/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe' warnings.warn(msg) running build running build_py running build_ext building 'OpenSSL.crypto' extension gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c OpenSSL/crypto/crypto.c -o build/temp.linux-x86_64-2.7

Custom urllib opener that uses client certificates

南笙酒味 提交于 2019-11-28 12:30:38
I have got an API that I have to work with. The API is secured by HTTPS and uses mutual authentication/client certificates. I have a PEM file and a CRT file. When I connect to the server regularly, using PyOpenSSL I have no problem, here is the code: import settings from OpenSSL import SSL import socket def verify(conn, cert, errnum, depth, ok): # This obviously has to be updated print 'Got certificate: %s' % cert.get_subject() return ok def password_callback(maxlen, verify, extra): print (maxlen, verify, extra) return settings.DEPOSIT_CODE context = SSL.Context(SSL.SSLv23_METHOD) context.set

easy_install PyOpenSSL error

孤者浪人 提交于 2019-11-28 07:32:08
Any idea about what cause the error below ? I use Linux centos with openssl-devel.i386 0.9.8e-12.el5_5.7 $ easy_install PyOpenSSL Searching for PyOpenSSL Reading http://pypi.python.org/simple/PyOpenSSL/ Reading http://launchpad.net/pyopenssl Reading http://pyopenssl.sourceforge.net/ Best match: pyOpenSSL 0.13 Downloading http://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.tar.gz#md5=767bca18a71178ca353dff9e10941929 Processing pyOpenSSL-0.13.tar.gz Running pyOpenSSL-0.13/setup.py -q bdist_egg --dist-dir /tmp/easy_install-0Dunib/pyOpenSSL-0.13/egg-dist-tmp-aV6OCC warning: no

extracting public key from certificate and encrypting data

我的未来我决定 提交于 2019-11-28 01:38:58
问题 This is for a homework assignment! I get the server's certificate using get_peer_certificate() and the calling dump_certificate to dump the certificate in a variable. The format is PEM and looks right to me. -----BEGIN CERTIFICATE----- GIBBERISH................ ...................... ........................ -----END CERTIFICATE----- How do I extract the server's public key from this file ('server.pubkey') and encrypt plaintext using RSA algorithm and any python library. At the time of

How to block SSL protocols in favor of TLS?

北战南征 提交于 2019-11-27 16:14:16
How can I block SSL protocols in PyOpenSSL in favour of TLS ? I'm using CentOS 7 and have these versions: pyOpenSSL-0.13.1-3.el7.x86_64 openssl-1.0.1e-34.el7_0.7.x86_64 In my config file (this if for a CherryPy app) I have: 'server.ssl_module': 'pyopenssl', This is really good question for CherryPy today. This month we started discussing SSL issues and overall maintainability of CherryPy's wrappers over py2.6+ ssl and pyOpenSSL in CherryPy user group . I'm planning a topic about SSL issues there, so you can subscribe for the group to get more details later. For now, here's what is possible. I

Web app hangs for several hours in ssl.py at self._sslobj.do_handshake()

你离开我真会死。 提交于 2019-11-27 15:49:49
问题 I am using Python 2.7.5. I have a web app which queries an API every few minutes and has been working successfully for the last day or so. However, after leaving it sitting for a few hours, I came back to find my program stalled with no activity for several hours. I quit the program and found that it has been stalled in the ssl handshake method for most of the day, during one of the API calls. Here is the traceback: ... File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib