How to make gpg2 flush the stream?

Posted by Vi on Super User See other posts from Super User or by Vi
Published on 2010-03-26T00:36:58Z Indexed on 2010/03/26 0:43 UTC
Read the original article Hit count: 284

Filed under:
|
|

I want to get some slowly flowing data saved in encrypted form at the device which can be turned off abruptly. But gpg2 seems to not to flush it's output frequently and I get broken files when I try to read such truncated file.

vi@vi-notebook:~$ cat
asdkfgmafl
asdkfgmafl
ggggg
ggggg
2342
2342

cat behaves normally. I see the output right after input.

vi@vi-notebook:~$ gpg2 -er _Vi --batch
?pE??x...(more binary data here)....???-??....
asdfsadf
22223
sdfsdfasf
Still no data...
Still no output...
^C
gpg: signal Interrupt caught ... exiting

vi@vi-notebook:~$ gpg2 -er _Vi --batch > /tmp/qqq
skdmfasldf
gkvmdfwwerwer
zfzdfdsfl
^\
gpg: signal Quit caught ... exiting
Quit

vi@vi-notebook:~$ gpg2 "
2048-bit ELG key, ID 78F446CA, created 2008-01-06 (main key ID 1735A052)

gpg: [don't know]: 1st length byte missing


vi@vi-notebook:~$ # Where is my "skdmfasldf"

How to make gpg2 to handle such case? I want it to put enough output to reconstruct each incoming chunk of input. (Also fsyncing after each output can be benefitial as an additional option). Should I use other tool (I need pubkey encryption).

© Super User or respective owner

Related posts about gpg

Related posts about pgp