(msg,sig,hexPubkey)
| 47 | raise ValueError("Unknown digest algorithm %s" % (digestAlg)) |
| 48 | # Verifies with hex public key |
| 49 | def verify(msg,sig,hexPubkey): |
| 50 | # As mentioned above, we must upgrade gracefully to use SHA256. So |
| 51 | # let us check the signature using both SHA1 and SHA256 and if one |
| 52 | # of them passes then we will be satisfied. Eventually this can |
| 53 | # be simplified and we'll only check with SHA256. |
| 54 | try: |
| 55 | sigVerifyPassed = makePubCryptor(hexPubkey).verify(sig,msg,digest_alg=OpenSSL.digest_ecdsa_sha1) # old SHA1 algorithm. |
| 56 | except: |
| 57 | sigVerifyPassed = False |
| 58 | if sigVerifyPassed: |
| 59 | # The signature check passed using SHA1 |
| 60 | return True |
| 61 | # The signature check using SHA1 failed. Let us try it with SHA256. |
| 62 | try: |
| 63 | return makePubCryptor(hexPubkey).verify(sig,msg,digest_alg=OpenSSL.EVP_sha256) |
| 64 | except: |
| 65 | return False |
| 66 | |
| 67 | # Does an EC point multiplication; turns a private key into a public key. |
| 68 | def pointMult(secret): |
nothing calls this directly
no test coverage detected