Retired Microsoft Blog disclaimer

This directory is a mirror of retired "Decrypt My World" MSDN blog and is provided as is. All posting authorship and copyrights belong to respective authors.
Original URL: https://blogs.msdn.microsoft.com/alejacma/2008/04/04/how-to-encrypt-and-decrypt-with-cryptoapi-and-a-user-certificate-windows-mobile/
Post name: How to Encrypt and Decrypt with CryptoAPI and a user Certificate (Windows Mobile)
Original author: Alejandro Campos Magencio
Posting date: 2008-04-04T04:00:00+00:00


Hi all, welcome back,

The other day I had the pleasure to collaborate with my colleague Raffaele Limosanion a CryptoAPI case in Windows Mobile. I don't give technical support to Windows Mobile, and I don't know the specifics on mobile development. He does ?? So we managed to put together a sample which shows how to encrypt and decrypt data with acertificate in a PFX file and works on that platform: Encrypting\Decrypting Data through PFX certificate on Windows Mobile.

CryptoAPI is limitedon Windows Mobile. Some methods are not supported, and we may find differences in the supported methods: number of parameters, flags... We could use the ideas shown in this sample if we want to do the same stuff on Windows NT (XP, Vista, Server 2008, etc.). Just pay attention to the differences I mentioned.MSDN will be our friend here, as always.

The sample shows the usage of the following CryptoAPI methods on encryption:

- CertOpenStore.

- CertFindCertificateInStore

- CryptAcquireContext

- CryptImportPublicKeyInfoEx

- CryptEncrypt

- CertFreeCertificateContext

- CertCloseStore

And on decryption:

- CertOpenStore

- CertFindCertificateInStore

- CryptAcquireCertificatePrivateKey

- CryptGetUserKey

- CryptDecrypt

- CertFreeCertificateContext

- CertCloseStore

I hope this helps.

Cheers,

Alex (Alejandro Campos Magencio)


Share this article:

Comments:

Comments are closed.