I am using a classic advapi32
based ImpersonateValidUser code.
I use the user's credentials to submit a request to the CA using CertEnrollLib.
I initiate the request from the private key by building a CX509PrivateKey
.
If the user has the profile (the user's folder under C:\users) then this code works fine; if the user does not have a profile, the code fails with
System.IO.FileNotFoundException: CertEnroll::CX509PrivateKey::Create: The system cannot find the file specified. 0x80070002 (WIN32: 2)
I looked into loading user profile but it seems to fail for me 'invalid handle' errors.
Any suggestions?