Re: interop: PaddingMode.None TripleDES with CrptoAPI

From: John Banes [MS] (jbanes_at_online.microsoft.com)
Date: 06/19/04


Date: Fri, 18 Jun 2004 17:12:39 -0700

You might try calling CryptEncrypt/CryptDecrypt without the 'final' flag.
That way, the function won't know that it's the final block and thus won't
add/remove any padding.

This approach will probably work with most or all CSPs that are out there.

Regards,
John Banes
[Microsoft Security Developer]

This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

"casey chesnut" <casey@braSPAMins-N-braSPAMwn.com> wrote in message
news:OjHGGfIVEHA.2360@TK2MSFTNGP10.phx.gbl...
> i'm trying to do TripleDES with no padding in the CryptoAPI
>
> going off this article here:
> http://www.di-mgt.com.au/cryptopad.html#example3des
>
> which lists these expected results:
> Example using Triple DES with key
> 0x0123456789ABCDEFFEDCBA987654321089ABCDEF01234567
> 3DES INPUT BLOCKS: 12345376 06666665 55551205
> 3DES OUTPUT: 7ADE45981580DB32 421E3D90B5B47D5B 1175FA3DD8B932D7
> using an 8 byte IV of all zero.
>
> if i take the 1st block and encrypt it with the CryptoAPI.
> then i get 7ADE45981580DB32 (as expected) plus 8 more bytes of padding.
> ok, so if i want to encrypt with no padding,
> i just do that for 8 block chunks and strip off the trailing 8 each time.
> so that should be compatible with the desktop.
>
> but the problem is when i try to decrypt with the CryptoAPI.
> if i take the result 7ADE45981580DB32 and append 8 bytes of padding:
> 0808080808080808,
> when i try to decrypt, i get BAD DATA.
>
> what else do i need to do?
>
> Thank you,
> casey
>
>



Relevant Pages

  • Padding removal went wrong
    ... I wrote an encryption program, ... which means that I have to encrypt 8 bytes each ... Now I want to decrypt it. ... # Remove padding if last block ...
    (comp.lang.perl.misc)
  • Encrypted Data
    ... I need to compress data, encrypt it, send it someplace, decrypt it and then ... I must also plan on padding being applied to my final block. ... may have been necessary off the back of the data before I try to decompress ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: interop: PaddingMode.None TripleDES with CrptoAPI
    ... > i'm trying to do TripleDES with no padding in the CryptoAPI ... > if i take the 1st block and encrypt it with the CryptoAPI. ... > but the problem is when i try to decrypt with the CryptoAPI. ...
    (microsoft.public.platformsdk.security)
  • Re: interop: PaddingMode.None TripleDES with CrptoAPI
    ... > i'm trying to do TripleDES with no padding in the CryptoAPI ... > if i take the 1st block and encrypt it with the CryptoAPI. ... > but the problem is when i try to decrypt with the CryptoAPI. ...
    (microsoft.public.dotnet.security)
  • Re: noob question about AES & pigeonhole principle
    ... back when you decrypt. ...  Block cyphers are ... split into blocks and the last block gets the padding. ... So I had a look at my tests, & realized that when I encrypt 128 ...
    (sci.crypt)

Quantcast