简体   繁体   中英

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 to 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM