~myers-1/pyopenssl/npn

« back to all changes in this revision

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

  • Committer: Jean-Paul Calderone
  • Date: 2010-01-25 22:55:30 UTC
  • mfrom: (126 trunk)
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: exarkun@divmod.com-20100125225530-5e9nsb6bzoesoz42
merge trunk and resolve simple conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
<table align="center" width="100%" cellpadding="0" cellspacing="2">
17
17
<tr>
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"
41
41
<br><hr>
42
42
</DIV>
43
43
<!--End of Navigation Panel-->
 
44
 
44
45
<H2><A NAME="SECTION000430000000000000000">&nbsp;</A>
45
46
<BR>
46
47
3.3 <tt class="module">SSL</tt> -- An interface to the SSL-specific parts of OpenSSL 
54
55
Context, Connection.
55
56
 
56
57
<P>
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>
58
59
<dd>
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
63
64
context object.
64
65
</dl>
65
66
 
66
67
<P>
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>
68
69
<dd>
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.
73
74
</dl>
74
75
 
75
76
<P>
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>
77
78
<dd>
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.
81
82
</dl>
82
83
 
83
84
<P>
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>
85
86
<dd>
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
97
98
</dl>
98
99
 
99
100
<P>
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>
101
102
<dd>
102
 
A Python type object representing the Context object type.
 
103
See <tt class="class">Context</tt>.
103
104
</dl>
104
105
 
105
106
<P>
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>)
107
108
<dd>
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.
 
111
 
 
112
<P>
 
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>.
111
115
</dl>
112
116
 
113
117
<P>
114
 
<dl><dt><b><a name='l2h-106'><tt>ConnectionType</tt></a></b>
115
 
<dd>
116
 
A Python type object representing the Connection object type.
117
 
</dl>
118
 
 
119
 
<P>
120
 
<dl><dt><b><a name='l2h-107'><tt class='function'>Connection</tt></a></b>(<var>context, socket</var>)
121
 
<dd>
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.
125
 
</dl>
126
 
 
127
 
<P>
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>
 
119
<dd>
 
120
See <tt class="class">Connection</tt>.
 
121
</dl>
 
122
 
 
123
<P>
 
124
<dl><dt><b>class <a name='l2h-116'><tt class='class'>Connection</tt></a></b>(<var>context, socket</var>)
 
125
<dd>
 
126
A class representing SSL connections.
 
127
 
 
128
<P>
 
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>
 
134
methods.
 
135
</dl>
 
136
 
 
137
<P>
 
138
<dl><dt><b>exception <a name='l2h-117'><tt class='exception'>Error</tt></a></b>
129
139
<dd>
130
140
This exception is used as a base class for the other SSL-related
131
141
exceptions, but may also be raised directly.
139
149
</dl>
140
150
 
141
151
<P>
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>
143
153
<dd>
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
153
163
</dl>
154
164
 
155
165
<P>
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>
157
167
<dd>
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.
 
171
 
 
172
<P>
 
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.
161
180
</dl>
162
181
 
163
182
<P>
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>
165
184
<dd>
166
 
See <tt class="exception">WantReadError</tt>.
 
185
See <tt class="exception">WantReadError</tt>.  The socket send buffer may be too full to
 
186
write more data.
167
187
</dl>
168
188
 
169
189
<P>
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>
171
191
<dd>
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
176
196
</dl>
177
197
 
178
198
<P>
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>
180
200
<dd>
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
188
208
<P>
189
209
<BR><HR><H4>Footnotes</H4>
190
210
<DL>
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!
196
216
 
197
217
</DD>
198
218
</DL>
199
219
<p><hr>
200
 
 
201
220
<!--Table of Child-Links-->
202
221
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
203
222
 
214
233
<table align="center" width="100%" cellpadding="0" cellspacing="2">
215
234
<tr>
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>
239
258
<hr>
240
 
<span class="release-info">Release 0.9.</span>
 
259
<span class="release-info">Release 0.10.</span>
241
260
</DIV>
242
261
<!--End of Navigation Panel-->
243
262