Re: Files Encrypted on Win9x/NT/2K Cannot be Decrypted on WinXP
From: Robert Gu [MS] (robertg@online.microsoft.com)
Date: 06/11/02
- Next message: Ernie Welsh: "Access Denied"
- Previous message: Robert Gu [MS]: "Re: Files Encrypted on Win9x/NT/2K Cannot be Decrypted on WinXP"
- In reply to: Robert Gu [MS]: "Re: Files Encrypted on Win9x/NT/2K Cannot be Decrypted on WinXP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Robert Gu [MS]" <robertg@online.microsoft.com> Date: Tue, 11 Jun 2002 10:02:53 -0700
And I don't see you specify the key length in CryptDeriveKey(). The default
key length could be different among the OSes. See the SDK DOC for the API,
dwFlags
[in] Specifies the type of key generated.
The sizes of a session key can be set when the key is generated. The key
size, representing the length of the key modulus in bits, is set with the
upper 16 bits of this parameter. Thus, if a 128-bit RC4 session key is to be
generated, the value 0x00800000 is combined with any other dwFlags
predefined value with a bitwise-OR operation. Due to changing export control
restrictions, the default CSP and default key length may change between
operating system releases. It is important that both the encryption and
decryption use the same CSP and that the key length be explicitly set using
the dwFlags parameter to ensure interoperability on different operating
system platforms.
-- This posting is provided "AS IS" with no warranties, and confers no rights. Robert Gu [MS Security Developer] "Robert Gu [MS]" <robertg@online.microsoft.com> wrote in message news:uMZBsfWECHA.2104@tkmsftngp02... > 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 > >
- Next message: Ernie Welsh: "Access Denied"
- Previous message: Robert Gu [MS]: "Re: Files Encrypted on Win9x/NT/2K Cannot be Decrypted on WinXP"
- In reply to: Robert Gu [MS]: "Re: Files Encrypted on Win9x/NT/2K Cannot be Decrypted on WinXP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|