How do you verify an RSA SHA1 signature in Python?

后端 未结 8 1475
面向向阳花
面向向阳花 2020-11-29 00:35

I\'ve got a string, a signature, and a public key, and I want to verify the signature on the string. The key looks like this:

-----BEGIN PUBLIC KEY-----
MIGf         


        
8条回答
  •  盖世英雄少女心
    2020-11-29 00:57

    I think ezPyCrypto might make this a little easier. The high-level methods of the key class includes these two methods which I hope will solve your problem:

    • verifyString - verify a string against a signature
    • importKey - import public key (and possibly private key too)

    Rasmus points out in the comments that verifyString is hard-coded to use MD5, in which case ezPyCryto can't help Andrew unless he wades into its code. I defer to joeforker's answer: consider M2Crypto.

提交回复
热议问题