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

x509/validation: make algo sets non-optional #9821

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Changes from all commits
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
38 changes: 12 additions & 26 deletions src/rust/cryptography-x509-validation/src/policy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,11 @@ pub struct Policy<'a, B: CryptoOps> {

/// The set of permitted public key algorithms, identified by their
/// algorithm identifiers.
///
/// If not `None`, all certificates validated by this policy MUST
/// have a public key algorithm in this set.
///
/// If `None`, all public key algorithms are permitted.
pub permitted_public_key_algorithms: Option<HashSet<AlgorithmIdentifier<'a>>>,
pub permitted_public_key_algorithms: HashSet<AlgorithmIdentifier<'a>>,

/// The set of permitted signature algorithms, identified by their
/// algorithm identifiers.
///
/// If not `None`, all certificates validated by this policy MUST
/// have a signature algorithm in this set.
///
/// If `None`, all signature algorithms are permitted.
pub permitted_signature_algorithms: Option<HashSet<AlgorithmIdentifier<'a>>>,
pub permitted_signature_algorithms: HashSet<AlgorithmIdentifier<'a>>,

pub critical_ca_extensions: HashSet<ObjectIdentifier>,
pub critical_ee_extensions: HashSet<ObjectIdentifier>,
Expand All @@ -247,20 +237,16 @@ impl<'a, B: CryptoOps> Policy<'a, B> {
subject,
validation_time: time,
extended_key_usage: EKU_SERVER_AUTH_OID.clone(),
permitted_public_key_algorithms: Some(
WEBPKI_PERMITTED_SPKI_ALGORITHMS
.clone()
.into_iter()
.cloned()
.collect(),
),
permitted_signature_algorithms: Some(
WEBPKI_PERMITTED_SIGNATURE_ALGORITHMS
.clone()
.into_iter()
.cloned()
.collect(),
),
permitted_public_key_algorithms: WEBPKI_PERMITTED_SPKI_ALGORITHMS
.clone()
.into_iter()
.cloned()
.collect(),
permitted_signature_algorithms: WEBPKI_PERMITTED_SIGNATURE_ALGORITHMS
.clone()
.into_iter()
.cloned()
.collect(),
critical_ca_extensions: RFC5280_CRITICAL_CA_EXTENSIONS.iter().cloned().collect(),
critical_ee_extensions: RFC5280_CRITICAL_EE_EXTENSIONS.iter().cloned().collect(),
}
Expand Down
Loading