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

オープン 初心者向け
#2,544 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
34

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RustCrypto/formats のほかの issue

RustCrypto/formats の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。