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 841588 - symmetric encryption exits with non-zero exit code
Summary: symmetric encryption exits with non-zero exit code
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gnupg2
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: beta
: ---
Assignee: Tomas Mraz
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
: 884264 (view as bug list)
Depends On:
Blocks: 1110706 1191020
TreeView+ depends on / blocked
 
Reported: 2012-07-19 13:49 UTC by Ondrej Moriš
Modified: 2016-09-02 12:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-02 12:12:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ondrej Moriš 2012-07-19 13:49:24 UTC
Description of problem:

Symmetric encryption in GnuPG2 exits with non-zero exit code (2) even though ecryption itself proceeds correctly (text is encrypted well). Whenever one tries to encrypt a text using a trusted key, the side-effect is as follows:

gpg: can't connect to the agent: Invalid value passed to IPC
gpg: problem with the agent: No agent running

And exit code is 2.

Asymmetric encryption / decryption works fine (exit code 0).

Version-Release number of selected component (if applicable):

gnupg2-2.0.18-3.el7

How reproducible:

100%

Steps to Reproduce:
gpg: can't connect to the agent: Invalid value passed to IPC
gpg: problem with the agent: No agent running

1. Import some key into gnupg2 and make sure it is trusted
2. Encrypt some file, eg.:

   gpg2 --homedir ./.gnupg --batch --local-user bob-rsa-1024 --passphrase
     password --output binary.msg-rsa-1024-3DES --cipher-algo 3DES 
     --symmetric binary.msg

Actual results:

gpg: can't connect to the agent: Invalid value passed to IPC
gpg: problem with the agent: No agent running
[exit code 2]


Expected results:

[exit code 0]

Additional info:

Comment 1 Tomas Mraz 2012-07-19 14:05:09 UTC
Reported upstream as https://bugs.g10code.com/gnupg/issue1427

Comment 2 Tomas Mraz 2012-07-19 14:36:51 UTC
Actually not a bug.

The command line arguments do not make much sense. The proper line is:

gpg2 --batch --passphrase password --output binary.msg.encrypted --cipher-algo 3DES --symmetric binary.msg

The incorrect specification of --homedir is what causes the problem.

Comment 3 Ondrej Moriš 2012-07-24 06:20:22 UTC
(In reply to comment #2)
> Actually not a bug.
> 
> The command line arguments do nThis is confusing? ot make much sense. The proper line is:
> 
> gpg2 --batch --passphrase password --output binary.msg.encrypted
> --cipher-algo 3DES --symmetric binary.msg
> 
> The incorrect specification of --homedir is what causes the problem.

This is confusing - is "--homedir" prohibited in RHEL7? I do not want to use the default homedir on purpose. Moreover, this worked fine on RHEL6...

Comment 4 Tomas Mraz 2012-07-24 09:06:21 UTC
You're right that with RHEL-6 it worked fine. But there was failure running agent as well just unreported in the exit code.

I'll reopen the upstream bug report with more details.

What works for me:

1. start the gpg-agent with the homedir specified as absolute path:
gpg-agent --homedir $(pwd)/.gnupg --use-standard-socket --daemon
2. run gpg2 as you need
gpg2 --homedir $(pwd)/.gnupg --batch --passphrase password --output binary.msg.encrypted --cipher-algo 3DES --symmetric binary.msg

So there are 2 problems:
1. homedir must be absolute path not relative
2. homedir is not forwarded to the gpg-agent when it is started up by gpg2

Comment 5 Ondrej Moriš 2012-07-24 11:41:25 UTC
Thanks a lot for this explanation, I have corrected my tests and they work now. Nevertheless, it would be nice to have both points you mentioned corrected even though they actually might not be "real" bugs. Let's see what the upstream will tell us.

Comment 6 Tomas Mraz 2012-07-24 11:53:43 UTC
Well at least the item 2. from above is a real bug. The item 1. might be considered as missing feature.

Comment 9 Tomas Mraz 2012-11-12 13:39:14 UTC
Unfortunately there is no reaction from upstream yet.

Comment 10 Tomas Mraz 2012-12-05 21:59:50 UTC
*** Bug 884264 has been marked as a duplicate of this bug. ***

Comment 11 Tomas Mraz 2013-08-09 13:45:42 UTC
Still no reaction from upstream https://bugs.g10code.com/gnupg/issue1427


Note You need to log in before you can comment on or make changes to this bug.