NE_SSL_CERT_CMP(3)

NAME
ne_ssl_cert_cmp, ne_ssl_cert_free, ne_ssl_cert_digest, ne_ssl_cert_hdigest, ne_ssl_cert_validity, ne_ssl_cert_validity_time - functions to operate on certificate objects

SYNOPSIS

#include <ne_header.h>

int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, const ne_ssl_certificate *c2);

void ne_ssl_cert_free(ne_ssl_certificate *cert);

int ne_ssl_cert_digest(const ne_ssl_certificate *c1, char *digest);

char *ne_ssl_cert_hdigest(const ne_ssl_certificate *c1, unsigned int flags);

void ne_ssl_cert_validity_time(const ne_ssl_certificate *cert, time_t *from, time_t *until);

void ne_ssl_cert_validity(const ne_ssl_certificate *cert, char *from, char *until);

DESCRIPTION

The ne_ssl_cert_cmp function can be used to compare two certificate objects; it returns zero if they refer to the same certificate, and non-zero otherwise.

The ne_ssl_cert_free function can be used to destroy a certificate object when it is no longer needed.

The ne_ssl_cert_digest function writes a human-readable fingerprint as a NUL-terminated string to the digest buffer provided, in the format "aa:bb...:ff". The digest buffer must be at least NE_SSL_DIGESTLEN bytes in length.

The ne_ssl_cert_hdigest function returns a human-readable fingerprint for the certificate object. The flags parameter specifies the hash formatting options as if passed to ne_strhash(3). The returned string is malloc-allocated and must be freed after use.

The ne_ssl_cert_validity_time function retrieves both the time from which the certificate is valid from and until. Each time is returned through the from and until parameters, which are written as (time_t)-1 if either time cannot be represented as a time_t value. The ne_ssl_cert_validity function similarly writes the validity times to the string buffers provided, using RFC 1123-style date formatting (not localized). The output parameters must be at least NE_SSL_VDATELEN bytes in length. Either parameter can be passed as NULL.

RETURN VALUE

ne_ssl_cert_cmp returns 0 if the certificates are the same, and non-zero otherwise. ne_ssl_cert_digest returns 0 on success or non-zero on error. The return value of ne_ssl_cert_hdigest is a NUL-terminated malloc-allocated string, or NULL if the hash cannot be created.

HISTORY

ne_ssl_cert_hdigest is available in in neon 0.32.0 and later.

SEE ALSO

ne_strhash(3)

COPYRIGHT
Copyright © 2001-2026 Joe Orton