keyutils bindings for Python
Project description
turkeyutils is a set of python bindings for keyutils (available from http://people.redhat.com/~dhowells/keyutils), a key management suite that leverages the infrastructure provided by the Linux kernel for safely storing and retrieving sensitive infromation in your programs.
Usage
The C extension module follows closely the C API (see add_key(2), request_key(2), keyctl_read_alloc(2)).
Exceptions also follow the C API. The only notable difference is for request_key: when the key is not present, None is returned, instead of raising an exception (which is usually a more expensive operation).
Note that the function parameters are passed as bytes not strings! On python 3 this usually requires an explicit param.encode() call.
For example:
import keyutils
# NOTE: only pass `bytes` to the keyutils API:
name = b'foo'
value = b'bar'
ring = keyutils.KEY_SPEC_PROCESS_KEYRING
key_id = keyutils.add_key(name, value, ring)
assert keyutils.request_key(name, ring) == key_id
assert keyutils.read_key(key_id) == value
# set timeout to 5 seconds, wait and then... it's gone:
keyutils.set_timeout(key_id, 5)
from time import sleep
sleep(6)
assert keyutils.request_key(name, ring) == None
Further examples can be found in the test subfolder.
History
This project was part of the Conary/rpath project at SAS that is no longer supported or maintained. This project is a fork maintained by me!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for turkeyutils-0.6.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07d36e08f396a443774a08a60957219ba6b6bdb2e4c56055ee727bd636c1201d |
|
MD5 | a3aab2789e9394341f94dd66cb04dd1b |
|
BLAKE2b-256 | c0e99b155a9bc38ddf4812cc5c484cae010a6b27be49c5763936d5b666520954 |
Hashes for turkeyutils-0.6.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4393bb89825139f3c10313b10416bef31cf044a42807c0bc4f0738e544958e66 |
|
MD5 | fe2767a1c0f8a4ca39a6b06e809e3004 |
|
BLAKE2b-256 | 7e861206d44a1dd36004f8405297c39537cbd6ba22fec07c67b85589e18ace62 |
Hashes for turkeyutils-0.6.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6efd7f195cb3b0e00e8db13eca94d6cd6493713a5d95b9fc8b63a3b95e05a2a4 |
|
MD5 | b3f474779e180e31d74cdbbb7c5aeaf2 |
|
BLAKE2b-256 | 357818b8ab8b59e3b464927da514a4fd4335ada4797dc4413785406152975487 |
Hashes for turkeyutils-0.6.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74cbf7327d397972f5336ffe498bf468709261aad3122062a1d0d03e0b5749bb |
|
MD5 | 59433b286b13354009664c2665bde3e6 |
|
BLAKE2b-256 | 836231b9a55522daf78cd8ddca27f2ab077e142cd7621d2005159e519274ecfb |