thomasb
thomasb

Reputation: 6035

Several questions about rijndael in .net

I need to consume a webservice exposed by another company.

They tell me to use Rijndael in OFB mode to encrypt the data I send them, but apparently, .Net (3.5) does not supports OFB for Rijndael. It tells me : System.Security.Cryptography.CryptographicException: the (crypting?) mode is not valid for this algorithm (approximate on-the-fly translation).

They gave me an IV that is 32 alphanumeric characters. I can't use it (using System.Text.Encoding.ASCII.GetBytes(k)), it tells me : System.Security.Cryptography.CryptographicException: the specified initialization vector (IV) does not match the block size for this algorithm (approximate on-the-fly translation). The key is the same length as the IV, and it works.

What can I do to make it work ?

Thanks

Upvotes: 1

Views: 448

Answers (1)

AVH
AVH

Reputation: 11516

You can use CBC mode to generate an OFB output by feeding your CBC method all 0s as plaintext input. Then manually xor the received keystream with your true plaintext. Actually, the diagrams on Wikipedia show quite nicely how this works, look here.

Upvotes: 3

Related Questions