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.

Project details


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.3.tar.gz (130.8 kB view details)

Uploaded Source

Built Distribution

python_pskc-1.3-py2.py3-none-any.whl (53.1 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: python-pskc-1.3.tar.gz
  • Upload date:
  • Size: 130.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for python-pskc-1.3.tar.gz
Algorithm Hash digest
SHA256 6ae3671887383bf7b77e019d2c2d43f1f289443cc6ebd20e3a8367cd5a7ee903
MD5 c863f0149b0332c89a4d8250e7e23b77
BLAKE2b-256 51b491cc042a24d3840580a0c5d66cb10b96ca651497d1f4c0902a91c66147bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_pskc-1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for python_pskc-1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b0b86ecef3bfc1d9be3bf24df28d6499e7ec1015230f4b4ef09b933a23832860
MD5 09d7dd9cf7c527e6a2b63f5d0dc8eb20
BLAKE2b-256 682f0b038974f663ae07a4c54a0c48878fe91d866d8b973db66aa2c0eb025680

See more details on using hashes here.

Supported by

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