Questions tagged [m2crypto]

M2Crypto is the most complete Python wrapper for OpenSSL featuring RSA, DSA, DH, HMACs, message digests, symmetric ciphers (including AES); SSL functionality to implement clients and servers; HTTPS extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing AuthCookies for web session management; FTP/TLS client and server; S/MIME; ZServerSSL.

M2Crypto is the most complete Python wrapper for OpenSSL featuring RSA, DSA, DH, HMACs, message digests, symmetric ciphers (including AES); SSL functionality to implement clients and servers; HTTPS extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing AuthCookies for web session management; FTP/TLS client and server; S/MIME; ZServerSSL.

271 questions
341
votes
13 answers

How do I update a Python package?

I'm running Ubuntu 9:10 and a package called M2Crypto is installed (version is 0.19.1). I need to download, build and install the latest version of the M2Crypto package (0.20.2). The 0.19.1 package has files in a number of locations including…
thompson
  • 3,429
  • 2
  • 15
  • 5
53
votes
11 answers

How to generate SSH key pairs with Python

I'm attempting to write a script to generate SSH Identity key pairs for me. from M2Crypto import RSA key = RSA.gen_key(1024, 65337) key.save_key("/tmp/my.key", cipher=None) The file /tmp/my.key looks great now. By running ssh-keygen -y -f…
Lee
  • 571
  • 1
  • 4
  • 4
51
votes
7 answers

Trouble installing m2crypto with pip on OS X / macOS

pip install m2crypto Generates the following output: building 'M2Crypto.__m2crypto' extension swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c swig -python -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7…
user5275692
  • 603
  • 1
  • 6
  • 11
39
votes
3 answers

How can I retrieve the TLS/SSL peer certificate of a remote host using python?

I need to scan through a list of IPs and retrieve the common name from the certificate on that IP (for every IP that allows port 443 connections). I have been able to successfully do this using the sockets and ssl modules. It works for all IPs with…
Dave Forgac
  • 3,146
  • 7
  • 39
  • 54
21
votes
3 answers

How do I install M2Crypto on Ubuntu?

I'm trying to build and install M2Crypto on Ubuntu 10.04 LTS. I downloaded and untarred M2Crypto-0.20.2.tar, and from the M2Crypto-0.20.2 directory I tried python setup.py build. I got an error because I don't have swig. So I ran sudo apt-get…
Daryl Spitzer
  • 143,156
  • 76
  • 154
  • 173
18
votes
5 answers

Install m2crypto on a virtualenv without system packages

I have created a virtual environment without the system packages with python's virtualenv in Ubuntu and installed m2crypto, but when I execute a shell and I try to import M2Crypto i get the following error: ImportError:…
txominpelu
  • 1,067
  • 1
  • 6
  • 11
17
votes
6 answers

How to Install M2crypto on Windows

After installing OpenSSL, downloading the pre-built Swig executable, and ensuring the openssl libraries are located in the default c:\pkg, pip install m2crypto results in: ... C:\Program Files (x86)\gfortran\bin\gcc.exe -mno-cygwin -mdll -O -Wall…
ecoe
  • 4,994
  • 7
  • 54
  • 72
15
votes
1 answer

Getting PKCS7 signer chain in python

I have PKCS7 message which is signed. It contains a data and a signing certificate (with the whole chain of trust). I have a code which uses m2crypto to get a certificate out of it. bio = BIO.MemoryBuffer(pkcs7message) p7 =…
Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
15
votes
4 answers

How to validate / verify an X509 Certificate chain of trust in Python?

I am working on implementing a web application that utilizes an API. During a response, the API server sends over a link to an X509 certificate (in PEM format, composed of a signing certificate and one or more intermediate certificates to a root CA…
speznot
  • 151
  • 1
  • 1
  • 6
15
votes
2 answers

Sign CSR from client using CA root certificate in python

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…
nishi
  • 1,245
  • 3
  • 13
  • 22
14
votes
1 answer

EXP(ORT) ciphers and M2Crypto/OpenSSL

I am having a hard time running a M2Crypto SSLServer with EXPORT grade ciphers. LOW/MEDIUM/HIGH grade ciphers work without any problems, but EXPORT just won't. Also, when OpenSSL is run in a server mode from a command line it accepts EXPORT grade…
stamparm
  • 178
  • 8
13
votes
7 answers

pip install m2crypto error

$sudo pip3 install m2crypto Collecting m2crypto Using cached M2Crypto-0.26.0.tar.gz Requirement already satisfied: typing in /usr/local/lib/python3.5/dist-packages (from m2crypto) Installing collected packages: m2crypto Running setup.py install…
Brother of peoples
  • 143
  • 1
  • 1
  • 5
13
votes
4 answers

How do I verify an SSL certificate in python?

I need to verify that a certificate was signed by my custom CA. Using OpenSSL command-line utilities this is easy to do: # Custom CA file: ca-cert.pem # Cert signed by above CA: bob.cert $ openssl verify -CAfile test-ca-cert.pem bob.cert bob.cert:…
Nathan Stocks
  • 2,096
  • 3
  • 20
  • 31
11
votes
2 answers

Trying to verify SHA1 message signature using Python. What am I doing wrong?

I'm attempting to verify the SHA1 signature of a message by downloading a certificate from a website and extracting its public key. There's a few bits of sample code elsewhere on SO (here and here), however I haven't yet figured out what I'm doing…
jamieb
  • 9,847
  • 14
  • 48
  • 63
10
votes
6 answers

Installing M2Crypto on CentOS

I am trying to install M2Crypto on CentOS by compiling from the source. i am doing a python setup.py build But I get the following error, /usr/local/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite' …
Prasanna
  • 121
  • 1
  • 1
  • 8
1
2 3
18 19