From e8ac716383157ba4b8b111c95458cccef8f0284e Mon Sep 17 00:00:00 2001 From: aitbc Date: Tue, 28 Apr 2026 12:11:45 +0200 Subject: [PATCH] debug: add decryption error logging to diagnose keystore decryption failure --- apps/blockchain-node/src/aitbc_chain/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/blockchain-node/src/aitbc_chain/main.py b/apps/blockchain-node/src/aitbc_chain/main.py index e022d133..33ab9caf 100755 --- a/apps/blockchain-node/src/aitbc_chain/main.py +++ b/apps/blockchain-node/src/aitbc_chain/main.py @@ -51,6 +51,7 @@ def _load_private_key_from_keystore(keystore_dir: Path, password: str, target_ad from cryptography.hazmat.primitives.ciphers.aead import AESGCM from cryptography.hazmat.backends import default_backend + logger.info(f"Attempting to decrypt keystore file: {kf.name}") crypto = data["crypto"] kdfparams = crypto["kdfparams"] salt = bytes.fromhex(kdfparams["salt"]) @@ -68,8 +69,10 @@ def _load_private_key_from_keystore(keystore_dir: Path, password: str, target_ad private_bytes = aesgcm.decrypt(nonce, ciphertext, None) # Verify it's ed25519 priv_key = ed25519.Ed25519PrivateKey.from_private_bytes(private_bytes) + logger.info(f"Successfully decrypted keystore file: {kf.name}") return private_bytes - except Exception: + except Exception as e: + logger.warning(f"Failed to decrypt keystore file {kf.name}: {e}") continue return None