On Thu, Oct 02, 2008 at 05:01:39PM -0500, Duwaine Robinson wrote: > Hi All, > > Is there a way to get GnuPG to complete encryption, if there is at least > one valid public key specified? I am trying automate my encryption > process, and I am hoping to be able to get away with not having to > specify error handling if one or more of my public keys does not exist > on the key ring. > > Any help is greatly appreciated. > Thank you
I'm not sure that what you're asking would be such a good idea; after all, it boils down to "let GnuPG report success even if it did not really do most of what you asked it to, with no real way of knowing which parts it did do and which parts it didn't" :) IMHO, an alternative would be to actually *ask* it which keys it does have before attempting the encryption; you can do something like: gpg --list-keys --with-colons 16194553 87E057BE 5DBFAB91 ...and then look for the lines beginning with "pub". If this is a Unixish environment, you could try filtering the output through awk -F: '$1 == "pub" && $12 ~ /E/ { print $5 }' ..or, of course, just use your programming language's text processing capabilities to extract the fifth field of the "pub" lines that contain an "E" character in the twelfth field :) All of them will identify valid public keys that GnuPG can actually encrypt to (the uppercase 'E' signifies exactly that, according to the doc/DETAILS file in the GnuPG source). Hope that helps :) G'luck, Peter -- Peter Pentchev [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 because I didn't think of a good beginning of it.
pgpO5L6ITb134.pgp
Description: PGP signature
_______________________________________________ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users