X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ticket.py;h=c6dc4f734481defcf6abddf0669fc0df3305c718;hb=ecee05390277f57b02d21ffca0195292bde1defa;hp=0292cfb12bae0f237a248feb8f10147c61f166c0;hpb=3224c1906c82596a86ae734181488ed14a0f0976;p=nodemanager.git diff --git a/ticket.py b/ticket.py index 0292cfb..c6dc4f7 100644 --- a/ticket.py +++ b/ticket.py @@ -1,6 +1,3 @@ -# $Id$ -# $URL$ - """An extremely simple interface to the signing/verifying capabilities of gnupg. @@ -12,6 +9,10 @@ from xmlrpclib import dumps, loads GPG = '/usr/bin/gpg' +def _popen_gpg(*args): + """Return a Popen object to GPG.""" + return Popen((GPG, '--batch', '--no-tty') + args, + stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) def sign(data): """Return signed with the default GPG key.""" @@ -33,11 +34,8 @@ def verify(signed_msg): msg = p.stdout.read() p.stdout.close() p.stderr.close() - if p.wait(): return None # verification failed + if p.wait(): + return None # verification failed else: data, = loads(msg)[0] return data - -def _popen_gpg(*args): - """Return a Popen object to GPG.""" - return Popen((GPG, '--batch', '--no-tty') + args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)