When M2Crypto is not loaded attempt to parse x509 certificate fails with following traceback:
File "myfile.py", line 124, in readServerSection
x509.parse(c)
File "/opt/tlslite/x509.py", line 43, in parse
self.parseBinary(bytes)
File "/opt/tlslite/x509.py", line 97, in parseBinary
self.publicKey = _createPublicRSAKey(n, e)
File "/opt/tlslite/utils/keyfactory.py", line 179, in _createPublicRSAKey
return PyCrypto_RSAKey(n, e)
File "/opt/tlslite/utils/pycrypto_rsakey.py", line 18, in init
self.rsa = RSA.construct( (n, e) )
File "/usr/lib/python2.7/dist-packages/Crypto/PublicKey/RSA.py", line 539, in construct
key = self._math.rsa_construct(*tup)
File "/usr/lib/python2.7/dist-packages/Crypto/PublicKey/_slowmath.py", line 85, in rsa_construct
assert isinstance(e, long)
This is because PyCrypto expects parameters as long, but tlslite passes e as int.
This was tested on PyCrypto 2.6.1
When M2Crypto is not loaded attempt to parse x509 certificate fails with following traceback: File "myfile.py", line 124, in readServerSection x509.parse(c) File "/opt/tlslite/x509.py", line 43, in parse self.parseBinary(bytes) File "/opt/tlslite/x509.py", line 97, in parseBinary self.publicKey = _createPublicRSAKey(n, e) File "/opt/tlslite/utils/keyfactory.py", line 179, in _createPublicRSAKey return PyCrypto_RSAKey(n, e) File "/opt/tlslite/utils/pycrypto_rsakey.py", line 18, in init self.rsa = RSA.construct( (n, e) ) File "/usr/lib/python2.7/dist-packages/Crypto/PublicKey/RSA.py", line 539, in construct key = self._math.rsa_construct(*tup) File "/usr/lib/python2.7/dist-packages/Crypto/PublicKey/_slowmath.py", line 85, in rsa_construct assert isinstance(e, long)
This is because PyCrypto expects parameters as long, but tlslite passes e as int. This was tested on PyCrypto 2.6.1