Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1233182

Summary: RSA-{E,S} public keys cannot be imported
Product: Red Hat Enterprise Linux 7 Reporter: Marcel Kolaja <mkolaja>
Component: gnupg2Assignee: Tomas Mraz <tmraz>
Status: CLOSED ERRATA QA Contact: Stefan Kremen <skremen>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dmoessne, hkario, lmiksik
Target Milestone: rcKeywords: FutureFeature, Patch, Reproducer
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: gnupg2-2.0.22-4.el7 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 1405361 (view as bug list) Environment:
Last Closed: 2016-11-04 01:30:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1203710, 1296594, 1313485    
Attachments:
Description Flags
proposed patch for RHEL 7.1
none
proposed patch for RHEL 7.1 tmraz: review+

Description Marcel Kolaja 2015-06-18 11:45:38 UTC
Description of problem:
RSA-{E,S} public keys cannot be imported using --import. gpg throws error "no valid user IDs". Using -v gpg says: "unsupported public key algorithm". --list-packets can't handle it either.

Version-Release number of selected component (if applicable):
2.0.22-3.el7

How reproducible:
always

Steps to Reproduce:
1. try to import an RSA-E or RSA-S public key

Actual results:
the key does not get imported

Expected results:
the key gets imported

Additional info:
libgcrypt in RHEL 7 does not support RSA-{E,S}. This has been addressed later in libgcrypt's upstream commit 773e23698218755e9172d2507031a8263c47cc0b. Before that, the issue was addressed in gnupg in upstream commit 30ec869b8c63f1edcc58110ed20b83b0e77248f8.

Comment 3 Marcel Kolaja 2015-06-18 12:00:00 UTC
Using --allow-non-selfsigned-uid works around the issue.

Comment 4 Tomas Mraz 2015-06-18 12:05:53 UTC
You're referencing commits from different upstream branches of gnupg and libgcrypt and they probably would not be easily backportable.

Comment 6 Marcel Kolaja 2015-06-18 12:11:36 UTC
Created attachment 1040457 [details]
proposed patch for RHEL 7.1

The attached patch solves the issue.

Comment 7 Tomas Mraz 2015-06-18 12:44:50 UTC
The patch needs some work - you're duplicating the mapping in the map_pk_openpgp_to_gcry and the individual callers, and there are other places where the map is not called and which you're not patching - such as pubkey_nbits().

This is upstream patch from the 2.0 branch, which on the other hand does not patch the map_pk_openpgp_to_gcry() so it might be incomplete.

http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blobdiff;f=g10/misc.c;h=82a13aa9a4e41897aae4b4fe8138504c4cf7cf03;hp=9b7c8ab4e6b75d766d729b4eb87fb23264897f8d;hb=efecbb7a3f0c32ea40db3a050c89f288550b05c2;hpb=dc941bdaec29d2fc60e2bddf85e11568367f531c

Comment 8 Marcel Kolaja 2015-06-19 07:24:09 UTC
(In reply to Tomas Mraz from comment #7)
> The patch needs some work - you're duplicating the mapping in the
> map_pk_openpgp_to_gcry and the individual callers, and there are other
> places where the map is not called and which you're not patching - such as
> pubkey_nbits().

You seem to be right. Thanks for pointing that out! I have missed that. The reason is that I first followed the approach in the upstream commit 30ec869b8c63f1edcc58110ed20b83b0e77248f8. That made --list-packets working.

--import, however, did not work yet, so I have studied where it needs fixing yet and looking at where it keeps failing and what functions are called from there, I have concluded that map_pk_openpgp_to_gcry() is the best place to perform the mapping. While I confirmed that --import works after introducing the mapping in map_pk_openpgp_to_gcry(), I have not checked whether the previously added mappings in pubkey_get_n*() are still necessary. And they do not seem to be necessary, as all pubkey_get_n*() functions call map_pk_openpgp_to_gcry() right after the mapping I have added. I'll fix the patch later today.

Comment 9 Marcel Kolaja 2015-06-19 12:36:55 UTC
Created attachment 1040931 [details]
proposed patch for RHEL 7.1

This patch addresses the issues mentioned in comment #7.

Comment 10 Tomas Mraz 2015-06-19 13:06:18 UTC
Comment on attachment 1040931 [details]
proposed patch for RHEL 7.1

Yes, this looks OK.

Comment 16 errata-xmlrpc 2016-11-04 01:30:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2238.html