code: @Override
    public void setX509Certificate(X509Certificate certificate) {
  
      String encoding;
      try {
        encoding = Base64Support.encode(certificate.getEncoded(), true);
      }
      catch (CertificateEncodingException e) {
        throw new SecurityException("Failed to get certificate encoding", e);
      }
      org.opensaml.xmlsec.signature.X509Certificate cert = (new X509CertificateBuilder()).buildObject();
      cert.setValue(encoding);
  
      X509Data x509data = (new X509DataBuilder()).buildObject();
      x509data.getX509Certificates().add(cert);
  
      KeyInfo keyInfo = (new KeyInfoBuilder()).buildObject();
      keyInfo.getX509Datas().add(x509data);
  
      this.setKeyInfo(keyInfo);
    }
docs: {@inheritDoc}