Updated ValueError in addresses.py, updated safeGet & added exception handling for read permission error in helper_startup.py and reverted highlevelcrypto.py changes
This commit is contained in:
parent
a704b1a3b2
commit
3555f1d426
|
@ -45,7 +45,7 @@ def decodeBase58(string, alphabet=ALPHABET):
|
|||
for char in string:
|
||||
num *= base
|
||||
num += alphabet.index(char)
|
||||
except: # noqa:E722 # ValueError
|
||||
except ValueError:
|
||||
# character not found (like a space character or a 0)
|
||||
return 0
|
||||
return num
|
||||
|
|
|
@ -49,13 +49,17 @@ def loadConfig():
|
|||
'Loading config files from directory specified'
|
||||
' on startup: %s', state.appdata)
|
||||
else:
|
||||
config.read(paths.lookupExeFolder() + 'keys.dat')
|
||||
try:
|
||||
config.get('bitmessagesettings', 'settingsversion')
|
||||
config.read(paths.lookupExeFolder() + 'keys.dat')
|
||||
except: # noqa:E722
|
||||
logger.info(
|
||||
'Permission error in BMConfigParser().read() method for keys.dat file')
|
||||
|
||||
if config.safeGet('bitmessagesettings', 'settingsversion'):
|
||||
logger.info('Loading config files from same directory as program.')
|
||||
needToCreateKeysFile = False
|
||||
state.appdata = paths.lookupExeFolder()
|
||||
except: # noqa:E722
|
||||
else:
|
||||
# Could not load the keys.dat file in the program directory.
|
||||
# Perhaps it is in the appdata directory.
|
||||
state.appdata = paths.lookupAppdataFolder()
|
||||
|
|
|
@ -95,7 +95,7 @@ def verify(msg, sig, hexPubkey):
|
|||
# old SHA1 algorithm.
|
||||
sigVerifyPassed = makePubCryptor(hexPubkey).verify(
|
||||
sig, msg, digest_alg=OpenSSL.digest_ecdsa_sha1)
|
||||
except: # noqa:E722
|
||||
except:
|
||||
sigVerifyPassed = False
|
||||
if sigVerifyPassed:
|
||||
# The signature check passed using SHA1
|
||||
|
@ -104,7 +104,7 @@ def verify(msg, sig, hexPubkey):
|
|||
try:
|
||||
return makePubCryptor(hexPubkey).verify(
|
||||
sig, msg, digest_alg=OpenSSL.EVP_sha256)
|
||||
except: # noqa:E722
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
|
|
Reference in New Issue
Block a user