Questions tagged [pyopenssl]

Pyopenssl is a Python interface to the OpenSSL library.

Pyopenssl is a Python interface to the OpenSSL library.

480 questions
6
votes
1 answer

How to associated the cn in an ssl cert of pyOpenSSL verify_cb to a generated socket

I am a little new to pyOpenSSL. I am trying to figure out how to associate the generated socket to an ssl cert. verify_cb gets called which give me access to the cert and a conn but how do I associate those things when this happens: cli,addr =…
xp_prg
6
votes
2 answers

Custom urllib opener that uses client certificates

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…
Hosane
  • 915
  • 9
  • 19
6
votes
0 answers

Python OpenSSL: openssl s_client -connect

What is the equivalent to sudo openssl s_client -connect in python open ssl? I have looked over documentation and have yet to find anything that is useful. I want to compare the results to the certifier lib, because I am not sold that the certifier…
Soatl
  • 10,224
  • 28
  • 95
  • 153
6
votes
2 answers

requests.exceptions.SSLError

I have fiddle.py containing 4 lines import requests url = "https://randomuser.me/api/" locations = requests.get(url,verify=False).json() print locations When I run it, I kept getting requests.exceptions.SSLError: [SSL:…
code-8
  • 54,650
  • 106
  • 352
  • 604
6
votes
1 answer

OpenSSL.crypto.X509.sign() throws " 'bytes' object has no attribute 'encode' "

So I'm trying to use the OpenSSL crypto module to generate a new CA certificate with this code: #warning: this block is background information, probably not #where my real problem is #generate the key…
6
votes
1 answer

How to use latest openssl library with pyOpenSSL?

I am currently using pyOpenssl, and it uses openssl 1.0.1f which is installed by system. now I install openssl 1.0.1j from source, and set new version library path into LD_LIBRARY_PATH, at this time, when I running my py file, it will produce…
Jerry YY Rain
  • 4,134
  • 7
  • 35
  • 52
6
votes
3 answers

Is it possible to set subjectAltName using pyOpenSSL?

I need to generate SSL certificates from Python using pyOpenSSL. Does anyone know if it's possible to set subjectAltName? From the documentation (https://pythonhosted.org/pyOpenSSL/api/crypto.html#x509-objects) it doesn't seem so. In fact, only a…
user3725459
  • 414
  • 3
  • 9
6
votes
3 answers

pyOpenSSL creating a pem file

I've created a key pair using the following code in python with pyOpenSSL: from OpenSSL import crypto k = crypto.PKey() k.generate_key(crypto.TYPE_RSA, 2048) Now how can I create the private and public key .pem files from the key object? If there…
RatDon
  • 3,403
  • 8
  • 43
  • 85
6
votes
1 answer

Verify signature with pyopenssl

I believe that since this question, pyOpenSSL has started supporting the verification of signatures (as of pyOpenSSL 0.11. I am working on a project which was started by someone else using M2Crypto. M2Crypto is really painful to include on platforms…
jvc26
  • 6,363
  • 6
  • 46
  • 75
5
votes
7 answers

pip throws "TypeError: deprecated() " error

I am trying to install few packages and started getting an error. Then used multiple commands in ubuntu to update few things but errors are similar pip install -U pip setuptools or python3 -m pip install --upgrade pip or sudo -H pip3 install…
dhairya
  • 431
  • 1
  • 4
  • 12
5
votes
4 answers

How to link python3 to use openssl11 / or latest version of openssl (1.1.1) on centos 7

We wanted to upgrade OpenSSL in centos 7 but it didn't happen, the reason may be this. Upgrading CentOS 7 to OpenSSL 1.1.1 by yum install openssl11 I've came to know openssl11 is for "spot" usage. Can we link python / pyOpenssl with…
Mounya A
  • 51
  • 1
  • 3
5
votes
0 answers

OpenSSL's command for Partial Chain in Python

I'm trying to use OpenSSL module in Python for certificate validation. I have window's openssl command as: openssl verify -partial_chain -CAfile Intermediate.pem UserCert.pem Will you please suggest me equivalent of this in Python? Requirement: This…
Bogota
  • 401
  • 4
  • 15
5
votes
3 answers

How to check that TLS handshake was finalize in Twisted

This is a follow up of this question: SSL handshake failures when no data was sent over Twisted TLSConnection I have implemented a simple SSL server that closes the connection as soon as the client is connected. I am testing it with openssl and I…
Adi Roiban
  • 1,293
  • 2
  • 13
  • 28
5
votes
3 answers

Python 3 No module named '_ssl'

The Problem While I run you python3 application, it shows File "/usr/local/lib/python3.6/ssl.py", line 101, in import _ssl # if we can't import it, let the error propagate ModuleNotFoundError: No module named '_ssl' What…
Lanston
  • 11,354
  • 8
  • 32
  • 37
5
votes
2 answers

Using ssl context.set_servername_callback in Python

I have a goal of allowing an ssl client to select from a number of valid certificate pairs from the server. The client has a CA certificate which it will use to validate the certificate coming from the server. So to try to accomplish this, I'm using…
caleb
  • 2,687
  • 30
  • 25