读取CSP接口的usbkey里的证书样例程序

求一个读取CSP接口的usbkey里的证书样例程序
类似于证书工具,把usbkey里的证书读出来,比如颁发者、主题、有效期、公钥、版本等信息读出来
求以上功能的样例


------解决方案--------------------
madn上有

PCCERT_CONTEXT pCertContext = NULL; 

//------------------------------ 
// Create a new certificate from the encoded part of
// an available certificate. pDesiredCert is a previously
// assigned PCCERT_CONTEXT variable.
if(pCertContext = CertCreateCertificateContext(
MY_ENCODING_TYPE, // The encoding type
pDesiredCert->pbCertEncoded, // The encoded data from
// the certificate retrieved
pDesiredCert->cbCertEncoded)) // The length of the encoded data
{
printf("A new certificate as been created.\n");
 
// Use the certificate context as needed.
// ...

// When finished, free the certificate context.
CertFreeCertificateContext(pCertContext);
}
else
{
printf("A new certificate could not be created.\n");
exit(1);
}

pCertContext->pCertInfo 中的内容就是你需要读出来的证书的信息

你看一下PCERT_INFO这个结构的定义然后读就可以了