diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-05-21 17:06:21 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-05-21 17:06:21 -0400 |
commit | ba86ef91f400678b8aed191ad8787a8479e74162 (patch) | |
tree | 39df5d984b6f9c1e9e8bf442909ddf1692b589a9 | |
parent | bdd1011f265b3c0da0ff32619c88998cbc4fb262 (diff) | |
download | patatt-ba86ef91f400678b8aed191ad8787a8479e74162.tar.gz |
Return RES_NOKEY when openpgp key is not found
When keysrc returns as "None" means that the check failed even using the
default keyring. In this case, return RES_NOKEY instead of RES_BADSIG.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | patatt/__init__.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/patatt/__init__.py b/patatt/__init__.py index 7226413..1101d7f 100644 --- a/patatt/__init__.py +++ b/patatt/__init__.py @@ -933,6 +933,11 @@ def validate_message(msgdata: bytes, sources: list, trim_body: bool = False) -> signtime = pm.validate(i, pkey, trim_body=trim_body) attestations.append((RES_VALID, i, signtime, keysrc, algo, errors)) except ValidationError: + if keysrc is None: + # Not in default keyring + errors.append('%s/%s no matching openpgp key found' % (i, s)) + attestations.append((RES_NOKEY, i, t, None, algo, errors)) + continue errors.append('failed to validate using %s' % keysrc) attestations.append((RES_BADSIG, i, t, keysrc, algo, errors)) |