32 lines
631 B
Python
Executable File
32 lines
631 B
Python
Executable File
#!/bin/python3
|
|
import sys
|
|
import logging
|
|
|
|
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):
|
|
|
|
if len(args) != 3:
|
|
logger.error("Need password and file to store keys")
|
|
sys.exit(-1)
|
|
|
|
|
|
#Generate the key pair
|
|
keyPair = ''
|
|
|
|
#Get the 2 different keys
|
|
pubKey = ''
|
|
privateKey = ''
|
|
|
|
with open(args[2], "wb") as f:
|
|
f.write(pubKey.encode() + b"\n\n" + privateKey.encode())
|
|
|
|
|
|
if __name__ == '__main__':
|
|
generateKeyPair(sys.argv)
|
|
|