1NE_SSL_CERT_READ(3) neon API reference NE_SSL_CERT_READ(3)
2
3
4
6 ne_ssl_cert_read, ne_ssl_cert_write, ne_ssl_cert_import,
7 ne_ssl_cert_export - functions to read or write certificates to and
8 from files or strings
9
11 #include <ne_ssl.h>
12
13 ne_ssl_certificate *ne_ssl_cert_read(const char *filename);
14
15 int ne_ssl_cert_write(const ne_ssl_certificate *cert,
16 const char *filename);
17
18 ne_ssl_certificate *ne_ssl_cert_import(const char *data);
19
20 char *ne_ssl_cert_export(const ne_ssl_certificate *cert);
21
23 The ne_ssl_cert_write function writes a certificate to a file using the
24 PEM encoding. The ne_ssl_cert_export function returns a base64-encoded
25 NUL-terminated string representing the certificate. This string is
26 malloc-allocated and should be destroyed using free by the caller.
27
28 The ne_ssl_cert_read function reads a certificate from a PEM-encoded
29 file, and returns a certificate object. The ne_ssl_cert_import function
30 returns a certificate object from a base64-encoded string, data, as
31 returned by ne_ssl_cert_export. The certificate object returned by
32 these functions should be destroyed using ne_ssl_cert_free after use.
33
35 ne_ssl_cert_read returns NULL if a certificate could not be read from
36 the file. ne_ssl_cert_write returns non-zero if the certificate could
37 not be written to the file. ne_ssl_cert_export always returns a
38 NUL-terminated string, and never NULL. ne_ssl_cert_import returns NULL
39 if the string was not a valid base64-encoded certificate.
40
42 The string produced by ne_ssl_cert_export is the base64 encoding of the
43 DER representation of the certificate. The file written by
44 ne_ssl_cert_write uses the PEM format: this is the base64 encoding of
45 the DER representation with newlines every 64 characters, and start and
46 end marker lines.
47
49 Joe Orton
50 Author.
51
53neon 0.32.5 21 January 2023 NE_SSL_CERT_READ(3)