#!/bin/python3 import sys import logging import argparse from cryptLib import keyPair logging.basicConfig(format='%(levelname)s\t- %(message)s') logger = logging.getLogger() logger.setLevel(logging.INFO) # Generate a key pair for a subject # password - file for keys def generateKeyPair(args): parser = argparse.ArgumentParser() parser.add_argument('password', nargs='?', default=None) parser.add_argument('file', nargs='?', default=None) args = parser.parse_args() if len(args) != 2: logger.error("Need password and file to store keys") sys.exit(-1) #Generate the key pair keys = keyPair.generate_key_pair(args.password) #Get the 2 different keys pubKey = '' privateKey = '' with open(args.file, "wb") as f: f.write(pubKey.encode() + b"\n\n" + privateKey.encode()) if __name__ == '__main__': generateKeyPair(sys.argv)