| fealfu@gmail.com 2006-04-21, 8:05 am |
| Hi
I have generated a PKCS#7 digital signature in Firefox (with javascript
function window.crypto.signtext) and in Internet Explorer (with ActiveX
Capicom).
Now I must verify this signature in the web server Tomcat.
My problem is that my signature is not verified.
I don=B4t know the reason.
In the browser I have 2 inputs:
1=2E sha --> Text input with an hexadecimal sha to firm:
1D8595D6DC3712AFDA66A616B2232A8DAB8648D6
2=2E firma--> The pkcs#7 detached obtain with Capicom o Javascript.
And in the web server I have this code:
Signature firma;
try
{
Security.addProvider(new BouncyCastleProvider());
firma =3D Signature.getInstance("SHA1WithRSAEncryption");
firma.initVerify(cert);
firma.update(request.getParameter("sha").getBytes());
if (firma.verify(request.getParameter("firma")))
{
out.print("**********VERIFIED******************");
}
else
{
out.print("-------NOT VERIFIED----------");
}
}
catch(Exception e)
{
out.print("ERROR EN LA VALIDACION: " + e.getMessage());
e.printStackTrace();
return;
}
What is wrong? Are there another way to validate the signature?.
Thans
|