Closed GoogleCodeExporter closed 9 years ago
Hi,
At a first glance the signature looks ok. I'll try to reproduce the issue later.
Original comment by luis.fgoncalv
on 10 Aug 2011 at 8:52
I'm waiting for your comments.
Thanks again.
Original comment by mustafa....@gmail.com
on 11 Aug 2011 at 10:23
I was able to sign the document and produce a signature identical to yours with
the following code (uses helper methods on the lib test classes):
class TestAlgsProvider extends DefaultAlgorithmsProvider
{
@Override
public String getDigestAlgorithmForDataObjsReferences()
{
return MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1;
}
@Override
public String getSignatureAlgorithm(String keyAlgorithmName) throws UnsupportedAlgorithmException
{
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1;
}
}
/***************************************************************************/
XadesBesSigningProfile profile = new XadesBesSigningProfile(keyingProviderMy);
profile.withSignaturePropertiesProvider(new SignaturePropertiesProvider()
{
@Override
public void provideProperties(SignaturePropertiesCollector signedPropsCol)
{
signedPropsCol.setSigningTime(new SigningTimeProperty());
signedPropsCol.setSignerRole(new SignerRoleProperty("Test Role"));
}
})
.withAlgorithmsProvider(TestAlgsProvider.class);
Enveloped env = new Enveloped(profile.newSigner());
Document doc = getDocument("test.xml");
env.sign(doc.getDocumentElement());
outputDocument(doc, "test_signed.xml");
/***********************************************************************/
XadesVerificationProfile verifProfile = new XadesVerificationProfile(VerifierTestBase.validationProviderMySigs);
XadesVerifier verifier = verifProfile.newVerifier();
doc = getDocument("test_signed.xml");
Element signatureNode = VerifierTestBase.getSigElement(doc);
verifier.verify(signatureNode, null);
If, on your scenario, the reference's digest changed, something is probably
changing the dom tree after signature production.. How are you writing the
signed file to disk?
Original comment by luis.fgoncalv
on 14 Aug 2011 at 9:50
Attachments:
I was using my own xml save method. When i changed to your outputDocument and
getDocument methods the problem was solved.
Thanks a lot for your help :)
Original comment by mustafa....@gmail.com
on 15 Aug 2011 at 4:14
Original comment by luis.fgoncalv
on 16 Aug 2011 at 8:46
Original issue reported on code.google.com by
mustafa....@gmail.com
on 9 Aug 2011 at 11:39Attachments: