How to open a Windows Service certificate store?
I need to install a Personal certificate for a Windows Service. So far I have been able to install certificate in CurrentUser and LocalMachine (in case of root certs), but I haven't been able to find if there is way to do this for a Windows Service store (for Message Queuing - MSMQ
service). Here is what I have so far.
X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
Any ideas? I have seen references to Web Service Enhancements having a method to open a service cert collection, but I am trying t开发者_JAVA技巧o figure out if System.Security.Cryptography has something equivalent.
This program is in C# targetting .NET 4.
I don't think that any of the .NET APIs allow access to the Services Certificate store.
However, you can install the certificate into the CurrentUser store of the account that the service runs under.
For machine accounts like NetworkService, you can run the certificate installing application under that account, in order to write to the store.
精彩评论