From 7a3731ce57ee2e874bc859fcb3e69541882aebee Mon Sep 17 00:00:00 2001 From: Victor_Grycuk Date: Fri, 14 May 2021 14:54:04 -0300 Subject: [PATCH] Add support for key files --- StreamDeck-KeePass/StreamDeck-KeePass/KeePassRetrieve.cs | 8 ++++++++ .../PropertyInspector/KeePassRetrievePI.html | 4 ++++ StreamDeck-KeePass/StreamDeck-KeePass/manifest.json | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/StreamDeck-KeePass/StreamDeck-KeePass/KeePassRetrieve.cs b/StreamDeck-KeePass/StreamDeck-KeePass/KeePassRetrieve.cs index b6f4cfe..ac24cd7 100644 --- a/StreamDeck-KeePass/StreamDeck-KeePass/KeePassRetrieve.cs +++ b/StreamDeck-KeePass/StreamDeck-KeePass/KeePassRetrieve.cs @@ -21,6 +21,7 @@ public static PluginSettings CreateDefaultSettings() { DBPath = string.Empty, Password = string.Empty, + KeyFilePath = string.Empty, EntryTitle = string.Empty, Field = string.Empty }; @@ -34,6 +35,9 @@ public static PluginSettings CreateDefaultSettings() [JsonProperty(PropertyName = "Password")] public string Password { get; set; } + [JsonProperty(PropertyName = "keyFilePath")] + public string KeyFilePath { get; set; } + [JsonProperty(PropertyName = "entryTitle")] public string EntryTitle { get; set; } @@ -70,6 +74,10 @@ public override void KeyPressed(KeyPayload payload) var conn = new IOConnectionInfo { Path = settings.DBPath }; var compKey = new CompositeKey(); compKey.AddUserKey(new KcpPassword(settings.Password)); + if (!string.IsNullOrEmpty(settings.KeyFilePath)) + { + compKey.AddUserKey(new KcpKeyFile(settings.KeyFilePath)); + } var db = new KeePassLib.PwDatabase(); db.Open(conn, compKey, null); var entryList = from entry in db.RootGroup.GetEntries(true) diff --git a/StreamDeck-KeePass/StreamDeck-KeePass/PropertyInspector/KeePassRetrievePI.html b/StreamDeck-KeePass/StreamDeck-KeePass/PropertyInspector/KeePassRetrievePI.html index f1fca1c..30c9777 100644 --- a/StreamDeck-KeePass/StreamDeck-KeePass/PropertyInspector/KeePassRetrievePI.html +++ b/StreamDeck-KeePass/StreamDeck-KeePass/PropertyInspector/KeePassRetrievePI.html @@ -15,6 +15,10 @@
KeePass db path
+
+
(Optional) Key File path
+ +
KeePass db password
diff --git a/StreamDeck-KeePass/StreamDeck-KeePass/manifest.json b/StreamDeck-KeePass/StreamDeck-KeePass/manifest.json index 47e8054..22a2d50 100644 --- a/StreamDeck-KeePass/StreamDeck-KeePass/manifest.json +++ b/StreamDeck-KeePass/StreamDeck-KeePass/manifest.json @@ -36,7 +36,7 @@ "Description": "Simple interface to retrieve information from KeePass database. Unofficial.", "Icon": "Images/pluginIcon", "URL": "https://github.com/VictorGrycuk/StreamDeck-KeePass", - "Version": "1.3.1", + "Version": "1.4.0", "CodePath": "streamdeck-keepass", "Category": "KeePass", "CategoryIcon": "Images/categoryIcon",