Skip to content

Commit

Permalink
Allow "required if present" EKUs
Browse files Browse the repository at this point in the history
  • Loading branch information
jasperpatterson committed Feb 7, 2024
1 parent 4689881 commit 73af928
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/verify_cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,13 @@ impl KeyUsage {
inner: ExtendedKeyUsage::Required(KeyPurposeId::new(oid)),
}
}

/// Construct a new [`KeyUsage`] requiring a certificate to support the specified OID, if the certificate has EKUs.
pub const fn required_if_present(oid: &'static [u8]) -> Self {
Self {
inner: ExtendedKeyUsage::RequiredIfPresent(KeyPurposeId::new(oid)),
}
}

Check warning on line 475 in src/verify_cert.rs

View check run for this annotation

Codecov / codecov/patch

src/verify_cert.rs#L471-L475

Added lines #L471 - L475 were not covered by tests
}

/// Extended Key Usage (EKU) of a certificate.
Expand Down

0 comments on commit 73af928

Please sign in to comment.