I'm currently trying to use the SignerSignEx2 function to sign a DLL with Authenticode. For that purpose I created a private key and put it into the machine key store (so the file would be stored in C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys).
Unfortunately it seems that the SignerSignEx2 function only looks for keys in the user store (when I put the keys into the user store (so that the file is stored in C:\Users{user}\AppData\Roaming\Microsoft\Crypto\RSA{user-id}) it works fine).
Does anyone know of a way to call SignerSignEx2 in such a way that it uses the machine key store instead of the user store?
Essentially the functionality should be similar to the CspParameters class, which allows using CspProviderFlags.UseMachineKeyStore to control which key store is used.