Re: gnutls_certificate_status_t to text

Jeremy Harris <[email protected]>
Newsgroups gmane.network.gnutls.general
Message-ID <[email protected]>
On 29/03/18 10:41, Petr Špaček wrote:
> is there a recommended way to transform non-zero
> gnutls_certificate_status_t value returned by
> gnutls-certificate-verify-peers3 to text, which can be displayed to user?


[guile/src/enum-map.i.c]

static const char *
scm_gnutls_certificate_status_to_c_string (gnutls_certificate_status_t
c_obj)
{
  static const struct { gnutls_certificate_status_t value; const char
*name; } table[] =
    {
       { GNUTLS_CERT_INVALID, "invalid" },
       { GNUTLS_CERT_REVOKED, "revoked" },
       { GNUTLS_CERT_SIGNER_NOT_FOUND, "signer-not-found" },
       { GNUTLS_CERT_SIGNER_NOT_CA, "signer-not-ca" },
       { GNUTLS_CERT_INSECURE_ALGORITHM, "insecure-algorithm" },
    };
  unsigned i;
  const char *name = NULL;
  for (i = 0; i < 5; i++)
    {
      if (table[i].value == c_obj)
        {
          name = table[i].name;
          break;
        }
    }
  return (name);
}

_______________________________________________
Gnutls-help mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnutls-help
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.