---
name: "ne_ssl_cert_cmp"
section: "3"
platform: "linux"
package: "neon"
version: "0.37.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ne_ssl_cert_cmp"
---

# ne\_ssl\_cert\_cmp(3)

functions to operate on certificate objects

## 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)](/ne_strhash/3.md). 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)](/ne_strhash/3.md)

## COPYRIGHT

Copyright © 2001-2026 Joe Orton\
