This article is from the PGP FAQ, by Jeff Licquia email@example.com with numerous contributions by others.
A number of people have more than one public key that they would like
to make available. One way of doing this is executing the "-kxa"
command for each key you wish to extract from the key ring into
separate armored files, then appending all the individual files into a
single long file with multiple armored blocks. This is not as
convenient as having all of your keys in a single armored block.
Unfortunately, the present version of PGP does not allow you to do
this directly. Fortunately, there is an indirect way to do it.
I would like to thank Robert Joop <firstname.lastname@example.org> for
supplying the following method which is simpler than the method that I
had previously given.
pgp -kxaf uid1 > extract
pgp -kxaf uid2 >> extract
pgp -kxaf uid3 >> extract
Someone who does a `pgp extract` processes the individual keys, one by
one. that's inconvinient.
pgp -kx uid1 extract
pgp -kx uid2 extract
pgp -kx uid3 extract
This puts all three keys into extract.pgp. To get an ascii amored
pgp -a extract.pgp
You get an extract.asc. Someone who does a `pgp extract` and has
either file processes all three keys simultaneously.
A Unix script to perform the extraction with a single command would be
#!/bin/csh foreach name (name1 name2 name3 ...) pgp -kx $name /tmp/keys.pgp <keyring> end or: #!/bin/sh for name in name1 name2 name3 ... ; do pgp -kx $name /tmp/keys.pgp <keyring> end