Is it possible to sign digitally from windows service? The same code, that works from console application, does not work from Windows service
I got folllowing error when I attempt to digitally sign:
System.InvalidOperationException: The current session is not interactive. at System.Security.Cryptography.CAPI.CryptUIDlgSelectCertificateW(CRYPTUI_SELECTCERTIFICATE_STRUCTW csc) at System.Security.Cryptography.X509Certificates.X509Certificate2UI.SelectFromStore(SafeCertStoreHandle safeSourceStoreHandle, String title, String message, X509SelectionFlag selectionFlags, IntPtr hwndParent) at System.Security.Cryptography.X509Certificates.X509Certificate2UI.SelectFromCollectionHelper(X509Certificate2Collection certificates, String title, String message, X509SelectionFlag selectionFlag, IntPtr hwndParent) at System.Security.Cryptography.X509Certificates.X509Certificate2UI.SelectFromCollection(X509Certificate2Collection certificates, String title, String message, X509SelectionFlag selectionFlag)
Seems like Windows Service cannot invoke GUI that offers list of certificates to choose or window for PIN? Service runs as LocalSystem which is Admin. I also added app.manifest with following settings:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Is it possible to use win service for this functionality?