- Language
- 🐍 Python
- Package
dojo-trust·import dojo.trust- Latest version
- 0.4.0 · 19 November 2026
- Requires
- Python ≥ 3.9
- Dependencies
- none
- License
- MIT
- Language
- 🐘 PHP
- Package
dojo/trust·Dojo\Trust- Latest version
- 0.4.0 · 19 November 2026
- Requires
- PHP ≥ 8.1
- Dependencies
ext-json *,ext-openssl *- License
- MIT
Works with: Python 3.9+, zero dependencies (stdlib only). PHP variant >= 8.1 with ext-json and ext-openssl (core).
Independent MikroTik Dojo project library: it is not MikroTik software nor is it approved by MikroTik. Test it in a lab first.
Installation and usage
Installation (Python)
pip install --index-url https://mikrotikdojo.com/en/pypi/<your-address>/simple/ dojo-trustThe library is installed with pip from the dojo index, using a personal URL reserved for dojo members. Joining is free: you only need your email.
Usage example (Python)
from dojo.trust import (TrustStore, sample_store, example_chain,
example_roots, verify_chain)
# Dati demo inclusi: catena reale Let's Encrypt 2021 (leaf lencr.org -> R3)
chain, roots = example_chain(), example_roots()
# Store "legacy" senza ISRG Root X1, come iOS 9 / Android 7.0:
# DST Root CA X3 scade il 2021-09-30
legacy = TrustStore.from_dict({
"os": "sample", "version": "legacy",
"roots": [r for r in sample_store().roots
if r["name"] == "DST Root CA X3"],
})
res = verify_chain(chain, legacy, at="2021-09-01", extra_roots=roots)
print(res.verdict) # trusted
res = verify_chain(chain, legacy, at="2021-10-01", extra_roots=roots)
print(res.verdict) # not-trusted
print(res) # motivazioni: DST Root CA X3 scaduto al 2021-10-01
# Con un trust store reale per versione OS (JSON, vedi README):
# store = TrustStore.load("stores/apple/ios10.json")
# res = verify_chain(open("chain.pem").read(), store, at="2021-10-01",
# extra_roots=roots)
# print(res.verdict) # trusted: ISRG Root X1 e' nello store da iOS 10Installation (PHP)
composer config repositories.dojo composer https://mikrotikdojo.com/en/composer/<your-address>/
composer require dojo/trustThe library is installed with Composer from the dojo repository, using a personal URL reserved for dojo members. Joining is free: you only need your email.
Usage example (PHP)
use Dojo\Trust\TrustStore;
use Dojo\Trust\Verifier;
// Dati demo inclusi: catena reale Let's Encrypt 2021 (leaf lencr.org -> R3)
$chain = file_get_contents('data/example-chain.pem');
$roots = file_get_contents('data/example-roots.pem');
$full = TrustStore::load('data/sample-store.json');
// Store "legacy" senza ISRG Root X1, come iOS 9 / Android 7.0:
// DST Root CA X3 scade il 2021-09-30
$legacy = TrustStore::fromArray([
'os' => 'sample', 'version' => 'legacy',
'roots' => array_values(array_filter($full->roots,
fn($r) => $r['name'] === 'DST Root CA X3')),
]);
$res = Verifier::verifyChain($chain, $legacy, '2021-09-01', $roots);
echo $res['verdict']; // trusted
$res = Verifier::verifyChain($chain, $legacy, '2021-10-01', $roots);
echo $res['verdict']; // not-trusted
print_r($res['paths']); // motivazioni: DST Root CA X3 scaduto al 2021-10-01
// Con un trust store reale per versione OS (JSON, vedi README):
// $store = TrustStore::load('stores/apple/ios10.json');
// $res = Verifier::verifyChain(file_get_contents('chain.pem'), $store,
// '2021-10-01', $roots);
// echo $res['verdict']; // trusted: ISRG Root X1 e' nello store da iOS 10What it does
dojo.trust answers a question normal TLS clients never ask: “was this certificate chain trusted by that OS version, on that date?”. It is the tool to understand and reproduce the historical cases where a perfectly working site becomes “not secure” on millions of already-deployed devices, with no change on the server side.
The classic example: DST Root CA X3 / Let’s Encrypt (September 2021). The DST Root CA X3 root expired on 2021-09-30. Let’s Encrypt reached older devices through a cross-sign on that root; devices with ISRG Root X1 in their store (iOS 10+, Android 7.1.1+) had an alternative anchor, the others did not. With dojo.trust you prove it with a real chain and two dates:
verify_chain(chain, store_ios9, at="2021-09-01") → trusted; verify_chain(chain, store_ios9, at="2021-10-01") → not-trusted, with the exact reason (“DST Root CA X3: expired/not valid at 2021-10-01”). On iOS 10+ it stays trusted afterwards. The package ships demo data (a real 2021 lencr.org leaf chain + a store with ISRG Root X1 and DST Root CA X3) so you can try it immediately, with nothing to download.
What it does: PEM/DER certificate parsing (subject, issuer, serial, validity, SAN, EKU, basicConstraints, embedded SCTs); cryptographic verification of RSA PKCS#1 v1.5 (SHA-1/256/384/512) and ECDSA P-256/P-384 signatures; leaf → root path building inside a JSON trust store, including cross-signs and multiple paths; a trusted / not-trusted / ask verdict at the requested date with per-path reasons; documented extra-store rules for Apple (SHA-2, RSA ≥ 2048, SAN dNSName, serverAuth EKU, validity ≤ 825 days, Certificate Transparency) and Windows (root EKU in the Microsoft program).
Trust stores are JSON files with the root fingerprints per OS version: you build them from official sources (Apple “List of available trusted root certificates” pages, the AOSP platform/system/ca-certificates repository per Android tag, the CCADB report of the Microsoft Trusted Root Program). The format is documented in the README and also supports the blocked (blocklist) and always-ask statuses, plus serial+name matching for legacy Apple pages without fingerprints.
What it does not do: it is not a TLS client, it does not check revocation (CRL/OCSP), it does no hostname matching, and it does not support Ed25519/DSA. Validity is evaluated at day granularity (UTC); the Apple rules are a documented simplification of the official policies, with sources cited in the code.
Two implementations, same API and same verdicts (parity verified case by case): Python 3.9+ (stdlib only) and PHP 8.1+ (ext-openssl, a core extension) — both with zero external dependencies, MIT license. The Python package also ships a CLI: python -m dojo.trust --demo for the DST X3 demo, or --chain ... --store ... --date ... for your own chains.
Versions
| Version | News | File |
|---|---|---|
| 0.4.0 PHP latest 19 November 2026 | 0.4.0 — OS stores bundled (Apple / Android / Windows). Beyond the RouterOS factory stores, the package now bundles per-OS-version trust stores: 10 Android (AOSP base, 7.0→15), 24 Apple (iOS/macOS, including the |
|
| 0.4.0 Python latest 19 November 2026 | 0.4.0 — OS stores bundled (Apple / Android / Windows). Beyond the RouterOS factory stores, the package now bundles per-OS-version trust stores: 10 Android (AOSP base, 7.0→15), 24 Apple (iOS/macOS, including the |
|
Previous versions (8, superseded)
They remain downloadable, with their fingerprint and OpenTimestamps proof, for anyone who pinned a version in their project. Use the latest: GPG signatures are only on the current versions.
| Version | News | File |
|---|---|---|
| 0.3.0 PHP 19 November 2026 | 0.3.0 — localized messages (it/en), English by default. Like the Python variant: verdict messages and readable errors are localizable, default English. Switch with |
|
| 0.3.0 Python 19 November 2026 | 0.3.0 — localized messages (it/en), English by default. The human-readable verdict messages ( | |
| 0.2.0 PHP 18 November 2026 | 0.2.0 — RouterOS trust-store family (twin of the Python library). dojo/trust now ships RouterOS's factory trust stores, extracted from the |
|
| 0.2.0 Python 18 November 2026 | 0.2.0 — a new trust-store family: RouterOS. On top of the Apple/Android/Windows stores, dojo.trust now ships RouterOS's factory trust stores, extracted from the | |
| 0.1.1 PHP 18 November 2026 | 0.1.1 — security fix (twin of the Python library): path building now enforces a valid signature on every link, not just the last one. Namespace |
|
| 0.1.1 Python 18 November 2026 | 0.1.1 — security fix. Path building now requires a valid signature on every link of the chain, not just the last one: before, an invalid leaf ← intermediate signature could be reported as «trusted» when the intermediate ← root link was valid and the root was in the store. Added a regression test. No API change. | |
| 0.1.0 PHP 17 November 2026 | First public release (PHP). Namespace |
|
| 0.1.0 Python 17 November 2026 | First public release (Python). |
Each file has its SHA-256 fingerprint (pip and Composer check it automatically) and an OpenTimestamps proof registered on Bitcoin: anyone can verify that the file is the one published on that date. Signed files also carry the MikroTik Dojo GPG signature: it says who published them, OpenTimestamps says when. Key and instructions → Files are downloaded only if you are in the dojo.