<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Decrypt my World : Smart Card</title><link>http://blogs.msdn.com/alejacma/archive/tags/Smart+Card/default.aspx</link><description>Tags: Smart Card</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to clean up expired certs on your smart card</title><link>http://blogs.msdn.com/alejacma/archive/2008/10/30/how-to-clean-up-expired-certs-on-your-smart-card.aspx</link><pubDate>Thu, 30 Oct 2008 13:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9024221</guid><dc:creator>alejacma</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alejacma/comments/9024221.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alejacma/commentrss.aspx?PostID=9024221</wfw:commentRss><description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;The other day a colleague of mine was trying to renew his smart card certificate, but he got an error telling him that there was not enough space in the card to store the new cert. So&amp;nbsp;he asked me: Alex, how can I delete a certificate from my smart card so there is room for a new one?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: ES; mso-fareast-language: ES; mso-bidi-language: AR-SA"&gt;Well, admins generally have special tools for this task, but sometimes it may be necessary for an end/admin user to manually free up space on an smart card in order to enroll or renew certs. If you are in this situation, you may follow these steps:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: ES; mso-fareast-language: ES; mso-bidi-language: AR-SA"&gt;1) Run the following command to &lt;STRONG&gt;get a list of certificates&lt;/STRONG&gt; stored in the smart card:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: ES; mso-fareast-language: ES; mso-bidi-language: AR-SA"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: ES; mso-fareast-language: ES; mso-bidi-language: AR-SA"&gt;&lt;STRONG&gt;certutil -scinfo &amp;gt; output.txt&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: ES; mso-fareast-language: ES; mso-bidi-language: AR-SA"&gt;Note: Certutil tool should be included on Windows Vista/Server 2008 by default. You may also get it from Windows Server 2003 Admin Pack, for instance.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;Cerutil may request the smart card PIN several times. You can safely ignore these requests by pressing Esc every time. You will finally get a dialog with a list of certificates in the card (in my particular case I got 3 certs, and one of them had already expired). Now close that dialog and wait until certutil finishes running.&lt;BR&gt;&amp;nbsp;&lt;BR&gt;2)&amp;nbsp;Take a look to &lt;STRONG&gt;output.txt&lt;/STRONG&gt;.&amp;nbsp;For example,&amp;nbsp;in my case the first cert (“Certificate 0”) was the expired one (I could see strings like “&lt;STRONG&gt;Chain on smart card is invalid&lt;/STRONG&gt;”, “&lt;STRONG&gt;CERT_TRUST_IS_NOT_TIME_VALID&lt;/STRONG&gt;”&amp;nbsp;and “&lt;STRONG&gt;Expired certificate&lt;/STRONG&gt;”). &lt;STRONG&gt;Copy&lt;/STRONG&gt; its related “&lt;STRONG&gt;Key Container&lt;/STRONG&gt;” value (“f6138188-3725-4c2b-8cf6-9c421d8bee69” in my case).&lt;BR&gt;&amp;nbsp;&lt;BR&gt;3)&amp;nbsp;Run the following command to &lt;STRONG&gt;remove the certificate associated to the key container&lt;/STRONG&gt; you copied before:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: ES; mso-fareast-language: ES; mso-bidi-language: AR-SA"&gt;&lt;STRONG&gt;certutil -delkey -csp "Microsoft Base Smart Card Crypto Provider" "f6138188-3725-4c2b-8cf6-9c421d8bee69"&lt;BR&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;BR&gt;Note: your smart card CSP may be different. Use yours.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: ES; mso-fareast-language: ES; mso-bidi-language: AR-SA"&gt;Now you should be able to store a new cert in the card.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: ES; mso-fareast-language: ES; mso-bidi-language: AR-SA"&gt;I hope this helps.&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alex (Alejandro Campos Magencio)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9024221" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alejacma/archive/tags/Smart+Card/default.aspx">Smart Card</category></item><item><title>PKCS#11 interface support on Windows 2000/Server 2003</title><link>http://blogs.msdn.com/alejacma/archive/2008/03/06/pkcs-11-interface-support-on-windows.aspx</link><pubDate>Thu, 06 Mar 2008 09:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8026837</guid><dc:creator>alejacma</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alejacma/comments/8026837.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alejacma/commentrss.aspx?PostID=8026837</wfw:commentRss><description>&lt;P&gt;Hi all, welcome back,&lt;/P&gt;
&lt;P&gt;I recently had some issues involving PKCS#11 interface on Windows,&amp;nbsp;and it seems quite clear that we don't support it, at least on Windows 2000 &amp;amp;&amp;nbsp;Server 2003, and as far as I know on any other version of Windows:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://technet.microsoft.com/en-us/library/bb742463.aspx" mce_href="http://technet.microsoft.com/en-us/library/bb742463.aspx"&gt;Public Key Interoperability&lt;/A&gt; &lt;BR&gt;"&lt;BR&gt;Hardware Support &lt;BR&gt;...&lt;BR&gt;&lt;STRONG&gt;Windows 2000&lt;/STRONG&gt; uses CryptoAPI to abstract hardware-based key management from applications and uses the PC/SC standard instead of PKCS#11 to communicate with smart cards and readers. Entrust, Netscape and Baltimore have their own cryptographic APIs and use PKCS#11 to interface to hardware tokens like smart cards. IBM uses CDSA as its cryptographic framework that includes support for hardware devices. Because Windows 2000 requires hardware devices to also support Plug and Play and Power Management features, and Microsoft's implementation of PC/SC includes support for these ease-of-use features, &lt;STRONG&gt;there are no plans to add support for PKCS#11&lt;/STRONG&gt; in Windows 2000.&lt;BR&gt;"&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://technet2.microsoft.com/windowsserver/en/library/99f41414-39cb-4d38-9659-07e48ec3cf301033.mspx" mce_href="http://technet2.microsoft.com/windowsserver/en/library/99f41414-39cb-4d38-9659-07e48ec3cf301033.mspx"&gt;Evaluating Factors That Affect Extended Trusts&lt;/A&gt;&lt;BR&gt;"&lt;BR&gt;Algorithm Support&lt;BR&gt;...&lt;BR&gt;&lt;STRONG&gt;Windows Server 2003&lt;/STRONG&gt; uses CryptoAPI to abstract hardware-based key management from applications, and it uses the PC/SC standard instead of PKCS#11 to communicate with smart cards and readers. Many third-party CAs have their own cryptographic APIs and use PKCS#11 to interface to hardware tokens such as smart cards. Because Windows 2000 and Windows Server 2003 require hardware devices to support Plug and Play and power management features, and PC/SC includes support for these ease-of-use features, Windows Server 2003 &lt;STRONG&gt;does not support PKCS#11&lt;/STRONG&gt;.&lt;BR&gt;Note&lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The Windows Server 2003 PKI can use third-party CSPs, and can enroll users for certificates that have keys that were generated by third-party CSPs.&lt;BR&gt;"&lt;/P&gt;
&lt;P&gt;So if you have any issues with a PKCS#11 interface, Microsoft Technical Support&amp;nbsp;is not the one you should contact, but the provider of the interface instead.&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alex (Alejandro Campos Magencio)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8026837" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alejacma/archive/tags/CryptoAPI/default.aspx">CryptoAPI</category><category domain="http://blogs.msdn.com/alejacma/archive/tags/Smart+Card/default.aspx">Smart Card</category><category domain="http://blogs.msdn.com/alejacma/archive/tags/SCard+API/default.aspx">SCard API</category></item><item><title>How to select which Smart Card reader to perform actions on</title><link>http://blogs.msdn.com/alejacma/archive/2008/03/03/how-to-select-which-smart-card-reader-to-perform-actions-on.aspx</link><pubDate>Mon, 03 Mar 2008 14:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8000547</guid><dc:creator>alejacma</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alejacma/comments/8000547.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alejacma/commentrss.aspx?PostID=8000547</wfw:commentRss><description>&lt;P&gt;Hi all, welcome back,&lt;/P&gt;
&lt;P&gt;Most of the time we only have a smart card reader in our machine, and we only use one smart card to perform crypto operations. But what if we have &lt;STRONG&gt;several readers and cards&lt;/STRONG&gt;, and those cards share the &lt;STRONG&gt;same CSP&lt;/STRONG&gt; (Cryptographic Service Provider)? Can we select the one we want to use when working with &lt;STRONG&gt;CryptoAPI/XEnroll/CertEnroll&lt;/STRONG&gt;?&lt;/P&gt;
&lt;P&gt;Let's take a look to &lt;STRONG&gt;XEnroll&lt;/STRONG&gt;, for instance: We can set &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en"&gt;WriteCertToCSP&lt;/A&gt; Property of the &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en"&gt;ICEnroll4 Interface&lt;/A&gt; to TRUE so the certificates will be written to the smart card in addition to being written to "MY" store when calling i.e. &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en"&gt;acceptPKCS7&lt;/A&gt; method (Note: WriteCertToCSP is TRUE by default). But apparently we can't specify which card we want to write the cert to. So what happens if we have two cards with same CSP inserted at the same time? Well, in this case the CSP itself will be responsible of giving the user the possibility to choose the card it wants. When we enroll the cert, the CSP should show a dialog so we can choose&amp;nbsp;the appropiate&amp;nbsp;card.&lt;/P&gt;
&lt;P&gt;As you sure know, XEnroll won’t work on &lt;STRONG&gt;Vista&lt;/STRONG&gt;. Vista now uses the new certificate enrollment component &lt;STRONG&gt;CertEnroll&lt;/STRONG&gt; (see &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en"&gt;Certificate Enrollment API&lt;/A&gt; for more info). But my comments still apply here: the CSP should help us to choose the card.&lt;/P&gt;
&lt;P&gt;And what if we want to do the selection programmatically? Can that be done? Yes, we may be able to do it. If we want to select the card for the CSP then we should figure out which &lt;STRONG&gt;reader&lt;/STRONG&gt; the card is in, and then use the "&lt;STRONG&gt;\\.\&amp;lt;Reader Name&amp;gt;\&lt;/STRONG&gt;" format for the &lt;STRONG&gt;container name&lt;/STRONG&gt; when calling &lt;STRONG&gt;CryptAcquireContext&lt;/STRONG&gt; API, for instance. If we also know the container name we can use "&lt;STRONG&gt;\\.\&amp;lt;Reader Name&amp;gt;\&amp;lt;Container Name&amp;gt;\&lt;/STRONG&gt;" (See the &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ac201438-3317-44d3-9638-07625fe397b9&amp;amp;displaylang=en"&gt;smart card white paper&lt;/A&gt; for more details on our &lt;STRONG&gt;MS Base CSP&lt;/STRONG&gt;). The CSP should be able to work with the right card. &lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Alex (Alejandro Campos Magencio)&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8000547" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alejacma/archive/tags/CryptAcquireContext/default.aspx">CryptAcquireContext</category><category domain="http://blogs.msdn.com/alejacma/archive/tags/CryptoAPI/default.aspx">CryptoAPI</category><category domain="http://blogs.msdn.com/alejacma/archive/tags/Smart+Card/default.aspx">Smart Card</category></item><item><title>SCardGetStatusChange fails with SCARD_E_NO_SERVICE error </title><link>http://blogs.msdn.com/alejacma/archive/2007/12/17/scardgetstatuschange-fails-with-scard-e-no-service-error.aspx</link><pubDate>Mon, 17 Dec 2007 12:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6787837</guid><dc:creator>alejacma</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/alejacma/comments/6787837.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alejacma/commentrss.aspx?PostID=6787837</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Hi, welcome back,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;STRONG&gt;Smart Card Redirection&lt;/STRONG&gt; on&amp;nbsp;&lt;STRONG&gt;Microsoft Remote Desktop Protocol (RDP)&amp;nbsp;client 6.0&lt;/STRONG&gt; may cause &lt;STRONG&gt;SCardGetStatusChange&lt;/STRONG&gt; to fail with error &lt;STRONG&gt;0x8010001d&amp;nbsp;- SCARD_E_NO_SERVICE&amp;nbsp;- "The Smart card resource manager is not running."&lt;/STRONG&gt;.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;When a user connects from her machine A (i.e. Windows XP SP2) to a remote machine B (i.e. Windows Vista) using Microsoft RDP client, she can use her smart card inserted in a reader on machine A to perform operations on remote machine B. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;This is called smart card redirection and is enabled by default.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;However, from &lt;STRONG&gt;RDP client 6.0&lt;/STRONG&gt; on, there appears to be a problem with applications on machine B which call SCardGetStatusChange() in order to monitor smart card status changes, such as smart card insertions and removals.&amp;nbsp;SCardGetStatusChange API fails with the error shown above. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Previous versions of the RDP client did not exhibit this problem.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Well, I've seen that this issue happens when some fields of the &lt;STRONG&gt;rgReaderStates&lt;/STRONG&gt; structure being passed to &lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;A class="" href="http://msdn2.microsoft.com/en-us/library/aa379773.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/aa379773.aspx"&gt;SCardGetStatusChange&lt;/A&gt; are not being initialized, so they contain invalid values that SCardGetStatusChange tries to use unsuccessfully.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;A piece of advice: clean up the fields of the rgReaderStates structure before calling SCardGetStatusChange, so all unused fields are set to 0.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;I hope this helps.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT face=Calibri size=3&gt;Cheers,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;o:p&gt;Alex (Alejandro Campos Magencio)&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6787837" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alejacma/archive/tags/Smart+Card/default.aspx">Smart Card</category><category domain="http://blogs.msdn.com/alejacma/archive/tags/SCard+API/default.aspx">SCard API</category></item><item><title>Smart Card's PIN gets cached</title><link>http://blogs.msdn.com/alejacma/archive/2007/12/12/smartcard-s-pin-gets-cached.aspx</link><pubDate>Wed, 12 Dec 2007 21:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6748249</guid><dc:creator>alejacma</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alejacma/comments/6748249.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alejacma/commentrss.aspx?PostID=6748249</wfw:commentRss><description>&lt;P&gt;Hi,&amp;nbsp;welcome back,&lt;/P&gt;
&lt;P&gt;When we use a &lt;STRONG&gt;Smart Card&lt;/STRONG&gt;&amp;nbsp;with any application (i.e. Internet Explorer),&amp;nbsp;the &lt;STRONG&gt;PIN&lt;/STRONG&gt; that user inserted to access the card the first time&amp;nbsp;may get &lt;STRONG&gt;cached&lt;/STRONG&gt; and not requested again during the live of the application.&amp;nbsp;But what if we need the PIN to be requested everytime we use the card with that application?&lt;/P&gt;
&lt;P&gt;The Smart Card &lt;STRONG&gt;CSP&lt;/STRONG&gt; (Crypto Service Provider) is in charge of PIN cache. PIN is cached by card/process/time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We may have two possible solutions here:&lt;/P&gt;
&lt;P&gt;1) The CSP has a parameter that we can set in i.e. the registry to disable the PIN cache. This depends on the CSP.&lt;/P&gt;
&lt;P&gt;2) We can flush the cache with &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/aa380276.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/aa380276.aspx"&gt;CryptSetProvParam&lt;/A&gt;&amp;nbsp;API, but not all CSP implement this. Microsoft Base Smart Card Crypto Provider implements it, for instance. This is the way we should call this &lt;STRONG&gt;CryptoAPI&lt;/STRONG&gt;:&lt;/P&gt;&lt;PRE&gt;CryptSetProvParam(hProv, PP_SIGNATURE_PIN, NULL, 0)
&lt;/PRE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alex (Alejandro Campos Magencio)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6748249" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alejacma/archive/tags/CryptoAPI/default.aspx">CryptoAPI</category><category domain="http://blogs.msdn.com/alejacma/archive/tags/Smart+Card/default.aspx">Smart Card</category></item></channel></rss>