Re: Writing a Smart Card Minidriver (on PKCS#11)



Hi Alex,

As a lot of full CSPs are based on PKCS#11, I want to use our PKCS#11 in
the
minidriver.

I wouldn't really say that a lot of full CSPs are based on an underlying
PKCS#11 library. My experience is that it's a lot easier to write a CSP
that directly sends APDUs to the smart card using the smart card API, than
trying to map a PKCS#11 library model onto the entirely different CSP model.

I read the Minidriver Specification, but there were some
functions like Challenge Response authentication or writing files which
are
not supported by PKCS#11. We only want to use the cards for certificate
authentication and signing (e.g. outlook, website authentication, logon)
and
roll out certificates with certsrv but not to store user data on them.

You don't have to support the challenge response authentication, which is
used for administrator 'log on' to the card. However, you won't be able to
e.g. use the pintool.exe tool to unblock a card if you don't have
challenge/response authentication.
You don't need to have a file system physically on your card, however your
smart card minidriver will have to emulate one. E.g., the card ID will be
read from the \cardid file and the container map file (mscp\cmapfile) will
link key container names to key numbers. Your minidriver can translate a
CardReadFile() call for the \cardid file into an APDU that retrieves a
unique card id from the card and then retrurn the card id to the caller,
without the need for a file to actually exist on the card.

Has somebody experience with a minidriver based on PKCS#11? Does this work
or are there major problems expected.

It's probably doable; but I wouldn't do it. My guess is you'll lose a lot
of time and encounter a lot of frustration trying to map 3 different
cryptographic token models: (1) the model implicitly assumed by the
minidriver model, (2) the PKCS#11 model and (3) the actual architecture of
your smart card and its APDU command and feature set. Also, you're bound to
be doing some hacks to make those models match, which will negatively affect
the security and maintainability of your solution.

To check which function of the minidriver the applications are calling
with
the parameters, it would be useful to debug a minidriver. How can I debug
it?
Is the driver running in kernel mode or can I debug it like a normal dll.
How can I debug during logon? Do I need to debug in kernel mode with 2 PCs
and a serial cable, or is there a more convenient way?

A smart card minidriver works entirely in user mode. You can debug it using
a normal debugger. The application that uses the cryptographic functions
will be calling advapi32.dll, which in turn calls basecsp.dll (the Microsoft
Base Smart Card CSP), which in turn calls your minidriver, all in user mode.
Debugging during logon using a live debugger is not possible as far as I
know. However, you can always write logging traces to a log file and
examine that. In my experience; this is sufficient to debug smart card
logon sequences.

Cheers,
Jan.


.



Relevant Pages

  • Re: Writing a Smart Card Minidriver (on PKCS#11)
    ... I tested now my minidriver with certutil -scinfo. ... CardWriteFile, updating the \cardcf file ... CardWriteFile to the mscp\cmapfile, creating a key container. ... CardQueryCapabilities is called to verify if the card can generate key ...
    (microsoft.public.platformsdk.security)
  • Re: yellow SCRFILTER device for a smartcard (!) on Windows 7
    ... Microsoft provides a one or two minidriver which are special for some cards. ... card the customer will use. ... Meanwhile our driver passed the WHQL tests and got the Win7 logo. ... I'm about to WHQL-test our driver for smartcard readers on Windows ...
    (microsoft.public.development.device.drivers)
  • Re: Handling of key container in smart card module + SecurityEnvironmentID
    ... in my chip specification for creating key container. ... One of the things you have to do when writing a minidriver is to map the ... pair onto the card, or to instruct the card to generate a key pair. ... the idea is to get a new key pair onto the card (in case of an RSA ...
    (microsoft.public.platformsdk.security)
  • Re: Writing a Smart Card Minidriver (on PKCS#11)
    ... what is expected in practise from the minidriver; ... Maybe there is also a sample project for a card mini ... the pintool.exe that comes with the Microsoft Base Smart Card CSP. ... card, however, none of the standard tools (such as the card unblock in the ...
    (microsoft.public.platformsdk.security)
  • Re: USB Mass Storage Device
    ... hard to make any intelligent suggestions without any debug info. ... When you put a SD memory card in the slot it appears in the file ... The card has to be inserted before. ... I have following doubts regarding USB Mass Storage Device ...
    (microsoft.public.windowsce.platbuilder)