.\" Title: ne_ssl_cert_read
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.72.0
.\" Date: 14 July 2007
.\" Manual: neon API reference
.\" Source: neon 0.26.4
.\"
.TH "NE_SSL_CERT_READ" "3" "14 July 2007" "neon 0.26.4" "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"
.sp
.ft B
.nf
#include
.fi
.ft
.HP 37
.BI "ne_ssl_certificate *ne_ssl_cert_read(const\ char\ *" "filename" ");"
.HP 22
.BI "int ne_ssl_cert_write(const\ ne_ssl_certificate\ *" "cert" ", const\ char\ *" "filename" ");"
.HP 39
.BI "ne_ssl_certificate *ne_ssl_cert_import(const\ char\ *" "data" ");"
.HP 25
.BI "char *ne_ssl_cert_export(const\ ne_ssl_certificate\ *" "cert" ");"
.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.
.SH "AUTHOR"
.PP
\fBJoe Orton\fR <\&neon@webdav.org\&>
.sp -1n
.IP "" 4
Author.
.SH "COPYRIGHT"