diff --git a/Guard.WPF/Core/Import/Importer/AegisAuthenticatorImporter.cs b/Guard.WPF/Core/Import/Importer/AegisAuthenticatorImporter.cs index 5e2c482..179b204 100644 --- a/Guard.WPF/Core/Import/Importer/AegisAuthenticatorImporter.cs +++ b/Guard.WPF/Core/Import/Importer/AegisAuthenticatorImporter.cs @@ -1,6 +1,7 @@ using System.IO; using System.Text; using System.Text.Json; +using Guard.Core; using Guard.Core.Models; using Guard.Core.Security; using Guard.WPF.Core.Icons; @@ -78,6 +79,13 @@ public bool RequiresPassword(string? path) ); } + if (!Aes256Gcm.IsSupported) + { + throw new Exception( + "AES256-GCM is not supported on this platform. The reason may be that your CPU does not support hardware-accelerated AES256-GCM encryption." + ); + } + byte[]? masterKey = null; foreach (AegisExport.HeaderSlot slot in export.Header.Slots) @@ -170,14 +178,18 @@ public bool RequiresPassword(string? path) ); break; } - catch (Exception) + catch (Exception e) { + Log.Logger.Error( + $"Failed to decrypt Aegis master key: {e.Message}\n{e.StackTrace}" + ); continue; } } if (masterKey == null) { + Log.Logger.Error("Failed to decrypt Aegis master key: master key is null"); throw new Exception(I18n.GetString("import.password.invalid")); } diff --git a/Guard.WPF/Core/Import/Importer/AuthenticatorProImporter.cs b/Guard.WPF/Core/Import/Importer/AuthenticatorProImporter.cs index f6718cb..1d43978 100644 --- a/Guard.WPF/Core/Import/Importer/AuthenticatorProImporter.cs +++ b/Guard.WPF/Core/Import/Importer/AuthenticatorProImporter.cs @@ -226,7 +226,7 @@ private static BackupType GetBackupType(byte[] data) if (!Aes256Gcm.IsSupported) { throw new Exception( - "This platform does not support hardware-accelerated AES (GCM) encryption that is required to import this file." + "AES256-GCM is not supported on this platform. The reason may be that your CPU does not support hardware-accelerated AES256-GCM encryption." ); } diff --git a/Guard.WPF/Core/Import/Importer/TwoFasImporter.cs b/Guard.WPF/Core/Import/Importer/TwoFasImporter.cs index 421605e..037576d 100644 --- a/Guard.WPF/Core/Import/Importer/TwoFasImporter.cs +++ b/Guard.WPF/Core/Import/Importer/TwoFasImporter.cs @@ -223,7 +223,7 @@ public bool RequiresPassword(string? path) if (!Aes256Gcm.IsSupported) { throw new Exception( - "This platform does not support hardware-accelerated AES (GCM) encryption that is required to import this file." + "AES256-GCM is not supported on this platform. The reason may be that your CPU does not support hardware-accelerated AES256-GCM encryption." ); }