Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/pskc/xml.py
Commit message (Collapse)AuthorAgeFilesLines
* Support reading from stdin if input is -Arthur de Jong2020-01-051-2/+3
| | | | This is needed for some XML parsing implementations.
* Force sorting of namespace definitionsArthur de Jong2019-08-161-1/+2
| | | | | | This ensures that namespace declarations in the generated XML files are ordered alphabetically when using lxml (mostly so our tests are reproducible).
* Implement signature checkingArthur de Jong2017-12-271-1/+4
| | | | | | | | | | | | | | | This adds support for creating and verifying embedded XML signatures in PSKC files. This uses the third-party signxml library for actual signing and verification. The signxml library has a dependency on lxml and defusedxml (and a few others) but all parts of python-pskc still work correctly with our without lxml and/or defusedxml and signxml is only required when working with embedded signatures. This modifies the tox configuration to skip the signature checks if singxml is not installed and to only require 100% code coverage if the signature tests are done.
* Move namespace moving to own functionArthur de Jong2017-12-271-11/+16
|
* Implement our own XML formattingArthur de Jong2017-09-251-5/+31
| | | | | | This avoids a using xml.dom.minidom to indent the XML tree and keep the attributes ordered alphabetically. This also allows for customisations to the XML formatting.
* Use defusedxml if availableArthur de Jong2017-09-241-10/+21
| | | | | This uses the defusedxml library if available to defend agains a number of XML-based attacks.
* Various minor code style improvementsArthur de Jong2017-06-101-4/+8
|
* Switch to using non-deprecated methodArthur de Jong2017-06-101-1/+1
| | | | | | This uses ElementTree.iter() instead of ElementTree.getiterator() for going over all the child elements in the tree because the latter is deprecated.
* Add support for older Internet Draft versionArthur de Jong2016-12-211-12/+14
| | | | | | | | | | | | | | This adds support for parsing most examples from draft-ietf-keyprov-pskc-02. That file uses a few other names for elements and attributes of the PSKC file and a few other minor differences. The XML parsing has been changed to allow specifying multiple matches and the find*() functions now return the first found match. While all examples from draft-ietf-keyprov-pskc-02 are tested support for verifying digital signatures and asymmetric keys have not yet been implemented.
* Adapt coverage pragma annotationsArthur de Jong2016-12-201-2/+2
| | | | | This fixes the pragma directives to be be correct independently of whether lxml is installed or not.
* Improve branch coverageArthur de Jong2016-09-141-1/+1
| | | | This enables branch coverage testing and adds tests to improve coverage.
* Copy namespaces to toplevel elementArthur de Jong2016-03-201-0/+11
| | | | | | Ensure that when writing an XML file all namespace definitions are on the toplevel KeyContainer element instead of scattered throughout the XML document.
* Support both CheckDigit and CheckDigitsArthur de Jong2016-03-191-2/+9
| | | | | | RFC 6030 is not clear about whether the attribute of ChallengeFormat and ResponseFormat should be the singular CheckDigit or the plural CheckDigits. This ensures that both forms are accepted.
* Strip XML namespaces before parsingArthur de Jong2016-01-241-15/+22
| | | | | | | | | This simplifies calls to the find() family of functions and allows parsing PSKC files that have slightly different namespace URLs. This is especially common when parsing old draft versions of the specification. This also removes passing multiple patterns to the find() functions that was introduced in 68b20e2.
* Support Python 3Arthur de Jong2015-10-061-3/+3
| | | | | | | | This enables support for Python 3 together with Python 2 support with a single codebase. On Python 3 key data is passed around as bytestrings which makes the doctests a little harder to maintain across Python versions.
* Fix issue with namespaced PBKDF2 parametersArthur de Jong2015-10-061-16/+17
| | | | | | | | | | | | The find() utility functions now allow specifying multiple paths to be searched where the first match is returned. This allows handling PSKC files where the PBKDF2 salt, iteration count, key length and PRF elements are prefixed with the xenc11 namespace. A test including such a PSKC file has been included. Thanks to Eric Plet for reporting this.
* Rename pskc.parse to pskc.xmlArthur de Jong2014-10-091-0/+165
This renames the parse module to xml to better reflect the purpose of the module and it's functions. This also introduces a parse() function that wraps etree.parse().