• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find any provider supporting AES

 
Rishi Kanth
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am new to Java Security and Crypto algorithms. I have implemented a AES to encrypt and decrypt sensitive string data. I using Java 1.6 update 16 and JRE6.
I have the following for


I have sunjce_provider.jar in my project build path. Can someone help me in resolving my issues.

Thanks,
Rishi

 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAVA_HOME needs to point to a single directory which is the top-level directory of your Java installation. Something like "C:\Program Files\Java\jdk1.6.0_16" would be correct.

I have sunjce_provider.jar in my project build path.

That file needs to be somewhere in the JRE installation, JAVA_HOME/lib/security I think.
 
Rishi Kanth
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have later changed JAVA_HOME to "C:\Program Files\Java\jdk1.6.0_16". I have my sunjce_provider.jar in JAVA_HOME/jre/lib/ext and jre/lib/ext. I am still unable to get AES algorithm work.

Any idea's please.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still unable to get AES algorithm work.

What does this mean - how are you trying to use AES? Are you getting any error messages? If so, which ones? Does your code differ in any significant way from the code described in http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html?
 
Rishi Kanth
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I am trying to use AES in similar way as in Sun AES example. Here is the code, where "AC.KEY" point to the location of the "Key" generated using AES instance.

This is the exception which is thrown when trying to encrypt using the above


Thanks for the help.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of just "AES", try using "AES/ECB/PKCS5Padding".

This won't work, by the way:
new String(encodedStr).toString()

Encrypted stuff is binary data, not character data, and it can't be treated as if it were. If you need an ASCII representation of something that's encrypted, run it through an encoding such as base-64.
 
Rishi Kanth
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the information. I will change the way I store the encrypted data.

I have used "AES/ECB/PKCS5Padding" instead of "AES". I see the same exception.

When I debug the program and check


I can see sunJCE and its implementations.
 
greg stark
Ranch Hand
Posts: 220
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have either messed up your build path or messed up your JRE. Don't move or copy any files from the their normal JRE locations, and don't put them on your build path either.
 
Rishi Kanth
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have re-installed JDK 6 u17 just in case I have messed up anything as you said. I still have the same issue. I am using the new Eclipse Galileo for the development.
 
greg stark
Ranch Hand
Posts: 220
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
build and run the example from Ulf's reply. If that doesn't work, you have messed up your build path somehow.
 
Rishi Kanth
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have build the Example which Ulf have given me. It work fine. When I try to run my application I am facing the error msg. Well I am trying to Encrypt username & Password for an web application. Ulf example is a Java Application, does that make any difference.

Thanks,
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic