Re: Files Encrypted on Win9x/NT/2K Cannot be Decrypted on WinXP

From: David Lowndes (davidl@mvps.org)
Date: 06/11/02


From: David Lowndes <davidl@mvps.org>
Date: Tue, 11 Jun 2002 17:36:10 +0100


>We've been using the Microsoft Cryptography functions to encrypt and
>decrypt files. The encryption in XP seems to be incompatible with
>previous versions of Windows: files encrypted on previous versions
>cannot be decrypted on WindowsXP.

The usual problem is that you're using the sample code, which uses
NULL in the call to CryptAcquireContext:

>CryptAcquireContext(&hProv,NULL,NULL,PROV_RSA_FULL,CRYPT_VERIFYCONTEXT);

Here's the reply I had from MS:

"... The default provider also may
change due to installation of IE. I believe Win2000, NT, and Win9x
behave differently when installing IE though I don't know the
specifics. To fix the problem it is necessary to be specific about
which provider you want. So you may want to use MS_DEF_PROV
when calling CryptAcquireContext instead of NULL.
"

Dave

--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.