model/Account.py
def create_keys(self):
        """Create a new pair of private and public keys"""
        try:
            # If we've already created a private key before, import it
            # Otherwise, create it

            with open(self.key_path, "r") as f:
                private_key = RSA.import_key(
                    f.read(), passphrase=self.__password)
                public_key = private_key.publickey()
        except IOError:
            private_key = create_key()
            public_key = private_key.publickey()

            with open(self.key_path, "wb") as f:
                f.write(private_key.export_key(
                    "PEM", passphrase=self.__password))

        self.__private_key = parse_key(private_key)
        self.__public_key = parse_key(public_key)
Create a new pair of private and public keys
Create a new pair of private and public keys
Create a new pair of private and public keys
def create_keys(self):
        try:
            with open(self.key_path, "r") as f:
                private_key = RSA.import_key(
                    f.read(), passphrase=self.__password)
                public_key = private_key.publickey()
        except IOError:
            private_key = create_key()
            public_key = private_key.publickey()
            with open(self.key_path, "wb") as f:
                f.write(private_key.export_key(
                    "PEM", passphrase=self.__password))
        self.__private_key = parse_key(private_key)
        self.__public_key = parse_key(public_key)
def create_keys ( self ) : try : with open ( self . key_path , "r" ) as f : private_key = RSA . import_key ( f . read ( ) , passphrase = self . __password ) public_key = private_key . publickey ( ) except IOError : private_key = create_key ( ) public_key = private_key . publickey ( ) with open ( self . key_path , "wb" ) as f : f . write ( private_key . export_key ( "PEM" , passphrase = self . __password ) ) self . __private_key = parse_key ( private_key ) self . __public_key = parse_key ( public_key )
Create a new pair of private and public keys
Create a new pair of private and public keys
"""Create a new pair of private and public keys""" # If we've already created a private key before, import it # Otherwise, create it
self