Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow "required if present" EKUs #229

Merged
merged 4 commits into from
Feb 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 {
jasperpatterson marked this conversation as resolved.
Show resolved Hide resolved
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