From a02ed2b54980b5428e2d6f3073b9620c9e4348f6 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Wed, 10 Jul 2024 17:07:35 +0200 Subject: [PATCH] Add debug logging when hmac-secret output decryption fails --- src/ctap2/commands/get_assertion.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ctap2/commands/get_assertion.rs b/src/ctap2/commands/get_assertion.rs index b8435935..5ac64c67 100644 --- a/src/ctap2/commands/get_assertion.rs +++ b/src/ctap2/commands/get_assertion.rs @@ -376,7 +376,13 @@ impl GetAssertion { { dev.get_shared_secret() .and_then(|shared_secret| hmac_response.decrypt_secrets(shared_secret)) - .and_then(Result::ok) + .and_then(|result| match result { + Ok(ok) => Some(ok), + Err(err) => { + debug!("Failed to decrypt hmac-secret response: {:?}", err); + None + } + }) } else { None }; @@ -398,7 +404,13 @@ impl GetAssertion { { dev.get_shared_secret() .and_then(|shared_secret| hmac_response.decrypt_secrets(shared_secret)) - .and_then(Result::ok) + .and_then(|result| match result { + Ok(ok) => Some(ok), + Err(err) => { + debug!("Failed to decrypt hmac-secret response: {:?}", err); + None + } + }) .map(|outputs| outputs.into()) } else { None