Mounir IDRASSI replied to Lagar
20-Nov-09 09:34 AM

Hi,
You can not have two AT_SIGNATURE keys in one container. A container can
have only one AT_SIGNATURE key and one AT_KEYEXCHANGE key.
So, if your smart card contains two signature keys, you must expose two CSP
containers, one for each key, and each container will have a different name.
This is the first thing to do.
Concerning the default container, this is a notion that is merely used by
smart card logon scenarios under Windows 2000/XP where Winlogon acquires a
context on the default container in order to access the logon certificate and
the associated key. This default container is a logical container that is
mapped by the CSP to the right physical container depending on various
criteria.
For most other applications that use smart cards, they do not call CSPs
direcly because then they simply do not have any idea about them. In almost
all cases, an application looks into the Internet Explorer "MY" Certificate
Store in order to find the certificate it needs and from that it will call
CryptAcquireCertificatePrivateKey in order to get a context on the CSP
associated with this certificate for doing cryptographic operations.
It is the responsibility of the CSP provider to ensure that each time a
smart card is inserted, all the certificates present on the card are
correctly exported to the IE "MY" Certificate Store and that the
CERT_KEY_PROV_INFO_PROP_ID property of each certificate context contains the
right information about the CSP and the container name and its key specifier.
I hope this gives you more clues about the internals of Crypto API.
Starting from here, your CSP should ,for your card, export two named
containers and you have to choose which one of them will be the default one.
Also, you will have to ensure that the content of your card is correctly
synchronized with the IE "MY" Certificate Store.
Cheers,
--
Mounir IDRASSI
IDRIX
http://www.idrix.fr
To reach me: mounir_idrix_fr (replace the underscores with the at and dot
characters respectively)