-
Notifications
You must be signed in to change notification settings - Fork 143
Replace custom OpenPGP packet parsing with pysequoia #7433
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| pytest<10 | ||
| pytest-custom_exit_code | ||
| pytest-xdist | ||
| python-gnupg | ||
| pysequoia | ||
| proxy.py~=2.4.10 | ||
| trustme~=1.2.1 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| import os | ||
|
|
||
| import gnupg | ||
| import subprocess | ||
|
|
||
| from pathlib import Path | ||
|
|
||
|
|
@@ -72,13 +71,33 @@ def handle(self, *args, **options): | |
| ) | ||
| ) | ||
|
|
||
| gpg = gnupg.GPG(gnupghome=options["gnupghome"], keyring=options["keyring"]) | ||
| gpg_cmd = ["gpg"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't we need this to use sequoia too in order to handle all the new algorithms and keyfile formats?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even sequoia doesn't "support" them yet because the IETF draft isn't final yet. You have to install a special build to get them. So it's out of scope for now. At some point, probably, but even then it might be a host-dependent thing. |
||
| if options["gnupghome"]: | ||
| gpg_cmd += ["--homedir", options["gnupghome"]] | ||
| if options["keyring"]: | ||
| gpg_cmd += ["--keyring", options["keyring"]] | ||
|
|
||
| key_list = gpg.list_keys(keys=[key_id]) | ||
| if not len(key_list) == 1: | ||
| raise CommandError(_("There are {} keys matching the key id.").format(len(key_list))) | ||
| fingerprint = key_list[0]["fingerprint"] | ||
| public_key = gpg.export_keys(key_id) | ||
| result = subprocess.run( | ||
| gpg_cmd + ["--with-colons", "--fingerprint", key_id], | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
| if result.returncode != 0: | ||
| raise CommandError(result.stderr.strip()) | ||
|
|
||
| fpr_lines = [line for line in result.stdout.splitlines() if line.startswith("fpr:")] | ||
| if len(fpr_lines) != 1: | ||
| raise CommandError(_("There are {} keys matching the key id.").format(len(fpr_lines))) | ||
| fingerprint = fpr_lines[0].split(":")[9] | ||
|
|
||
| result = subprocess.run( | ||
| gpg_cmd + ["--armor", "--export", key_id], | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
| if result.returncode != 0: | ||
| raise CommandError(result.stderr.strip()) | ||
| public_key = result.stdout | ||
|
|
||
| try: | ||
| script_path = Path(script).resolve(strict=True) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we even repeating the dependency here? (It's not optional in pyproject, right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functional tests can run outside the environment where Pulp is installed.