Skip to main content

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.

Release files for python-pskc 1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-pskc 1.4
File Size Uploaded
python_pskc-1.4.tar.gz 138.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-pskc 1.4
File Interpreter ABI Platform
python_pskc-1.4-py3-none-any.whl Python 3 none any Details

Total release size: 196.4 kB

Release files / python_pskc-1.4.tar.gz

Download URL python_pskc-1.4.tar.gz
Size 138.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4a36381446ca067be728b30e01b4d18dbd9d1ad553bf07c3710abcd87653eefe
BLAKE2b-256 checksum
How to use checksums
bb96877a597fc0bd9a3ed33ada8b30a93f9705805dc43a330e048a8bb1078365
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / python_pskc-1.4-py3-none-any.whl

Download URL python_pskc-1.4-py3-none-any.whl
Size 58.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb097c429d6b741cc2aac2cb7eb999315421496ea0c85beed9702820d610c664
BLAKE2b-256 checksum
How to use checksums
cbed9cab18ebc3f0fb31ed0567c690b9f4cc1d4856dd972794b8e234b18ddeec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

1.4 This release

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page