private RSAPublicKey createPublicKey(String certificate) {
    RSAPublicKey publicKey = null;
    if (certificate != null) {
      certificate = certificate.trim();
    }
    if (!StringUtils.isEmpty(certificate)) {
      // Ensure the PEM data is properly formatted
      if (!certificate.startsWith(PEM_CERTIFICATE_HEADER)) {
        certificate = PEM_CERTIFICATE_HEADER + "/n" + certificate;
      }
      if (!certificate.endsWith(PEM_CERTIFICATE_FOOTER)) {
        certificate = certificate + "/n" + PEM_CERTIFICATE_FOOTER;
      }

      try {
        publicKey = CertificateUtils.getPublicKeyFromString(certificate);
      } catch (CertificateException | UnsupportedEncodingException e) {
        LOG.error("Unable to parse public certificate file. JTW authentication will fail.", e);
      }
    }

    return publicKey;
  }
Given a String containing PEM-encode x509 certificate, an {@link RSAPublicKey} is created and
returned.
<p>
If the certificate data is does not contain the proper PEM-encoded x509 digital certificate
header and footer, they will be added.

@param certificate a PEM-encode x509 certificate
@return an {@link RSAPublicKey}
ambari-server/src/main/java/org/apache/ambari/server/security/authentication/jwt/JwtAuthenticationProperties.java