Coder Social home page Coder Social logo

Verification Problem about xades4j HOT 8 CLOSED

luisgoncalves avatar luisgoncalves commented on June 3, 2024
Verification Problem

from xades4j.

Comments (8)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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

from xades4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
I'm waiting for your comments.
Thanks again.

Original comment by [email protected] on 11 Aug 2011 at 10:23

from xades4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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:

from xades4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 15 Aug 2011 at 4:14

from xades4j.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024

Original comment by luis.fgoncalv on 16 Aug 2011 at 8:46

  • Changed state: Invalid

from xades4j.

santipineda avatar santipineda commented on June 3, 2024

Hi;
I use xades4j for signing xml docs.
I'm signing the face_f0900032774003A699D2F.xml(attached) with xades4j with Xades-BES Enveloped type and produce face_f0900032774003A699D2F_signed.xml (attached).
But when my provider verifying xml signnature, show me this:

xades4j.verification.ReferenceValueException: Reference '#xmldsig-7786ae15-dcbf-46ff-94c6-d9c6834b9b25-keyinfo' cannot be validated

Please help!!!
face_f0900032774003A699D2F.zip

from xades4j.

Niedowidek avatar Niedowidek commented on June 3, 2024

Thank you very much. I made the same mistake (with writing signed xml to disk). This thread let me understand what I was doing wrong.

from xades4j.

FuriosoJack avatar FuriosoJack commented on June 3, 2024

@santipineda Llegaste a solucionarlo?

from xades4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.