Re: Rijndael class, Padding bug?, Ivan Medvedev
From: Ivan Medvedev [MS] (ivanmed@online.microsoft.com)
Date: 01/24/03
- Next message: John Graf: "Compatibility with CryptDeriveKey()"
- Previous message: Ivan Medvedev [MS]: "Re: FileIOPermission"
- In reply to: AJoshi: "Re: Rijndael class, Padding bug?, Ivan Medvedev"
- Next in thread: AJoshi: "Re: Rijndael class, Padding bug?, Ivan Medvedev"
- Reply: AJoshi: "Re: Rijndael class, Padding bug?, Ivan Medvedev"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Ivan Medvedev [MS]" <ivanmed@online.microsoft.com> Date: Thu, 23 Jan 2003 15:09:40 -0800
If you do TransformFinalBlock for both encryption and decryption and don't
set the padding (the defauld value is PKCS7 padding) everything should work.
One thing that many people miss is that when you use padding the encrypted
data can be larger than the plaintext and when decrypting one needs to make
sure he is feeding all the encrypted data to the decryptor, not just the
same number of bytes the plaintext had. If this still does not work for you
could you please post your code?
Thanks,
--Ivan
This posting is provided "AS IS" with no warranties, and confers no rights
"AJoshi" <ajoshi@approva.net> wrote in message
news:e6znd24uCHA.1628@TK2MSFTNGP10...
> Thank you, Greg. I already had a buffer with the raw data, so why go
through
> hoops and use a stream? BTW, TransformFinalBlock worked, but I still had
to
> use PaddinMode.None.
>
>
> "Greg Fee" <gregfee@microsoft.com> wrote in message
> news:OlGvD01uCHA.1848@TK2MSFTNGP09...
> > You'll need to call TransformFinalBlock for the final block of the
> > encryption. The streams are nice as they handle of this for you.
> >
> >
> > "AJoshi" <ajoshi@approva.net> wrote in message
> > news:#didOsvuCHA.2372@TK2MSFTNGP12...
> > > I used code similar to the one posted by Ivan on 1/4/2003, except that
I
> > > used byte[] for raw, encrypted and decrypted data. I did not use any
> > > streams. Something very strange. I used the CreateEncryptor and
> > > CreateDecryptor methods on the Rijndael class and used the
> TransformBlock
> > > methods of the returned ICryptoTransform. Encryption works fine.
> > Decryption
> > > works only if you set the Padding property of the Rijndael class to
> > > Padding.None. Strange.
> > > Thanks
> > > A Joshi
> > >
> > >
> >
> >
>
>
- Next message: John Graf: "Compatibility with CryptDeriveKey()"
- Previous message: Ivan Medvedev [MS]: "Re: FileIOPermission"
- In reply to: AJoshi: "Re: Rijndael class, Padding bug?, Ivan Medvedev"
- Next in thread: AJoshi: "Re: Rijndael class, Padding bug?, Ivan Medvedev"
- Reply: AJoshi: "Re: Rijndael class, Padding bug?, Ivan Medvedev"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|