pyopenssl

Python: reading a pkcs12 certificate with pyOpenSSL.crypto

旧街凉风 提交于 2019-11-27 13:18:22
I have a valid certificate issued by the spanish authority (FNMT) and I want to play with it to learn more about it. The file has extension .p12 I would like to read the information in it (first and last name) and check if the certificate is valid. Is it possible to do that with pyOpenSSL? I guess I have to use the crypto module in OpenSSL. Any help or useful link? Trying reading here: http://packages.python.org/pyOpenSSL/openssl-crypto.html but not much information :-( It's fairly straight-forward to use. This isn't tested, but should work: # load OpenSSL.crypto from OpenSSL import crypto #

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

半腔热情 提交于 2019-11-27 09:31:25
问题 $ 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

Custom urllib opener that uses client certificates

随声附和 提交于 2019-11-27 07:03:59
问题 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

Python AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

感情迁移 提交于 2019-11-27 03:35:39
A Python script of mine is failing with: Traceback (most recent call last): File "./inspect_sheet.py", line 21, in <module> main() File "./inspect_sheet.py", line 12, in main workbook_name=workbook_name, File "./google_sheets.py", line 56, in __init__ self.login() File "./google_sheets.py", line 46, in login self.client = gspread.authorize(credentials) File "/usr/local/lib/python2.7/site-packages/gspread/client.py", line 335, in authorize client.login() File "/usr/local/lib/python2.7/site-packages/gspread/client.py", line 98, in login self.auth.refresh(http) File "/usr/local/lib/python2.7/site

HTTPS connection Python

自闭症网瘾萝莉.ら 提交于 2019-11-26 19:38:06
I am trying to verify the that target exposes a https web service. I have code to connect via HTTP but I am not sure how to connect via HTTPS. I have read you use SSL but I have also read that it did not support certificate errors. The code I have got is from the python docs: import httplib conn = httplib.HTTPConnection("www.python.org") conn.request("GET", "/index.html") r1 = conn.getresponse() print r1.status, r1.reason Does anyone know how to connect to HTTPS? I already tried the HTTPSConenction but it responds with an error code claiming httplib does not have attribute HTTPSConnection. I

How to block SSL protocols in favor of TLS?

自古美人都是妖i 提交于 2019-11-26 18:37:19
问题 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', 回答1: 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

Python: reading a pkcs12 certificate with pyOpenSSL.crypto

风流意气都作罢 提交于 2019-11-26 16:16:51
问题 I have a valid certificate issued by the spanish authority (FNMT) and I want to play with it to learn more about it. The file has extension .p12 I would like to read the information in it (first and last name) and check if the certificate is valid. Is it possible to do that with pyOpenSSL? I guess I have to use the crypto module in OpenSSL. Any help or useful link? Trying reading here: http://packages.python.org/pyOpenSSL/openssl-crypto.html but not much information :-( 回答1: It's fairly

Python AttributeError: &#39;module&#39; object has no attribute &#39;SSL_ST_INIT&#39;

試著忘記壹切 提交于 2019-11-26 09:29:30
问题 A Python script of mine is failing with: Traceback (most recent call last): File \"./inspect_sheet.py\", line 21, in <module> main() File \"./inspect_sheet.py\", line 12, in main workbook_name=workbook_name, File \"./google_sheets.py\", line 56, in __init__ self.login() File \"./google_sheets.py\", line 46, in login self.client = gspread.authorize(credentials) File \"/usr/local/lib/python2.7/site-packages/gspread/client.py\", line 335, in authorize client.login() File \"/usr/local/lib/python2

HTTPS connection Python

让人想犯罪 __ 提交于 2019-11-26 06:19:03
问题 I am trying to verify the that target exposes a https web service. I have code to connect via HTTP but I am not sure how to connect via HTTPS. I have read you use SSL but I have also read that it did not support certificate errors. The code I have got is from the python docs: import httplib conn = httplib.HTTPConnection(\"www.python.org\") conn.request(\"GET\", \"/index.html\") r1 = conn.getresponse() print r1.status, r1.reason Does anyone know how to connect to HTTPS? I already tried the