Skip to content

Commit

Permalink
fix(signature): return error on KeyId missmatch
Browse files Browse the repository at this point in the history
Fixes #232
  • Loading branch information
dignifiedquire committed Mar 30, 2023
1 parent b88fe25 commit 02bef50
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/packet/signature/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,11 @@ impl Signature {
{
if let Some(issuer) = self.issuer() {
if &key.key_id() != issuer {
warn!(
bail!(
"validating signature with a non matching Key ID {:?} != {:?}",
&key.key_id(),
issuer
);
// We can't validate this against this key, as there is a missmatch.
return Ok(());
}
}

Expand Down Expand Up @@ -121,12 +119,11 @@ impl Signature {

if let Some(issuer) = self.issuer() {
if &key_id != issuer {
warn!(
bail!(
"validating certificate with a non matching Key ID {:?} != {:?}",
key_id, issuer
key_id,
issuer
);
// We can't validate this against this key, as there is a missmatch.
return Ok(());
}
}

Expand Down Expand Up @@ -194,12 +191,11 @@ impl Signature {
let key_id = signing_key.key_id();
if let Some(issuer) = self.issuer() {
if &key_id != issuer {
// TODO: should this be an actual error?
warn!(
bail!(
"validating key binding with a non matching Key ID {:?} != {:?}",
&key_id, issuer
&key_id,
issuer
);
return Ok(());
}
}

Expand Down Expand Up @@ -240,12 +236,11 @@ impl Signature {
let key_id = key.key_id();
if let Some(issuer) = self.issuer() {
if &key_id != issuer {
warn!(
bail!(
"validating key (revocation) with a non matching Key ID {:?} != {:?}",
&key_id, issuer
&key_id,
issuer
);
// We can't validate this against this key, as there is a missmatch.
return Ok(());
}
}

Expand Down

0 comments on commit 02bef50

Please sign in to comment.