💄 Better error and exit for decryption failures

This commit is contained in:
Renato Alves
2023-07-07 00:05:34 +02:00
parent ac857efde7
commit 297112af45

View File

@@ -102,6 +102,7 @@ class Exit(Exception):
FAIL_SHUTDOWN_NSS = 14 FAIL_SHUTDOWN_NSS = 14
BAD_MASTER_PASSWORD = 15 BAD_MASTER_PASSWORD = 15
NEED_MASTER_PASSWORD = 16 NEED_MASTER_PASSWORD = 16
DECRYPTION_FAILED = 17
PASSSTORE_NOT_INIT = 20 PASSSTORE_NOT_INIT = 20
PASSSTORE_MISSING = 21 PASSSTORE_MISSING = 21
@@ -492,8 +493,9 @@ class NSSProxy:
try: try:
if err_status: # -1 means password failed, other status are unknown if err_status: # -1 means password failed, other status are unknown
self.handle_error( self.handle_error(
Exit.NEED_MASTER_PASSWORD, Exit.DECRYPTION_FAILED,
"Password decryption failed. Passwords protected by a Master Password!", "Username/Password decryption failed. "
"Credentials damaged or cert/key file mismatch.",
) )
res = out.decode_data() res = out.decode_data()