Assuming I have encrypted a (possibly large) file using GPG; e.g.
gpg --recipient "Markus Rothe" -o this_file.gpg --encrypt this_file.txt
Is it possible to add another recipient without first decrypting the file, followed by another encryption?
|
Assuming I have encrypted a (possibly large) file using GPG; e.g.
Is it possible to add another recipient without first decrypting the file, followed by another encryption? | |||
|
feedback
|
|
Short answer: no First of all, note that if you are not one of the recipients, it is completely impossible. You do not even have the ability to decrypt the file, much less add a recipient. Even if you encrypted it two seconds ago. Assuming you are a recipient, it is technically possible. The file is actually encrypted with a session key and the session key is encrypted with your public key, so you could in theory decrypt the session key and reencrypt it to another persons' key, and then package everything together in a file just as if you had originally encrypted the document to both people. However, gpg does not have this capability. The closest you can get with gpg is
| ||||
|
feedback
|
|
1) This situation is why encrypting a file to yourself (as well as the intended recipients) is always a good idea. RedGrittyBrick is correct above in describing how GPG and PGP work, which flows into nathang's answer above. 2) However, if you have the original file, you're best off to simply create a new encrypted file to the new recipient. Assuming you don't want to go the session key route from nathang's suggestion, if you encrypted the file to yourself (as above in #1) in the first place, then decrypt it and then follow step #2 above. If you neither have the original nor encrypted it to yourself, you cannot get the data back and cannot encrypt it to anyone else without that first recipient sending you back a copy. | |||
|
feedback
|
--symmetricfor that. With--recipientit uses th recipient's public key. There may be more than 1 recipient, but it must be done in one command, not in 2 separate commands. – ott-- Jan 21 at 17:40gpg -e -r <name1> -r <name2> ... <file>" I haven't tried this myself though. It fits with what I learned of crypto many years ago which is that it is almost always more efficient to use fast symmetric algorithms to encrypt the message text. Only the message-key is encrypted using slow asymmetric encryption. – RedGrittyBrick Jan 21 at 17:57