16
16
<table align="center" width="100%" cellpadding="0" cellspacing="2">
18
18
<td><A href="openssl-rand.html"><img src="previous.gif"
19
border="0" height="32"
19
border="0" height="32"
20
20
alt="Previous Page" width="32"></A></td>
21
21
<td><A href="openssl.html"><img src="up.gif"
22
border="0" height="32"
22
border="0" height="32"
23
23
alt="Up One Level" width="32"></A></td>
24
24
<td><A href="openssl-context.html"><img src="next.gif"
25
border="0" height="32"
25
border="0" height="32"
26
26
alt="Next Page" width="32"></A></td>
27
27
<td align="center" width="100%">Python OpenSSL Manual</td>
28
28
<td><A href="contents.html"><img src="contents.gif"
29
border="0" height="32"
29
border="0" height="32"
30
30
alt="Contents" width="32"></A></td>
31
31
<td><img src="blank.gif"
32
32
border="0" height="32"
54
55
Context, Connection.
57
<dl><dt><b><a name='l2h-100'><tt>SSLv2_METHOD</tt></a></b>
58
<dl><dt><b><a name='l2h-109'><tt>SSLv2_METHOD</tt></a></b>
59
<dt><b><a name='l2h-114'><tt>SSLv3_METHOD</tt></a></b><dd>
60
<dt><b><a name='l2h-115'><tt>SSLv23_METHOD</tt></a></b><dd>
61
<dt><b><a name='l2h-116'><tt>TLSv1_METHOD</tt></a></b><dd>
60
<dt><b><a name='l2h-123'><tt>SSLv3_METHOD</tt></a></b><dd>
61
<dt><b><a name='l2h-124'><tt>SSLv23_METHOD</tt></a></b><dd>
62
<dt><b><a name='l2h-125'><tt>TLSv1_METHOD</tt></a></b><dd>
62
63
These constants represent the different SSL methods to use when creating a
67
<dl><dt><b><a name='l2h-101'><tt>VERIFY_NONE</tt></a></b>
68
<dl><dt><b><a name='l2h-110'><tt>VERIFY_NONE</tt></a></b>
69
<dt><b><a name='l2h-117'><tt>VERIFY_PEER</tt></a></b><dd>
70
<dt><b><a name='l2h-118'><tt>VERIFY_FAIL_IF_NO_PEER_CERT</tt></a></b><dd>
70
<dt><b><a name='l2h-126'><tt>VERIFY_PEER</tt></a></b><dd>
71
<dt><b><a name='l2h-127'><tt>VERIFY_FAIL_IF_NO_PEER_CERT</tt></a></b><dd>
71
72
These constants represent the verification mode used by the Context
72
73
object's <tt class="method">set_verify</tt> method.
76
<dl><dt><b><a name='l2h-102'><tt>FILETYPE_PEM</tt></a></b>
77
<dl><dt><b><a name='l2h-111'><tt>FILETYPE_PEM</tt></a></b>
78
<dt><b><a name='l2h-119'><tt>FILETYPE_ASN1</tt></a></b><dd>
79
<dt><b><a name='l2h-128'><tt>FILETYPE_ASN1</tt></a></b><dd>
79
80
File type constants used with the <tt class="method">use_certificate_file</tt> and
80
81
<tt class="method">use_privatekey_file</tt> methods of Context objects.
84
<dl><dt><b><a name='l2h-103'><tt>OP_SINGLE_DH_USE</tt></a></b>
85
<dl><dt><b><a name='l2h-112'><tt>OP_SINGLE_DH_USE</tt></a></b>
86
<dt><b><a name='l2h-120'><tt>OP_EPHEMERAL_RSA</tt></a></b><dd>
87
<dt><b><a name='l2h-121'><tt>OP_NO_SSLv2</tt></a></b><dd>
88
<dt><b><a name='l2h-122'><tt>OP_NO_SSLv3</tt></a></b><dd>
89
<dt><b><a name='l2h-123'><tt>OP_NO_TLSv1</tt></a></b><dd>
87
<dt><b><a name='l2h-129'><tt>OP_EPHEMERAL_RSA</tt></a></b><dd>
88
<dt><b><a name='l2h-130'><tt>OP_NO_SSLv2</tt></a></b><dd>
89
<dt><b><a name='l2h-131'><tt>OP_NO_SSLv3</tt></a></b><dd>
90
<dt><b><a name='l2h-132'><tt>OP_NO_TLSv1</tt></a></b><dd>
90
91
Constants used with <tt class="method">set_options</tt> of Context objects.
91
92
<tt class="constant">OP_SINGLE_DH_USE</tt> means to always create a new key when using ephemeral
92
93
Diffie-Hellman. <tt class="constant">OP_EPHEMERAL_RSA</tt> means to always use ephemeral RSA keys
100
<dl><dt><b><a name='l2h-104'><tt>ContextType</tt></a></b>
101
<dl><dt><b><a name='l2h-113'><tt>ContextType</tt></a></b>
102
A Python type object representing the Context object type.
103
See <tt class="class">Context</tt>.
106
<dl><dt><b><a name='l2h-105'><tt class='function'>Context</tt></a></b>(<var>method</var>)
107
<dl><dt><b>class <a name='l2h-114'><tt class='class'>Context</tt></a></b>(<var>method</var>)
108
Factory function that creates a new Context object given an SSL method. The
109
method should be <tt class="constant">SSLv2_METHOD</tt>, <tt class="constant">SSLv3_METHOD</tt>,
109
A class representing SSL contexts. Contexts define the parameters of one or
110
more SSL connections.
113
<var>method</var> should be <tt class="constant">SSLv2_METHOD</tt>, <tt class="constant">SSLv3_METHOD</tt>,
110
114
<tt class="constant">SSLv23_METHOD</tt> or <tt class="constant">TLSv1_METHOD</tt>.
114
<dl><dt><b><a name='l2h-106'><tt>ConnectionType</tt></a></b>
116
A Python type object representing the Connection object type.
120
<dl><dt><b><a name='l2h-107'><tt class='function'>Connection</tt></a></b>(<var>context, socket</var>)
122
Factory fucnction that creates a new Connection object given an SSL context and
123
a socket <A NAME="tex2html4"
124
HREF="#foot975"><SUP>3</SUP></A> object.
128
<dl><dt><b>exception <a name='l2h-108'><tt class='exception'>Error</tt></a></b>
118
<dl><dt><b><a name='l2h-115'><tt>ConnectionType</tt></a></b>
120
See <tt class="class">Connection</tt>.
124
<dl><dt><b>class <a name='l2h-116'><tt class='class'>Connection</tt></a></b>(<var>context, socket</var>)
126
A class representing SSL connections.
129
<var>context</var> should be an instance of <tt class="class">Context</tt> and <var>socket</var>
130
should be a socket <A NAME="tex2html4"
131
HREF="#foot1112"><SUP>3</SUP></A> object. <var>socket</var> may be
132
<var>None</var>; in this case, the Connection is created with a memory BIO: see
133
the <tt class="method">bio_read</tt>, <tt class="method">bio_write</tt>, and <tt class="method">bio_shutdown</tt>
138
<dl><dt><b>exception <a name='l2h-117'><tt class='exception'>Error</tt></a></b>
130
140
This exception is used as a base class for the other SSL-related
131
141
exceptions, but may also be raised directly.
142
<dl><dt><b>exception <a name='l2h-109'><tt class='exception'>ZeroReturnError</tt></a></b>
152
<dl><dt><b>exception <a name='l2h-118'><tt class='exception'>ZeroReturnError</tt></a></b>
144
154
This exception matches the error return code <code>SSL_ERROR_ZERO_RETURN</code>, and
145
155
is raised when the SSL Connection has been closed. In SSL 3.0 and TLS 1.0, this
156
<dl><dt><b>exception <a name='l2h-110'><tt class='exception'>WantReadError</tt></a></b>
166
<dl><dt><b>exception <a name='l2h-119'><tt class='exception'>WantReadError</tt></a></b>
158
168
The operation did not complete; the same I/O method should be called again
159
169
later, with the same arguments. Any I/O method can lead to this since new
160
170
handshakes can occur at any time.
173
The wanted read is for <i>dirty</i> data sent over the network, not the
174
<i>clean</i> data inside the tunnel. For a socket based SSL connection,
175
<i>read</i> means data coming at us over the network. Until that read
176
succeeds, the attempted <tt class="method">OpenSSL.SSL.Connection.recv</tt>,
177
<tt class="method">OpenSSL.SSL.Connection.send</tt>, or
178
<tt class="method">OpenSSL.SSL.Connection.do_handshake</tt> is prevented or incomplete. You
179
probably want to <tt class="method">select()</tt> on the socket before trying again.
164
<dl><dt><b>exception <a name='l2h-111'><tt class='exception'>WantWriteError</tt></a></b>
183
<dl><dt><b>exception <a name='l2h-120'><tt class='exception'>WantWriteError</tt></a></b>
166
See <tt class="exception">WantReadError</tt>.
185
See <tt class="exception">WantReadError</tt>. The socket send buffer may be too full to
170
<dl><dt><b>exception <a name='l2h-112'><tt class='exception'>WantX509LookupError</tt></a></b>
190
<dl><dt><b>exception <a name='l2h-121'><tt class='exception'>WantX509LookupError</tt></a></b>
172
192
The operation did not complete because an application callback has asked to be
173
193
called again. The I/O method should be called again later, with the same
179
<dl><dt><b>exception <a name='l2h-113'><tt class='exception'>SysCallError</tt></a></b>
199
<dl><dt><b>exception <a name='l2h-122'><tt class='exception'>SysCallError</tt></a></b>
181
201
The <tt class="exception">SysCallError</tt> occurs when there's an I/O error and OpenSSL's
182
202
error queue does not contain any information. This can mean two things: An
189
209
<BR><HR><H4>Footnotes</H4>
191
<DT><A NAME="foot975">... socket</A><A
211
<DT><A NAME="foot1112">... socket</A><A
192
212
href="openssl-ssl.html#tex2html4"><SUP>3</SUP></A></DT>
193
<DD>Actually, all that is required is an object that
194
<i>behaves</i> like a socket, you could even use files, even though it'd be
195
tricky to get the handshakes right!
213
<DD>Actually, all that is required is an object
214
that <i>behaves</i> like a socket, you could even use files, even though
215
it'd be tricky to get the handshakes right!
201
220
<!--Table of Child-Links-->
202
221
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
214
233
<table align="center" width="100%" cellpadding="0" cellspacing="2">
216
235
<td><A href="openssl-rand.html"><img src="previous.gif"
217
border="0" height="32"
236
border="0" height="32"
218
237
alt="Previous Page" width="32"></A></td>
219
238
<td><A href="openssl.html"><img src="up.gif"
220
border="0" height="32"
239
border="0" height="32"
221
240
alt="Up One Level" width="32"></A></td>
222
241
<td><A href="openssl-context.html"><img src="next.gif"
223
border="0" height="32"
242
border="0" height="32"
224
243
alt="Next Page" width="32"></A></td>
225
244
<td align="center" width="100%">Python OpenSSL Manual</td>
226
245
<td><A href="contents.html"><img src="contents.gif"
227
border="0" height="32"
246
border="0" height="32"
228
247
alt="Contents" width="32"></A></td>
229
248
<td><img src="blank.gif"
230
249
border="0" height="32"
237
256
<b class="navlabel">Up:</b> <a class="sectref" href="openssl.html">3 OpenSSL </A>
238
257
<b class="navlabel">Next:</b> <a class="sectref" href="openssl-context.html">3.3.1 Context objects</A>
240
<span class="release-info">Release 0.9.</span>
259
<span class="release-info">Release 0.10.</span>
242
261
<!--End of Navigation Panel-->