Re: Cryptography RC4



On Thu, 3 Jan 2008 11:56:02 -0800, surcon
<surcon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hi everyone,

I would like to know whether .NET framework 2.0 provides support for
deriving an RC4 encryption key. Any suggestions would be greatly appreciated.
I have:

TripleDESCryptoServiceProvider des = new TripleDESCryptoServiceProvider();
des.IV = new byte[8];
PasswordDeriveBytes pdb = new PasswordDeriveBytes(password, new byte[0]);

When I try to create the object DES.key
des.Key = pdb.CryptDeriveKey("RC4", "MD5" 128, des.IV);

It throw the exception at this line that algorithm is not supported but
there is no problem if replacing RC4 by RC2.

Best Regards
From your code fragments, you appear to be deriving a DES key, not an
RC4 key: "des.Key = ...". You cannot use RC4 as the algname parameter
of CryptDeriveKey, the only allowed algorithms are DES, 3DES and RC2.
See http://blogs.msdn.com/shawnfa/archive/2004/04/14/113514.aspx for
more details.

RC4 is pretty flexible about the size of key it takes, the
specification allows keys up to 256 bytes long, with a default of 128
bytes. It should be possible to use a DES sized key with RC4.

The major question is why you want to use either DES or RC4, both are
rather old and rather broken. Neither can be considered secure at
present - better to use AES (=Rijndael), or if you need a stream
cypher then AES in CTR mode.

rossum

.



Relevant Pages

  • Re: Source code of DES or RC4 needed
    ... need the source code of DES or RC4 encryprtion algorithm in C,C++ or ... Why would you want DES or RC4? ... In Java, you could use the Java Cryptography Extension, which has AES. ...
    (sci.crypt)
  • Re: Crypto algorithms in SSL, TLS, and MS Outlook.
    ... those protocols. ... They are forever evolving - but mainly DES, RC4 and 3DES ...
    (microsoft.public.win2000.security)
  • Re: Cryptography on .net CF
    ... There is no such class as RC4 in either the full framework or CF. ... MD5 is not supported in CF 1.0 but is supported under CF2.0. ... OpenNETCF.Security.Cryptography namespace as there is very limited ...
    (microsoft.public.dotnet.framework.compactframework)
  • CS46xx LFE and Center and Rear Speaker support
    ... Is there any support, i've seen several patches but can't seem to get ... surround sound enabled under Gentoo Linux 1.4 Rc4. ...
    (comp.os.linux.hardware)