File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Security and the fly likes want to use the SHA256 Algorithm in J2SDK 1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "want to use the SHA256 Algorithm in J2SDK 1.4" Watch "want to use the SHA256 Algorithm in J2SDK 1.4" New topic
Author

want to use the SHA256 Algorithm in J2SDK 1.4

Kavya Anjali
Ranch Hand

Joined: Mar 23, 2006
Posts: 30
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.


SCJP 5.0
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
The algorithm of SHA256 is not available with the satadard sun jce provider.Use Bouncycastle provider.
Configure BouncyCastly then use your usual code.


Rahul Bhattacharjee
LinkedIn - Blog
Kavya Anjali
Ranch Hand

Joined: Mar 23, 2006
Posts: 30
Thanks for the reply..I will look into that...
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18842
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
That might be the reason as he is using 1.4.1 version of JDK.
Mallik Soupati
Greenhorn

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

Joined: Nov 29, 2005
Posts: 2308
Yes , I also think the same way ,for all the forums , but specially for this.
Kavya Anjali
Ranch Hand

Joined: Mar 23, 2006
Posts: 30
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: want to use the SHA256 Algorithm in J2SDK 1.4