Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use IDEA cyptography agorithm from the JCE

 
Gary Warren
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Does anyone have a sample of how to use the IDEA encrypt and decrypt algorithms from the JCE. Specifically what cipher values to use (ECB, padding, etc...)?
Thanks
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The standard JCE provider which comes with the JRE does not contain an IDEA implementation. You'll have to use a provider that does, like the one from bouncycastle.org.
 
Gary Warren
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. Now using Bouncy Castle and have a few more questions...

How do I serialize a KEY value to a file (a Bouncy Castle KEY). I am getting a non serializable error.
I can encrypt with a password using SecretKeyFactory and PBEKeySpec but do you have an example of
how to decrypt with a password?
Thanks again for your help...
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "key value" - a PBEKeySpec? Not sure, but you can get all its constituent parameters from it, and store those.

You can find some example code for how to do encrypting/decrypting with JCE at https://www.coderanch.com/how-to/java/SecurityFaq#encryption. Those examples are for other algorithms, but the basic principles are the same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic