Comment 19 for bug 502291

Revision history for this message
Darsey Litzenberger (dlitz) wrote :

Thanks, everyone! Legrandin's implementation was merged in v2.5. From the docs:

    This scheme is more properly called ``RSASSA-PKCS1-v1_5``.

    For example, a sender may authenticate a message using SHA-1 like
    this:

            >>> from Crypto.Signature import PKCS1_v1_5
            >>> from Crypto.Hash import SHA
            >>> from Crypto.PublicKey import RSA
            >>>
            >>> message = 'To be signed'
            >>> key = RSA.importKey(open('privkey.der').read())
            >>> h = SHA.new(message)
            >>> signer = PKCS1_v1_5.new(key)
            >>> signature = signer.sign(h)

    At the receiver side, verification can be done using the public part of
    the RSA key:

            >>> key = RSA.importKey(open('pubkey.der').read())
            >>> h = SHA.new(message)
            >>> verifier = PKCS1_v1_5.new(key)
            >>> if verifier.verify(h, signature):
            >>> print "The signature is authentic."
            >>> else:
            >>> print "The signature is not authentic."