473,513 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cryptography RC4

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
Jan 3 '08 #1
1 6044
On Thu, 3 Jan 2008 11:56:02 -0800, surcon
<su****@discussions.microsoft.comwrote:
>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/archiv...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

Jan 4 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2007
by: Apple | last post by:
Hi guys, I am working on my java cryptography assignment. I am looking for the popular or the best cryptography softwares either wrote in java or not to encrypt/decrypt files using DES/RSA...
0
3527
by: Andrzej | last post by:
Hi, I have to figure out why we have a problem with special characters in encrypted usernames and passwords. Case: Username: r&bgeorge Password: tigger
0
1156
by: EP | last post by:
I have a WSE server app that uses the <cryptography> element in the configuration (seen below). This worked perfectly in WSE sp1, but when I upgraded to SP2 and then to SP3, I get the following...
1
2740
by: muthu | last post by:
Hi, I have two web applications running on my machine.The application is developed using asp.net 1.1 and vb.net.When i try to run both the applications in the same browsers, i get the following...
1
2222
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
Hi, everybody here. I am implementing data encryption/decryption, and try to use System.Security.Cryptography.TripleDESCryptoServiceProvider. But I can not find it in MS Visual Studio when I...
1
12488
by: Eric Simmons | last post by:
Hello, I am trying to run a .NET 2.0 application that I developed and I am getting the following error: Key not valid for use in specified state I am attempting to retrieve the...
6
6281
by: andrew | last post by:
Hi, I have a web service application written in C# .NET 1.1 using MD5CryptoServiceProvider.ComputeHash(Byte) The problem is that after a while(web service processes requests) the call throws...
0
3340
by: Amelyan | last post by:
Why does this happen? How to fix it? Once in a while I get error in ~/ScriptResource.axd?d=... System.Reflection.TargetInvocationException: Exception has been thrown by the target of an...
0
1294
by: tutorialwebs | last post by:
Applied cryptography text books http://www.365x24live.com/Applied%20Cryptography/ewtoc.html http://www.365x24live.com/Applied%20Cryptography/ewtoc.html...
1
2094
by: Napcrisis | last post by:
Hi guys i need to know if its possible to use visual c++ and make use of .net cryptography to encrypt files using the cryptography algorithms .net has to offer. cuz i have been searching around and...
0
7157
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7379
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5084
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.