Re: DES Key & IV

From: Kun (sokun_at_seila.gov.kh)
Date: 08/06/03


Date: Wed, 6 Aug 2003 16:26:37 +0700


I can't make it works :(
Would you please give me a sample code?

Regards,
Kun

"Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in message
news:#YDK359WDHA.2568@tk2msftngp13.phx.gbl...
> I hit this problem before as well. Try using 64-bit or ASCII character
> encoding instead of UTF8. If that fails, send me an email, and I will
send
> you a crypto class that does it.
> BTW: If someone can explain IV to me in non-mathematical way that doesn't
> make it sound like cryptography sound like it really requires 2 keys, I'd
> appreciate it. My current means for generating one is to derive it from a
> hash of the original key, but that itself makes the encrypted data
insecure,
> but I would think that if the IV was really a second key, they'd just call
> them "KeyA" and "KeyB". I would think that when I create a key and store
> it, I'm just storing a key and not generating a key and another key and
then
> storing both under the guise of "key" and "other thing that isn't a key
but
> is instead used to initialize the crypto"
>
> "Kun" <sokun@seila.gov.kh> wrote in message
> news:eZnnub9WDHA.1900@TK2MSFTNGP10.phx.gbl...
> > Dear All,
> > I am new to crypto.
> >
> > I have code bellow:
> > DES des = DESServer ...();
> > MemoryStream ms = new MemoryStream();
> > CryptoStream cs;
> >
> > byte[] bStr;
> > byte[] myKey;
> > byte[] myIV;
> >
> > myKey = System.Text.Encoding.UTF8.GetBytes("Testing");
> > myIV = System.Text.Encoding.UTF8.GetBytes("Something else");
> >
> > bStr = System.Text.Encoding.UTF8.GetBytes("This string to enctypt");
> >
> > //okay now the error.
> > // Additional information: Specified key is not a valid size for this
> > algorithm.
> > cs = new CryptoStream(ms, des.CreateEncryptor(myKey,myIV),
> > CryptoStreamMode.Write);
> >
> > I guess I use wrong lenght of key or whatever.
> > Please advise.
> >
> > Regards,
> > Kun
> >
> >
> >
> >
>
>