Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem following bouncy castle example

 
Lester D Jones
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I am following an example to implement bouncy castle to encrypt data coming out of a midp to servlet.

On the servlet I have the following line: Digest digest = new SHA1Digest();
I cannot compile because i get the following error: type mismatch cannot convert from SHA1Digest to Digest.

Digest is an interface and not a class. How can I go around this?

Les
 
Jon Eaves
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

On the servlet I have the following line: Digest digest = new SHA1Digest();
I cannot compile because i get the following error: type mismatch cannot convert from SHA1Digest to Digest.


The SHA1Digest is a BC specific class. If you are going to use the light-weight library on both ends, then you can either import the correct Digest class or use the JCE equivalent ;

MessageDigest digest = MessageDigest.getInstance("SHA1", "BC");
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!