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

Pass VerificationCertificate slightly deeper in the callstack #11865

Merged
merged 1 commit into from
Oct 30, 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
2 changes: 1 addition & 1 deletion src/rust/cryptography-x509-verification/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ impl<'a, 'chain: 'a, B: CryptoOps> ChainBuilder<'a, 'chain, B> {
let issuer_extensions = issuing_cert_candidate.certificate().extensions()?;
match self.policy.valid_issuer(
issuing_cert_candidate,
working_cert.certificate(),
working_cert,
current_depth,
&issuer_extensions,
) {
Expand Down
10 changes: 5 additions & 5 deletions src/rust/cryptography-x509-verification/src/policy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ impl<'a, B: CryptoOps> Policy<'a, B> {
pub(crate) fn valid_issuer(
&self,
issuer: &VerificationCertificate<'_, B>,
child: &Certificate<'_>,
child: &VerificationCertificate<'_, B>,
current_depth: u8,
issuer_extensions: &Extensions<'_>,
) -> Result<(), ValidationError> {
Expand All @@ -520,7 +520,7 @@ impl<'a, B: CryptoOps> Policy<'a, B> {
{
return Err(ValidationError::Other(format!(
"Forbidden public key algorithm: {:?}",
&child.tbs_cert.spki.algorithm
&issuer.certificate().tbs_cert.spki.algorithm
)));
}

Expand All @@ -532,11 +532,11 @@ impl<'a, B: CryptoOps> Policy<'a, B> {
// position).
if !self
.permitted_signature_algorithms
.contains(&child.signature_alg)
.contains(&child.certificate().signature_alg)
{
return Err(ValidationError::Other(format!(
"Forbidden signature algorithm: {:?}",
&child.signature_alg
&child.certificate().signature_alg
)));
}

Expand All @@ -559,7 +559,7 @@ impl<'a, B: CryptoOps> Policy<'a, B> {
let pk = issuer
.public_key(&self.ops)
.map_err(|_| ValidationError::Other("issuer has malformed public key".to_string()))?;
if self.ops.verify_signed_by(child, pk).is_err() {
if self.ops.verify_signed_by(child.certificate(), pk).is_err() {
return Err(ValidationError::Other(
"signature does not match".to_string(),
));
Expand Down