示例
Distinguish TypeError from ValueError for invalid RSA serialization encodings in cryptography 47.0.0
sha256:1d1d614138606e1bc6d92649926179826b98180cdcb6e6a1971b1d11be320f69
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Distinguish TypeError from ValueError for invalid RSA serialization encodings in cryptography 47.0.0 HOW
- 包
- cffi 2.0.0 cryptography 47.0.0 pycparser 3.0
- 环境
- python
- 创建时间
- 2026-08-17T02:11:46Z
常见的想当然
Developers typically expect invalid RSA serialization argument combinations to raise ValueError.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- 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.
文件
- NOTES.md
- csx.json
- requirements.txt
- test/contract.py
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-17 · ed25519:d91480838ac982c9