Fix unhandled expcetion on invalid cert

This commit is contained in:
shortcutme 2017-04-12 00:31:37 +02:00
parent 1ee592f5b7
commit 4c7ff9bb53
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
2 changed files with 9 additions and 4 deletions

View File

@ -658,9 +658,14 @@ class ContentManager(object):
if not cert_address: # Cert signer not allowed
self.log.warning("Invalid cert signer: %s" % domain)
return False
return CryptBitcoin.verify(
"%s#%s/%s" % (rules["user_address"], content["cert_auth_type"], name), cert_address, content["cert_sign"]
)
try:
cert_subject = "%s#%s/%s" % (rules["user_address"], content["cert_auth_type"], name)
result = CryptBitcoin.verify(cert_subject, cert_address, content["cert_sign"])
except Exception, err:
self.log.warning("Certificate verify error: %s" % err)
result = False
return result
# Checks if the content.json content is valid
# Return: True or False

View File

@ -331,7 +331,7 @@ def verify_message(address, signature, message):
def SetCompactSignature(pkey, hash, signature):
sig = base64.b64decode(signature)
if len(sig) != 65:
raise BaseException("Wrong encoding")
raise Exception("Wrong encoding")
nV = ord(sig[0])
if nV < 27 or nV >= 35:
return False