|
@@ -340,7 +340,7 @@ password again")
|
|
|
tries += 1
|
|
|
|
|
|
if not key:
|
|
|
- raise Exception("Wrong password entered %s times; giving up"
|
|
|
+ raise CryptoBadKeyException("Wrong password entered %s times; giving up"
|
|
|
% max_tries)
|
|
|
try:
|
|
|
key = str(key).decode('base64')
|
|
@@ -478,10 +478,20 @@ class CryptoEngineOld(CryptoEngine):
|
|
|
"""
|
|
|
retrieve encrypted data
|
|
|
"""
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ try:
|
|
|
+ plaintext.decode('utf-8')
|
|
|
+ except UnicodeDecodeError:
|
|
|
+ raise CryptoBadKeyException("Error decrypting, bad key")
|
|
|
+
|
|
|
if (plaintext.startswith(_TAG)):
|
|
|
plaintext = plaintext[len(_TAG):]
|
|
|
-
|
|
|
-
|
|
|
|
|
|
try:
|
|
|
|