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.
Copyright
Copyright (C) 2014-2024 Arthur de Jong
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ae3671887383bf7b77e019d2c2d43f1f289443cc6ebd20e3a8367cd5a7ee903 |
|
MD5 | c863f0149b0332c89a4d8250e7e23b77 |
|
BLAKE2b-256 | 51b491cc042a24d3840580a0c5d66cb10b96ca651497d1f4c0902a91c66147bd |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0b86ecef3bfc1d9be3bf24df28d6499e7ec1015230f4b4ef09b933a23832860 |
|
MD5 | 09d7dd9cf7c527e6a2b63f5d0dc8eb20 |
|
BLAKE2b-256 | 682f0b038974f663ae07a4c54a0c48878fe91d866d8b973db66aa2c0eb025680 |