Forums Register Login

Problem following bouncy castle example

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
 


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");
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1055 times.
Similar Threads
bouncy castle download
need to generate RSA keys from txt files
how to access an interface
Authentication on J2ME
PGP - Eliminating Temp Files?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 01:35:28.