Sample Header Ad - 728x90

gpg syntax to incrementally append encrypted data

0 votes
0 answers
32 views
Data is sporadically generated and appended to a file (consider mbox or a log file). I want to store only an encrypted version. For a single "batch" of data, this sort of thing would work:
$ echo hello | gpg -e -r key >file1
$ file1
$ file2
$ sleep 10
$ echo world | gpg -e -r key [...] >>file2
$ 
--- I didn't notice any relevent options in the gpg manpage. I see there is gpgtar but this creates independent files. Encryption output (third example above) seems to be just multiple PGP messages concatenated together, so presumably if there is a way to detect the boundaries, one could split the input and invoke gpg separately on each message although I guess that would be quite inefficient. I see that there is significant overhead for encrypting small amounts of data (598 bytes were added to each chunk in my test) so perhaps there is a better approach.
Asked by jhnc (305 rep)
May 17, 2025, 09:05 PM