File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

want to use the SHA256 Algorithm in J2SDK 1.4

 
Kavya Anjali
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At present we are using SHA1 ( Secure Hash Algorithm ) for Message digest and JDK Version 1.4.1. But we get one new requirement for Message Digest that instead of using the SHA1 we need to use the SHA256 Algorithm.

we call the Message Digest Class which is in rt.jar by passing the required parameter like,

current one :

MessageDigest digest = MessageDigest.getInstance("SHA-1");

which is working fine.

Required One :

MessageDigest digest = MessageDigest.getInstance("SHA256");

or

MessageDigest digest = MessageDigest.getInstance("SHA-256);

We tried with the JDK version 1.4.1 , 1.4.2 , 1.5 but it throw the exception like,

java.security.NoSuchAlgorithmException: SHA256 MessageDigest not available

We need to implement this Message Digest by using SHA256 Algorithm, Could you please suggest some idea or procedure or any step we need to follow for this.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The algorithm of SHA256 is not available with the satadard sun jce provider.Use Bouncycastle provider.
Configure BouncyCastly then use your usual code.
 
Kavya Anjali
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply..I will look into that...
 
Henry Wong
author
Marshal
Pie
Posts: 20823
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The SHA-256 algorithm works with my JVM (JDK 1.4.2). A quick google shows that SHA-256, SHA-384, and SHA-512, were added to the Sun JVM starting with JDK 1.4.2.

Henry
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That might be the reason as he is using 1.4.1 version of JDK.
 
Mallik Soupati
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be more helpful to the folks visit these forums if the person who posted a question gives feedback on whether he/she got his/her answer, or fixed it.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes , I also think the same way ,for all the forums , but specially for this.
 
Kavya Anjali
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry for the late response but I promise to be more regular about this.
I was away for some presonal work and so couldnt look at this issue afterwards.

Yes the problem was solved with the bouncy castle solution. But you all are also right in that the JDK version was 1.4.1 and not 1.4.2

Thanks for all the suggestions
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic