Open wilfredcom opened 4 years ago
I don't see any of your document so no idea why the errors.
On 6/11/20 9:31 PM, Wilfredo Pachón López wrote:
I'm trying to sign an XML withe de first lines like this
When try to sign this I have the following warnings and the result is wrong: DOMNode::C14N(): Relative namespace UR is invalid here : dian DOMNode::C14N(): Internal error : checking for relative namespaces DOMNode::C14N(): Internal error : processing docs children list
How can I fix them?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/robrichards/xmlseclibs/issues/210, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABTNRISQ65WR5ATKCUDBQLRWGAP3ANCNFSM4N3426QQ.
Thanks for the response. The problem is issued when try to canonicalize de XML before the sign:
$objDSig = new XMLSecurityDSig(); $objDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
And the warning and failure is reported in line 296 of the script robrichards/xmlseclibs/src/XMLSecurityDSig.php:
return $node->C14N($exclusive, $withComments, $arXPath, $prefixList);
All seems to be good but always throw the error:
DOMNode::C14N(): Relative namespace UR is invalid here : dian DOMNode::C14N() Internal error : checking for relative namespaces DOMNode::C14N() Internal error : processing docs children list
, except if the line
xmlns:sts="dian:gov:co:facturaelectronica:Structures-2-1" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:xades141="http://uri.etsi.org/01903/v1.4.1#"
Is removed, but i cannot do this because this NS is essential part of my XML
I would need to see the full document and code being used to know what you are trying to sign and what's being passed in.
Thanks, the XML document to be signed looks like: `
Alguna solución a este problema? Tengo el mismo problema
I'm trying to sign an XML withe de first lines like this
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:sts="dian:gov:co:facturaelectronica:Structures-2-1" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:xades141="http://uri.etsi.org/01903/v1.4.1#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd">
When try to sign this I have the following warnings when the sytem try to use
DOMNode::C14N
to canonicalize and the result is wrong:DOMNode::C14N(): Relative namespace UR is invalid here : dian DOMNode::C14N(): Internal error : checking for relative namespaces DOMNode::C14N(): Internal error : processing docs children list
How can I fix them?
se pudo solucionar este problema?
I am no expert in this topic but did a little research as I recently run into this issue myself. Here are my foundings:
Note: This specification supports the recent XML plenary decision to deprecate relative namespace URIs as follows: implementations of XML canonicalization MUST report an operation failure on documents containing relative namespace URIs. XML canonicalization MUST NOT be implemented with an XML parser that converts relative URIs to absolute URIs.
@moltam Thanks for posting your analysis which solved the issue for me. I'm using canonicalization in PHP and, as a third party test, using the canonicalization class built into the Microsoft .NET Framework cryptography package. PHP (libxml) does report errors with relative namespaces but the .NET Framework implementation does not which caught me out.
Or
I am sorry. xmlns:sts="https://www.dian.gov.co/contratos/facturaelectronica/v1/Structures" OR xmlns:sts="urn:dian:gov:co:facturaelectronica:Structures-2-1"
I have found a solution to this issue, this is in https://es.stackoverflow.com/a/532015/283864
Regards!
I'm trying to sign an XML withe de first lines like this
`<?xml version="1.0" encoding="UTF-8" standalone="no"?>