Endpoint Encryption

 View Only

PGP command line: "key invalid" when encrypting for multiple recipients

  • 1.  PGP command line: "key invalid" when encrypting for multiple recipients

    Posted Jul 31, 2015 04:22 AM

    I got a strange problem: I am using PGP Command Line 10.3.2 build 12281 and I want to encrypt a file for multiple recipients. The public keys of them are imported and signed, and they work fine when used individually ("user1" and "user2" are just placeholders for the real key names):

    $ pgp --encrypt test.dat -r "user1"
    test.dat:encrypt (0:output file test.dat.pgp)

    $ pgp --encrypt test.dat -r "user2"
    test.dat:encrypt (0:output file test.dat.pgp)

    $ pgp --list-keys|grep -e "user1" -e "user2"

     RSA4 pub  2048/2048 [VT---] 0xD6742E99 user1
     RSA4 pub  2048/2048 [VT---] 0xBAE71BC0 user2

    However when used together I get a warning message about an invalid key of the second recipient:

    $ rm test.dat.pgp; pgp --encrypt test.dat -r "user1" -r "user2"
    0xBAE71BC0:encrypt (3064:key invalid)
    test.dat:encrypt (0:output file test.dat.pgp)

    When I switch the order of the recipients (...  -r "user2" -r "user1"), then the key of user1 is shown as "invalid". If I use more than 2 recipients, then the "key invalid" line is printed for every recipient specified after the first. The encryption process itself seems to work, an encrypted file is being created. But it leaves me worried and I am wondering why this is happening here.

    Am I doing anything wrong?