| 1 |
'\" t |
| 2 |
.\" Title: ne_ssl_cert_identity |
| 3 |
.\" Author: |
| 4 |
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/> |
| 5 |
.\" Date: 3 May 2011 |
| 6 |
.\" Manual: neon API reference |
| 7 |
.\" Source: neon 0.29.6 |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "NE_SSL_CERT_IDENTITY" "3" "3 May 2011" "neon 0.29.6" "neon API reference" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
ne_ssl_cert_identity, ne_ssl_cert_signedby, ne_ssl_cert_issuer, ne_ssl_cert_subject \- functions to access certificate properties |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.sp |
| 34 |
.ft B |
| 35 |
.nf |
| 36 |
#include <ne_ssl\&.h> |
| 37 |
.fi |
| 38 |
.ft |
| 39 |
.HP \w'const\ char\ *ne_ssl_cert_identity('u |
| 40 |
.BI "const char *ne_ssl_cert_identity(const\ ne_ssl_certificate\ *" "cert" ");" |
| 41 |
.HP \w'const\ ne_ssl_certificate\ *ne_ssl_cert_signedby('u |
| 42 |
.BI "const ne_ssl_certificate *ne_ssl_cert_signedby(const\ ne_ssl_certificate\ *" "cert" ");" |
| 43 |
.HP \w'const\ ne_ssl_dname\ *ne_ssl_cert_subject('u |
| 44 |
.BI "const ne_ssl_dname *ne_ssl_cert_subject(const\ ne_ssl_certificate\ *" "cert" ");" |
| 45 |
.HP \w'const\ ne_ssl_dname\ *ne_ssl_cert_issuer('u |
| 46 |
.BI "const ne_ssl_dname *ne_ssl_cert_issuer(const\ ne_ssl_certificate\ *" "cert" ");" |
| 47 |
.SH "DESCRIPTION" |
| 48 |
.PP |
| 49 |
The function |
| 50 |
\fBne_ssl_cert_identity\fR |
| 51 |
retrieves the |
| 52 |
\(lqidentity\(rq |
| 53 |
of a certificate; for an SSL server certificate, this will be the hostname for which the certificate was issued\&. In PKI parlance, the identity is the |
| 54 |
\fIcommon name\fR |
| 55 |
attribute of the distinguished name of the certificate subject\&. |
| 56 |
.PP |
| 57 |
The functions |
| 58 |
\fBne_ssl_cert_subject\fR |
| 59 |
and |
| 60 |
\fBne_ssl_cert_issuer\fR |
| 61 |
can be used to access the objects representing the distinguished name of the subject and of the issuer of a certificate, respectively\&. |
| 62 |
.PP |
| 63 |
If a certificate object is part of a certificate chain, then |
| 64 |
\fBne_ssl_cert_signedby\fR |
| 65 |
can be used to find the certificate which signed a particular certificate\&. For a self\-signed certificate or a certificate for which the full chain is not available, this function will return |
| 66 |
NULL\&. |
| 67 |
.SH "RETURN VALUE" |
| 68 |
.PP |
| 69 |
\fBne_ssl_cert_issuer\fR |
| 70 |
and |
| 71 |
\fBne_ssl_cert_subject\fR |
| 72 |
are guaranteed to never return |
| 73 |
NULL\&. |
| 74 |
\fBne_ssl_cert_identity\fR |
| 75 |
may return |
| 76 |
NULL |
| 77 |
if the certificate has no specific |
| 78 |
\(lqidentity\(rq\&. |
| 79 |
\fBne_ssl_cert_signedby\fR |
| 80 |
may return |
| 81 |
NULL |
| 82 |
as covered above\&. |
| 83 |
.SH "EXAMPLES" |
| 84 |
.PP |
| 85 |
The following function could be used to display information about a given certificate: |
| 86 |
.sp |
| 87 |
.if n \{\ |
| 88 |
.RS 4 |
| 89 |
.\} |
| 90 |
.nf |
| 91 |
void dump_cert(const ne_ssl_certificate *cert) { |
| 92 |
const char *id = ne_ssl_cert_identity(cert); |
| 93 |
char *dn; |
| 94 |
|
| 95 |
if (id) |
| 96 |
printf("Certificate was issued for \*(Aq%s\*(Aq\&.\en", id); |
| 97 |
|
| 98 |
dn = ne_ssl_readable_dname(ne_ssl_cert_subject(cert)); |
| 99 |
printf("Subject: %s\en", dn); |
| 100 |
free(dn); |
| 101 |
|
| 102 |
dn = ne_ssl_readable_dname(ne_ssl_cert_issuer(cert)); |
| 103 |
printf("Issuer: %s\en", dn); |
| 104 |
free(dn); |
| 105 |
} |
| 106 |
.fi |
| 107 |
.if n \{\ |
| 108 |
.RE |
| 109 |
.\} |
| 110 |
.SH "SEE ALSO" |
| 111 |
.PP |
| 112 |
ne_ssl_cert_cmp, |
| 113 |
ne_ssl_readable_dname |
| 114 |
.SH "AUTHOR" |
| 115 |
.PP |
| 116 |
\fBJoe Orton\fR <\&[email protected]\&> |
| 117 |
.RS 4 |
| 118 |
Author. |
| 119 |
.RE |
| 120 |
.SH "COPYRIGHT" |
| 121 |
.br |