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

From: Robert Gu [MS] (robertg@online.microsoft.com)
Date: 06/11/02


From: "Robert Gu [MS]" <robertg@online.microsoft.com>
Date: Tue, 11 Jun 2002 09:49:59 -0700


Did you define USE_BLOCK_CIPHER?

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Robert Gu [MS Security Developer]
"Dave" <NOSPAM_drubin@NOSPAM_i-2000.com> wrote in message
news:wBgGPSEwzcX16lZ94Ug7+6OzOtzb@4ax.com...
> 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.
>
> Our code is simple and follows the MSDN samples. In summary:
>
> #ifdef USE_BLOCK_CIPHER
>     // defines for RC2 block cipher
>     #define ENCRYPT_ALGORITHM CALG_RC2
>     #define ENCRYPT_BLOCK_SIZE 8
> #else
>     // defines for RC4 stream cipher
>     #define ENCRYPT_ALGORITHM CALG_RC4
>     #define ENCRYPT_BLOCK_SIZE 1
> #endif
>
> Initialize:
> ::CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT)
> ::CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash)
> ::CryptDeriveKey(hProv, ENCRYPT_ALGORITHM, hHash, 0, &hKey)
>
> Encrypt:
> ::CryptEncrypt(hKey, 0, TRUE, 0, *ppDataOut, pdwLenOut, dwBufLen)
>
> Decrypt:
> ::CryptDecrypt(hKey, 0, TRUE, 0, *ppDataOut, pdwLenOut)
>
> Our goal is to encrypt the files on ANY OS and have them decryptable
> on ANY OS. (Currently we have to encrypt on WindowsXP if we want the
> files to be decryptable on WIndowsXP.)
>
> I would appreciate any advice on how to use the Crypto functions in a
> platform-independent way. Please respond via mailto:drubin@i-2000.com.
>
>
> --
> Dave Rubin
> mailto:drubin@i-2000.com


Relevant Pages

  • Re: Files Encrypted on Win9x/NT/2K Cannot be Decrypted on WinXP
    ... And I don't see you specify the key length in CryptDeriveKey. ... >> decrypt files. ... >> Encrypt: ... (Currently we have to encrypt on WindowsXP if we want the>> files to be decryptable on WIndowsXP.) ...
    (microsoft.public.security)
  • Files Encrypted on Win9x/NT/2K Cannot be Decrypted on WinXP
    ... We've been using the Microsoft Cryptography functions to encrypt and ... decrypt files. ... cannot be decrypted on WindowsXP. ...
    (microsoft.public.security)
  • RE: NTE_BAD_DATA
    ... They are NOT used DIRECTLY to encrypt / decrypt data; ... you should generate a RANDOM SESSION KEY and select a SYMMETRIC ENCRYPTION ... // imported from a BLOB read in from the source file or having ...
    (microsoft.public.platformsdk.security)
  • Re: Back Doors
    ... >> Design into the system a master key. ... Encrypt that with public key. ... Decrypt random symmetric key with private key. ...
    (sci.crypt)
  • Re: CAPI and RC4: can not decrypt when Final parameter is set to F
    ... to store ASYMMETRIC key pairs - never symmetric keys like RC4, ... Now when you need to encrypt at one place and decrypt at the other normally ... Get a HCRYPTPROV handle to a key container with CryptAcquireContext ...
    (microsoft.public.platformsdk.security)