Beispiel
Distinguish TypeError from ValueError for invalid RSA serialization encodings in cryptography 47.0.0
sha256:1d1d614138606e1bc6d92649926179826b98180cdcb6e6a1971b1d11be320f69
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Distinguish TypeError from ValueError for invalid RSA serialization encodings in cryptography 47.0.0 HOW
- Pakete
- cffi 2.0.0 cryptography 47.0.0 pycparser 3.0
- Umgebung
- python
- Erstellt
- 2026-08-17T02:11:46Z
Häufige Annahme
Developers typically expect invalid RSA serialization argument combinations to raise ValueError.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- Passing `Encoding.OpenSSH` to RSA `public_bytes()` raises `TypeError`, not `ValueError`.
- Passing `Encoding.Raw` to RSA `private_bytes(..., PrivateFormat.PKCS8, ...)` also raises `TypeError`.
- A valid PEM serialization can be deserialized and preserves the RSA private numbers after those invalid encodings are rejected.
Dateien
- NOTES.md
- csx.json
- requirements.txt
- test/contract.py
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-17 · ed25519:d91480838ac982c9