Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>3.3.1 Context objects </title> |
| 5 | <META NAME="description" CONTENT="3.3.1 Context objects "> |
| 6 | <META NAME="keywords" CONTENT="pyOpenSSL"> |
| 7 | <META NAME="resource-type" CONTENT="document"> |
| 8 | <META NAME="distribution" CONTENT="global"> |
| 9 | <link rel="STYLESHEET" href="pyOpenSSL.css"> |
| 10 | <LINK REL="next" href="openssl-connection.html"> |
| 11 | <LINK REL="previous" href="openssl-ssl.html"> |
| 12 | <LINK REL="up" href="openssl-ssl.html"> |
| 13 | <LINK REL="next" href="openssl-connection.html"> |
| 14 | </head> |
| 15 | <body> |
| 16 | <DIV CLASS="navigation"> |
| 17 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 18 | <tr> |
| 19 | <td><A href="openssl-ssl.html"><img src="previous.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 20 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 21 | alt="Previous Page" width="32"></A></td> |
| 22 | <td><A href="openssl-ssl.html"><img src="up.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 23 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 24 | alt="Up One Level" width="32"></A></td> |
| 25 | <td><A href="openssl-connection.html"><img src="next.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 26 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 27 | alt="Next Page" width="32"></A></td> |
| 28 | <td align="center" width="100%">Python OpenSSL Manual</td> |
| 29 | <td><A href="contents.html"><img src="contents.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 30 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 31 | alt="Contents" width="32"></A></td> |
| 32 | <td><img src="blank.gif" |
| 33 | border="0" height="32" |
| 34 | alt="" width="32"></td> |
| 35 | <td><img src="blank.gif" |
| 36 | border="0" height="32" |
| 37 | alt="" width="32"></td> |
| 38 | </tr></table> |
| 39 | <b class="navlabel">Previous:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL </A> |
| 40 | <b class="navlabel">Up:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL </A> |
| 41 | <b class="navlabel">Next:</b> <a class="sectref" href="openssl-connection.html">3.3.2 Connection objects</A> |
| 42 | <br><hr> |
| 43 | </DIV> |
| 44 | <!--End of Navigation Panel--> |
| 45 | |
| 46 | <H3><A NAME="SECTION000431000000000000000"> </A> |
| 47 | <BR> |
| 48 | 3.3.1 Context objects |
| 49 | </H3> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 50 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 51 | <P> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 52 | Context objects have the following methods: |
| 53 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 54 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 55 | <dl><dt><b><a name='l2h-152'><tt class='method'>check_privatekey</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 56 | <dd> |
| 57 | Check if the private key (loaded with <tt class="method">use_privatekey<big>[</big>_file<big>]</big></tt>) |
| 58 | matches the certificate (loaded with <tt class="method">use_certificate<big>[</big>_file<big>]</big></tt>). |
Jean-Paul Calderone | f05fbbe | 2008-03-06 21:52:35 -0500 | [diff] [blame] | 59 | Returns <code>None</code> if they match, raises <tt class="exception">Error</tt> otherwise. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 60 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 61 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 62 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 63 | <dl><dt><b><a name='l2h-153'><tt class='method'>get_app_data</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 64 | <dd> |
| 65 | Retrieve application data as set by <tt class="method">set_app_data</tt>. |
| 66 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 67 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 68 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 69 | <dl><dt><b><a name='l2h-154'><tt class='method'>get_cert_store</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 70 | <dd> |
| 71 | Retrieve the certificate store (a X509Store object) that the context uses. |
| 72 | This can be used to add "trusted" certificates without using the. |
| 73 | <tt class="method">load_verify_locations()</tt> method. |
| 74 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 75 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 76 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 77 | <dl><dt><b><a name='l2h-155'><tt class='method'>get_timeout</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 78 | <dd> |
| 79 | Retrieve session timeout, as set by <tt class="method">set_timeout</tt>. The default is 300 |
| 80 | seconds. |
| 81 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 82 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 83 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 84 | <dl><dt><b><a name='l2h-156'><tt class='method'>get_verify_depth</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 85 | <dd> |
| 86 | Retrieve the Context object's verify depth, as set by |
| 87 | <tt class="method">set_verify_depth</tt>. |
| 88 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 89 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 90 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 91 | <dl><dt><b><a name='l2h-157'><tt class='method'>get_verify_mode</tt></a></b>() |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 92 | <dd> |
Jean-Paul Calderone | 6c1d4f9 | 2009-03-07 09:10:30 -0500 | [diff] [blame] | 93 | Retrieve the Context object's verify mode, as set by <tt class="method">set_verify</tt>. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 94 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 95 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 96 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 97 | <dl><dt><b><a name='l2h-158'><tt class='method'>load_client_ca</tt></a></b>(<var>pemfile</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 98 | <dd> |
| 99 | Read a file with PEM-formatted certificates that will be sent to the client |
| 100 | when requesting a client certificate. |
| 101 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 102 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 103 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 104 | <dl><dt><b><a name='l2h-159'><tt class='method'>set_client_ca_list</tt></a></b>(<var>certificate_authorities</var>) |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 105 | <dd> |
| 106 | Replace the current list of preferred certificate signers that would be |
| 107 | sent to the client when requesting a client certificate with the |
| 108 | <var>certificate_authorities</var> sequence of <tt class="class">OpenSSL.crypto.X509Name</tt>s. |
| 109 | |
| 110 | <P> |
| 111 | |
| 112 | <span class='versionnote'>New in version 0.10.</span> |
| 113 | |
| 114 | </dl> |
| 115 | |
| 116 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 117 | <dl><dt><b><a name='l2h-160'><tt class='method'>add_client_ca</tt></a></b>(<var>certificate_authority</var>) |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 118 | <dd> |
| 119 | Extract a <tt class="class">OpenSSL.crypto.X509Name</tt> from the <var>certificate_authority</var> |
| 120 | <tt class="class">OpenSSL.crypto.X509</tt> certificate and add it to the list of preferred |
| 121 | certificate signers sent to the client when requesting a client certificate. |
| 122 | |
| 123 | <P> |
| 124 | |
| 125 | <span class='versionnote'>New in version 0.10.</span> |
| 126 | |
| 127 | </dl> |
| 128 | |
| 129 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 130 | <dl><dt><b><a name='l2h-161'><tt class='method'>load_verify_locations</tt></a></b>(<var>pemfile, capath</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 131 | <dd> |
Jean-Paul Calderone | 6c1d4f9 | 2009-03-07 09:10:30 -0500 | [diff] [blame] | 132 | Specify where CA certificates for verification purposes are located. These |
| 133 | are trusted certificates. Note that the certificates have to be in PEM |
| 134 | format. If capath is passed, it must be a directory prepared using the |
| 135 | <code>c_rehash</code> tool included with OpenSSL. Either, but not both, of |
| 136 | <var>pemfile</var> or <var>capath</var> may be <code>None</code>. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 137 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 138 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 139 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 140 | <dl><dt><b><a name='l2h-162'><tt class='method'>set_default_verify_paths</tt></a></b>() |
Jean-Paul Calderone | 6c1d4f9 | 2009-03-07 09:10:30 -0500 | [diff] [blame] | 141 | <dd> |
| 142 | Specify that the platform provided CA certificates are to be used for |
| 143 | verification purposes. This method may not work properly on OS X. |
| 144 | </dl> |
| 145 | |
| 146 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 147 | <dl><dt><b><a name='l2h-163'><tt class='method'>load_tmp_dh</tt></a></b>(<var>dhfile</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 148 | <dd> |
| 149 | Load parameters for Ephemeral Diffie-Hellman from <var>dhfile</var>. |
| 150 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 151 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 152 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 153 | <dl><dt><b><a name='l2h-164'><tt class='method'>set_app_data</tt></a></b>(<var>data</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 154 | <dd> |
| 155 | Associate <var>data</var> with this Context object. <var>data</var> can be retrieved |
| 156 | later using the <tt class="method">get_app_data</tt> method. |
| 157 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 158 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 159 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 160 | <dl><dt><b><a name='l2h-165'><tt class='method'>set_cipher_list</tt></a></b>(<var>ciphers</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 161 | <dd> |
| 162 | Set the list of ciphers to be used in this context. See the OpenSSL manual for |
| 163 | more information (e.g. ciphers(1)) |
| 164 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 165 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 166 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 167 | <dl><dt><b><a name='l2h-166'><tt class='method'>set_info_callback</tt></a></b>(<var>callback</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 168 | <dd> |
| 169 | Set the information callback to <var>callback</var>. This function will be called |
| 170 | from time to time during SSL handshakes. |
Jean-Paul Calderone | 420bf21 | 2008-02-19 21:19:30 -0500 | [diff] [blame] | 171 | <var>callback</var> should take three arguments: a Connection object and two |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 172 | integers. The first integer specifies where in the SSL handshake the function |
| 173 | was called, and the other the return code from a (possibly failed) internal |
| 174 | function call. |
| 175 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 176 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 177 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 178 | <dl><dt><b><a name='l2h-167'><tt class='method'>set_options</tt></a></b>(<var>options</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 179 | <dd> |
| 180 | Add SSL options. Options you have set before are not cleared! |
Jean-Paul Calderone | 420bf21 | 2008-02-19 21:19:30 -0500 | [diff] [blame] | 181 | This method should be used with the <tt class="constant">OP_*</tt> constants. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 182 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 183 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 184 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 185 | <dl><dt><b><a name='l2h-168'><tt class='method'>set_passwd_cb</tt></a></b>(<var>callback</var><big>[</big><var>, userdata</var><big>]</big>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 186 | <dd> |
| 187 | Set the passphrase callback to <var>callback</var>. This function will be called |
Jean-Paul Calderone | 1eeb29e | 2008-10-19 11:50:53 -0400 | [diff] [blame] | 188 | when a private key with a passphrase is loaded. <var>callback</var> must accept |
| 189 | three positional arguments. First, an integer giving the maximum length of |
| 190 | the passphrase it may return. If the returned passphrase is longer than |
| 191 | this, it will be truncated. Second, a boolean value which will be true if |
| 192 | the user should be prompted for the passphrase twice and the callback should |
| 193 | verify that the two values supplied are equal. Third, the value given as the |
| 194 | <var>userdata</var> parameter to <tt class="method">set_passwd_cb</tt>. If an error occurs, |
| 195 | <var>callback</var> should return a false value (e.g. an empty string). |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 196 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 197 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 198 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 199 | <dl><dt><b><a name='l2h-169'><tt class='method'>set_session_id</tt></a></b>(<var>name</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 200 | <dd> |
| 201 | Set the context <var>name</var> within which a session can be reused for this |
| 202 | Context object. This is needed when doing session resumption, because there is |
| 203 | no way for a stored session to know which Context object it is associated with. |
| 204 | <var>name</var> may be any binary data. |
| 205 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 206 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 207 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 208 | <dl><dt><b><a name='l2h-170'><tt class='method'>set_timeout</tt></a></b>(<var>timeout</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 209 | <dd> |
| 210 | Set the timeout for newly created sessions for this Context object to |
| 211 | <var>timeout</var>. <var>timeout</var> must be given in (whole) seconds. The default |
| 212 | value is 300 seconds. See the OpenSSL manual for more information (e.g. |
| 213 | SSL_CTX_set_timeout(3)). |
| 214 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 215 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 216 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 217 | <dl><dt><b><a name='l2h-171'><tt class='method'>set_verify</tt></a></b>(<var>mode, callback</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 218 | <dd> |
| 219 | Set the verification flags for this Context object to <var>mode</var> and specify |
| 220 | that <var>callback</var> should be used for verification callbacks. <var>mode</var> |
| 221 | should be one of <tt class="constant">VERIFY_NONE</tt> and <tt class="constant">VERIFY_PEER</tt>. If |
| 222 | <tt class="constant">VERIFY_PEER</tt> is used, <var>mode</var> can be OR:ed with |
| 223 | <tt class="constant">VERIFY_FAIL_IF_NO_PEER_CERT</tt> and <tt class="constant">VERIFY_CLIENT_ONCE</tt> to |
| 224 | further control the behaviour. |
Jean-Paul Calderone | 420bf21 | 2008-02-19 21:19:30 -0500 | [diff] [blame] | 225 | <var>callback</var> should take five arguments: A Connection object, an X509 object, |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 226 | and three integer variables, which are in turn potential error number, error |
| 227 | depth and return code. <var>callback</var> should return true if verification passes |
| 228 | and false otherwise. |
| 229 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 230 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 231 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 232 | <dl><dt><b><a name='l2h-172'><tt class='method'>set_verify_depth</tt></a></b>(<var>depth</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 233 | <dd> |
| 234 | Set the maximum depth for the certificate chain verification that shall be |
| 235 | allowed for this Context object. |
| 236 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 237 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 238 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 239 | <dl><dt><b><a name='l2h-173'><tt class='method'>use_certificate</tt></a></b>(<var>cert</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 240 | <dd> |
| 241 | Use the certificate <var>cert</var> which has to be a X509 object. |
| 242 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 243 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 244 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 245 | <dl><dt><b><a name='l2h-174'><tt class='method'>add_extra_chain_cert</tt></a></b>(<var>cert</var>) |
Jean-Paul Calderone | 87b4060 | 2008-02-19 21:13:25 -0500 | [diff] [blame] | 246 | <dd> |
| 247 | Adds the certificate <var>cert</var>, which has to be a X509 object, to the |
| 248 | certificate chain presented together with the certificate. |
| 249 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 250 | |
Jean-Paul Calderone | 87b4060 | 2008-02-19 21:13:25 -0500 | [diff] [blame] | 251 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 252 | <dl><dt><b><a name='l2h-175'><tt class='method'>use_certificate_chain_file</tt></a></b>(<var>file</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 253 | <dd> |
| 254 | Load a certificate chain from <var>file</var> which must be PEM encoded. |
| 255 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 256 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 257 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 258 | <dl><dt><b><a name='l2h-176'><tt class='method'>use_privatekey</tt></a></b>(<var>pkey</var>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 259 | <dd> |
| 260 | Use the private key <var>pkey</var> which has to be a PKey object. |
| 261 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 262 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 263 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 264 | <dl><dt><b><a name='l2h-177'><tt class='method'>use_certificate_file</tt></a></b>(<var>file</var><big>[</big><var>, format</var><big>]</big>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 265 | <dd> |
| 266 | Load the first certificate found in <var>file</var>. The certificate must be in the |
| 267 | format specified by <var>format</var>, which is either <tt class="constant">FILETYPE_PEM</tt> or |
| 268 | <tt class="constant">FILETYPE_ASN1</tt>. The default is <tt class="constant">FILETYPE_PEM</tt>. |
| 269 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 270 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 271 | <P> |
Jean-Paul Calderone | 78caacc | 2011-04-07 15:41:56 -0400 | [diff] [blame] | 272 | <dl><dt><b><a name='l2h-178'><tt class='method'>use_privatekey_file</tt></a></b>(<var>file</var><big>[</big><var>, format</var><big>]</big>) |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 273 | <dd> |
| 274 | Load the first private key found in <var>file</var>. The private key must be in the |
| 275 | format specified by <var>format</var>, which is either <tt class="constant">FILETYPE_PEM</tt> or |
| 276 | <tt class="constant">FILETYPE_ASN1</tt>. The default is <tt class="constant">FILETYPE_PEM</tt>. |
| 277 | </dl> |
Jean-Paul Calderone | 2aa2b33 | 2008-03-06 21:43:14 -0500 | [diff] [blame] | 278 | |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 279 | <P> |
| 280 | |
| 281 | <DIV CLASS="navigation"> |
| 282 | <p><hr> |
| 283 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 284 | <tr> |
| 285 | <td><A href="openssl-ssl.html"><img src="previous.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 286 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 287 | alt="Previous Page" width="32"></A></td> |
| 288 | <td><A href="openssl-ssl.html"><img src="up.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 289 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 290 | alt="Up One Level" width="32"></A></td> |
| 291 | <td><A href="openssl-connection.html"><img src="next.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 292 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 293 | alt="Next Page" width="32"></A></td> |
| 294 | <td align="center" width="100%">Python OpenSSL Manual</td> |
| 295 | <td><A href="contents.html"><img src="contents.gif" |
Jean-Paul Calderone | 215d51b | 2009-11-13 09:19:21 -0500 | [diff] [blame] | 296 | border="0" height="32" |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 297 | alt="Contents" width="32"></A></td> |
| 298 | <td><img src="blank.gif" |
| 299 | border="0" height="32" |
| 300 | alt="" width="32"></td> |
| 301 | <td><img src="blank.gif" |
| 302 | border="0" height="32" |
| 303 | alt="" width="32"></td> |
| 304 | </tr></table> |
| 305 | <b class="navlabel">Previous:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL </A> |
| 306 | <b class="navlabel">Up:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL </A> |
| 307 | <b class="navlabel">Next:</b> <a class="sectref" href="openssl-connection.html">3.3.2 Connection objects</A> |
| 308 | <hr> |
Jean-Paul Calderone | 26ebc9e | 2011-04-11 19:57:10 -0400 | [diff] [blame] | 309 | <span class="release-info">Release 0.12.</span> |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 310 | </DIV> |
| 311 | <!--End of Navigation Panel--> |
| 312 | |
| 313 | </BODY> |
| 314 | </HTML> |