Talking to GPG on Linux through os.popen

Bernhard Reiter breiter at usf.Uni-Osnabrueck.DE
Thu Aug 17 12:50:21 EDT 2000


In article <399C0374.6D321938 at nowonder.de>,
	Peter Schneider-Kamp <nowonder at nowonder.de> writes:
> "Morten W. Petersen" wrote:

>> f = os.popen('gpg --sign gpgtest.py','w')
>> f.write("Test\n")
>> 
>> Doesn't work for me, and I'm a bit baffled (and annoyed) because I can't
>> find the problem.
> 
> I'm not surprised by this. Try for example:
> 
> echo Test | gpg --sign gpgtest.py
> 
> or
> 
> echo Test > dummbrot
> cat dummbrot | gpg --sign gpgtest.py
> 
> gpg does not accept the passphrase from a pipe.

True. 
There is an option (which AFAIR was undocumented before GPG 1.0.2,
but at least included in 1.0.1)

	     --passphrase-fd n
               Read the passphrase from file descriptor n. If you
               use  0  for  n,  the  passphrase will be read from
               stdin.        This can only be used  if  only  one
               passphrase  is  supplied. Don't use this option if
               you can avoid it.

Oh, I could also attach my stupid passphrase permutation tester.

If you really want to see how to controll gpg, you have to check
the gpapa part from gpa. ;->
	Bernhard

-- 
Professional Service around Free Software                (intevation.net)  
The FreeGIS Project				            (freegis.org)
Association for a Free Informational Infrastructure            (ffii.org)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_gpg_passphrases.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20000817/9c0bbb52/attachment.ksh>


More information about the Python-list mailing list