X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ticket.py;h=1904b81cc109361355cf788ea57c86ed02810a1c;hb=fe7afc94bd4a904df900fffd2c49012b9ebf966f;hp=aa24b888d635a9c52a2abedb247789bc32373c18;hpb=a869b6b1e66606b97fc654001275bb50b9f63206;p=nodemanager.git diff --git a/ticket.py b/ticket.py index aa24b88..1904b81 100644 --- a/ticket.py +++ b/ticket.py @@ -1,6 +1,3 @@ -# $Id$ -# $URL$ - """An extremely simple interface to the signing/verifying capabilities of gnupg. @@ -8,13 +5,13 @@ You must already have the key in the keyring. """ from subprocess import PIPE, Popen -from xmlrpclib import dumps, loads +from xmlrpc.client import dumps, loads GPG = '/usr/bin/gpg' def _popen_gpg(*args): """Return a Popen object to GPG.""" - return Popen((GPG, '--batch', '--no-tty') + args, + return Popen((GPG, '--batch', '--no-tty') + args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) def sign(data): @@ -37,9 +34,8 @@ def verify(signed_msg): msg = p.stdout.read() p.stdout.close() p.stderr.close() - if p.wait(): + if p.wait(): return None # verification failed else: data, = loads(msg)[0] return data -