Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Wed, 21 May 2008 01:00:01 -0700,    group: microsoft.public.platformsdk.security        back       


how to import certificate to CSP automatically   
I am implementing CSP and have a question about importing certificate to CSP.

I read some old posts. KP_CERTIFICATE param in CPSetKeyParam() is used for 
importing certificate to CSP.
Now, I finished implementing KP_CERTIFICATE param in CPSetKeyParam().

I tried to importing PKCS#12 file with Certificate Import Wizard. I found
- CPImportKey() is called to import a private key
- Certificate is stored in MY store
- But CPSetKeyParam() is not called with KP_CERTIFICATE param

I want a certificate to be imported to CSP automatically.
Is there a way to do it?

I also want to know when CPSetKeyParam() with KP_CERTIFICATE is called by MS 
applications?
date: Wed, 21 May 2008 01:00:01 -0700   author:   Worawit Wang

RE: how to import certificate to CSP automatically   
Hi,

As far as I know, the Certificate Import Wizard is designed to work only 
with the MS CSPs and to interact with the system certificate stores. It's not 
intended to be used to import keys and certificates using custom CSPs. For 
that, all the CSP provider companies (at least smart card vendors) ship with 
their libraries custom tools that enable the user to load Pfx file using 
their CSP ( into the user card for example)
That being said, there is one context where an MS tool loads keys and 
certificates into a custom CSP: it's in the case of user Enrollment with a 
Windows CA. For that, through a web page, the user choose which CSP to use to 
generate his key and at the end of the process the certificate created by the 
CA is imported to the chosen CSP by the web page using a call to 
CryptSetKeyParam.

I hope this clarifies things to you.
-- 
Mounir IDRASSI
IDRIX
http://www.idrix.fr


"Worawit Wang" wrote:

> I am implementing CSP and have a question about importing certificate to CSP.
> 
> I read some old posts. KP_CERTIFICATE param in CPSetKeyParam() is used for 
> importing certificate to CSP.
> Now, I finished implementing KP_CERTIFICATE param in CPSetKeyParam().
> 
> I tried to importing PKCS#12 file with Certificate Import Wizard. I found
> - CPImportKey() is called to import a private key
> - Certificate is stored in MY store
> - But CPSetKeyParam() is not called with KP_CERTIFICATE param
> 
> I want a certificate to be imported to CSP automatically.
> Is there a way to do it?
> 
> I also want to know when CPSetKeyParam() with KP_CERTIFICATE is called by MS 
> applications?
date: Wed, 21 May 2008 06:37:00 -0700   author:   Mounir IDRASSI am

RE: how to import certificate to CSP automatically   
In the CAPI model certificates are not handled by CSPs. (Yes, you can still 
HAVE them.) In CAPI certificates are handled by a different subsystem - the 
APIs start with 'Cert' vs. the CSP related APIs which start with 'Crypt'. 
CAPI handles certificates in CERTIFICATE STORES which are different from the 
CONTAINERS which CSPs handle. 

So generally the CSP doesn't need to care about certificates - although it 
is advisable to be able to store and return them IF an application happens to 
use KP_CERTIFICATE in CryptSet/GetKeyParam.
One reason few apps do it because if you retrieve the certificate that way 
it is just the pure certificate and the app would need to handle (parse) the 
ASN1 format - or import it into a certificate store to allow CAPI to handle 
the certificate content. (Of course, in the latter case it is easier to just 
store the cert in the cert store in the first place.)

TOKEN CSPs usually have a mechanism (either automated -> when the token is 
plugged in; or manual -> with a utility program) which allows them to copy 
the certificates on the token into CAPI certificate stores. Yes, for that 
they use CryptGetKeyParam(KP_CERTIFICATE) but after they certs are moved to 
cert stores, they are handled there.
Since Microsoft doesn't have CSPs for tokens, all their code assume the 
certs are in the certificate store(s).

Laszlo Elteto
SafeNet, Inc.

"Worawit Wang" wrote:

> I am implementing CSP and have a question about importing certificate to CSP.
> 
> I read some old posts. KP_CERTIFICATE param in CPSetKeyParam() is used for 
> importing certificate to CSP.
> Now, I finished implementing KP_CERTIFICATE param in CPSetKeyParam().
> 
> I tried to importing PKCS#12 file with Certificate Import Wizard. I found
> - CPImportKey() is called to import a private key
> - Certificate is stored in MY store
> - But CPSetKeyParam() is not called with KP_CERTIFICATE param
> 
> I want a certificate to be imported to CSP automatically.
> Is there a way to do it?
> 
> I also want to know when CPSetKeyParam() with KP_CERTIFICATE is called by MS 
> applications?
date: Wed, 21 May 2008 09:04:06 -0700   author:   lelteto

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us