MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / verify

Function verify

src/highlevelcrypto.py:49–65  ·  view source on GitHub ↗
(msg,sig,hexPubkey)

Source from the content-addressed store, hash-verified

47 raise ValueError("Unknown digest algorithm %s" % (digestAlg))
48# Verifies with hex public key
49def 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.
68def pointMult(secret):

Callers

nothing calls this directly

Calls 2

makePubCryptorFunction · 0.85
verifyMethod · 0.80

Tested by

no test coverage detected