-1

I am getting the following Exception while executing my code.

Here the code snippet which causes this error

Cipher c = Cipher.getInstance("PBEWithMD5AndDES");

I have used javax-crypto.jar.

Caused by: java.security.NoSuchAlgorithmException: Cannot find any provider supporting PBEWithMD5AndDES
    at javax.crypto.Cipher.getInstance(DashoA13*..)

My runtime is

C:\Documents and Settings\592635>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)

What can be the reason ? Please help.

Abhishek Singh
  • 10,243
  • 22
  • 74
  • 108

1 Answers1

0

Your Oracle JRE has been configured this way or it has become corrupted. For instance, the provider that contains the required algorithm may have been removed from the list in lib/security/java.security in your Java JRE.

If you are not in an Oracle JRE then your runtime may not contain a provider that implements the algorithm. Note that a Java RE is not required to support "PBEWithMD5AndDES", at least not at the Java 7 level. In that case install the Bouncy Castle or Spongy Castle libraries (according to their documentation).

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
  • Actually, PBEWithMD5AndDES is specifically mentioned in the [Cipher section](http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Cipher) of that document both for Java 7 and even [Java 6 too](http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#Cipher). – Oleg Estekhin Jul 15 '14 at 05:30
  • How to check if my jre is configured that way ?? – Abhishek Singh Jul 15 '14 at 06:23
  • @OlegEstekhin And in 8 as well. So the algorithm should be available by default in the Oracle JRE. But not in others, per se. PS feel free to edit such information in... – Maarten Bodewes Jul 15 '14 at 07:11