Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes 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");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic