| 1 |
<refentry id="refsslca"> |
| 2 |
|
| 3 |
<refmeta> |
| 4 |
<refentrytitle>ne_ssl_trust_cert</refentrytitle> |
| 5 |
<manvolnum>3</manvolnum> |
| 6 |
</refmeta> |
| 7 |
|
| 8 |
<refnamediv> |
| 9 |
<refname id="ne_ssl_trust_cert">ne_ssl_trust_cert</refname> |
| 10 |
<refname id="ne_ssl_trust_default_ca">ne_ssl_trust_default_ca</refname> |
| 11 |
<refpurpose>functions to indicate that certificates are trusted</refpurpose> |
| 12 |
</refnamediv> |
| 13 |
|
| 14 |
<refsynopsisdiv> |
| 15 |
|
| 16 |
<funcsynopsis> |
| 17 |
|
| 18 |
<funcsynopsisinfo>#include <ne_session.h></funcsynopsisinfo> |
| 19 |
|
| 20 |
<funcprototype> |
| 21 |
<funcdef>void <function>ne_ssl_trust_cert</function></funcdef> |
| 22 |
<paramdef>ne_session *<parameter>session</parameter></paramdef> |
| 23 |
<paramdef>const ne_ssl_certificate *<parameter>cert</parameter></paramdef> |
| 24 |
</funcprototype> |
| 25 |
|
| 26 |
<funcprototype> |
| 27 |
<funcdef>void <function>ne_ssl_trust_default_ca</function></funcdef> |
| 28 |
<paramdef>ne_session *<parameter>session</parameter></paramdef> |
| 29 |
</funcprototype> |
| 30 |
|
| 31 |
</funcsynopsis> |
| 32 |
|
| 33 |
</refsynopsisdiv> |
| 34 |
|
| 35 |
<refsect1> |
| 36 |
<title>Description</title> |
| 37 |
|
| 38 |
<para>To indicate that a given certificate is trusted by the |
| 39 |
user, the certificate object can be passed to |
| 40 |
<function>ne_ssl_trust_cert</function>. The certificate object is |
| 41 |
duplicated internally and can subsequently be destroyed.</para> |
| 42 |
|
| 43 |
<para>The SSL library in use by &neon; may include a default |
| 44 |
set of CA certificates; calling the |
| 45 |
<function>ne_ssl_trust_default_ca</function> function will indicate |
| 46 |
that these CAs are trusted by the user.</para> |
| 47 |
|
| 48 |
</refsect1> |
| 49 |
|
| 50 |
<refsect1> |
| 51 |
<title>Examples</title> |
| 52 |
|
| 53 |
<para>Load the CA certificate stored in <filename>/path/to/cacert.pem</filename>:</para> |
| 54 |
<programlisting>&egsess; |
| 55 |
ne_ssl_certificate *cert = ne_ssl_cert_read("/path/to/cacert.pem"); |
| 56 |
|
| 57 |
if (cert) { |
| 58 |
ne_ssl_trust_cert(sess, cert); |
| 59 |
ne_ssl_cert_free(cert); |
| 60 |
} else { |
| 61 |
printf("Could not load CA cert: %s\n", ne_get_error(sess)); |
| 62 |
}</programlisting> |
| 63 |
</refsect1> |
| 64 |
|
| 65 |
<refsect1> |
| 66 |
<title>See also</title> |
| 67 |
|
| 68 |
<para><xref linkend="ne_ssl_cert_read"/>, <xref |
| 69 |
linkend="ne_ssl_cert_import"/>, <xref |
| 70 |
linkend="ne_ssl_cert_free"/></para> </refsect1> |
| 71 |
|
| 72 |
</refentry> |