Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating key for RC2

 
Kashmira Patel
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Kashmira Patel
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic