Important edit:

The things almost work right know (I had put to open as a new session on system setings and reboot the computer).

When I tried to sign and encript a file with Kleopatra the pinentry appeared, but, disappeared before I input anything.

So, I think solving this, everything will work.

Appreciate help, thx.

The Question

I'm problem with signing messages on Kleopatra and KMail.

When I try sign files/e-mails I got a error: bad passphrase. Appreciate helps, thanks.

My sistem is:

Ubuntu 12.04 LTS \n \l

Linux Tevatron 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:22 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux




Statup timing: 0 ms elapsed: Command line args created

Qt: 4.8.1

Plataforma de desenvolvimento KDE: 4.8.2 (4.8.2)

Kleopatra: 2.1.1


Qt: 4.8.1

Plataforma de desenvolvimento KDE: 4.8.2 (4.8.2)

KMail: 4.8.2


gpg-agent (GnuPG) 2.0.17

libgcrypt 1.5.0

Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.


Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg

Algoritmos suportados:

Chave pública: RSA, RSA-E, RSA-S, ELG-E, DSA


Dispersão (Hash): MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224

Compressão: não comprimido, ZIP, ZLIB, BZIP2

I tried create a file in ~/.kde/env named gpg-agent.sh and did it as executable. The content is:


eval $(gpg-agent --daemon --pinentry-program /usr/bin/pinentry-qt4)

Created a file in ~/.kde/shutdown name gpg-agent.sh too and did it as executable too. The content is:


# the second field of the GPG_AGENT_INFO variable is the

# process ID of the gpg-agent active in the current session

# so we'll just kill that, rather than all of them

[ -n "${GPG_AGENT_INFO}" ] && kill $(echo "${GPG_AGENT_INFO}" | cut -d ':' -f 2)

Created the file ~/.gnupg/gpg.conf with the content:

# GnuPG config file created by KGpg

default-key <My key ID>

keyserver-options auto-key-retrieve


where <My key ID> is the ID of my key and I ommited.

I have pinentry-qt4 installed.

Appreciate the helps, thx.

  • I tried this solution, but didn't worked. And I post a bug on launchpad recently too. – GarouDan Apr 29 '12 at 14:14
  • @Matthew, I could say, this bug, and another things I had collected let me found the solution and your post did that I try again. Thx. – GarouDan Apr 29 '12 at 14:42
  • 2
    When you ask for help on a site like this, it helps to put the end goal you desire first and foremost, followed by the precise problems you are encountering. This question isn't getting attention because it reads like jumping into a story midway through. It starts with an edit, and then a section which claims to be the question but which contains no questions at all. If one gets past that and hits a long list of software versions, it doesn't seem worth the effort to try and figure it all out. The solution here isn't to ask more; instead ask in a way that will help your potential answerers. – mattdm Apr 29 '12 at 14:51
  • @mattdm, I disagree with you. I know my problem when what I did to solve it. I didnt came here with nothing in hands, I tried a lot solve the problem but I hadnt sucess. So, I decided ask here, and put all useful information that I collected for the people who will help me not ask if I tried someting or no. The edit is because I almost solved. And the rest of the question points what I did, so, both, at least for me, is necessary. – GarouDan Apr 30 '12 at 15:41
  • That's fine. I'm not trying to argue with you, just to explain why the question got downvotes instead of the positive attention you're looking for. It's not that the background information you provide isn't potentially useful, it's that it isn't presented in a way that is conducive to getting help. You can disagree with that if you like, but I think the results speak for themselves. – mattdm Apr 30 '12 at 15:46

Well, don't have certain what I did at all, but maybe it works for another people.


default-key  `<My Key ID>`
keyserver-options auto-key-retrieve


pinentry-program /usr/bin/pinentry-qt4
display :0.0
max-cache-ttl 86400
debug-level expert
default-cache-ttl 10


#eval $(gpg-agent --daemon --pinentry-program /usr/bin/pinentry-qt4)
eval `GTK_IM_MODULE="" QT_IM_MODULE="" XMODIFIERS="" gpg-agent --daemon`


[ -n "${GPG_AGENT_INFO}" ] &&
kill $(echo "${GPG_AGENT_INFO}" | cut -d ':' -f 2)

Shutdown the system and started it again.

Then entry in terminal echo "test" | gpg -ase -r 0x791E0AAA | gpg the prompt appeared and waited my answer^^.

Then I tried sign messages using KMail and Kleopatra and worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.