def generate_certificates(base_dir: str, remove_certificates: bool=False):
public_keys_dir = os.path.join(base_dir, '<STR_LIT>')<EOL>secret_keys_dir = os.path.join(base_dir, '<STR_LIT>')<EOL>for path in (public_keys_dir, secret_keys_dir):<EOL><INDENT>if not os.path.exists(path):<EOL><INDENT>os.mkdir(path)<EOL><DEDENT><DEDENT>server_public_file, server_secret_file = zmq.auth.create_certificates(base_dir, "<STR_LIT>")<EOL>client_public_file, client_secret_file = zmq.auth.create_certificates(base_dir, "<STR_LIT>")<EOL>vexbot_public = os.path.join(public_keys_dir, '<STR_LIT>')<EOL>client_public = os.path.join(public_keys_dir, '<STR_LIT>')<EOL>vexbot_secret = os.path.join(secret_keys_dir, '<STR_LIT>')<EOL>client_secret = os.path.join(secret_keys_dir, '<STR_LIT>')<EOL>if os.path.exists(vexbot_public) and remove_certificates:<EOL><INDENT>os.unlink(vexbot_public)<EOL>try:<EOL><INDENT>os.unlink(vexbot_secret)<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>elif os.path.exists(vexbot_public) and not remove_certificates:<EOL><INDENT>os.unlink(server_public_file)<EOL>os.unlink(server_secret_file)<EOL><DEDENT>if os.path.exists(client_public) and remove_certificates:<EOL><INDENT>os.unlink(client_public)<EOL>try:<EOL><INDENT>os.unlink(client_secret)<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>elif os.path.exists(client_public) and not remove_certificates:<EOL><INDENT>os.unlink(client_public_file)<EOL>os.unlink(client_secret_file)<EOL><DEDENT>for key_file in os.listdir(base_dir):<EOL><INDENT>if key_file.endswith("<STR_LIT>"):<EOL><INDENT>shutil.move(os.path.join(base_dir, key_file),<EOL>os.path.join(public_keys_dir, '<STR_LIT:.>'))<EOL><DEDENT><DEDENT>for key_file in os.listdir(base_dir):<EOL><INDENT>if key_file.endswith("<STR_LIT>"):<EOL><INDENT>shutil.move(os.path.join(base_dir, key_file),<EOL>os.path.join(secret_keys_dir, '<STR_LIT:.>'))<EOL><DEDENT><DEDENT>
Generate client and server CURVE certificate files