Skip to main content

Python module for handling PSKC files

Project description

A Python module to handle Portable Symmetric Key Container (PSKC) files as defined in RFC 6030. PSKC files are used to transport and provision symmetric keys and key meta data (seed files) to different types of crypto modules, commonly one-time password systems or other authentication devices.

This module can be used to extract keys from PSKC files for use in an OTP authentication system. The module can also be used for authoring PSKC files.

This module should be able to handle most common PSKC files.

https://arthurdejong.org/python-pskc/

API

The module provides a straightforward API that is mostly geared towards parsing existing PSKC files.

Extracting key material from encrypted PSKC files is as simple as:

>>> from pskc import PSKC
>>> pskc = PSKC('tests/rfc6030/figure7.pskcxml')
>>> pskc.encryption.derive_key('qwerty')
>>> for key in pskc.keys:
...     print('%s %s' % (key.serial, str(key.secret.decode())))
987654321 12345678901234567890

Writing am encrypted PSKC file is as simple as:

>>> pskc = PSKC()
>>> key = pskc.add_key(
...     id='456', secret='987654321', manufacturer='Manufacturer',
...     algorithm = 'urn:ietf:params:xml:ns:keyprov:pskc:hotp')
>>> pskc.encryption.setup_pbkdf2('passphrase')
>>> pskc.write('output.pskcxml')

The key object has a number of properties. See the pskc.key.Key documentation for details.

Security considerations

This code handles private key material and is written in Python. No precautions have been taken to lock pages in memory to prevent swapping. Also no attempt is currently made to securely dispose of memory that may have held private key material.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-pskc-1.1.tar.gz (132.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_pskc-1.1-py2.py3-none-any.whl (53.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file python-pskc-1.1.tar.gz.

File metadata

  • Download URL: python-pskc-1.1.tar.gz
  • Upload date:
  • Size: 132.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2+

File hashes

Hashes for python-pskc-1.1.tar.gz
Algorithm Hash digest
SHA256 489938c60a6c8493a619b39854aa5cf49e259ba089fc70e611c018353c88eb83
MD5 4220bef768505b2833097e60d7324576
BLAKE2b-256 936f3045001fa593beb6850a986a72c09bed6960b12ad5b133d90809f268035b

See more details on using hashes here.

File details

Details for the file python_pskc-1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: python_pskc-1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 53.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2+

File hashes

Hashes for python_pskc-1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c7c2d86f341515684823f3912f0065dac8715d7b2cf6cbacd2a900c76874c8a9
MD5 76d83508aace21615c3f8393a3534cc9
BLAKE2b-256 44a21d5a8aca80dc481e29c07df1fe6284483720656e221d15454beaf8871b92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page