Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/pskc
Commit message (Collapse)AuthorAgeFilesLines
* Get files ready for 0.4 release0.4Arthur de Jong2016-03-281-1/+1
|
* Document writing encrypted filesArthur de Jong2016-03-271-2/+2
|
* Allow configuring a pre-shared keyArthur de Jong2016-03-261-13/+38
| | | | | | | This method allows configuring a pre-shared encryption key and will chose reasonable defaults for needed encryption values (e.g. it will choose an algorithm, generate a new key of the appropriate length if needed, etc.).
* Allow configuring PBKDF2 key derivationArthur de Jong2016-03-261-12/+69
| | | | | This factors out the PBKDF2 key derivation to a separate function and introduces a function to configure KeyDerivation instances with PBKDF2.
* Allow configuring a MAC keyArthur de Jong2016-03-261-0/+33
| | | | | This method will set up a MAC key and algorithm as specified or use reasonable defauts.
* Generate MAC valuesArthur de Jong2016-03-262-13/+30
|
* Write MACMethodArthur de Jong2016-03-263-3/+52
| | | | | | This also makes the MAC.algorithm a property similarly as what is done for Encryption (normalise algorithm names) and adds a setter for the MAC.key property.
* Write out encrypted valuesArthur de Jong2016-03-262-11/+88
| | | | | | | | | The Encryption class now has a fields property that lists the fields that should be encrypted when writing the PSKC file. This adds an encrypt_value() function that performs the encryption and various functions to convert the plain value to binary before writing the encrypted XML elements.
* Make Encryption and MAC constructors consistentArthur de Jong2016-03-263-6/+4
| | | | | | This removes calling parse() from the Encryption and MAC constructors and stores a reference to the PSKC object in both objects so it can be used later on.
* Write encryption key informationArthur de Jong2016-03-262-3/+36
| | | | | | This writes information about a pre-shared key or PBKDF2 key derivation in the PSKC file. This also means that writing a decrypted version of a previously encrypted file requires actively removing the encryption.
* Add algorithm_key_lengths propertyArthur de Jong2016-03-261-16/+26
| | | | | This property on the Encryption object provides a list of key sizes (in bytes) that the configured encryption algorithm supports.
* Also check key expiry in may_use()Arthur de Jong2016-03-231-2/+24
|
* 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 writing to text streams in Python 3Arthur de Jong2016-03-191-1/+6
| | | | | This supports writing the XML output to binary streams as well as text streams in Python 3.
* Improve tests and test coverageArthur de Jong2016-03-192-6/+4
| | | | | | | | | | This adds tests to ensure that incorrect attribute and value types in the PSKC file raise a ValueError exception and extends the tests for invalid encryption options. This removes some code or adds no cover directives to a few places that have unreachable code or are Python version specific and places doctest directives inside the doctests where needed.
* Support both CheckDigit and CheckDigitsArthur de Jong2016-03-192-4/+15
| | | | | | 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.
* Implement policy checkingArthur de Jong2016-03-191-7/+17
| | | | | This checks for unknown policy elements in the PSKC file and will cause the key usage policy check to fail.
* Support various integer representationsArthur de Jong2016-03-191-3/+14
| | | | | | | | | | | | | | | | | | | This extends support for handling various encoding methods for integer values in PSKC files. For encrypted files the decrypted value is first tried to be evaluated as an ASCII representation of the number and after that big-endian decoded. For plaintext values first ASCII decoding is tried after which base64 decoding is tried which tries the same encodings as for decrypted values. There should be no possibility for any base64 encoded value (either of an ASCII value or a big-endian value) to be interpreted as an ASCII value for any 32-bit integer. There is a possibility that a big-endian encoded integer could be incorrectly interpreted as an ASCII value but this is only the case for 110 numbers when only considering 6-digit numbers.
* Re-organise test filesArthur de Jong2016-01-301-1/+1
| | | | | This puts the test PSKC files in subdirectories so they can be organised more cleanly.
* Refactor out EncryptedValue and ValueMACArthur de Jong2016-01-243-155/+135
| | | | | | | | | This removes the EncryptedValue and ValueMAC classes and instead moves the XML parsing of these values to the DataType class. This will make it easier to support different parsing schemes. This also includes a small consistency improvement in the subclasses of DataType.
* Normalise algorithm namesArthur de Jong2016-01-241-2/+45
| | | | | This transforms the algorithm URIs that are set to known values when parsing or setting the algorithm.
* Add encryption algorithm propertyArthur de Jong2016-01-241-0/+23
| | | | | | Either determine the encryption algorithm from the PSKC file or from the explicitly set value. This also adds support for setting the encryption key name.
* Fix a problem when writing previously encrypted fileArthur de Jong2016-01-241-1/+1
| | | | | This fixes a problem with writing a PSKC file that is based on a read file that was encrypted.
* Strip XML namespaces before parsingArthur de Jong2016-01-246-85/+79
| | | | | | | | | 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.
* Make value conversion methods static privateMathias Laurin2015-11-301-11/+20
| | | | | - the conversions do not call self: they are static - the conversions are not to be used out of the class: make private
* Provide abstract methods to clarify APIMathias Laurin2015-11-301-4/+12
|
* Fix typo in variable nameMathias Laurin2015-11-301-6/+6
|
* Get files ready for 0.3 release0.3Arthur de Jong2015-10-071-1/+1
|
* Update documentationArthur de Jong2015-10-071-3/+1
| | | | | | | This updates the documentation with the new features (writing PSKC files) as well as many editorial improvements, some rewording and a few typo fixes. Some things were moved around a little in order to be more easily readable and easier to find.
* Support Python 3Arthur de Jong2015-10-067-24/+31
| | | | | | | | 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-062-24/+27
| | | | | | | | | | | | 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.
* Move encryption functions in pskc.crypto packageArthur de Jong2014-10-094-2/+2
| | | | | | This moves the encryption functions under the pskc.crypto package to more clearly separate it from the other code. Ideally this should be replaced by third-party library code.
* Rename pskc.parse to pskc.xmlArthur de Jong2014-10-096-19/+26
| | | | | | | 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().
* Add function for writing XMLArthur de Jong2014-06-282-0/+17
| | | | This provides a function for pretty-printing the generated XML document.
* Construct XML document with basic PKSC informationArthur de Jong2014-06-283-0/+109
| | | | | | This introduces make_xml() functions to build an XML document that contains the basic PSKC information and keys. This currently only supports writing unencrypted PSKC files.
* Introduce mk_elem() to create elementsArthur de Jong2014-06-281-0/+48
| | | | | | This introduces the mk_elem() function that can be used to create ElementTree elements for building XML documents. This function transparetly handles namespaces, translation of values into XML etc.
* Simplify DataType value handlingArthur de Jong2014-06-271-38/+32
| | | | | | | Only store the native value of the property, not the text representation. This also results in the BinaryDataType and IntegerDataType subclasses only needing from_text() and from_bin() functions.
* Get files ready for 0.2 release0.2Arthur de Jong2014-06-191-1/+1
|
* Only catch normal exceptionsArthur de Jong2014-06-191-1/+1
|
* Remove unused importArthur de Jong2014-06-181-2/+0
|
* PEP8 fixArthur de Jong2014-06-171-2/+2
|
* Remove __str__ from exceptionArthur de Jong2014-06-171-3/+1
| | | | | The message property has been deprecated as of Python 2.6 and printing the first argument is the default.
* Simplify finding ElementTree implementationArthur de Jong2014-06-151-10/+1
| | | | | These are the only ElementTree implementations that have been tested to provide the needed functionality (mostly namespaces).
* Refactor out some functions to parseArthur de Jong2014-06-153-26/+26
| | | | | This introduces the getint() and getbool() functions in parse to avoid some code duplication.
* Add support for setting secretArthur de Jong2014-06-151-24/+39
| | | | | | This supports setters for the secret, counter, time_offset, time_interval and time_drift properties. Setting these values stores the values unencrypted internally.
* Support PBKDF2 PRF argumentArthur de Jong2014-06-151-5/+9
| | | | | Support specifying a pseudorandom function for PBKDF2 key derivation. It currently supports any HMAC that the MAC checking also supports.
* Provide a get_hmac() functionArthur de Jong2014-06-151-11/+16
| | | | | Refactor the functionality to find an HMAC function into a separate function.
* Raise exception when MAC validation failsArthur de Jong2014-06-142-21/+24
| | | | | | | | | This changes the way the check() function works to raise an exception when the MAC is not correct. The MAC is also now always checked before attempting decryption. This also renames the internal DataType.value property to a get_value() method for clarity.
* Handle missing MAC algorithm properlyArthur de Jong2014-06-141-1/+2
|
* Automatically support all MACs in hashlibArthur de Jong2014-06-141-5/+15
| | | | | This uses the name of the hash to automatically get the correct hash object from Python's hashlib.