Skip to content

Relax root CA AKI field checks #11462

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

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Changelog
not be empty.
* Added support for timestamp extraction to the
:class:`~cryptography.fernet.MultiFernet` class.
* Relax the Authority Key Identifier requirements on root CA certificates
during X.509 verification to allow fields permitted by :rfc:`5280` but
forbidden by the CA/Browser BRs.

.. _v43-0-0:

Expand Down
19 changes: 7 additions & 12 deletions src/rust/cryptography-x509-verification/src/policy/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,13 @@ pub(crate) mod ca {
));
}

// authorityCertIssuer and authorityCertSerialNumber MUST NOT be present.
if aki.authority_cert_issuer.is_some() {
return Err(ValidationError::Other(
"authorityKeyIdentifier must not contain authorityCertIssuer".to_string(),
));
}

if aki.authority_cert_serial_number.is_some() {
return Err(ValidationError::Other(
"authorityKeyIdentifier must not contain authorityCertSerialNumber".to_string(),
));
}
// NOTE: CABF 7.1.2.1.3 says that Root CAs MUST NOT
// have authorityCertIdentifier or authorityCertSerialNumber,
// but these are present in practice in trust program bundles
// due to older roots that have been grandfathered in.
// Other validators are permissive of these being present,
// so we don't check for them.
// See #11461 for more information.
}

Ok(())
Expand Down
6 changes: 6 additions & 0 deletions tests/x509/verification/test_limbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
# forbidden under CABF. This is consistent with what
# Go's crypto/x509 and Rust's webpki crate do.
"webpki::aki::root-with-aki-ski-mismatch",
# We allow root CAs where the AKI contains fields other than keyIdentifier,
# which is technically forbidden under CABF. No other implementations
# enforce this requirement.
"webpki::aki::root-with-aki-authoritycertissuer",
"webpki::aki::root-with-aki-authoritycertserialnumber",
"webpki::aki::root-with-aki-all-fields",
# We allow RSA keys that aren't divisible by 8, which is technically
# forbidden under CABF. No other implementation checks this either.
"webpki::forbidden-rsa-not-divisable-by-8-in-root",
Expand Down