def create_keys(cls, pw): salt = os.urandom(16) master_key = cls.generate_key(pw, salt) aes_key = cls.generate_random_key() mac_key = cls.generate_random_key() wrapped_aes_key = cls.wrap_key(master_key, aes_key) wrapped_mac_key = cls.wrap_key(master_key, mac_key) return KeyFile(cls.to_base64(salt), cls.to_base64(wrapped_aes_key), cls.to_base64(wrapped_mac_key))
def has_signed_up(self): return data.file_exists(utils.KEY_MAP_FILE_NAME) and KeyFile.verify_content()
def verify_pw(pw): key_file = KeyFile.load_from_file() return AESCrypto(key_file, pw)
def has_signed_up(self): return data.file_exists( utils.KEY_MAP_FILE_NAME) and KeyFile.verify_content()