Re: DES Key & IV
From: Kun (sokun_at_seila.gov.kh)
Date: Wed, 6 Aug 2003 16:26:37 +0700
I can't make it works :(
Would you please give me a sample code?
"Keith Patrick" <email@example.com> wrote in message
> 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
> 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
> 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
> storing both under the guise of "key" and "other thing that isn't a key
> is instead used to initialize the crypto"
> "Kun" <firstname.lastname@example.org> wrote in message
> > 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