localzet-jose
Educational/reference JOSE library in Rust: JWS, JWE, JWK and JWT. This is an unfinished continuation of JWT and LWT, grouped by localzet-tokens. Полная документация на русском.
Cryptographic primitives come from RustCrypto crates; the library implements JOSE framing, signing input, key/claims models and explicit verification policies. It is not an audited replacement for a mature production library.
Implemented scope
Заголовок раздела «Implemented scope»- JWS compact serialization, detached payload, RFC 7797
b64=false, critical-header handling and explicit algorithm allow-lists. - HMAC SHA-256/384/512; RSA PKCS#1 v1.5/PSS; ECDSA P-256/P-384/P-521/secp256k1; Ed25519. Unsecured
nonerequires a separate explicit opt-in. - JWE compact framing with
diror RSA-OAEP variants and A128GCM/A256GCM. Decryption requires explicitalg/encallow-lists. - JWK/JWK Set models, key ID selection, symmetric key extraction and RFC 7638 thumbprints.
- Typed registered JWT claims with preserved additional claims. Cryptographic verification and application claim validation are separate operations.
- Registry snapshots preserve unknown future identifiers. An identifier in the registry does not imply a working cryptographic provider.
JSON serialization has data models, rather than complete signing/decryption APIs. RSA1_5, Ed448, ML-DSA, AES-KW, ECDH-ES, PBES2, CBC-HMAC and A192GCM remain unsupported cryptographic operations.
cargo test --locked --all-targetscargo run --locked --example hs256let policy = VerificationPolicy::new().allow_algorithm("Ed25519");let verified = jwt::verify(token, &key, &policy, &claims_validation)?;Caller policy, provider algorithm and key type must agree. Never derive trust solely from the token’s alg. Review SECURITY.md before integration.
Toolchain and status
Заголовок раздела «Toolchain and status»Rust 1.85 is required by locked dependencies; the old 1.75 declaration was inaccurate. Local tests were run on Rust 1.98.1. CI checks 1.85 and 1.98.1. CI rejects Clippy warnings in the library. Existing test/example style warnings remain outside that gate.
The current tests cover compact and detached HMAC signing, JWT round trips and explicit rejection of unsecured signatures without opt-in. They do not establish interoperability of every listed provider.
Next work
Заголовок раздела «Next work»- RFC 7520 vectors, negative algorithm/key confusion tests and parser fuzzing.
- Complete JSON serialization APIs and JWK-to-provider key import.
- Add AES-KW/ECDH-ES/PBES2 only with interoperability coverage.
- Review key lifetime, secret storage and errors before production use.
License: AGPL-3.0-or-later.
Исходный код · AGPL-3.0