Hi,
Finally I was able to sign some data, but now I am not able to verify. I
am getting the following error.
java.security.SignatureException: encryptedDigest was not the correct
signature of the contents of the DER-encoded authenticated attributes
at
org.mozilla.jss.pkcs7.SignerInfo.verifyWithAuthenticatedAttributes(SignerInfo.java
at org.mozilla.jss.pkcs7.SignerInfo.verify(SignerInfo.java:488)
Any ideas would really help. I have pasted my code below.
Thanks
Krish.
ContentInfo signature = new ContentInfo(sd);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
signature.encode(bos);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ContentInfo ci = (ContentInfo) ContentInfo.getTemplate().decode(bis);
SignedData sd = (SignedData) ci.getInterpretedContent();
SET signers1 = sd.getSignerInfos();
SignerInfo sinfo = (SignerInfo) signers1.elementAt(0);
byte[] edigest = sinfo.getEncryptedDigest();
MessageDigest md1 =MessageDigest.getInstance("SHA-1");
sinfo.verify(messageDigest,ContentInfo.DATA, cert.getPublicKey());