Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/pskc/serialiser.py
Commit message (Collapse)AuthorAgeFilesLines
* Add and cleanup docstringsArthur de Jong2018-02-151-0/+11
| | | | | | | | This adds docstrings to public methods and cleans up a few other docstrings to pass most flake8 docstring related tests. This also adds noqa statements in a few places so we can remove most entries from the global flake8 ignore list.
* Correctly write a PSKC file without a MAC keyArthur de Jong2018-02-091-0/+2
| | | | | | | | In some cases a PSKC file can be written with a MAC algorithm but without a MAC key. This is possible when the MAC key is not supplied (allowed in older PSKC versions) and a fallback to the encryption key is done. If we have not yet decrypted the file the MAC key is not yet available and so can't be included in the written file.
* Correctly write a PSKC file with a global IVArthur de Jong2018-02-091-2/+8
| | | | | | | This ensures that the encryption IV, which should be per encrypted value is written out per encrypted value instead of globally. This is mostly useful for when reading an old format PSKC file and writing out a RFC 6030 compliant one.
* Also use EncryptedValue for MAC keyArthur de Jong2018-02-091-12/+12
| | | | | | | | This ensures that an encrypted MAC key is hanled in the same way as normal encrypted data values. This also ensures consistent fallback to the globally configured encryption algorithm if no value has been set in the EncryptedValue.
* Always output a PSKC 1.0 format fileArthur de Jong2018-02-081-3/+2
| | | | | This ignores the value of the version attribute in the PSKC object and always writes a PSKC 1.0 (RFC 6030) format file.
* Fix code style issuesArthur de Jong2018-02-081-1/+1
| | | | Fixes 1ff3237f, 84bfb8a6 and 20bf9c5
* Implement signature checkingArthur de Jong2017-12-271-2/+13
| | | | | | | | | | | | | | | 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.
* Fix typo in pin_max_failed_attempts attributeArthur de Jong2017-12-181-2/+2
| | | | | This makes the old name (pin_max_failed_attemtps) available as a deprecated property.
* Refactor internal storate of encrypted valuesArthur de Jong2017-12-151-33/+45
| | | | | | | | | | | This changes the way encrypted values are stored internally before being decrypted. For example, the internal _secret property can now be a decrypted plain value or an EncryptedValue instance instead of always being a DataType, simplifying some things (e.g. all XML encoding/decoding is now done in the corresponding module). This should not change the public API but does have consequences for those who use custom serialisers or parsers.
* Implement our own XML formattingArthur de Jong2017-09-251-1/+1
| | | | | | 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.
* Fix bug in saving PBKDF2 salt on Python3Arthur de Jong2017-09-241-1/+1
| | | | | | | The PBKDF2 salt was saved in the wrong way (b'base64encodeddata' instead of base64encodeddata) when using Python 3. This fixes that problem and tests that saving and loading of a file that uses PBKDF2 key derivation works.
* Run flake8 from toxArthur de Jong2017-09-201-2/+1
| | | | | This also makes a few small code formatting changes to ensure that the flake8 tests pass.
* Various minor code style improvementsArthur de Jong2017-06-101-4/+5
|
* Ensure XML file ends with a newlineArthur de Jong2016-12-201-1/+1
|
* Also move outer writing and parsing to modulesArthur de Jong2016-09-241-1/+10
|
* Support separate device from keyArthur de Jong2016-09-171-22/+21
| | | | | | | | This allows having multiple keys per device while also maintaining the previous API. Note that having multiple keys per device is not allowed by the RFC 6030 schema but is allowed by some older internet drafts.
* Move XML generation to own moduleArthur de Jong2016-09-171-0/+214
Similar to the change for parsing, move the XML serialisation of PSKC data to a single class in a separate module.