~zseil/pyopenssl/util-cleanup

« back to all changes in this revision

Viewing changes to doc/html/openssl-context.html

  • Committer: Jean-Paul Calderone
  • Date: 2009-11-13 14:19:21 UTC
  • Revision ID: exarkun@divmod.com-20091113141921-owxvonvw23qs0c81
Regenerate documentation for 0.10 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
<table align="center" width="100%" cellpadding="0" cellspacing="2">
18
18
<tr>
19
19
<td><A href="openssl-ssl.html"><img src="previous.gif"
20
 
border="0" height="32"
 
20
  border="0" height="32"
21
21
  alt="Previous Page" width="32"></A></td>
22
22
<td><A href="openssl-ssl.html"><img src="up.gif"
23
 
border="0" height="32"
 
23
  border="0" height="32"
24
24
  alt="Up One Level" width="32"></A></td>
25
25
<td><A href="openssl-connection.html"><img src="next.gif"
26
 
border="0" height="32"
 
26
  border="0" height="32"
27
27
  alt="Next Page" width="32"></A></td>
28
28
<td align="center" width="100%">Python OpenSSL Manual</td>
29
29
<td><A href="contents.html"><img src="contents.gif"
30
 
border="0" height="32"
 
30
  border="0" height="32"
31
31
  alt="Contents" width="32"></A></td>
32
32
<td><img src="blank.gif"
33
33
  border="0" height="32"
52
52
Context objects have the following methods:
53
53
 
54
54
<P>
55
 
<dl><dt><b><a name='l2h-124'><tt class='method'>check_privatekey</tt></a></b>()
 
55
<dl><dt><b><a name='l2h-133'><tt class='method'>check_privatekey</tt></a></b>()
56
56
<dd>
57
57
Check if the private key (loaded with <tt class="method">use_privatekey<big>[</big>_file<big>]</big></tt>)
58
58
matches the certificate (loaded with <tt class="method">use_certificate<big>[</big>_file<big>]</big></tt>).
60
60
</dl>
61
61
 
62
62
<P>
63
 
<dl><dt><b><a name='l2h-125'><tt class='method'>get_app_data</tt></a></b>()
 
63
<dl><dt><b><a name='l2h-134'><tt class='method'>get_app_data</tt></a></b>()
64
64
<dd>
65
65
Retrieve application data as set by <tt class="method">set_app_data</tt>.
66
66
</dl>
67
67
 
68
68
<P>
69
 
<dl><dt><b><a name='l2h-126'><tt class='method'>get_cert_store</tt></a></b>()
 
69
<dl><dt><b><a name='l2h-135'><tt class='method'>get_cert_store</tt></a></b>()
70
70
<dd>
71
71
Retrieve the certificate store (a X509Store object) that the context uses.
72
72
This can be used to add "trusted" certificates without using the.
74
74
</dl>
75
75
 
76
76
<P>
77
 
<dl><dt><b><a name='l2h-127'><tt class='method'>get_timeout</tt></a></b>()
 
77
<dl><dt><b><a name='l2h-136'><tt class='method'>get_timeout</tt></a></b>()
78
78
<dd>
79
79
Retrieve session timeout, as set by <tt class="method">set_timeout</tt>. The default is 300
80
80
seconds.
81
81
</dl>
82
82
 
83
83
<P>
84
 
<dl><dt><b><a name='l2h-128'><tt class='method'>get_verify_depth</tt></a></b>()
 
84
<dl><dt><b><a name='l2h-137'><tt class='method'>get_verify_depth</tt></a></b>()
85
85
<dd>
86
86
Retrieve the Context object's verify depth, as set by
87
87
<tt class="method">set_verify_depth</tt>.
88
88
</dl>
89
89
 
90
90
<P>
91
 
<dl><dt><b><a name='l2h-129'><tt class='method'>get_verify_mode</tt></a></b>()
 
91
<dl><dt><b><a name='l2h-138'><tt class='method'>get_verify_mode</tt></a></b>()
92
92
<dd>
93
93
Retrieve the Context object's verify mode, as set by <tt class="method">set_verify</tt>.
94
94
</dl>
95
95
 
96
96
<P>
97
 
<dl><dt><b><a name='l2h-130'><tt class='method'>load_client_ca</tt></a></b>(<var>pemfile</var>)
 
97
<dl><dt><b><a name='l2h-139'><tt class='method'>load_client_ca</tt></a></b>(<var>pemfile</var>)
98
98
<dd>
99
99
Read a file with PEM-formatted certificates that will be sent to the client
100
100
when requesting a client certificate.
101
101
</dl>
102
102
 
103
103
<P>
104
 
<dl><dt><b><a name='l2h-131'><tt class='method'>load_verify_locations</tt></a></b>(<var>pemfile, capath</var>)
 
104
<dl><dt><b><a name='l2h-140'><tt class='method'>set_client_ca_list</tt></a></b>(<var>certificate_authorities</var>)
 
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>
 
117
<dl><dt><b><a name='l2h-141'><tt class='method'>add_client_ca</tt></a></b>(<var>certificate_authority</var>)
 
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>
 
130
<dl><dt><b><a name='l2h-142'><tt class='method'>load_verify_locations</tt></a></b>(<var>pemfile, capath</var>)
105
131
<dd>
106
132
Specify where CA certificates for verification purposes are located. These
107
133
are trusted certificates. Note that the certificates have to be in PEM
111
137
</dl>
112
138
 
113
139
<P>
114
 
<dl><dt><b><a name='l2h-132'><tt class='method'>set_default_verify_paths</tt></a></b>()
 
140
<dl><dt><b><a name='l2h-143'><tt class='method'>set_default_verify_paths</tt></a></b>()
115
141
<dd>
116
142
Specify that the platform provided CA certificates are to be used for
117
143
verification purposes.  This method may not work properly on OS X.
118
144
</dl>
119
145
 
120
146
<P>
121
 
<dl><dt><b><a name='l2h-133'><tt class='method'>load_tmp_dh</tt></a></b>(<var>dhfile</var>)
 
147
<dl><dt><b><a name='l2h-144'><tt class='method'>load_tmp_dh</tt></a></b>(<var>dhfile</var>)
122
148
<dd>
123
149
Load parameters for Ephemeral Diffie-Hellman from <var>dhfile</var>.
124
150
</dl>
125
151
 
126
152
<P>
127
 
<dl><dt><b><a name='l2h-134'><tt class='method'>set_app_data</tt></a></b>(<var>data</var>)
 
153
<dl><dt><b><a name='l2h-145'><tt class='method'>set_app_data</tt></a></b>(<var>data</var>)
128
154
<dd>
129
155
Associate <var>data</var> with this Context object. <var>data</var> can be retrieved
130
156
later using the <tt class="method">get_app_data</tt> method.
131
157
</dl>
132
158
 
133
159
<P>
134
 
<dl><dt><b><a name='l2h-135'><tt class='method'>set_cipher_list</tt></a></b>(<var>ciphers</var>)
 
160
<dl><dt><b><a name='l2h-146'><tt class='method'>set_cipher_list</tt></a></b>(<var>ciphers</var>)
135
161
<dd>
136
162
Set the list of ciphers to be used in this context. See the OpenSSL manual for
137
163
more information (e.g. ciphers(1))
138
164
</dl>
139
165
 
140
166
<P>
141
 
<dl><dt><b><a name='l2h-136'><tt class='method'>set_info_callback</tt></a></b>(<var>callback</var>)
 
167
<dl><dt><b><a name='l2h-147'><tt class='method'>set_info_callback</tt></a></b>(<var>callback</var>)
142
168
<dd>
143
169
Set the information callback to <var>callback</var>. This function will be called
144
170
from time to time during SSL handshakes.
149
175
</dl>
150
176
 
151
177
<P>
152
 
<dl><dt><b><a name='l2h-137'><tt class='method'>set_options</tt></a></b>(<var>options</var>)
 
178
<dl><dt><b><a name='l2h-148'><tt class='method'>set_options</tt></a></b>(<var>options</var>)
153
179
<dd>
154
180
Add SSL options. Options you have set before are not cleared!
155
181
This method should be used with the <tt class="constant">OP_*</tt> constants.
156
182
</dl>
157
183
 
158
184
<P>
159
 
<dl><dt><b><a name='l2h-138'><tt class='method'>set_passwd_cb</tt></a></b>(<var>callback</var><big>[</big><var>, userdata</var><big>]</big>)
 
185
<dl><dt><b><a name='l2h-149'><tt class='method'>set_passwd_cb</tt></a></b>(<var>callback</var><big>[</big><var>, userdata</var><big>]</big>)
160
186
<dd>
161
187
Set the passphrase callback to <var>callback</var>. This function will be called
162
188
when a private key with a passphrase is loaded. <var>callback</var> must accept
170
196
</dl>
171
197
 
172
198
<P>
173
 
<dl><dt><b><a name='l2h-139'><tt class='method'>set_session_id</tt></a></b>(<var>name</var>)
 
199
<dl><dt><b><a name='l2h-150'><tt class='method'>set_session_id</tt></a></b>(<var>name</var>)
174
200
<dd>
175
201
Set the context <var>name</var> within which a session can be reused for this
176
202
Context object. This is needed when doing session resumption, because there is
179
205
</dl>
180
206
 
181
207
<P>
182
 
<dl><dt><b><a name='l2h-140'><tt class='method'>set_timeout</tt></a></b>(<var>timeout</var>)
 
208
<dl><dt><b><a name='l2h-151'><tt class='method'>set_timeout</tt></a></b>(<var>timeout</var>)
183
209
<dd>
184
210
Set the timeout for newly created sessions for this Context object to
185
211
<var>timeout</var>. <var>timeout</var> must be given in (whole) seconds. The default
188
214
</dl>
189
215
 
190
216
<P>
191
 
<dl><dt><b><a name='l2h-141'><tt class='method'>set_verify</tt></a></b>(<var>mode, callback</var>)
 
217
<dl><dt><b><a name='l2h-152'><tt class='method'>set_verify</tt></a></b>(<var>mode, callback</var>)
192
218
<dd>
193
219
Set the verification flags for this Context object to <var>mode</var> and specify
194
220
that <var>callback</var> should be used for verification callbacks. <var>mode</var>
203
229
</dl>
204
230
 
205
231
<P>
206
 
<dl><dt><b><a name='l2h-142'><tt class='method'>set_verify_depth</tt></a></b>(<var>depth</var>)
 
232
<dl><dt><b><a name='l2h-153'><tt class='method'>set_verify_depth</tt></a></b>(<var>depth</var>)
207
233
<dd>
208
234
Set the maximum depth for the certificate chain verification that shall be
209
235
allowed for this Context object.
210
236
</dl>
211
237
 
212
238
<P>
213
 
<dl><dt><b><a name='l2h-143'><tt class='method'>use_certificate</tt></a></b>(<var>cert</var>)
 
239
<dl><dt><b><a name='l2h-154'><tt class='method'>use_certificate</tt></a></b>(<var>cert</var>)
214
240
<dd>
215
241
Use the certificate <var>cert</var> which has to be a X509 object.
216
242
</dl>
217
243
 
218
244
<P>
219
 
<dl><dt><b><a name='l2h-144'><tt class='method'>add_extra_chain_cert</tt></a></b>(<var>cert</var>)
 
245
<dl><dt><b><a name='l2h-155'><tt class='method'>add_extra_chain_cert</tt></a></b>(<var>cert</var>)
220
246
<dd>
221
247
Adds the certificate <var>cert</var>, which has to be a X509 object, to the
222
248
certificate chain presented together with the certificate.
223
249
</dl>
224
250
 
225
251
<P>
226
 
<dl><dt><b><a name='l2h-145'><tt class='method'>use_certificate_chain_file</tt></a></b>(<var>file</var>)
 
252
<dl><dt><b><a name='l2h-156'><tt class='method'>use_certificate_chain_file</tt></a></b>(<var>file</var>)
227
253
<dd>
228
254
Load a certificate chain from <var>file</var> which must be PEM encoded.
229
255
</dl>
230
256
 
231
257
<P>
232
 
<dl><dt><b><a name='l2h-146'><tt class='method'>use_privatekey</tt></a></b>(<var>pkey</var>)
 
258
<dl><dt><b><a name='l2h-157'><tt class='method'>use_privatekey</tt></a></b>(<var>pkey</var>)
233
259
<dd>
234
260
Use the private key <var>pkey</var> which has to be a PKey object.
235
261
</dl>
236
262
 
237
263
<P>
238
 
<dl><dt><b><a name='l2h-147'><tt class='method'>use_certificate_file</tt></a></b>(<var>file</var><big>[</big><var>, format</var><big>]</big>)
 
264
<dl><dt><b><a name='l2h-158'><tt class='method'>use_certificate_file</tt></a></b>(<var>file</var><big>[</big><var>, format</var><big>]</big>)
239
265
<dd>
240
266
Load the first certificate found in <var>file</var>. The certificate must be in the
241
267
format specified by <var>format</var>, which is either <tt class="constant">FILETYPE_PEM</tt> or
243
269
</dl>
244
270
 
245
271
<P>
246
 
<dl><dt><b><a name='l2h-148'><tt class='method'>use_privatekey_file</tt></a></b>(<var>file</var><big>[</big><var>, format</var><big>]</big>)
 
272
<dl><dt><b><a name='l2h-159'><tt class='method'>use_privatekey_file</tt></a></b>(<var>file</var><big>[</big><var>, format</var><big>]</big>)
247
273
<dd>
248
274
Load the first private key found in <var>file</var>. The private key must be in the
249
275
format specified by <var>format</var>, which is either <tt class="constant">FILETYPE_PEM</tt> or
257
283
<table align="center" width="100%" cellpadding="0" cellspacing="2">
258
284
<tr>
259
285
<td><A href="openssl-ssl.html"><img src="previous.gif"
260
 
border="0" height="32"
 
286
  border="0" height="32"
261
287
  alt="Previous Page" width="32"></A></td>
262
288
<td><A href="openssl-ssl.html"><img src="up.gif"
263
 
border="0" height="32"
 
289
  border="0" height="32"
264
290
  alt="Up One Level" width="32"></A></td>
265
291
<td><A href="openssl-connection.html"><img src="next.gif"
266
 
border="0" height="32"
 
292
  border="0" height="32"
267
293
  alt="Next Page" width="32"></A></td>
268
294
<td align="center" width="100%">Python OpenSSL Manual</td>
269
295
<td><A href="contents.html"><img src="contents.gif"
270
 
border="0" height="32"
 
296
  border="0" height="32"
271
297
  alt="Contents" width="32"></A></td>
272
298
<td><img src="blank.gif"
273
299
  border="0" height="32"
280
306
<b class="navlabel">Up:</b> <a class="sectref" href="openssl-ssl.html">3.3 SSL  </A>
281
307
<b class="navlabel">Next:</b> <a class="sectref" href="openssl-connection.html">3.3.2 Connection objects</A>
282
308
<hr>
283
 
<span class="release-info">Release 0.9.</span>
 
309
<span class="release-info">Release 0.10.</span>
284
310
</DIV>
285
311
<!--End of Navigation Panel-->
286
312