Merge pull request #2498 from PhilippC/2246--fix-base32-parsing-in-keepass2totp

replace base32 parsing algorithm to fix issue with some TOTP entries using KeePass2 style
This commit is contained in:
PhilippC
2024-01-03 11:27:14 +01:00
committed by GitHub

View File

@@ -5,6 +5,7 @@ using keepass2android;
using KeePassLib; using KeePassLib;
using KeePassLib.Cryptography; using KeePassLib.Cryptography;
using KeePassLib.Utility; using KeePassLib.Utility;
using KeeTrayTOTP.Libraries;
namespace PluginTOTP namespace PluginTOTP
{ {
@@ -66,8 +67,8 @@ namespace PluginTOTP
entryFields.TryGetValue(strPrefix + "Secret-Base32", out str); entryFields.TryGetValue(strPrefix + "Secret-Base32", out str);
if (!string.IsNullOrEmpty(str)) if (!string.IsNullOrEmpty(str))
return MemUtil.ParseBase32(str); return Base32.Decode(str);
entryFields.TryGetValue(strPrefix + "Secret-Base64", out str); entryFields.TryGetValue(strPrefix + "Secret-Base64", out str);
if (!string.IsNullOrEmpty(str)) if (!string.IsNullOrEmpty(str))
return Convert.FromBase64String(str); return Convert.FromBase64String(str);