473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 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 3329
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Csaba Henk | last post by:
For me, one reason for using Python is that with the help of it I can rid of several problems that I faced with during writing scripts in Bourneish shells. Biggest of these problem was the...
0
by: Matt Price | last post by:
Hi folks, I'm writing a python script which I plan to use in a macro for mutt, the mailer. The script is supposed to generate and send an email based on a mailto: url pulled out of an email...
2
by: Apple Grew | last post by:
I want to develope a Winboard like application which will support Winboard protocol. For that I require to know how to handle piping in Python. I seperated out module popen2, but when I use...
1
by: Jason Heyes | last post by:
I would like to have std::cout redirect its output to a std::ostringstream. Can this be done? Help is appreciated.
2
by: Fatih BOY | last post by:
Hi, I want to send a report from a windows application to a web page like 'report.asp' Currently i can send it via post method with a context like local=En&Username=fatih&UserId=45&Firm=none...
2
by: moti | last post by:
I am a newbie to MySQL. I'm confused as to the piping syntax of SERVER in the User DSN in ODBC for a client PC. If I use an ip it does not work, probably because of a firewall. So I tried using...
3
by: noob2008 | last post by:
can anyone explain me what is piping in C++ programming? for example invoice.exe < purchase.dat > statement.txt do i replace that where all the cin statements? i created a text file called...
4
by: samit | last post by:
I keen to persue coding like yahoo piping system which will include drag and drop and piping features
0
by: jsimps44 | last post by:
Hi, I'm fairly new to c, and very new to piping and file descriptors and can't seem to get past this problem. The piping is very much not working, and I can't figure out for the life of me why. Any...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.