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
10
votes
1 answer

On certificates, what type should E-mail addresses be when in subjectAltName

Little bit of background: I'm building a certificate authority using M2Crypto and Django, so please think twice before voting to close this as off topic! :) My approach is that end-users are identified by e-mail addresses and their self-signed…
Kimvais
  • 38,306
  • 16
  • 108
  • 142
9
votes
4 answers

_shutdown AttributeError (ignored) when linting code that uses M2Crypto

I'm running lint as follows: $ python -m pylint.lint m2test.py with this code: import M2Crypto def f(): M2Crypto.RSA.new_pub_key("").as_pem(cipher=None).split("\n") The lint output ends with: Exception AttributeError: '_shutdown' in
Tony Meyer
  • 10,079
  • 6
  • 41
  • 47
9
votes
3 answers

How to generate strong one time session key for AES in python

I am using M2Crypto's AES for encrypting message, but confused about how to generate a strong random session key and of what length. Does M2Crypto provide any function for generation random key.
user553947
7
votes
4 answers

How to get Python m2Crypto to work with virtualenv?

I'm trying to install M2Crypto so that I can generate pkey in my web app. My hosting requirements dictate that I must use pip to install any dependencies. Installing m2crypto at the system level is not an option for me. I'm using Mint 12 in…
bdd
  • 3,436
  • 5
  • 31
  • 43
7
votes
5 answers

M2Crypto Encrypt/Decrypt using AES256

Can someone provide me code to encrypt / decrypt using m2crypto aes256 CBC using Python
mike
7
votes
2 answers

Create self signed SSL certificates in Python

I am trying to generate self signed SSL certificates using Python, so that it is platform independent. My target is the *.pem format. I found this script that generates certificates, but no information how to self-sign them.
Niklas
  • 3,753
  • 4
  • 21
  • 29
6
votes
1 answer

M2Crypto bad performance to decrypt and verify big email

The input : big multipart signed and encrypted email (~10MB) done with openssl. Decrypting the file seems to be fast enough. Getting the decrypted information to verify them is MORE than long. It seems there is some problem in M2Crypto library. If…
TrapII
  • 2,219
  • 1
  • 15
  • 15
6
votes
3 answers

How to get the signed content from a PKCS7 envelop with M2Crypto?

I need to get the digest of a PKCS#7 envelop to manually check it. Usually when you want to validate the signature of a pkcs#7 envelop you do that: from M2Crypto import SMIME, X509, BIO sm_obj = SMIME.SMIME() x509 = X509.load_cert(join(PATH,…
Natim
  • 17,274
  • 23
  • 92
  • 150
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
3 answers

How can I verify an X509 certificate in python including a CRL check?

I'm trying to verify an X509 certificate using python. In particular I need to check CRLs when I do it. Now, you can use m2crypto to do this, but I can't find an option corresponding to openssl's -crl_check or -crl_check_all. Alternatively, I could…
wrgrs
  • 2,467
  • 1
  • 19
  • 24
5
votes
2 answers

M2crypto signature "algorithm"

These two codes provide the same signature, which is expected: code1: from M2Crypto import RSA, EVP import base64, hashlib text = "some text" pkey = EVP.load_key("mykey.pem") #"mykey.pem" was generated as: openssl genrsa -des3 -out mykey.pem…
michal
  • 51
  • 1
  • 3
5
votes
0 answers

How to sign and send a Mimultipart message in python?

Typically, sending a message with attachments is performed like this in python. import smtplib from os.path import basename from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from email.mime.text import…
user2284570
  • 2,891
  • 3
  • 26
  • 74
5
votes
0 answers

private encrypt (generate signature) using cryptography/ pycrypto as generated by M2Crypto

I am trying to generate a signature for a payload. My tech stack is in Python3.6, which provides library like cryptography or pycrypto. Problem is, I am unable to recreate the function private_encrypt of M2Crypto in libraries like cryptography. The…
Abhishek
  • 2,543
  • 4
  • 34
  • 46
5
votes
2 answers

How do I use m2crypto to validate a X509 certificate chain in a non-SSL setting

I'm trying to figure out how to, using m2crypto, validate the chain of trust from a public key version of a X509 certificate back to one of a set of known root CA's when the chain may be arbitrarily long. The SSL.Context module looks promising…
bpytlik
  • 77
  • 2
  • 9
5
votes
1 answer

What happens during a python module install? Can I just copy the module source to site-packages?

I'm having trouble installing M2Crypto on my shared webhost account with pip. Can I just copy the module's source into site-packages, or does pip do something extra?
mowwwalker
  • 16,634
  • 25
  • 104
  • 157
1
2
3
18 19