Re: DEBUGCHK error in smartcard

From: Igor Dvorkin [MS] (igord_at_online.microsoft.com)
Date: 07/08/04


Date: Thu, 08 Jul 2004 12:48:30 -0700

I'm having trouble understanding your email. Hopefully this answers your
questions.

I am looking int the CETK.

If you have a CSP for your smartcard (I don't think you have one) , then you
can use Cryptography APIs (CryptAcquireContext,etc) to access the card.

If you do not have a CSP you can communicate with the smartcard by using the
the Smart Card Resource Manager APIS
(SCardConnect,SCardTransmit,SCardLocateCards,etcs).

In general, A smartcard CSP will map CryptoAPI calls into Smart Card Resource
Manager calls.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Igor Dvorkin ( igord at microsoft dot com)
This posting is provided "AS IS" with no warranties, and confers no rights.

* visi <zqvisi@hotmail.com>:
> Hi Igor,
> If I may use CETK to test my driver and if CETK is using CSP? Because I ever
> use CETK to testing my driver,but the result is the same to open control
> panel,driver reads ATR and returns ATR to OS,then CETK calls several times
> IOCTL_SMARTCARD_GET_ATTRIBUTE and IOCTL_SMARTCARD_GET_STATE,then
> IOCTL_SMARTCARD_CANCEL_BLOCKING is called.
> The Smart Card Resource Manager APIS is CryptoAPI other than CryptoSPI ?
> If I use CryptoAPI to develop simple test application, do i not permit to
> write/read date in card because having not CSP?
>
> > (SCardConnect,SCardTransmit,SCardLocateCards,etcs).
> "Igor Dvorkin [MS]" <igord@online.microsoft.com> wrote in message
> news:slrnceot3b.2ns.igord@iggypop.redmond.corp.microsoft.com...
> > It sounds to me like your reader is working. A way to validate this is to
> use
> > the Smart Card Resource Manager APIS
> > (SCardConnect,SCardTransmit,SCardLocateCards,etcs).
> >
> >
> > The Certificate Control panel applet talks to the smartcard using
> Cryptography
> > API. Thus to use your smartcard from the Certificate Control Panel you
> will
> > need a Cryptograhic Service Provider (CSP) for your particular smartcard.
> > (See following picture).
> >
> >
> > -------------------------------------
> > | Certificate Control Panel Applet
> > -------------------------------------
> > | Cryptography API
> > -------------------------------------
> > | Smartcard CSP
> > -------------------------------------
> > | Smart Card Resource Manager
> > -------------------------------------
> > | Smart Card Driver
> > -------------------------------------
> >
> > If you need to write a CSP for your built in smartcard, we have a sample
> > smartcard CSP available at: public/common/sdk/samples/scwcsp. However,
> this
> > sample is dependant on a particular smartcard.
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > Igor Dvorkin ( igord at microsoft dot com)
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> > * visi <zqvisi@hotmail.com>:
> > > Hi Igor,
> > > because the first card state is SCARD_SWALLOWED, when calling
> RDF_CARD_POWER
> > > routine, it implements SCARD_COLD_RESET ,then read ATR, just then the
> card
> > > state is SCARD_NEGOTIABLE. Lastly calling
> IOCTL_SMARTCARD_CANCEL_BLOCKING,
> > > unload driver.
> > > I open Sertificate in Control panel, then select sertificate from smart
> > > card,The following debug message is output :
> > > ********************
> > > 0x8bdf623c: ==>>SCR_Open( )
> > > 0x8bdf623c: build-in Smart Card Reader : Open(321ac0) - entered
> > > 0x8bdf623c: InitializeDevice
> > > 0x8bdf623c: build-in Smart Card Reader : CardState 2
> > > 0x8bdf623c: <<==SCR_Open( )
> > >
> > > 0x8bdf623c: ==>>SCR_IOControl( )
> > > 0x8bdf623c: ==>>SmartcardDeviceControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Ioctl = GET_ATTRIBUTE
> > > 0x8bdf623c: default
> > > 0x8bdf623c: ==>>OCTL_SMARTCARD_GET_ATTRIBUTE
> > > 0x8bdf623c: <<==SMCDeviceIoControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Exit
> > > 0x8bdf623c: <<==SmartcardDeviceControl( )
> > > 0x8bdf623c: <<==SCR_IOControl( )
> > >
> > > 0x8bdf623c: ==>>SCR_IOControl( )
> > > 0x8bdf623c: ==>>SmartcardDeviceControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Ioctl = GET_STATE
> > > 0x8bdf623c: default
> > > 0x8bdf623c: IOCTL_SMARTCARD_GET_STATE
> > > 0x8bdf623c: <<==SMCDeviceIoControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Exit
> > > 0x8bdf623c: <<==SmartcardDeviceControl( )
> > > 0x8bdf623c: <<==SCR_IOControl( )
> > >
> > > 0x8bdf623c: ==>>SCR_IOControl( )
> > > 0x8bdf623c: ==>>SmartcardDeviceControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Ioctl = POWER
> > > 0x8bdf623c: default
> > > 0x8bdf623c: IOCTL_SMARTCARD_POWER
> > > 0x8bdf623c: ==>>TLP3ReaderPower( )
> > > 0x8bdf623c: SCARD_COLD_RESET
> > > 0x8bdf623c: build-in Smart Card Reader !TLP3ReaderPower: Enter (1)
> > > 0x8bb14774: build-in Smart Card Reader : SCRSerialEvent(321ac0) -
> entered
> > > 0x8bdf623c: ==>>SCRio( )
> > > 0x8bdf623c: <<==SCRio( )
> > > 0x8bdf623c: SCI!SmartcardUpdateCardCapabilities:
> > > 0x8bdf623c: ATR:
> > > 0x8bdf623c: 3B
> > > 0x8bdf623c: 16
> > > 0x8bdf623c: 94
> > > 0x8bdf623c: 01
> > > 0x8bdf623c: 01
> > > 0x8bdf623c: 02
> > > 0x8bdf623c: 07
> > > 0x8bdf623c: 01
> > > 0x8bdf623c: 00
> > > 0x8bdf623c:
> > > 0x8bdf623c: Card parameters from ATR:
> > > Fl = 09 (5000 KHz), Dl = 04, I = 00, P = 32, N = 00
> > > 0x8bdf623c: PTS parameters (PTS_TYPE_DEFAULT):
> > > Fl = 01 (3571 KHz), Dl = 01 (9600 Bps, 2 Stop Bits)
> > > 0x8bdf623c: Calculated timing values:
> > > Work etu = 105 micro sec, Guard time = 0 micro sec
> > > 0x8bdf623c: T=0 Values from ATR:
> > > WI = 10
> > > 0x8bdf623c: T=0 Timing from ATR:
> > > WT = 1008 ms
> > > 0x8bdf623c: Mode: Negotiable
> > >
> > >
> > > 0x8bdf623c: build-in Smart Card Reader !TLP3ReaderPower: Exit (0)
> > > 0x8bdf623c: <<==TLP3ReaderPower( )
> > > 0x8bdf623c: <<==SMCDeviceIoControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Exit
> > > 0x8bdf623c: <<==SmartcardDeviceControl( )
> > > 0x8bdf623c: <<==SCR_IOControl( )
> > >
> > > 0x8bdf623c: ==>>SCR_IOControl( )
> > > 0x8bdf623c: ==>>SmartcardDeviceControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Ioctl = GET_STATE
> > > 0x8bdf623c: default
> > > 0x8bdf623c: IOCTL_SMARTCARD_GET_STATE
> > > 0x8bdf623c: <<==SMCDeviceIoControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Exit
> > > 0x8bdf623c: <<==SmartcardDeviceControl( )
> > > 0x8bdf623c: <<==SCR_IOControl( )
> > >
> > > 0x8bdf623c: ==>>SCR_IOControl( )
> > > 0x8bdf623c: ==>>SmartcardDeviceControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Ioctl = GET_ATTRIBUTE
> > > 0x8bdf623c: default
> > > 0x8bdf623c: ==>>OCTL_SMARTCARD_GET_ATTRIBUTE
> > > 0x8bdf623c: SCARD_ATTR_ATR_STRING
> > > 0x8bdf623c: <<==SMCDeviceIoControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Exit
> > > 0x8bdf623c: <<==SmartcardDeviceControl( )
> > > 0x8bdf623c: <<==SCR_IOControl( )
> > >
> > > 0x8bdf623c: ==>>SCR_IOControl( )
> > > 0x8bdf623c: ==>>SmartcardDeviceControl( )
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Ioctl = *** UNKNOWN ***
> > > 0x8bdf623c: IOCTL_SMARTCARD_CANCEL_BLOCKING
> > > 0x8bdf623c: SCI!(SmartcardDeviceControl): Exit
> > > 0x8bdf623c: <<==SmartcardDeviceControl( )
> > > 0x8bdf623c: <<==SCR_IOControl( )
> > > 0x8bdf623c: ==>>SCR_Close( )
> > > 0x8bdf623c: build-in Smart Card Reader : Close(321ac0) - entered
> > > 0x8bdf623c: ==>>ValidateAndEnterDevice( )
> > > 0x8bdf623c: <<==ValidateAndEnterDevice( )
> > > 0x8bdf623c: <<==SCR_Close( )
> > > ***************************
> > > I think after driver returns ATR string to OS by SCARD_ATTR_ATR_STRING
> > > of OCTL_SMARTCARD_GET_ATTRIBUTE in Smcioctl.c, OS doesn't recognise ATR
> > > correctly or OS doesn't support this type smart card or the ATR string
> > > format returned is error, so calling IOCTL_SMARTCARD_CANCEL_BLOCKING.
> > > the card that I is using is SIM card issued by china mobile, unsureing
> who
> > > produces it.
> > >
> > > I ever use ATR=0x3f\0x67\0x25\0x00\0x21\0x20\0x00\0x0F\0x68\0x90\0x00
> rather
> > > than reading from card, the card state is SCARD_SPECIFIC, when the ATR
> is
> > > returnd to OS,IOCTL_SMARTCARD_CANCEL_BLOCKING still is called.
> > >
> > >
> > >
> > >
> > >
> > >
>
>



Relevant Pages

  • Re: DEBUGCHK error in smartcard
    ... If I may use CETK to test my driver and if CETK is using CSP? ... The Smart Card Resource Manager APIS is CryptoAPI other than CryptoSPI? ... Thus to use your smartcard from the Certificate Control Panel you ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Smartcard CSP Problem
    ... You don't need to emulate a smartcard CSP for it to work with S-MIME. ... But your "simulated" smartcard CSP is not going to work for Windows logon. ... > If I understood the concept of the certificate handling in windows, ... > provide certification handling - Does the enrollement task itsself store ...
    (microsoft.public.platformsdk.security)
  • RE: Disabled Smartcard logon?
    ... the Smartcard Logon GINA option from being displayed. ... csp for winlogon. ... > directly to the reader. ... > Ask the vendor if they have such service which you can use from your CSP code. ...
    (microsoft.public.platformsdk.security)
  • Re: DEBUGCHK error in smartcard
    ... I looked at the tests in the CETK. ... and most tests expect you to be able to add/remove a smartcard. ... You will need to write a test application using the Smart Card Resource Manager ... > can use Cryptography APIs to access the card. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Smartcard CSP Problem
    ... Emulating a smartcard reader is required for smartcard logon. ... > flash drive with an embedded crypto processor to perform the encryption. ... Would a simple CSP DLL work in this case? ... Is there a need to emulate a smart card? ...
    (microsoft.public.platformsdk.security)