sslcert.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <refentry id="refcert">
  2. <refmeta>
  3. <refentrytitle>ne_ssl_cert_identity</refentrytitle>
  4. <manvolnum>3</manvolnum>
  5. </refmeta>
  6. <refnamediv>
  7. <refname id="ne_ssl_cert_identity">ne_ssl_cert_identity</refname>
  8. <refname id="ne_ssl_cert_signedby">ne_ssl_cert_signedby</refname>
  9. <refname id="ne_ssl_cert_issuer">ne_ssl_cert_issuer</refname>
  10. <refname id="ne_ssl_cert_subject">ne_ssl_cert_subject</refname>
  11. <refpurpose>functions to access certificate properties</refpurpose>
  12. </refnamediv>
  13. <refsynopsisdiv>
  14. <funcsynopsis>
  15. <funcsynopsisinfo>#include &lt;ne_ssl.h&gt;</funcsynopsisinfo>
  16. <funcprototype>
  17. <funcdef>const char *<function>ne_ssl_cert_identity</function></funcdef>
  18. <paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef>
  19. </funcprototype>
  20. <funcprototype>
  21. <funcdef>const ne_ssl_certificate *<function>ne_ssl_cert_signedby</function></funcdef>
  22. <paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef>
  23. </funcprototype>
  24. <funcprototype>
  25. <funcdef>const ne_ssl_dname *<function>ne_ssl_cert_subject</function></funcdef>
  26. <paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef>
  27. </funcprototype>
  28. <funcprototype>
  29. <funcdef>const ne_ssl_dname *<function>ne_ssl_cert_issuer</function></funcdef>
  30. <paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef>
  31. </funcprototype>
  32. </funcsynopsis>
  33. </refsynopsisdiv>
  34. <refsect1>
  35. <title>Description</title>
  36. <para>The function <function>ne_ssl_cert_identity</function>
  37. retrieves the <quote>identity</quote> of a certificate; for an
  38. SSL server certificate, this will be the hostname for which the
  39. certificate was issued. In PKI parlance, the identity is the
  40. <emphasis>common name</emphasis> attribute of the distinguished name of
  41. the certificate subject.</para>
  42. <para>The functions <function>ne_ssl_cert_subject</function> and
  43. <function>ne_ssl_cert_issuer</function> can be used to access the
  44. objects representing the distinguished name of the subject and of
  45. the issuer of a certificate, respectively.</para>
  46. <para>If a certificate object is part of a certificate chain, then
  47. <function>ne_ssl_cert_signedby</function> can be used to find the
  48. certificate which signed a particular certificate. For a
  49. self-signed certificate or a certificate for which the full chain
  50. is not available, this function will return &null;.</para>
  51. </refsect1>
  52. <refsect1>
  53. <title>Return value</title>
  54. <para><function>ne_ssl_cert_issuer</function> and
  55. <function>ne_ssl_cert_subject</function> are guaranteed to never
  56. return &null;. <function>ne_ssl_cert_identity</function> may
  57. return &null; if the certificate has no specific
  58. <quote>identity</quote>. <function>ne_ssl_cert_signedby</function>
  59. may return &null; as covered above.</para>
  60. </refsect1>
  61. <refsect1>
  62. <title>Examples</title>
  63. <para>The following function could be used to display information
  64. about a given certificate:</para>
  65. <programlisting>void dump_cert(const ne_ssl_certificate *cert) {
  66. const char *id = ne_ssl_cert_identity(cert);
  67. char *dn;
  68. if (id)
  69. printf("Certificate was issued for '%s'.\n", id);
  70. dn = ne_ssl_readable_dname(ne_ssl_cert_subject(cert));
  71. printf("Subject: %s\n", dn);
  72. free(dn);
  73. dn = ne_ssl_readable_dname(ne_ssl_cert_issuer(cert));
  74. printf("Issuer: %s\n", dn);
  75. free(dn);
  76. }</programlisting>
  77. </refsect1>
  78. <refsect1>
  79. <title>See also</title>
  80. <para><xref linkend="ne_ssl_cert_cmp"/>, <xref linkend="ne_ssl_readable_dname"/></para>
  81. </refsect1>
  82. </refentry>