From cdbd12d7d5ef5f3a7188c8350eda2fae89e36ee6 Mon Sep 17 00:00:00 2001 From: 404-Code-404 Date: Tue, 16 Jun 2026 13:23:16 +0200 Subject: [PATCH] Add NTE_PERM error handling in NativeCapi.cs --- EpiSource.KeePass.Ekf/Crypto/Windows/NativeCapi.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/EpiSource.KeePass.Ekf/Crypto/Windows/NativeCapi.cs b/EpiSource.KeePass.Ekf/Crypto/Windows/NativeCapi.cs index a1ee979..fbd3c60 100644 --- a/EpiSource.KeePass.Ekf/Crypto/Windows/NativeCapi.cs +++ b/EpiSource.KeePass.Ekf/Crypto/Windows/NativeCapi.cs @@ -28,7 +28,8 @@ public static partial class NativeCapi { || r.Win32ErrorCode == unchecked((int) CryptoResult.NTE_BAD_KEY) || r.Win32ErrorCode == unchecked((int) CryptoResult.NTE_BAD_KEYSET) || r.Win32ErrorCode == unchecked((int) CryptoResult.SCARD_E_NO_SMARTCARD) - || r.Win32ErrorCode == unchecked((int) CryptoResult.SCARD_E_NO_READERS_AVAILABLE); + || r.Win32ErrorCode == unchecked((int) CryptoResult.SCARD_E_NO_READERS_AVAILABLE) + || r.Win32ErrorCode == unchecked((int) CryptoResult.NTE_PERM); public static bool IsCancelledByUserException(CryptographicException ex) { return ex is CryptoOperationCancelledException || unchecked((CryptoResult)ex.HResult) == CryptoResult.SCARD_W_CANCELLED_BY_USER; @@ -540,4 +541,4 @@ private static byte[] GetNcryptOrCspProperty(NcryptOrContextHandle handle, strin } } -} \ No newline at end of file +}