This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Security and the fly likes Generating key for RC2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Generating key for RC2" Watch "Generating key for RC2" New topic
Author

Generating key for RC2

Kashmira Patel
Greenhorn

Joined: Jun 08, 2003
Posts: 11
Hi all,
I am trying to write a very basic program to encrypt a string using RC2. I am stuck in the first step itself...KeyGenerator class does not support the RC2 algorithm. So what do I do? If there are any existing (simple) examples using RC2, please do point them out.
Thanks,
Kashmira
Richard Jensen
Ranch Hand

Joined: May 14, 2003
Posts: 67
Are you trying to implement RC2 or just get a string encrypted by RC2?
I found a web page giving javadoc for someone's implementation here.
There was also another site with this question (related to JCE):
"How do I encrypt/decrypt using RC2?" (needs a membership to view the answer)


Richard
N 37 33 W 122 18
Kashmira Patel
Greenhorn

Joined: Jun 08, 2003
Posts: 11
Originally posted by Richard Jensen:
Are you trying to implement RC2 or just get a string encrypted by RC2?
I found a web page giving javadoc for someone's implementation here.
There was also another site with this question (related to JCE):
"How do I encrypt/decrypt using RC2?" (needs a membership to view the answer)

Just trying to get a string encrypted by RC2.
This is what I did:
KeyGenerator kgen = KeyGenerator.getInstance("RC2");
SecretKey deskey = kgen.generateKey();
This is the error I get:
java.security.NoSuchAlgorithmException: Algorithm RC2 not available
at javax.crypto.SunJCE_b.a(DashoA6275)
at javax.crypto.KeyGenerator.getInstance(DashoA6275)
----------
Thanks,
Kashmira
norman richards
Author
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
The sun JCE provider doesn't provide RC2. Are you asking for another provider that does handle RC2 or are you looking for non-JCE code that does RC2? For the former, look to the sun website. There are provider lists for each JCE version. I can't help with the latter...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generating key for RC2