[Bug 2024496] [NEW] gpg: ecdh failed in gcry_cipher_decrypt: Checksum error

Jan Graichen 2024496 at bugs.launchpad.net
Tue Jun 20 20:42:31 UTC 2023


Public bug reported:

With "throw-keyids" enabled, encrypted files do not contain the
recipient key IDs. When decrypting, gpg tries all available secret keys
until a valid key is found. When there are multiple ECDH keys present,
if the *first* key does not match, and a second is tried, all following
tries will report an error. gpg exits with and error code, but the
message actually _is_ decrypted and printed:


    root at immortal-colt:~# gpg --decrypt secret.gpg 
    gpg: error getting version from 'scdaemon': No SmartCard daemon
    gpg: anonymous recipient; trying secret key 842F5314C2E18EFC ...
    gpg: ecdh failed in gcry_cipher_decrypt: Checksum error
    gpg: anonymous recipient; trying secret key B525EE73BB763C0A ...
    gpg: okay, we are the anonymous recipient.
    gpg: encrypted with ECDH key, ID 0000000000000000
    Hello World

Steps to reproduce:

1. Generate two or more keys:

    root at immortal-colt:~# gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key 'john at example.org'
    [..]
    root at immortal-colt:~# gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key 'jane at example.org'
    [..]

2. Enable throw-keyids:

    root at immortal-colt:~# echo throw-keyids >> ~/.gnupg/gpg.conf

3. Encrypt a secret message:

    root at immortal-colt:~#  echo 'Hello World' | gpg --encrypt -r
jane at example.org > secret.gpg

4. Try to decrypt:

    root at immortal-colt:~# gpg --decrypt secret.gpg 
    gpg: error getting version from 'scdaemon': No SmartCard daemon
    gpg: anonymous recipient; trying secret key 842F5314C2E18EFC ...
    gpg: ecdh failed in gcry_cipher_decrypt: Checksum error
    gpg: anonymous recipient; trying secret key B525EE73BB763C0A ...
    gpg: okay, we are the anonymous recipient.
    gpg: encrypted with ECDH key, ID 0000000000000000
    Hello World

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: gpg 2.2.27-3ubuntu2.1
ProcVersionSignature: Ubuntu 6.1.0-1014.14-oem 6.1.29
Uname: Linux 6.1.0-1014-oem x86_64
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Tue Jun 20 20:41:33 2023
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gnupg2
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: gnupg2 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug jammy uec-images

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gnupg2 in Ubuntu.
https://bugs.launchpad.net/bugs/2024496

Title:
  gpg: ecdh failed in gcry_cipher_decrypt: Checksum error

Status in gnupg2 package in Ubuntu:
  New

Bug description:
  With "throw-keyids" enabled, encrypted files do not contain the
  recipient key IDs. When decrypting, gpg tries all available secret
  keys until a valid key is found. When there are multiple ECDH keys
  present, if the *first* key does not match, and a second is tried, all
  following tries will report an error. gpg exits with and error code,
  but the message actually _is_ decrypted and printed:

  
      root at immortal-colt:~# gpg --decrypt secret.gpg 
      gpg: error getting version from 'scdaemon': No SmartCard daemon
      gpg: anonymous recipient; trying secret key 842F5314C2E18EFC ...
      gpg: ecdh failed in gcry_cipher_decrypt: Checksum error
      gpg: anonymous recipient; trying secret key B525EE73BB763C0A ...
      gpg: okay, we are the anonymous recipient.
      gpg: encrypted with ECDH key, ID 0000000000000000
      Hello World

  Steps to reproduce:

  1. Generate two or more keys:

      root at immortal-colt:~# gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key 'john at example.org'
      [..]
      root at immortal-colt:~# gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key 'jane at example.org'
      [..]

  2. Enable throw-keyids:

      root at immortal-colt:~# echo throw-keyids >> ~/.gnupg/gpg.conf

  3. Encrypt a secret message:

      root at immortal-colt:~#  echo 'Hello World' | gpg --encrypt -r
  jane at example.org > secret.gpg

  4. Try to decrypt:

      root at immortal-colt:~# gpg --decrypt secret.gpg 
      gpg: error getting version from 'scdaemon': No SmartCard daemon
      gpg: anonymous recipient; trying secret key 842F5314C2E18EFC ...
      gpg: ecdh failed in gcry_cipher_decrypt: Checksum error
      gpg: anonymous recipient; trying secret key B525EE73BB763C0A ...
      gpg: okay, we are the anonymous recipient.
      gpg: encrypted with ECDH key, ID 0000000000000000
      Hello World

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: gpg 2.2.27-3ubuntu2.1
  ProcVersionSignature: Ubuntu 6.1.0-1014.14-oem 6.1.29
  Uname: Linux 6.1.0-1014-oem x86_64
  ApportVersion: 2.20.11-0ubuntu82.5
  Architecture: amd64
  CasperMD5CheckResult: unknown
  Date: Tue Jun 20 20:41:33 2023
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: gnupg2
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnupg2/+bug/2024496/+subscriptions




More information about the foundations-bugs mailing list