This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Security and the fly likes  Cannot find any provider supporting AES Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark " Cannot find any provider supporting AES " Watch " Cannot find any provider supporting AES " New topic
Author

Cannot find any provider supporting AES

Rishi Kanth
Ranch Hand

Joined: May 23, 2006
Posts: 43
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
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
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.


Ping & DNS - my free Android networking tools app
Rishi Kanth
Ranch Hand

Joined: May 23, 2006
Posts: 43
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
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
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

Joined: May 23, 2006
Posts: 43
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
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
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

Joined: May 23, 2006
Posts: 43
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

Joined: Aug 10, 2006
Posts: 220
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.


Nice to meet you.
Rishi Kanth
Ranch Hand

Joined: May 23, 2006
Posts: 43
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

Joined: Aug 10, 2006
Posts: 220
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

Joined: May 23, 2006
Posts: 43
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
 
subject: Cannot find any provider supporting AES
 
Similar Threads
Where can I see JVM on my system
Database can connect in Service Netbeans screen but not using code
Error when running a class
'javac' is not recognized as an operable program or batch file
Command Prompt error- Can't run through compiler