Is there a way to Import a .p12/pfx
file to Smartcard programmatically? I know it works via certutil
:
certutil -user -p "pw" -csp "csp" -importpfx path
I am using "Microsoft Base Smart Card Crypto Provider"
Via certutil it is working thus I am sure it also should using c# (maybe CRYPTOAPI)...I just don´t want to use kind of (starting cmd adding the "Import string"):
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = strCmdText;
process.StartInfo = startInfo;
process.Start();
to Import the pfx!
But I have no clue how this could work programmatically in c#. Any help will be appreciated.