def extract_rsa_key_from_x509_cert(pem): cert = load_pem_x509_certificate(pem, backend) return cert.public_key()