Re: HCRYPTKEY from actual key bytes

From: Levy (thebe14_at_gmail.com)
Date: 06/23/05


Date: Thu, 23 Jun 2005 13:50:45 +0300

Ah, OK. Now I understand. My reading of the doc for CryptDecrypt was that on
the last block I can call it with less than a full block if I specify TRUE
for the bFinal parameter.

"lelteto" <lelteto@discussions.microsoft.com> wrote in message
news:E1FDB256-ABB8-40D4-84A3-53968166C0F6@microsoft.com...
> Yoy MUST send full blocks anyway so I don't understand your 'padding'
> issue
> at all. The encrypted content MUST always be multiple of full blocks.
> If your 'last chunk' is not full block than it surely cannot belong to an
> encrypted block. You would need somebody else's help (MS?) to figure out
> what's that last non-full-block chunk.
>
> Laszlo Elteto
> SafeNet, Inc.
>
> "Levy" wrote:
>
>> I am not sure I understand. I am decrypting the file's content by reading
>> in
>> blocks that are a multiple of the crypto algorithm's data block size,
>> then I
>> call CryptDecrypt with the final flag set to FALSE. The last data chunk
>> of
>> the file (which usually is larger than the data block size) is not a
>> multiple of the data block size. I was passing this last block to
>> CryptDecrypt, using TRUE for the bFinal flag. This last call fails.
>>
>> Now, are you saying that I also pass FALSE for the bFinal flag for this
>> last
>> block? But then, the data size of my last chunk should be a multiple of
>> the
>> algorithm's data block size (otherwise the operation fails, I think).
>> Should
>> I pad it? If yes, with what? And if I pad it, will it impact the
>> decryption
>> of the last few bytes of the file? I need to decrypt the entire file,
>> even
>> the last byte.
>>
>> Regards,
>> Levente
>



Relevant Pages

  • Re: HCRYPTKEY from actual key bytes
    ... The encrypted content MUST always be multiple of full blocks. ... what's that last non-full-block chunk. ... > blocks that are a multiple of the crypto algorithm's data block size, ... using TRUE for the bFinal flag. ...
    (microsoft.public.platformsdk.security)
  • Re: HCRYPTKEY from actual key bytes
    ... the decryption of the last block always fails (final flag set or not) ... The encrypted content MUST always be multiple of full blocks. ... >> blocks that are a multiple of the crypto algorithm's data block size, ...
    (microsoft.public.platformsdk.security)
  • Re: HCRYPTKEY from actual key bytes
    ... blocks that are a multiple of the crypto algorithm's data block size, ... multiple of the data block size. ... using TRUE for the bFinal flag. ... >> decrypting correctly because the IV is bad, ...
    (microsoft.public.platformsdk.security)