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");
A magnificient life is loaded with tough challenges. En garde tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1062 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
Apr 16, 2024 03:38:27.