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.4.tar.gz (138.2 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.4-py3-none-any.whl (58.2 kB view details)

Uploaded Python 3

File details

Details for the file python_pskc-1.4.tar.gz.

File metadata

  • Download URL: python_pskc-1.4.tar.gz
  • Upload date:
  • Size: 138.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for python_pskc-1.4.tar.gz
Algorithm Hash digest
SHA256 4a36381446ca067be728b30e01b4d18dbd9d1ad553bf07c3710abcd87653eefe
MD5 bb1f89bfc1f5539f06d1c1b8d944c699
BLAKE2b-256 bb96877a597fc0bd9a3ed33ada8b30a93f9705805dc43a330e048a8bb1078365

See more details on using hashes here.

File details

Details for the file python_pskc-1.4-py3-none-any.whl.

File metadata

  • Download URL: python_pskc-1.4-py3-none-any.whl
  • Upload date:
  • Size: 58.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for python_pskc-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fb097c429d6b741cc2aac2cb7eb999315421496ea0c85beed9702820d610c664
MD5 597d30a5a3b543ae58efb426a0eada9f
BLAKE2b-256 cbed9cab18ebc3f0fb31ed0567c690b9f4cc1d4856dd972794b8e234b18ddeec

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