Re: Rijndael class, Padding bug?, Ivan Medvedev

From: AJoshi (ajoshi@approva.net)
Date: 01/24/03


From: "AJoshi" <ajoshi@approva.net>
Date: Fri, 24 Jan 2003 17:23:46 +0530


Thanks, Ivan, Greg, George. It worked. I could find subsets that work. What
Ivan says about passing the whole encrypted thing is confirmed too.

"Ivan Medvedev [MS]" <ivanmed@online.microsoft.com> wrote in message
news:Os2L3RzwCHA.1656@TK2MSFTNGP09...
> 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
> > > >
> > > >
> > >
> > >
> >
> >
>
>