pycdoc
Python bindings for libcdoc - a library for reading and writing encrypted CDOC containers.
CDOC is a file format for encrypting documents, used primarily in Estonia for secure document exchange with the Estonian ID-card ecosystem.
Installation
uv add pycdoc
Requirements
Runtime
- Python 3.10+
- OpenSSL 3.5+ (usually pre-installed on modern systems)
Building from Source
Building from source requires:
- Python 3.10+
- CMake 3.20+
- SWIG 4.0+
- OpenSSL 3.5+
- libxml2
- zlib
- FlatBuffers
- C++23 compatible compiler
macOS:
brew install cmake swig openssl@3 libxml2 flatbuffers
Ubuntu/Debian:
sudo apt install cmake swig libssl-dev libxml2-dev zlib1g-dev libflatbuffers-dev
Fedora/RHEL:
sudo dnf install cmake swig openssl-devel libxml2-devel zlib-devel flatbuffers-devel
Quick Start
Install with LDAP support for certificate lookup:
uv add "pycdoc[ldap]"
Encrypting Files
import pycdoc
# Encrypt a file for an Estonian ID card holder
pycdoc.encrypt("document.pdf", "38607080247", output="encrypted.cdoc")
# Get CDOC as bytes instead of writing to file
cdoc_bytes = pycdoc.encrypt("document.pdf", "38607080247")
# Encrypt raw bytes
pycdoc.encrypt(b"secret content", "38607080247", filename="secret.txt", output="encrypted.cdoc")
# Encrypt multiple files into one container
pycdoc.encrypt(["file1.pdf", "file2.docx"], "38607080247", output="bundle.cdoc")
The recipient can decrypt with DigiDoc4 Client or cdoc-tool.
API Overview
Core Classes
CDocReader- Read and decrypt CDOC containersCDocWriter- Create and encrypt CDOC containers
Configuration
Configuration- Base configuration class (can be subclassed)JSONConfiguration- JSON file-based configuration
Backends
CryptoBackend- Cryptographic operations backend (can be subclassed)NetworkBackend- Network operations backend for key serversPKCS11Backend- PKCS#11 hardware token backend (smart cards, HSMs)
Data Types
Recipient- Encryption recipient informationLock- Decryption lock informationFileInfo- File metadata (name, size)DataSource- Abstract data source for streamingDataConsumer- Abstract data consumer for streaming
Result Codes
OK- Operation successfulWRONG_KEY- Incorrect decryption keyDATA_FORMAT_ERROR- Invalid container formatCRYPTO_ERROR- Cryptographic operation failedPKCS11_ERROR- PKCS#11/smart card error
Use pycdoc.get_error_str(code) to get human-readable error descriptions.
Building from Source
- Clone the repository with submodules:
git clone --recurse-submodules https://github.com/namespace-ee/pycdoc.git
cd pycdoc
- Build the wheel:
uv build --wheel
- Install the wheel:
uv pip install dist/pycdoc-*.whl
Development
# Build wheel
uv build --wheel
# Install in development mode (rebuild required after changes)
uv pip install --force-reinstall dist/pycdoc-*.whl
# Run tests
uv run pytest tests/ -v
License
This library is licensed under the GNU Lesser General Public License v2.1 or later (LGPL-2.1-or-later).
See LICENSE for the full license text.
Links
Metadata
Release files for pycdoc 0.1.2
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 |
|---|---|---|---|---|
| pycdoc-0.1.2.tar.gz | 460.3 kB | With provenance | Details for pycdoc-0.1.2.tar.gz |
Built distributions (wheels)
Total release size: 63.6 MB
Release files / pycdoc-0.1.2.tar.gz
| Download URL | pycdoc-0.1.2.tar.gz |
|---|---|
| Size | 460.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be4fcd6c8febfe8d8455d62519391d70c49f719a6fefd6fd505431057f3b30bc
|
|
BLAKE2b-256 checksum How to use checksums |
09d8d764a2533b10272379866e2faff68e533c6cc7d5934d53f295e791e71347
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp314-cp314-win_amd64.whl
| Download URL | pycdoc-0.1.2-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1cd52958b5c05952dc2f2d6a6a7ef25f43da8698802dcf0120c9ae27ec467f58
|
|
BLAKE2b-256 checksum How to use checksums |
32362f2a7f51d1a281b2fd04be98f16b8e8a7d76549a757c3d77abadbfdd394b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp314-cp314-manylinux_2_28_x86_64.whl
| Download URL | pycdoc-0.1.2-cp314-cp314-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
bfe34f1733632e065edaf01f0e44d6c84e1821848588bca9f0d39640cc599133
|
|
BLAKE2b-256 checksum How to use checksums |
f6256dd6bb295c75aad6c3c4d805982be1cca747a2f216a4acbfe58b10381265
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp314-cp314-macosx_15_0_arm64.whl
| Download URL | pycdoc-0.1.2-cp314-cp314-macosx_15_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.14 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
43e518a2774cd19fb8f512c45fc5fb88565a9510a9b87e06f2457c32dbff76f0
|
|
BLAKE2b-256 checksum How to use checksums |
2f9a2226673e7dbde42dad8e5575e8ab5254c2cba8ecba237ef149f544d1d3d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp313-cp313-win_amd64.whl
| Download URL | pycdoc-0.1.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
87bacbe921edb66a6967238e523be9579c086aac9bc417589a54002fc7b6ced0
|
|
BLAKE2b-256 checksum How to use checksums |
9eb510299f16c56882efcfe2dc7093c7142ac76c2c2e0ad80c7b3b8fc91d9ed6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | pycdoc-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
7a267858e3eb0e4e0e89b00933f8c5455dc7a7fb116d0cbd29fd989d8af002f1
|
|
BLAKE2b-256 checksum How to use checksums |
062fa63c6c228211de065430639cc32fe3a9232f7c4524f4e1a238d96cc6a9df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | pycdoc-0.1.2-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
546710d584d83fa688aa4c6b907be22e2058d9ad5b30bf2a4b4776d8e38acf56
|
|
BLAKE2b-256 checksum How to use checksums |
b008404913ecc0f39cc6d8c22e2c69fbe96e71c3c0896bb24a6a5dcec53b1449
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp312-cp312-win_amd64.whl
| Download URL | pycdoc-0.1.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
82b0d1191cb7ad1f0ff211ef06901e85c36714d5c212c5f7c42943430bf8c51e
|
|
BLAKE2b-256 checksum How to use checksums |
335891e77c8b6feea468527cf1a051a8e0330bc5c16e8211363f6ee5d1e7914d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | pycdoc-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
dd36c51f695e1a00af14f0d3718b8773e1edd68e2f35c2d510e12e698fafad8d
|
|
BLAKE2b-256 checksum How to use checksums |
727073fac0bf26193f2bb63c3ae6887e1b660caf0426e99e5cbd24d47ec93b20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | pycdoc-0.1.2-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2a4e12ac2c5f8daa440f95271fc63985c27cb106990c80923a29080f8f404611
|
|
BLAKE2b-256 checksum How to use checksums |
2ceb9a0686f3e2516c454f0e8163530b2bc7ddc026854bd4da3ad382e46cac1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp311-cp311-win_amd64.whl
| Download URL | pycdoc-0.1.2-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3111697576a5f2f9f000f55684b345e51d2e332bb9ce20ae61882e5aeee6b8f4
|
|
BLAKE2b-256 checksum How to use checksums |
b1973379e307a33a8f6493d3b5dd8c3eb70c9af40c43461540fe2ffa232a929d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | pycdoc-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
4e3265011527df2bf58ae52ceee1668b2a5ca403931643327982237da5c1f4a7
|
|
BLAKE2b-256 checksum How to use checksums |
a9d91686208b60ced21f675cc0d066d716217395862b3830f37f50ed3b661bb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | pycdoc-0.1.2-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d6d120fdfd9483cdca3ffbdb8125c4a53a10bd967cb97ecce9df2f241720c5c0
|
|
BLAKE2b-256 checksum How to use checksums |
f951d261a761db11eeb7cbca669a8fa4c53e9126941612956e734978dbf7e6dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp310-cp310-win_amd64.whl
| Download URL | pycdoc-0.1.2-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
cafc77a40904d840b5b79af0d3e82cee58e03a4b56137dadc2bd2696d6ecdada
|
|
BLAKE2b-256 checksum How to use checksums |
95f5dbfcde1ad09bb7cbd7bf42030a7184420870d76b236544733869aafe8e12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | pycdoc-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ceb565fd1956d94979e8cc90fe8e03e4470bc9a05719f24835f4e70a6e167843
|
|
BLAKE2b-256 checksum How to use checksums |
d5194f1aa4f65b0bcd6843bf86c09a3a80e1323ad05560688312ff953cf2924e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logRelease files / pycdoc-0.1.2-cp310-cp310-macosx_15_0_arm64.whl
| Download URL | pycdoc-0.1.2-cp310-cp310-macosx_15_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.10 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
efbd6b644f3302f47aeb8e288a6f160faa84fbf2430ca0be5a04de838b01b7e8
|
|
BLAKE2b-256 checksum How to use checksums |
ad8c41959051d5308d7e0c0590f923a6b6b3cbd90c2aa84500c3743f954e7ab6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 17, 2026.
Transparency logSecurity for pycdoc 0.1.2
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
All 16 files in this release have been uploaded with provenance metadata.
Attestation for pycdoc-0.1.2.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 Feb 17, 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.