From fee30c22721184e59a2ed4a5b4bc2f61ecde68b5 Mon Sep 17 00:00:00 2001 From: Jim Date: Thu, 2 Jan 2020 23:49:21 -0500 Subject: [PATCH 1/2] Reads thumbprint of desired X509 certificate from X509_thumprint.txt in the Keepass directory. --- Source/SmartCertificateKeyProvider.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Source/SmartCertificateKeyProvider.cs b/Source/SmartCertificateKeyProvider.cs index 8e37562..533bb11 100644 --- a/Source/SmartCertificateKeyProvider.cs +++ b/Source/SmartCertificateKeyProvider.cs @@ -27,9 +27,18 @@ private static X509Certificate2[] UserCertificates var myStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); myStore.Open(OpenFlags.ReadOnly); - var certificates = myStore.Certificates.Cast() - .Where(c => c.HasPrivateKey) - .ToArray(); + X509Certificate2[] certificates = myStore.Certificates.Cast() + .Where(c => c.HasPrivateKey) + .ToArray(); + + if (System.IO.File.Exists("X509_thumbprint.txt")) + { + System.IO.StreamReader file = new System.IO.StreamReader(@"X509_thumbprint.txt"); + string thumbprint = file.ReadLine(); + file.Close(); + X509Certificate2Collection matching_certificates = myStore.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, true); + certificates = matching_certificates.Cast().ToArray(); + } myStore.Close(); From ce09bf4faf2ae6c0ef89466ec44a29a93eb31c5d Mon Sep 17 00:00:00 2001 From: Jim Date: Tue, 7 Jan 2020 22:40:37 -0500 Subject: [PATCH 2/2] Updating to reference new repository, fix silly spelling mistakes, and add some new bugs. --- PluginVersion.txt | 2 +- Source/Properties/AssemblyInfo.cs | 2 +- Source/Smart Certificate KeyProvider.csproj | 32 ++++++++----------- Source/Smart Certificate KeyProvider.sln | 12 +++---- .../SmartCertificateKeyProviderPluginExt.cs | 2 +- 5 files changed, 22 insertions(+), 28 deletions(-) diff --git a/PluginVersion.txt b/PluginVersion.txt index a6454c1..5df52fd 100644 --- a/PluginVersion.txt +++ b/PluginVersion.txt @@ -1,3 +1,3 @@ : -SmartCertificateKeyProviderPlugin:2.0.1 +SmartCertificateKeyProviderPlugin:2.0.2 : diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index b797bb8..d23e2af 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SmartCertificateKeyProviderPlugin")] -[assembly: AssemblyDescription("This plugin uses X.509 certificate from your personal certificate storage to encrypt KeePass database with generated SHA1 hash from certificate's signature. It also allow to use certificates that are on your Smart Card. It is possible to use Secure Desktop feature (needs to be enabled in Options - Security tab) to avoid Keyloggers.\nDON'T LOOSE YOUR CERTIFICATE OR YOU WILL NOT BE ABLE TO OPEN YOUR DATABASE.")] +[assembly: AssemblyDescription("This plugin uses X.509 certificate from your personal certificate storage to encrypt KeePass database with generated SHA1 hash from certificate's signature. It also allow to use certificates that are on your Smart Card. It is possible to use Secure Desktop feature (needs to be enabled in Options - Security tab) to avoid Keyloggers.\nDON'T LOSE YOUR CERTIFICATE OR YOU WILL NOT BE ABLE TO OPEN YOUR DATABASE.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("BodnarSoft")] [assembly: AssemblyProduct("KeePass Plugin")] diff --git a/Source/Smart Certificate KeyProvider.csproj b/Source/Smart Certificate KeyProvider.csproj index 281260a..555d1ea 100644 --- a/Source/Smart Certificate KeyProvider.csproj +++ b/Source/Smart Certificate KeyProvider.csproj @@ -1,5 +1,6 @@  + Debug @@ -61,32 +62,25 @@ - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Source/Smart Certificate KeyProvider.sln b/Source/Smart Certificate KeyProvider.sln index dcfb085..73222f9 100644 --- a/Source/Smart Certificate KeyProvider.sln +++ b/Source/Smart Certificate KeyProvider.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2011 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29613.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Smart Certificate KeyProvider", "Smart Certificate KeyProvider.csproj", "{1FBC0E45-0C76-4346-967B-10D681FB712E}" EndProject @@ -17,10 +17,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1FBC0E45-0C76-4346-967B-10D681FB712E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1FBC0E45-0C76-4346-967B-10D681FB712E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1FBC0E45-0C76-4346-967B-10D681FB712E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1FBC0E45-0C76-4346-967B-10D681FB712E}.Release|Any CPU.Build.0 = Release|Any CPU + {1FBC0E45-0C76-4346-967B-10D681FB712E}.Debug|Any CPU.ActiveCfg = Release|Any CPU + {1FBC0E45-0C76-4346-967B-10D681FB712E}.Debug|Any CPU.Build.0 = Release|Any CPU + {1FBC0E45-0C76-4346-967B-10D681FB712E}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {1FBC0E45-0C76-4346-967B-10D681FB712E}.Release|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/SmartCertificateKeyProviderPluginExt.cs b/Source/SmartCertificateKeyProviderPluginExt.cs index 7eead12..a9f7018 100644 --- a/Source/SmartCertificateKeyProviderPluginExt.cs +++ b/Source/SmartCertificateKeyProviderPluginExt.cs @@ -15,7 +15,7 @@ public SmartCertificateKeyProviderPluginExt() #region Public properties - public override string UpdateUrl => "https://raw.githubusercontent.com/BodnarSoft/KeePass-Smart-Certificate-Key-Provider/master/PluginVersion.txt"; + public override string UpdateUrl => "https://raw.githubusercontent.com/jimmyswimmy/KeePass-Smart-Certificate-Key-Provider/master/PluginVersion.txt"; #endregion