~stepankk/pyopenssl/bug-845445

« back to all changes in this revision

Viewing changes to OpenSSL/test/test_crypto.py

  • Committer: Jean-Paul Calderone
  • Date: 2011-06-12 21:34:44 UTC
  • mfrom: (139.2.3 sign-and-verify-nulls)
  • Revision ID: exarkun@divmod.com-20110612213444-6wcy690j4ft2zmzg
Fix NUL handling in OpenSSL.crypto.sign and OpenSSL.crypto.verify

Show diffs side-by-side

added added

removed removed

Lines of Context:
2657
2657
            ValueError, verify, good_cert, sig, content, "strange-digest")
2658
2658
 
2659
2659
 
 
2660
    def test_sign_nulls(self):
 
2661
        """
 
2662
        L{sign} produces a signature for a string with embedded nulls.
 
2663
        """
 
2664
        content = b("Watch out!  \0  Did you see it?")
 
2665
        priv_key = load_privatekey(FILETYPE_PEM, root_key_pem)
 
2666
        good_cert = load_certificate(FILETYPE_PEM, root_cert_pem)
 
2667
        sig = sign(priv_key, content, "sha1")
 
2668
        verify(good_cert, sig, content, "sha1")
 
2669
 
 
2670
 
2660
2671
if __name__ == '__main__':
2661
2672
    main()