aspose file tools*
The moose likes Security and the fly likes RC4 encryption-decencryption Implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "RC4 encryption-decencryption Implementation" Watch "RC4 encryption-decencryption Implementation" New topic
Author

RC4 encryption-decencryption Implementation

Suman Shekhar
Greenhorn

Joined: Jun 13, 2008
Posts: 2
Dear All,

I have to implement RC4 encryption-decencryption for one of my client but unfortunately I dont have much idea about encryption-decryption. Could you guys help me to implement this and it would be great if you guys could share sample code.

Regs
Shekhar
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
Welcome to JavaRanch.

Good news: You don't need to implement it, it's built into the Java class libraries. The Java API for encryption/decryption is called JCE, and the http://faq.javaranch.com/java/SecurityFaq has a number of relevant links about it, including ready-to-run code.
Suman Shekhar
Greenhorn

Joined: Jun 13, 2008
Posts: 2
Dear Ulf,

I had gone through the link but unfortunately didnot get any code for RC4 encryption-decryption. Could you please help to find out?

Regs
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19064
    
  40

Originally posted by Suman Shekhar:
Dear Ulf,

I had gone through the link but unfortunately didnot get any code for RC4 encryption-decryption. Could you please help to find out?

Regs


Take a look again. There are examples under the JCE section on encyption and decryption. Unfortunately, the example isn't one that uses RC4 -- as that is not very popular.

Anyway, follow the link, under the JCE section, and you'll see that RC4 is supported. Now, you have to go back to the examples, and modify the example to configure the RC4 algorithm -- which should be a one line change.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
In addition to what Henry said, I would suggest that security is a topic where one really needs to understand what the code is doing. Just copying and pasting example code is likely to lead to insecure systems if one doesn't know what the code does in a fundamental way. So I'd start with learning about the JCE API (after which the change to RC4 will be trivial).
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Originally posted by Ulf Dittmer:
I would suggest that security is a topic where one really needs to understand what the code is doing.


Listen to Ulf here, it is trivial to make really weak systems by making small errors in crypto code.

You have to take the time to learn what it is doing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RC4 encryption-decencryption Implementation