implement list_keys, list_fingerprints, export and exportall parts.

This commit is contained in:
Serdar Dalgıç
2010-03-22 13:40:48 +00:00
parent 8ce9c7603d
commit 97afd12be5
+24 -14
View File
@@ -84,17 +84,32 @@ def update(GPG):
def net_update(): def net_update():
pass pass
def list_keys(): def list_keys(GPG):
cmd = GPG + ' --batch --list_keys'
print "cmd: " + cmd
pass pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def list_fingerprints(): def list_fingerprints(GPG):
cmd = GPG + ' --batch --fingerprint'
print "cmd: " + cmd
pass pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def export(): def export(GPG, keyid):
cmd = GPG + ' --armor --export %s' keyid
print "cmd: " + cmd
pass pass
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def exportAll(): def exportAll(GPG):
pass cmd = GPG + ' --armor --export'
print "cmd: " + cmd
pipe = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return pipe.wait() == 0
def printUsage(): def printUsage():
""" """
@@ -181,25 +196,20 @@ if __name__ == '__main__':
elif operation == 'list': elif operation == 'list':
# list keys # list keys
GPG += ' --batch --list-keys' list_keys(GPG)
list_keys()
elif operation == 'finger': elif operation == 'finger':
# list fingerprints # list fingerprints
GPG += ' --batch --fingerprint' ist_fingerprints(GPG)
list_fingerprints()
elif operation == 'export': elif operation == 'export':
# output the key with the <keyid> # output the key with the <keyid>
keyid = sys.argv[argc] keyid = sys.argv[argc]
argc += 1 #increment argc export(GPG, keyid)
GPG += ' --armor --export %s' % keyid
export()
elif operation == 'exportall': elif operation == 'exportall':
# output all trusted keys # output all trusted keys
GPG += ' --armor --export' exportAll(GPG)
exportAll()
elif operation == 'adv': elif operation == 'adv':
adv_command = GPG + ' ' + sys.args[3:] adv_command = GPG + ' ' + sys.args[3:]