{"action":"created","issue":{"url":"https://api.github.com/repos/kislyuk/signxml/issues/32","labels_url":"https://api.github.com/repos/kislyuk/signxml/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/kislyuk/signxml/issues/32/comments","events_url":"https://api.github.com/repos/kislyuk/signxml/issues/32/events","html_url":"https://github.com/kislyuk/signxml/issues/32","id":114470191,"number":32,"title":"Enveloped signature: Signature-placeholder not found when not direct child of root","user":{"login":"vboehm","id":4264426,"avatar_url":"https://avatars.githubusercontent.com/u/4264426?v=3","gravatar_id":"","url":"https://api.github.com/users/vboehm","html_url":"https://github.com/vboehm","followers_url":"https://api.github.com/users/vboehm/followers","following_url":"https://api.github.com/users/vboehm/following{/other_user}","gists_url":"https://api.github.com/users/vboehm/gists{/gist_id}","starred_url":"https://api.github.com/users/vboehm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vboehm/subscriptions","organizations_url":"https://api.github.com/users/vboehm/orgs","repos_url":"https://api.github.com/users/vboehm/repos","events_url":"https://api.github.com/users/vboehm/events{/privacy}","received_events_url":"https://api.github.com/users/vboehm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-01T13:39:00Z","updated_at":"2015-11-04T14:41:31Z","closed_at":null,"body":"Hello,\r\n\r\nAccording to then W3C specification an enveloped signature is\r\n> **Signature, Enveloped**\r\n> The signature is over the XML content that contains the signature as an element. The content provides the root XML document element. Obviously, enveloped signatures must take care not to include their own value in the calculation of the SignatureValue.\r\n\r\nThere is no need for the signature element to be a direct child of the root element.\r\n\r\nSo you may use\r\n\r\n    <TheInformation>\r\n        <SomeInfo>\r\n            ...\r\n            <Security>\r\n                ...\r\n                <Signature>  \r\n                    ...\r\n                </Signature>  \r\n                ...\r\n            </Security>\r\n            ...\r\n        <\\SomeInfo>\r\n        <SomeOtherInfo>\r\n            ...\r\n        <\\SomeOtherInfo>\r\n        ...\r\n    </TheInformation>\r\n\r\nAnd there are many implementations which put the _signature_ element **somewhere** in the\r\nXML-tree.\r\n\r\nYour implementation (method _\\_getPayload\\_c14n_) uses\r\n\r\n    .\r\n    .\r\n    signature_placeholders = self._findall(self.data, \"Signature[@Id='placeholder']\")\r\n    .\r\n    .\r\n\r\nto find the position of the signature element and _\\_findall_ is defined as\r\n\r\n    def _findall(self, element, query, namespace=\"ds\"):\r\n        return element.findall(namespace + \":\" + query, namespaces=namespaces)\r\n\r\nBut the element-method _findall_ only searches for direct childs if called with a simple name\r\n\r\n    element.findall('ds:Signature')\r\n\r\nTo find all descendants you have to search with an x-path  expression beginning with './/' \r\n\r\n    element.findall('.//ds:Signature')\r\n\r\nI changed the definition of _\\_findall_ to\r\n\r\n    def _findall(self, element, query, namespace=\"ds\"):\r\n        return element.findall('.//' + namespace + \":\" + query, namespaces=namespaces)\r\n\r\nand now the Program behaves correctly. \r\n\r\nBut since you use your _\\_findall_ method in several places, I don't know if I destroyed the other uses of this routine. \r\nAnd until now I didn't find the time to analyze, if the non-recursive search occurs in other places of your program (I think your _verify_ function does also not work for the above example).\r\n\r\nregards  Volker\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/kislyuk/signxml/issues/comments/153747396","html_url":"https://github.com/kislyuk/signxml/issues/32#issuecomment-153747396","issue_url":"https://api.github.com/repos/kislyuk/signxml/issues/32","id":153747396,"user":{"login":"kislyuk","id":862013,"avatar_url":"https://avatars.githubusercontent.com/u/862013?v=3","gravatar_id":"","url":"https://api.github.com/users/kislyuk","html_url":"https://github.com/kislyuk","followers_url":"https://api.github.com/users/kislyuk/followers","following_url":"https://api.github.com/users/kislyuk/following{/other_user}","gists_url":"https://api.github.com/users/kislyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/kislyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kislyuk/subscriptions","organizations_url":"https://api.github.com/users/kislyuk/orgs","repos_url":"https://api.github.com/users/kislyuk/repos","events_url":"https://api.github.com/users/kislyuk/events{/privacy}","received_events_url":"https://api.github.com/users/kislyuk/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T14:41:31Z","updated_at":"2015-11-04T14:41:31Z","body":"Sorry about the delay - will take a look and see what I can do."}}