Abhi
2004-12-01 06:53:01 UTC
Hi,
Can anyone tell me how to export/import certificate+private key from a
remote machine.
This is what I tried doing:
1. I opened personal ("MY") certificate store on a remote machine using
CertOpenStore().
2. Retrived the certificate context by enumerating certificates in remote
store using CertEnumCertificatesInStore() and selecting the desired
certificate.
3. added the desired certificate context to a separate
store(hTempStoreHandle) using CertAddCertificateContextToStore().
4.I used PFXExportCertStore(hTempStoreHandle...,EXPORT_PRIVATE_KEYS) to
get the PFX BLOB which failed. So I tried calling this function using
REPORT_NO_PRIVATE_KEY and it worked without giving error.
5 The BLOB is a PFX packet which i confirmed using PFXIsPFXBlob().
6. I tried importing this BLOB to local machine using PFXImportCertStore()
which also worked fine.
But the certificate is not visible in 'MY' store of local machine.
7. Then I created a temporary file and wrote the BLOB data with .pfx
extension.
8. Then I installed the certificate from this .pfx file onto local machine.
Now to check whether I got the private keys along with, I tried exporting
this certificate , and it said that private keys not found.
Please let me know in case ther is some other API by which I can import
certificate+private key from remote machine onto local machine.
Best
Abhi
Can anyone tell me how to export/import certificate+private key from a
remote machine.
This is what I tried doing:
1. I opened personal ("MY") certificate store on a remote machine using
CertOpenStore().
2. Retrived the certificate context by enumerating certificates in remote
store using CertEnumCertificatesInStore() and selecting the desired
certificate.
3. added the desired certificate context to a separate
store(hTempStoreHandle) using CertAddCertificateContextToStore().
4.I used PFXExportCertStore(hTempStoreHandle...,EXPORT_PRIVATE_KEYS) to
get the PFX BLOB which failed. So I tried calling this function using
REPORT_NO_PRIVATE_KEY and it worked without giving error.
5 The BLOB is a PFX packet which i confirmed using PFXIsPFXBlob().
6. I tried importing this BLOB to local machine using PFXImportCertStore()
which also worked fine.
But the certificate is not visible in 'MY' store of local machine.
7. Then I created a temporary file and wrote the BLOB data with .pfx
extension.
8. Then I installed the certificate from this .pfx file onto local machine.
Now to check whether I got the private keys along with, I tried exporting
this certificate , and it said that private keys not found.
Please let me know in case ther is some other API by which I can import
certificate+private key from remote machine onto local machine.
Best
Abhi