471,349 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

piping data stream through GPG

I played around trying to encrypt/decrypt data through GPG on the
fly (or worse - by using a file) (on Windows first - later to try
on Linux too)

Using os.popen3 like
>>i,o,e=os.popen3('gpg -e -r Robert')
# i.write('y\n')
i.write('wefwef')
i.close()
# e.read(1)
o.read(1)
hangs on o.read or e.read.

So its quite dark. Just a totally non-existing userid (-r) will
result significantly different like
>>i.write('wefwef')
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
IOError: [Errno 22] Invalid argument
GPG asks confirmation stuff (and pwd upon -d or -c) on the command
line.
How to get all this the right way?
Robert

Jun 9 '07 #1
2 3242
robert wrote:
I played around trying to encrypt/decrypt data through GPG on the fly
(or worse - by using a file) (on Windows first - later to try on Linux too)

Using os.popen3 like
>>i,o,e=os.popen3('gpg -e -r Robert')
>># i.write('y\n')
>>i.write('wefwef')
>>i.close()
>># e.read(1)
>>o.read(1)

hangs on o.read or e.read.

So its quite dark. Just a totally non-existing userid (-r) will result
significantly different like
>>i.write('wefwef')
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
IOError: [Errno 22] Invalid argument
GPG asks confirmation stuff (and pwd upon -d or -c) on the command line.
How to get all this the right way?

now tryed around like
>>i,o,e=os.popen3('gpg --status-fd 2 --passphrase-fd 0 -e -r
Robert','b')
>>i.write('y\r')
i.write('wefwef')
i.close()
# e.read(1)
o.read(1)

still just hanging... never any output (status or honey)

Robert
Jun 9 '07 #2
robert wrote:
I played around trying to encrypt/decrypt data through GPG on the fly
(or worse - by using a file) (on Windows first - later to try on Linux too)

Using os.popen3 like
>>i,o,e=os.popen3('gpg -e -r Robert')
>># i.write('y\n')
>>i.write('wefwef')
>>i.close()
>># e.read(1)
>>o.read(1)

hangs on o.read or e.read.

So its quite dark. Just a totally non-existing userid (-r) will result
significantly different like
>>i.write('wefwef')
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
IOError: [Errno 22] Invalid argument
GPG asks confirmation stuff (and pwd upon -d or -c) on the command line.
How to get all this the right way?

I basically can handle it now by a os.popen3 cmd like
'gpg -e -r Robert --batch --always-trust',
'gpg -d -r Robert --batch --always-trust --passphrase-fd 0'

and by using a thread for feeding the child_stdin stream
(necessary for files of significant length / more than buffers)
Robert
Jun 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Csaba Henk | last post: by
reply views Thread by Matt Price | last post: by
2 posts views Thread by Apple Grew | last post: by
1 post views Thread by Jason Heyes | last post: by
2 posts views Thread by Fatih BOY | last post: by
2 posts views Thread by moti | last post: by
3 posts views Thread by noob2008 | last post: by
4 posts views Thread by samit | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.