def generate_public_ssh_key(ssh_private_key_file):
try:<EOL><INDENT>with open(ssh_private_key_file, "<STR_LIT:rb>") as key_file:<EOL><INDENT>key = key_file.read()<EOL><DEDENT><DEDENT>except FileNotFoundError:<EOL><INDENT>raise IpaUtilsException(<EOL>'<STR_LIT>' % ssh_private_key_file<EOL>)<EOL><DEDENT>try:<EOL><INDENT>private_key = serialization.load_pem_private_key(<EOL>key,<EOL>password=None,<EOL>backend=default_backend()<EOL>)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise IpaUtilsException(<EOL>'<STR_LIT>'<EOL>% ssh_private_key_file<EOL>)<EOL><DEDENT>return private_key.public_key().public_bytes(<EOL>serialization.Encoding.OpenSSH,<EOL>serialization.PublicFormat.OpenSSH<EOL>)<EOL>
Generate SSH public key from private key file.