开发者

extract common name from a pfx file

I use Windows XP SP3. I resell digital signature certificates. I get the clients data, key them into a portal and download the dsc onto my machine. I 开发者_开发知识库use Internet Options and export the certificate to a pfx file with a password and send it off to the client. Since, this is being done over and over again, during export to pfx, inadvertently the wrong certificate is selected. Once the pfx file is generated, is there any way of knowing the common name in the pfx file without having to reinstall the certificate. I have looked into openssl, but not sure if it can be achieved by a batch file as a password has to be physically entered. Ideally, after exporting say 10 pfx files, I would like to run a batch file which would display only the common names. Once I confirm that the names are correct (I have exported correctly), I can delete the certificates from the store.


You should write your own application, that will perform batch processing of PFX files.

The pseudo code using CryptoAPI are as follows.,

  1. Read the pfx files from disk one by one using PFXImportCertStore. You will get the certificate store context.

  2. Acquire the certificate context PCCERT_CONTEXT phPfxCertCtx = CertEnumCertificatesInStore

  3. Get the subject name. phPfxCertCtx->pCertInfo->Subject

  4. You can have a predefined list of subjects to compare the subject names that are read now.

  5. Close the context and certificate store, CertCloseStore with CERT_CLOSE_STORE_FORCE_FLAG.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜