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

Allow verifying signatures without gpg #214

Closed
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
6 changes: 0 additions & 6 deletions securesystemslib/gpg/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,13 @@ def verify_signature(signature_object, pubkey_info, content):
securesystemslib.gpg.exceptions.KeyExpirationError:
if the passed public key has expired

securesystemslib.exceptions.UnsupportedLibraryError:
If the gpg command is not available

<Side Effects>
None.

<Returns>
True if signature verification passes, False otherwise.

"""
if not HAVE_GPG: # pragma: no cover
raise securesystemslib.exceptions.UnsupportedLibraryError(NO_GPG_MSG)

securesystemslib.formats.GPG_PUBKEY_SCHEMA.check_match(pubkey_info)
securesystemslib.formats.GPG_SIGNATURE_SCHEMA.check_match(signature_object)

Expand Down
3 changes: 0 additions & 3 deletions tests/check_public_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ def test_gpg_cmds(self):
with self.assertRaises(securesystemslib.exceptions.UnsupportedLibraryError):
securesystemslib.gpg.functions.create_signature('bar')

with self.assertRaises(securesystemslib.exceptions.UnsupportedLibraryError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to say that we do not raise this exception (regression test)?

Copy link
Contributor Author

@FlorianVeaux FlorianVeaux Feb 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT this would require running the securesystemslib.gpg.functions.verify_signature(None, 'f00', 'bar') function with correctly formatted arguments. I'm not really sure how that could be added but this is a great idea.

securesystemslib.gpg.functions.verify_signature(None, 'f00', 'bar')

with self.assertRaises(securesystemslib.exceptions.UnsupportedLibraryError):
securesystemslib.gpg.functions.export_pubkey('f00')

Expand Down