Error: "unusable public key"

Daniel Carrera daniel.carrera at
Tue Mar 21 16:55:02 CET 2006


I'm having another problem, again not in the FAQ:

sql.gz: encryption failed: unusable public key	

This happens when I try to encrypt a file with my public key.

This is what I'm trying to do: I want to backup a remote database 
regularly but I'd like to transmit it encrypted. So I want to run this 

sqldump ... | gzip -c | gpg ... -o backup.gpg

And then send the file backup.gpg to the client. This should be more 
than enogh for my needs.

So, I have gpg installed in the server. I imported my public key and I 
didn't see any errors. I went to the .gnupg directory and pubring.gpg is 
there and has a non-zero size. When I do a --list-keys on the server I 
see my public key there:

pub  1024D/42713DE9 2006-03-21 Daniel Carrera <daniel at>
sub  2048g/F2EB9C97 2006-03-21

I am trying to encrypt with the following command:

$ gpg -a --homedir /path/to/.gnupg -r daniel at --batch -o 
sql.asc -e sql.gz

Note: The '-e sql.gz' is for testing. I'll replace this by a pipe later.

When I run this command from a PHP script I get this error:

gpg: F2EB9C97: There is no indication that this key really belongs to 
the owner
gpg: sql.gz: encryption failed: unusable public key

I don't care about the first line. I don't plan to have a secret key on 
the server. But that first line does show that it located the correct 
public key. I don't understand how the public key can be unusable if it 
can identify the key ID correctly. What are the chances of that?

Could it be that I don't have a secret key? Why would a secret key be 
required if I just want to encrypt?

Could it be because I'm running this from a PHP script? Why would that 
make the key unusable?

I'm sure I'm not the first person who has thought of putting gpg on a 
server and using only a public key for encryption.


Any suggestions would be most appreciated.

    /\/_/   A life? Sounds great!
    \/_/    Do you know where I could download one?

More information about the Gnupg-users mailing list