Skip to content

Commit

Permalink
crl: use Extensions to write DER
Browse files Browse the repository at this point in the history
Now that all of the CRL entry extensions have been migrated to
`Extensions` we can let that type write the `SEQUENCE` and extension
values.

There are no longer any callers to `Extensions.iter()` so we remove that
fn.
  • Loading branch information
cpu committed Sep 10, 2023
1 parent 7320b73 commit f9040c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
15 changes: 3 additions & 12 deletions src/crl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,9 @@ impl RevokedCertParams {
// optional for conforming CRL issuers and applications. However, CRL
// issuers SHOULD include reason codes (Section 5.3.1) and invalidity
// dates (Section 5.3.2) whenever this information is available.
let has_reason_code =
matches!(self.reason_code, Some(reason) if reason != RevocationReason::Unspecified);
let has_invalidity_date = self.invalidity_date.is_some();
if has_reason_code || has_invalidity_date {
writer.next().write_sequence(|writer| {
// TODO: have the Extensions type write the outer sequence and each
// contained extension once we've ported each of the below
// extensions to self.extensions().
for ext in self.extensions().iter() {
ext.write_der(writer.next());
}
});
let extensions = self.extensions();
if !extensions.is_empty() {
extensions.write_der(writer.next());
}
})
}
Expand Down
4 changes: 0 additions & 4 deletions src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ impl Extensions {
pub(crate) fn is_empty(&self) -> bool {
self.0.is_empty()
}

pub(crate) fn iter(self: &Self) -> impl Iterator<Item = &Extension> {
self.0.iter()
}
}

/// An X.509v3 authority key identifier extension according to
Expand Down

0 comments on commit f9040c6

Please sign in to comment.