Skip to content

Commit

Permalink
Correctly encode a CRL with empty revokedCertificates.
Browse files Browse the repository at this point in the history
  • Loading branch information
partim committed Jun 11, 2024
1 parent 367fea7 commit 175e449
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/repository/crl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,9 @@ impl RevokedCertificates {

/// Returns a value encoder for a reference to the value.
pub fn encode_ref(&self) -> impl encode::Values + '_ {
encode::sequence(&self.0)
(!self.0.is_empty()).then(|| {
encode::sequence(&self.0)
})
}

/// Create a value from an iterator over CRL entries.
Expand Down Expand Up @@ -832,6 +834,18 @@ mod signer_test {
);
let crl = crl.into_crl(&signer, &key).unwrap().to_captured();
let _crl = Crl::decode(crl.as_slice()).unwrap();

let crl = TbsCertList::new(
Default::default(),
pubkey.to_subject_name(),
Time::now(),
Time::tomorrow(),
vec![],
pubkey.key_identifier(),
12u64.into()
);
let crl = crl.into_crl(&signer, &key).unwrap().to_captured();
let _crl = Crl::decode(crl.as_slice()).unwrap();
}
}

0 comments on commit 175e449

Please sign in to comment.