x509-cert: v1 CRLs fail to decode (`TBSCertList.version` is OPTIONAL)

未关闭 适合新手
#2,544 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust

调研方向

从 x509-cert 的 CRL 模块中的 TbsCertList 入手,并将其版本字段与 TbsCertificate 中默认的版本进行比较;issue 指出,#2445 中先前的修复仍然适用。使用提供的 DER 复现数据,为缺少可选版本的 v1 CRL 添加往返测试。完成标准是 CRL 成功解码,且测试确认其 v1 表示形式。

由索引模型根据 Issue 内容生成。

描述

RFC 5280 §5.1 makes TBSCertList.version OPTIONAL (absent means v1), and the doc
comment on TbsCertList quotes that, but the field is a required Version. So every
v1 CRL fails:

use der::Decode;
use x509_cert::crl::CertificateList;
// v1 CRL: TBSCertList { sha256WithRSAEncryption, CN=test, thisUpdate 260101000000Z }
let crl = hex_literal::hex!(
    "3044" "302f" "300d06092a864886f70d01010b0500"
    "300f310d300b06035504030c0474657374" "170d3236303130313030303030305a"
    "300d06092a864886f70d01010b0500" "03020000");
CertificateList::<x509_cert::certificate::Rfc5280>::from_der(&crl).unwrap();
// Err: unexpected ASN.1 DER tag: expected INTEGER, got SEQUENCE

I hit this on real CRLs (two Certipost qualified-CA CRLs and several in the EU DSS
test data); OpenSSL reads them as "Version 1".

#2445 had the fix (#[asn1(default = "Default::default")], as TbsCertificate
already does for its version, with a round-trip test) but was closed without review.
Its diff still applies to master 715d277d and makes the CRL above decode. Could it be
reopened?

Versions: x509-cert 0.3.0 and master 715d277d.


Found and analyzed with AI assistance; the reproducers and results above were run on the versions stated.

主要语言
Rust
星标
347
派生
200
平均合并
15 小时 53 分钟
30 天内合并 PR
34

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RustCrypto/formats 的其他 Issue

查看 RustCrypto/formats 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。