diff --git a/rsa.py b/rsa.py index 3337388..07a4cfa 100755 --- a/rsa.py +++ b/rsa.py @@ -66,7 +66,8 @@ def main(): # cipher = int(cipherFile.readline()) ##one line may make problems later with padding print("Signed by: ", sig) print("Decrypted message: \n", msg_decrypted) - + if sys.argv[1] == "list": + listKeys() @@ -214,5 +215,22 @@ def printKey(key): "\n----------------------------------------------", ) +def listKeys(): + if not os.path.isdir(keysFolder): + os.makedirs(keysFolder) + local_keys = os.listdir(keysFolder) + print(local_keys) + if len(local_keys) == 0: + return + print("ID PRIVATE") + print("________________") + for keyName in local_keys: + key = readKeyFile(keyName) + if key[D] == 0: + check = u'' + else: check = u'\u2713' + print("{} {}\n".format(key[ID], check)) + + if __name__ == "__main__": main() \ No newline at end of file