I'm wondering if it is possible to store smartcard credentials in an application and then pass them to items such as a password reset using DirectoryServices.AccountManagement.
- PrincipalContext domainContext = new PrincipalContext(ContextType.Domain, "abc.com:3268", "DC=abc, DC=com", Username, Password);
-
- UserPrincipal user = UserPrincipal.FindByIdentity(domainContext, "myUser");
-
- user.VoiceTelephoneNumber = "123-456-7890";
- user.Save();
In the above example I want to be able to use a smartcard (I have a class that uses the System.Security.Cryptography.X509Certificates namespace) to run the phone number reset code. I am able to get the credentials through the X509Certificates, and am able to run an executable using the credential Username and Password - but I do not want to start the application with those credentials. I just want to be able to store the credentials so only when certain features are used (resets, unlocks, etc) it access the credentials. Is this possible?