Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > 155a6b8ffc33b073b9bc0b0d9ec80b13 > files > 53

lib64neon0.27-devel-0.28.0-1mdv2008.1.x86_64.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ne_ssl_cert_identity</title><link rel="stylesheet" href="../manual.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="neon HTTP/WebDAV client library"><link rel="up" href="ref.html" title="neon API reference"><link rel="prev" href="refsockinit.html" title="ne_sock_init"><link rel="next" href="refsslcert2.html" title="ne_ssl_cert_cmp"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ne_ssl_cert_identity</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="refsockinit.html">Prev</a> </td><th width="60%" align="center">neon API reference</th><td width="20%" align="right"> <a accesskey="n" href="refsslcert2.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="refcert"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ne_ssl_cert_identity, ne_ssl_cert_signedby, ne_ssl_cert_issuer, ne_ssl_cert_subject — functions to access certificate properties</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;ne_ssl.h&gt;</pre><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">const char *<b class="fsfunc">ne_ssl_cert_identity</b>(</code></td><td>const ne_ssl_certificate * </td><td><var class="pdparam">cert</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">const ne_ssl_certificate *<b class="fsfunc">ne_ssl_cert_signedby</b>(</code></td><td>const ne_ssl_certificate * </td><td><var class="pdparam">cert</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">const ne_ssl_dname *<b class="fsfunc">ne_ssl_cert_subject</b>(</code></td><td>const ne_ssl_certificate * </td><td><var class="pdparam">cert</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">const ne_ssl_dname *<b class="fsfunc">ne_ssl_cert_issuer</b>(</code></td><td>const ne_ssl_certificate * </td><td><var class="pdparam">cert</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en"><a name="id356924"></a><h2>Description</h2><p>The function <code class="function">ne_ssl_cert_identity</code>
    retrieves the “<span class="quote">identity</span>” 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
    <span class="emphasis"><em>common name</em></span> attribute of the distinguished name of
    the certificate subject.</p><p>The functions <code class="function">ne_ssl_cert_subject</code> and
    <code class="function">ne_ssl_cert_issuer</code> can be used to access the
    objects representing the distinguished name of the subject and of
    the issuer of a certificate, respectively.</p><p>If a certificate object is part of a certificate chain, then
    <code class="function">ne_ssl_cert_signedby</code> 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 <code class="literal">NULL</code>.</p></div><div class="refsect1" lang="en"><a name="id356983"></a><h2>Return value</h2><p><code class="function">ne_ssl_cert_issuer</code> and
    <code class="function">ne_ssl_cert_subject</code> are guaranteed to never
    return <code class="literal">NULL</code>. <code class="function">ne_ssl_cert_identity</code> may
    return <code class="literal">NULL</code> if the certificate has no specific
    “<span class="quote">identity</span>”. <code class="function">ne_ssl_cert_signedby</code>
    may return <code class="literal">NULL</code> as covered above.</p></div><div class="refsect1" lang="en"><a name="id357038"></a><h2>Examples</h2><p>The following function could be used to display information
    about a given certificate:</p><pre class="programlisting">void dump_cert(const ne_ssl_certificate *cert) {
  const char *id = ne_ssl_cert_identity(cert);
  char *dn;

  if (id) 
    printf("Certificate was issued for '%s'.\n", id);

  dn = ne_ssl_readable_dname(ne_ssl_cert_subject(cert));
  printf("Subject: %s\n", dn);
  free(dn);

  dn = ne_ssl_readable_dname(ne_ssl_cert_issuer(cert));
  printf("Issuer: %s\n", dn);
  free(dn);
}</pre></div><div class="refsect1" lang="en"><a name="id357057"></a><h2>See also</h2><p><a class="xref" href="refsslcert2.html#ne_ssl_cert_cmp">ne_ssl_cert_cmp</a>, <a class="xref" href="refssldname.html#ne_ssl_readable_dname">ne_ssl_readable_dname</a></p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="refsockinit.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ref.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="refsslcert2.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ne_sock_init </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ne_ssl_cert_cmp</td></tr></table></div></body></html>