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

Building m2crypto: 7 unresolved externals

I've tried to build M2Crypto (github) for win-amd64-py3.3: python setup.py build --compiler msvc And I've got an linker's unresolved external symbol errors (full log): C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL…
kbec
  • 3,415
  • 3
  • 27
  • 42
0
votes
1 answer

Unable to verify a signature in python using PKI

I am struggling to port the following java code to python. I am using PyCrypto to read the publickKey but it fails with an assertionError: keyDER = b64decode(publicKeyBase64) seq = asn1.DerSequence() seq.decode(keyDER) keyPub = RSA.construct(…
Abhi
  • 261
  • 1
  • 3
  • 12
0
votes
1 answer

M2crypto compilation on aix

When compiling M2Crypto module on AIX5.1 with following scrambled command: /opt/local/python/2.7.3/bin/python setup.py build_ext --swig /opt/local/swig/1.3.4/bin/swig -I…
0
votes
1 answer

How to disable URL redirection in Python when using M2Crypto SSL?

This is what my code looks like: url_object = urlparse(url) hostname = url_object.hostname port = url_object.port uri = url_object.path if url_object.path else '/' ctx = SSL.Context() if ctx.load_verify_locations(cafile='ca-bundle.crt') != 1: raise…
Bhargava
  • 189
  • 3
  • 12
0
votes
1 answer

M2Crypto loading RSA key failed

I have this annoying M2Crypto error: In [126]: M2Crypto.EVP.load_key('private-key-2048.pem', 'r') --------------------------------------------------------------------------- BIOError Traceback (most recent call…
patroqueeet
  • 764
  • 1
  • 8
  • 19
0
votes
1 answer

pkcs11engine doesn't logout after engine cleanup()

I want to do the following: Generate key pair on security token (I use Aladdin tokens) (PyKCS11) Generate PKCS#10 request (I use M2Crypto + engine_pkcs11 for it) and send it to CA. Receive signed X.509 certificate from CA and write it to security…
leotrubach
  • 1,509
  • 12
  • 15
0
votes
1 answer

M2Crypto causes a core dump

Any idea how I can fix this? >>> from M2Crypto import SSL >>> M2Crypto.version '0.21.1' >>> >>> ctx = SSL.Context() >>> conn = SSL.Connection(ctx) >>> conn.connect(('cancerhelp.org.uk', 443)) Segmentation fault (core dumped)
FunLovinCoder
  • 7,597
  • 11
  • 46
  • 57
0
votes
1 answer

m2crypto threading usage

the documentation is somehow sparse. I intend to use m2crypto in a webserver and it seems m2crypto.threading.init() shall be used. Shall my python function called upon web request be something as: def do_something(): M2Crypto.threading.init() …
Čikić Nenad
  • 392
  • 5
  • 13
0
votes
3 answers

File accessing in load_pub_key

Consider the following code: fileHandle = open ( 'test8.pem','w' ) fileHandle.write (data) pub_key = M2Crypto.RSA.load_pub_key(open('test8.pem')) Which produces the following error: File "/usr/lib/python2.4/site-packages/M2Crypto/RSA.py", line…
jass
0
votes
1 answer

M2Crypto RSA Unicode Strings Encoded Differently Than Byte Strings

I was encoding emails to be used with an external website's API using Python M2Crypto's RSA with PKCS1 padding. When using unicode, the encoded emails returned no results from the API, but when I used str(unicode_email), I received the correct…
Cosmo
  • 203
  • 3
  • 9
0
votes
1 answer

m2crypto throws "TypeError: in method 'x509_req_set_pubkey'"

My little code snippet throws the following Traceback: Traceback (most recent call last): File "csr.py", line 48, in csr.create_cert_signing_request(pubkey, cert_name) File "csr.py", line 17, in create_cert_signing_request …
sp4rc
0
votes
2 answers

Python M2Crypto's AES 128 Encryption Different From PHP's Mcrypt

Here is my Python code, I can successfully encrypt and decrypt using M2Crypto: from base64 import b64encode, b64decode import M2Crypto class AESEncryptionService(object): def encrypt(self, key, msg): return self.__cipher(key, msg, 1) …
Richard Knop
  • 81,041
  • 149
  • 392
  • 552
0
votes
1 answer

Is there a way to suppress Python M2Crypto's RSA.gen_key output?

I'm using the Python M2Crypto package to generate RSA keys. >>> import M2Crypto >>> rsa = M2Crypto.RSA.gen_key (2048, 65537) .............................................................+++ ............................+++ >>> Notice that "openssl…
Cory
  • 3
  • 1
0
votes
1 answer

Error for M2Crypto https get thru a web proxy with cac card authentication

I'm trying to make a https get request from behind a squid proxy with cac card authentication. Loading the opensc engine and grabbing the cert and private key seem to work fine. Below is the traceback and the code. Any help is greatly…
Mark Giles
  • 449
  • 1
  • 4
  • 8
0
votes
1 answer

M2Crypto.rsa privat key components

Can anybody tell me, how to get p,q,dp,dq and u component of rsa private key? loading of the key: string = open(keyfile,"rb").read(); bio = BIO.MemoryBuffer(string); rsa = RSA.load_key_bio(bio); what shall i do next?
Torto
  • 1
1 2 3
18
19