linux-keyctl
A thin Python interface to the Linux kernel key management facility
(add_key(2), request_key(2), keyctl(2)).
- Pure Python: calls the system calls directly through
ctypes; nolibkeyutils, no compiled extension, no dependencies. - One function per
libkeyutilsoperation, with the kernel's semantics. - Kernel failures raise
OSErrorwith the kernel'serrno. - Secrets are never logged, cached or put in exception messages.
- Python ≥ 3.11; 64-bit Linux on x86_64, aarch64 or riscv64.
Installation
pip install linux-keyctl
The import name is linux_keyctl. (The unrelated PyPI package keyctl
uses the import name keyctl; this one never installs it.)
Example
import linux_keyctl as keyctl
SESSION = keyctl.KEY_SPEC_SESSION_KEYRING
key = keyctl.add_key(b"my-app:token", b"s3cret", SESSION)
keyctl.set_timeout(key, 3600) # expires in one hour
assert keyctl.read_key(key) == b"s3cret"
assert keyctl.search(SESSION, b"my-app:token") == key
keyctl.revoke(key)
Descriptions, key types and payloads are bytes. Importing the package
never touches the keyring; on a platform without keyring support every
call raises OSError with errno.ENOSYS.
Documentation
- Manual: getting started, integration contracts, API reference.
- Specification: the complete contract.
- Changes
Development setup, tests and the documentation build are described in the contributing guide.
License
GPL-3.0-or-later. See LICENSE.
Metadata
Release files for linux-keyctl 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| linux_keyctl-1.1.0.tar.gz | 51.3 kB | With provenance | Details for linux_keyctl-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| linux_keyctl-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for linux_keyctl-1.1.0-py3-none-any.whl |
Total release size: 73.2 kB
Release files / linux_keyctl-1.1.0.tar.gz
| Download URL | linux_keyctl-1.1.0.tar.gz |
|---|---|
| Size | 51.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d68929dc283c240755d718980691ca266724a27f2294454158f2fdc90c10f001
|
|
BLAKE2b-256 checksum How to use checksums |
f65f2567d86b4f7fedbdee493ecbc07e021474208880f5dafc1783b1c7764dbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / linux_keyctl-1.1.0-py3-none-any.whl
| Download URL | linux_keyctl-1.1.0-py3-none-any.whl |
|---|---|
| Size | 21.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24f31afa4e26e65d06ebcc42a3dc219919d0239a6374c1790af1d961d28798fe
|
|
BLAKE2b-256 checksum How to use checksums |
c6bf12141af132567e5304188c5348a661eb9adb5ce0100d2e6675a3504e5fdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for linux-keyctl 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for linux_keyctl-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.