smart card dialog popup with Win7
We have an issue in smart card dialog popup with Win7 If you try to sign any data with Smart Card, user is asked to insert his smart card in the reader and then enter his PIN. Now as long as card is not removed from the reader, user is not asked to enter PIN every you call sign API and data is signed correctly. If you pull smart card out, then user is asked to insert card and enter PIN when signing API is called, but after that even if the card is left in the reader, user is asked for PIN every time you call sign operation. This only happens on Win7, we have tested on Vista, 2003 and XP and it does not ask PIN again and again for each operation after you pull smart card out and put back in. I have tried creating a new instance of RSACryptoServiceProvider on every signing call or used singleton implementation both and problem persists in both implementations. Does anyone have idea on what is changed in Win7 ? and what is the fix for this? Below is the sample code which repros the condition. private string SignWithSmartCard2(string data) { byte[] signature; CspParameters cspParameters = null; RSACryptoServiceProvider csp = null; HashAlgorithm ha = null; try { cspParameters = new CspParameters(1, "Microsoft Base Smart Card Crypto Provider"); cspParameters.Flags = CspProviderFlags.UseDefaultKeyContainer; csp = new RSACryptoServiceProvider(cspParameters); ha = HashAlgorithm.Create("SHA1"); ha.Initialize(); signature = csp.SignData(new ASCIIEncoding().GetBytes(data), ha); return Convert.ToBase64String(signature); } finally { // release hash algorithm resources if (ha != null) ha.Clear(); // release csp resources if (csp != null) csp.Clear(); } }h8me
October 12th, 2009 9:45pm

Since this is a software development question, please discuss in our MSDN forum. Microsoft Developer Network Arthur Xie - MSFT
Free Windows Admin Tool Kit Click here and download it now
October 14th, 2009 12:17pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics