sslcertio.xml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <refentry id="refsslcertio">
  2. <refmeta>
  3. <refentrytitle>ne_ssl_cert_read</refentrytitle>
  4. <manvolnum>3</manvolnum>
  5. </refmeta>
  6. <refnamediv>
  7. <refname id="ne_ssl_cert_read">ne_ssl_cert_read</refname>
  8. <refname id="ne_ssl_cert_write">ne_ssl_cert_write</refname>
  9. <refname id="ne_ssl_cert_import">ne_ssl_cert_import</refname>
  10. <refname id="ne_ssl_cert_export">ne_ssl_cert_export</refname>
  11. <refpurpose>functions to read or write certificates to and from files or strings</refpurpose>
  12. </refnamediv>
  13. <refsynopsisdiv>
  14. <funcsynopsis>
  15. <funcsynopsisinfo>#include &lt;ne_ssl.h&gt;</funcsynopsisinfo>
  16. <funcprototype>
  17. <funcdef>ne_ssl_certificate *<function>ne_ssl_cert_read</function></funcdef>
  18. <paramdef>const char *<parameter>filename</parameter></paramdef>
  19. </funcprototype>
  20. <funcprototype>
  21. <funcdef>int <function>ne_ssl_cert_write</function></funcdef>
  22. <paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef>
  23. <paramdef>const char *<parameter>filename</parameter></paramdef>
  24. </funcprototype>
  25. <funcprototype>
  26. <funcdef>ne_ssl_certificate *<function>ne_ssl_cert_import</function></funcdef>
  27. <paramdef>const char *<parameter>data</parameter></paramdef>
  28. </funcprototype>
  29. <funcprototype>
  30. <funcdef>char *<function>ne_ssl_cert_export</function></funcdef>
  31. <paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef>
  32. </funcprototype>
  33. </funcsynopsis>
  34. </refsynopsisdiv>
  35. <refsect1>
  36. <title>Description</title>
  37. <para>The <function>ne_ssl_cert_write</function> function writes a
  38. certificate to a file using the PEM encoding. The
  39. <function>ne_ssl_cert_export</function> function returns a
  40. base64-encoded &nul;-terminated string representing the
  41. certificate. This string is malloc-allocated and should be
  42. destroyed using <function>free</function> by the caller.</para>
  43. <para>The <function>ne_ssl_cert_read</function> function reads a
  44. certificate from a PEM-encoded file, and returns a certificate
  45. object. The <function>ne_ssl_cert_import</function> function
  46. returns a certificate object from a base64-encoded string,
  47. <parameter>data</parameter>, as returned by
  48. <function>ne_ssl_cert_export</function>. The certificate object
  49. returned by these functions should be destroyed using <xref
  50. linkend="ne_ssl_cert_free"/> after use.</para>
  51. </refsect1>
  52. <refsect1>
  53. <title>Return value</title>
  54. <para><function>ne_ssl_cert_read</function> returns &null; if a
  55. certificate could not be read from the file.
  56. <function>ne_ssl_cert_write</function> returns non-zero if the
  57. certificate could not be written to the file.
  58. <function>ne_ssl_cert_export</function> always returns a
  59. &nul;-terminated string, and never &null;.
  60. <function>ne_ssl_cert_import</function> returns &null; if the
  61. string was not a valid base64-encoded certificate.</para>
  62. </refsect1>
  63. <refsect1>
  64. <title>Encoding Formats</title>
  65. <para>The string produced by
  66. <function>ne_ssl_cert_export</function> is the base64 encoding of
  67. the DER representation of the certificate. The file written by
  68. <function>ne_ssl_cert_write</function> uses the PEM format: this
  69. is the base64 encoding of the DER representation with newlines
  70. every 64 characters, and start and end marker lines.</para>
  71. </refsect1>
  72. </refentry>