RSA Digital Signature: SIGN in Python pyCrypto & verify in JavaScript jsrsasign

In most cases, we want to interact our python server (Flask/Django) with multiple clients over the web that uses JavaScript. This is a demonstration of how can you generate a signature in python and verity that signature in JavaScript and Vice Versa.

jsrsasign library test console:


  1. Also if anyone is testing in Python3. The hash function does not takes String , instead it takes Bytes. simply add a ` b' ` before the HELLO WORLD string. e.g. message = b'HELLO WORLD'

  2. Crypto is depricated. Use Cryptodome instead. Simple replace all Crpyto packages to Cryptodome. e.g. `from Cryptodome.Signature import PKCS1_v1_5`
    `from Cryptodome.Hash import SHA256` & `from Cryptodome.PublicKey import RSA`.

Leave a Reply

Your email address will not be published.