.\" ** You probably do not want to edit this file directly ** .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "NE_SSL_CERT_READ" "3" "23 May 2006" "neon 0.26.1" "neon API reference" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" ne_ssl_cert_read, ne_ssl_cert_write, ne_ssl_cert_import, ne_ssl_cert_export \- functions to read or write certificates to and from files or strings .SH "SYNOPSIS" .PP \fB#include \fR .HP 37 \fBne_ssl_certificate\ *\fBne_ssl_cert_read\fR\fR\fB(\fR\fBconst\ char\ *\fR\fB\fIfilename\fR\fR\fB);\fR .HP 22 \fBint\ \fBne_ssl_cert_write\fR\fR\fB(\fR\fBconst\ ne_ssl_certificate\ *\fR\fB\fIcert\fR\fR\fB, \fR\fBconst\ char\ *\fR\fB\fIfilename\fR\fR\fB);\fR .HP 39 \fBne_ssl_certificate\ *\fBne_ssl_cert_import\fR\fR\fB(\fR\fBconst\ char\ *\fR\fB\fIdata\fR\fR\fB);\fR .HP 25 \fBchar\ *\fBne_ssl_cert_export\fR\fR\fB(\fR\fBconst\ ne_ssl_certificate\ *\fR\fB\fIcert\fR\fR\fB);\fR .SH "DESCRIPTION" .PP The \fBne_ssl_cert_write\fR function writes a certificate to a file using the PEM encoding. The \fBne_ssl_cert_export\fR function returns a base64\-encoded NUL\-terminated string representing the certificate. This string is malloc\-allocated and should be destroyed using \fBfree\fR by the caller. .PP The \fBne_ssl_cert_read\fR function reads a certificate from a PEM\-encoded file, and returns a certificate object. The \fBne_ssl_cert_import\fR function returns a certificate object from a base64\-encoded string, \fIdata\fR, as returned by \fBne_ssl_cert_export\fR. The certificate object returned by these functions should be destroyed using ne_ssl_cert_free after use. .SH "RETURN VALUE" .PP \fBne_ssl_cert_read\fR returns NULL if a certificate could not be read from the file. \fBne_ssl_cert_write\fR returns non\-zero if the certificate could not be written to the file. \fBne_ssl_cert_export\fR always returns a NUL\-terminated string, and never NULL. \fBne_ssl_cert_import\fR returns NULL if the string was not a valid base64\-encoded certificate. .SH "ENCODING FORMATS" .PP The string produced by \fBne_ssl_cert_export\fR is the base64 encoding of the DER representation of the certificate. The file written by \fBne_ssl_cert_write\fR uses the PEM format: this is the base64 encoding of the DER representation with newlines every 64 characters, and start and end marker lines.