Coder Social home page Coder Social logo

Error validation about xml-crypto HOT 21 CLOSED

node-saml avatar node-saml commented on July 28, 2024
Error validation

from xml-crypto.

Comments (21)

yaronn avatar yaronn commented on July 28, 2024

where is the xml?

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

I attached you the xml and the public key
JAEP820923NM9-AOPF580423BIA.txt
JAEP820923NM9_publicKey.key.pem.txt

from xml-crypto.

yaronn avatar yaronn commented on July 28, 2024

this xml already contains a signature, why do you sign it again? try all of this on a very simple xml (1-2 tags) to see if it works on that.

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

I'm trying with hello and
sign = new SignedXml()
sign.addReference "//*[local-name(.)='node']" , "" , "" , "" , "" , "" , true

but it doesn't work

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

sorry , the xml I'm using now is from attached image
captura de pantalla 2015-11-25 a las 6 02 11 p m

from xml-crypto.

yaronn avatar yaronn commented on July 28, 2024

try this using null instead of empty strings in addReference.

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

I tried with null instead empty strings, but I had the same result
sign.addReference "//*[local-name(.)='node']" , null , null , null , null , null , true

from xml-crypto.

yaronn avatar yaronn commented on July 28, 2024

does it work if you just give addReference the first parameter (I know it will create the wrong URI but lets see if at least it gets the signature correctly).

from xml-crypto.

yaronn avatar yaronn commented on July 28, 2024

if it fails try the example file or readme sample of the project. if it works try to hard code here to use the empty uri value:

https://github.com/yaronn/xml-crypto/blob/master/lib/signed-xml.js#L560

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

the problem is that you must sign your xml with the enveloped signature transform (because the signature will live inside the node you are signing)

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

try using:

(example in js)

sign.addReference(
    "//*[local-name(.)='ConsultaSectorPrimario']",
    [
      'http://www.w3.org/2000/09/xmldsig#enveloped-signature',
      'http://www.w3.org/2001/10/xml-exc-c14n#'
    ],
    null,
    '',
    '',
    '',
    true
);

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

that should work.. if it doesn't work please create a repository with your original xml, a dumb private/public key and the code you are using.

from xml-crypto.

yaronn avatar yaronn commented on July 28, 2024

good call @bjrmatos!

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

woooooow, that it works, good one @bjrmatos, thanks, now I'm getting a successful validate, the web validator https://www.aleksey.com/xmlsec/xmldsig-verifier.html still says "invalid signature" but it doesn't care, thaks so much

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

I have a question, can I sign a xml twice? I mean a second sign to a xml previously signed and includes both signs

first xml to sign
primerxml
second xml to sign
segundoxml

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

mmm technically, you can (i'm sure xml-crypto let you do that) but i don't know if it is valid according to the XML Digital Signature Spec, i haven't seen a xml with a re-signature but maybe @yaronn know more about this

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

I don't think it'll be valid to the standard, but is a requirement of electronical invoice in México, I tried to do it but the first and the second sign has the same digestvalue always, I don't know if it'll be ok

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

i'm closing this because is not an issue, feel free to keep comment.

mmm interesting, i have implemented electronical invoice in Perú.. in that case there is no need for re-sign the document. if i understand correctly mexico (and other countries in south america) use the UBL standard for electronical invoices, is that correct?

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

Peru uses the UBL standard, but Mexico don't, Mexico has own standard, and it has many different process, one of them requires a resigned xml, and I just read that also requires a canonicalization method 1.1, I don't know if xml-crypto supports this method

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

xml-crypto support canonicalization methods and extending with custom canonicalization methods, but i don't know how the canonicalization 1.1 works (maybe is just one of the supported canonicalization methods that xml-crypto have but with other name).

I don't think it'll be valid to the standard, but is a requirement of electronical invoice in México, I tried to do it but the first and the second sign has the same digestvalue always, I don't know if it'll be ok

if you create a repository, i can help you to test the re-sign to a document. unfortunately i don't know coffeescript so you should create the repository in JavaScript (it is short code anyway)

from xml-crypto.

Gustavinho avatar Gustavinho commented on July 28, 2024

Thanks so much, I'll create a repository in javascript, and now I have an exact example with the xml signes an resigned, I'll also add it to repository

from xml-crypto.

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.