• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RC4 encryption-decencryption Implementation

 
Suman Shekhar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21427
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic