Reputation: 134
I need to gain access to private key of PKI certificate which is stored in a card. I have access to it via Smart Card reader. Whenever I try to use private key, at first time I always have to enter PIN number into PIN prompt.
Is it possible to enter PIN programmatically and use private key without PIN prompt? I need to create WCF service that will sign the input data using PKI certificate and take them back signed to user.
In that way I currently try to sign data using PKI certificate using C#:
var cmsSigner = new CmsSigner(x509certificate2); // certificate fetched from store
var contentInfo = new ContentInfo(dataToSign);
var signedCms = new SignedCms(contentInfo, true);
signedCms.ComputeSignature(cmsSigner, false);
PIN prompt always opens at the first ComputeSignature
method call. How can I pass PIN to gain access to private key directly and avoid entering PIN manually via prompt?
Upvotes: 2
Views: 3062
Reputation: 94048
It comes down to two situations:
In the first case you should read How to: Access Hardware Encryption Devices and then try to pass a KeyPassword
to the CSP.
In the latter case it probably amounts to contacting the company that created the CSP and ask which options are available. Fortunately this option is usually not implemented anymore.
Upvotes: 1