[gnutls-help] gnutls_certificate_status_t to text
Jeremy Harris
jgh at wizmail.org
Thu Mar 29 12:17:40 CEST 2018
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);
}
More information about the Gnutls-help
mailing list