RE: CryptoAPI TripleDes

From: Rhett Gong [MSFT] (
Date: 07/06/05

Date: Wed, 06 Jul 2005 09:10:47 GMT

In our doc and internal sites, there is no existing sample which describes
the use of 3des alg to encrypt string with pure c-style crypto interface.
It should not that complicated as you image, you just need to create a
random bytes (eg 8bytes) and appended to the front of the plaintext. then
you can get the key by calling CryptGenKey or CryptDeriveKey with CALG_3DES
as rc2. Please note that, to use 3des alg, you need to specify
MS_ENHANCED_PROV when calling CryptAcquireContext.

Fortunately, we have an encapsulated .net class named TripleDES which
encapsulate complexity of using 3des and provides a direct way to encrypt a
stream. You may take a look at following page, it provide a simple sample
code to encrypt a file:

Please let me know if my answer helps you resolve the problem. If there is
anything more I can assist you, please feel free to let me know.

Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! -

This posting is provided "AS IS" with no warranties and confers no rights.