Access web service with required personal security certificate - using x509 PFX personal certificate - Install Personal Security Certificate in C# compact framework. :


...
byte[] pfxData = GetFile(certificatePath);
...
CRYPT_DATA_BLOB pPFX = new CRYPT_DATA_BLOB();
pPFX.cbData = pfxData.Length;
pPFX.pbData = Marshal.AllocHGlobal(pfxData.Length);
Marshal.Copy(pfxData, 0, pPFX.pbData, pfxData.Length);
...
hMemStore = PFXImportCertStore(ref pPFX, password, CRYPT_USER_KEYSET);
...
cert_MY_store = CryptoAPI.CertOpenStore(new IntPtr(CERT_STORE_PROV_SYSTEM_W),
0,
IntPtr.Zero,
CERT_SYSTEM_STORE_CURRENT_USER,
"MY");
...
...
CertAddCertificateContextToStore(cert_MY_store,
hCertCntxt,
(int)CERT_STORE_ADD_REPLACE_EXISTING, IntPtr.Zero)
No comments:
Post a Comment