SMIME signing bug

Ludovico Magnocavallo <[email protected]>
Newsgroups gmane.comp.python.cryptography
Message-ID <[email protected]>
Clear signing large (>3Mb) SMIME messages from M2Crypto hangs python.

1.  A test run with debug print statements in my code and in
     M2Crypto.SMIME.py:

     time ./signer.py newreq_nopass.pem newcert.pem 21131.eml
21131_signed.eml

     setup
     BIO.MemoryBuffer(text)
     self._smime.sign
     m2.pkcs7_sign0 called
     [1]   Terminated              ./signer.py newreq_nopass.pem
newcert.pem 21131.eml 21131_signed.eml

     [2]+  Stopped                 ./signer.py newreq_nopass.pem
newcert.pem 21131.eml 21131_signed.eml

     real    0m26.028s
     user    0m0.000s
     sys     0m0.000s

     I had to kill %1 the backgrounded job, as ^C did nothing. I have
     tried leaving the process running for 15 minutes, and it just
     stays there eating a bit more memory each second.

2.  If I sign the same messages from openssl:

     time openssl smime -sign -in 21131.eml -out 21131_signed.eml
-signer newcert.pem -inkey newreq_nopass.pem

     real    0m0.671s
     user    0m0.538s
     sys     0m0.100s

3.  My same code using M2Crypto on a small message:

     time ./signer.py newreq_nopass.pem newcert.pem test.eml test_signed.eml

     setup
     BIO.MemoryBuffer(text)
     self._smime.sign
     m2.pkcs7_sign0 called
     BIO.MemoryBuffer(text)
     self._smime.write
     self._parser.parsestr

     real    0m0.390s
     user    0m0.197s
     sys     0m0.030s

the message sizes are:

ls -l *eml
-rw-r--r--    1 ludo     ludo      4777277 Jul  1 11:52 21131.eml
-rw-r--r--    1 ludo     ludo      4841919 Jul  1 12:20 21131_signed.eml
-rw-r--r--    1 ludo     ludo         6026 Jun 23 00:27 test.eml
-rw-r--r--    1 ludo     ludo         8730 Jul  1 12:21 test_signed.eml

I really need smime signing to work, should I wrap openssl's smime
command from python or is there a chance this will be fixed in M2Crypto?

Thanks

Ludo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.