~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/ssl/doc/src/old_ssl.xml

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE erlref SYSTEM "erlref.dtd">
 
3
 
 
4
<erlref>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>1999</year><year>2010</year>
 
8
      <holder>Ericsson AB. All Rights Reserved.</holder>
 
9
    </copyright>
 
10
    <legalnotice>
 
11
      The contents of this file are subject to the Erlang Public License,
 
12
      Version 1.1, (the "License"); you may not use this file except in
 
13
      compliance with the License. You should have received a copy of the
 
14
      Erlang Public License along with this software. If not, it can be
 
15
      retrieved online at http://www.erlang.org/.
 
16
 
 
17
      Software distributed under the License is distributed on an "AS IS"
 
18
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
19
      the License for the specific language governing rights and limitations
 
20
      under the License.
 
21
 
 
22
    </legalnotice>
 
23
 
 
24
    <title>ssl</title>
 
25
    <prepared>Peter H&ouml;gfeldt</prepared>
 
26
    <responsible>Peter H&ouml;gfeldt</responsible>
 
27
    <docno></docno>
 
28
    <approved>Peter H&ouml;gfeldt</approved>
 
29
    <checked></checked>
 
30
    <date>2003-03-25</date>
 
31
    <rev>D</rev>
 
32
    <file>old_ssl.xml</file>
 
33
  </header>
 
34
  <module>old_ssl</module>
 
35
  <modulesummary>Interface Functions for Secure Socket Layer</modulesummary>
 
36
  <description>
 
37
    <p>This module contains interface functions to the Secure Socket Layer.</p>
 
38
  </description>
 
39
 
 
40
  <section>
 
41
    <title>General</title>
 
42
 
 
43
    <p>This manual page describes functions that are defined
 
44
      in the ssl module and represents the old ssl implementation
 
45
      that coexists with the new one until it has been
 
46
      totally phased out. </p>
 
47
 
 
48
   <p>The old implementation can be
 
49
      accessed by providing the option {ssl_imp, old} to the
 
50
      ssl:connect and ssl:listen functions.</p>
 
51
      
 
52
    <p>The reader is advised to also read the <c>ssl(6)</c> manual page
 
53
      describing the SSL application.
 
54
      </p>
 
55
    <warning>
 
56
      <p>It is strongly advised to seed the random generator after
 
57
        the ssl application has been started (see <c>seed/1</c>
 
58
        below), and before any connections are established. Although
 
59
        the port program interfacing to the ssl libraries does a
 
60
        "random" seeding of its own in order to make everything work
 
61
        properly, that seeding is by no means random for the world
 
62
        since it has a constant value which is known to everyone
 
63
        reading the source code of the port program.</p>
 
64
    </warning>
 
65
  </section>
 
66
 
 
67
  <section>
 
68
    <title>Common data types</title>
 
69
    <p>The following datatypes are used in the functions below:
 
70
      </p>
 
71
    <list type="bulleted">
 
72
      <item>
 
73
        <p><c>options() = [option()]</c></p>
 
74
      </item>
 
75
      <item>
 
76
        <p><c>option() = socketoption() | ssloption()</c></p>
 
77
      </item>
 
78
      <item>
 
79
        <p><c>socketoption() = {mode, list} | {mode, binary} |  binary | {packet, packettype()} | {header, integer()} | {nodelay, boolean()} | {active, activetype()} |  {backlog, integer()} | {ip, ipaddress()} | {port, integer()}</c></p>
 
80
      </item>
 
81
      <item>
 
82
        <p><c>ssloption() = {verify, code()} | {depth, depth()} |  {certfile, path()} | {keyfile, path()} | {password, string()} | {cacertfile, path()} | {ciphers, string()}</c></p>
 
83
      </item>
 
84
      <item>
 
85
        <p><c>packettype()</c>  (see inet(3))</p>
 
86
      </item>
 
87
      <item>
 
88
        <p><c>activetype()</c>  (see inet(3))</p>
 
89
      </item>
 
90
      <item>
 
91
        <p><c>reason() = atom() | {atom(), string()}</c></p>
 
92
      </item>
 
93
      <item>
 
94
        <p><c>bytes() = [byte()]</c></p>
 
95
      </item>
 
96
      <item>
 
97
        <p><c>string() = [byte()]</c></p>
 
98
      </item>
 
99
      <item>
 
100
        <p><c>byte() = 0 | 1 | 2 | ... | 255</c></p>
 
101
      </item>
 
102
      <item>
 
103
        <p><c>code() = 0 | 1 | 2</c></p>
 
104
      </item>
 
105
      <item>
 
106
        <p><c>depth() = byte()</c></p>
 
107
      </item>
 
108
      <item>
 
109
        <p><c>address() = hostname() | ipstring() | ipaddress()</c></p>
 
110
      </item>
 
111
      <item>
 
112
        <p><c>ipaddress() = ipstring() | iptuple()</c></p>
 
113
      </item>
 
114
      <item>
 
115
        <p><c>hostname() = string()</c></p>
 
116
      </item>
 
117
      <item>
 
118
        <p><c>ipstring() = string()</c></p>
 
119
      </item>
 
120
      <item>
 
121
        <p><c>iptuple() = {byte(), byte(), byte(), byte()}</c></p>
 
122
      </item>
 
123
      <item>
 
124
        <p><c>sslsocket()</c></p>
 
125
      </item>
 
126
      <item>
 
127
        <p><c>protocol() = sslv2 | sslv3 | tlsv1</c></p>
 
128
      </item>
 
129
      <item>
 
130
        <p><c></c></p>
 
131
      </item>
 
132
    </list>
 
133
    <p>The socket option <c>{backlog, integer()}</c> is for
 
134
      <c>listen/2</c> only, and the option <c>{port, integer()}</c>
 
135
      is for <c>connect/3/4</c> only. 
 
136
      </p>
 
137
    <p>The following socket options are set by default: <c>{mode, list}</c>, <c>{packet, 0}</c>, <c>{header, 0}</c>, <c>{nodelay, false}</c>, <c>{active, true}</c>, <c>{backlog, 5}</c>,
 
138
      <c>{ip, {0,0,0,0}}</c>, and <c>{port, 0}</c>.
 
139
      </p>
 
140
    <p>Note that the options <c>{mode, binary}</c> and <c>binary</c>
 
141
      are equivalent. Similarly <c>{mode, list}</c> and the absence of
 
142
      option <c>binary</c> are equivalent. 
 
143
      </p>
 
144
    <p>The ssl options are for setting specific SSL parameters as follows:
 
145
      </p>
 
146
    <list type="bulleted">
 
147
      <item>
 
148
        <p><c>{verify, code()}</c> Specifies type of verification:
 
149
          0 = do not verify peer; 1 = verify peer, 2 = verify peer,
 
150
          fail if no peer certificate.  The default value is 0.
 
151
          </p>
 
152
      </item>
 
153
      <item>
 
154
        <p><c>{depth, depth()}</c> Specifies the maximum
 
155
          verification depth, i.e. how far in a chain of certificates
 
156
          the verification process can proceed before the verification
 
157
          is considered to fail. 
 
158
          </p>
 
159
        <p>Peer certificate = 0, CA certificate = 1, higher level CA
 
160
          certificate = 2, etc.  The value 2 thus means that a chain
 
161
          can at most contain peer cert, CA cert, next CA cert, and an
 
162
          additional CA cert.
 
163
          </p>
 
164
        <p>The default value is 1.
 
165
          </p>
 
166
      </item>
 
167
      <item>
 
168
        <p><c>{certfile, path()}</c> Path to a file containing the
 
169
          user's certificate.
 
170
          chain of PEM encoded certificates.</p>
 
171
      </item>
 
172
      <item>
 
173
        <p><c>{keyfile, path()}</c> Path to file containing user's
 
174
          private PEM encoded key.</p>
 
175
      </item>
 
176
      <item>
 
177
        <p><c>{password, string()}</c> String containing the user's
 
178
          password. Only used if the private keyfile is password protected.</p>
 
179
      </item>
 
180
      <item>
 
181
        <p><c>{cacertfile, path()}</c> Path to file containing PEM encoded
 
182
          CA certificates (trusted certificates used for verifying a peer
 
183
          certificate).</p>
 
184
      </item>
 
185
      <item>
 
186
        <p><c>{ciphers, string()}</c> String of ciphers as a colon
 
187
          separated list of ciphers. The function <c>ciphers/0</c> can
 
188
          be used to find all available ciphers.</p>
 
189
      </item>
 
190
    </list>
 
191
    <p>The type <c>sslsocket()</c> is opaque to the user.
 
192
      </p>
 
193
    <p>The owner of a socket is the one that created it by a call to
 
194
      <c>transport_accept/[1,2]</c>,  <c>connect/[3,4]</c>,
 
195
      or <c>listen/2</c>.
 
196
      </p>
 
197
    <p>When a socket is in active mode (the default), data from the
 
198
      socket is delivered to the owner of the socket in the form of
 
199
      messages:
 
200
      </p>
 
201
    <list type="bulleted">
 
202
      <item>
 
203
        <p><c>{ssl, Socket, Data}</c></p>
 
204
      </item>
 
205
      <item>
 
206
        <p><c>{ssl_closed, Socket}</c></p>
 
207
      </item>
 
208
      <item>
 
209
        <p><c>{ssl_error, Socket, Reason}</c></p>
 
210
      </item>
 
211
    </list>
 
212
    <p>A <c>Timeout</c> argument specifies a timeout in milliseconds. The 
 
213
      default value for a <c>Timeout</c> argument is <c>infinity</c>.
 
214
      </p>
 
215
    <p>Functions listed below may return the value <c>{error, closed}</c>, which only indicates that the SSL socket is
 
216
      considered closed for the operation in question. It is for
 
217
      instance possible to have <c>{error, closed}</c> returned from
 
218
      an call to <c>send/2</c>, and a subsequent call to <c>recv/3</c>
 
219
      returning <c>{ok, Data}</c>.
 
220
      </p>
 
221
    <p>Hence a return value of <c>{error, closed}</c> must not be
 
222
      interpreted as if the socket was completely closed. On the
 
223
      contrary, in order to free all resources occupied by an SSL
 
224
      socket, <c>close/1</c> must be called, or else the process owning
 
225
      the socket has to terminate.
 
226
      </p>
 
227
    <p>For each SSL socket there is an Erlang process representing the
 
228
      socket.  When a socket is opened, that process links to the
 
229
      calling client process.  Implementations that want to detect
 
230
      abnormal exits from the socket process by receiving <c>{'EXIT', Pid, Reason}</c> messages, should use the function <c>pid/1</c>
 
231
      to retrieve the process identifier from the socket, in order to
 
232
      be able to match exit messages properly.</p>
 
233
  </section>
 
234
  <funcs>
 
235
    <func>
 
236
      <name>ciphers() -> {ok, string()} | {error, enotstarted}</name>
 
237
      <fsummary>Get supported ciphers.</fsummary>
 
238
      <desc>
 
239
        <p>Returns a string consisting of colon separated cipher
 
240
          designations that are supported by the current SSL library
 
241
          implementation.
 
242
          </p>
 
243
        <p>The SSL application has to be started to return the string
 
244
          of ciphers.</p>
 
245
      </desc>
 
246
    </func>
 
247
    <func>
 
248
      <name>close(Socket) -> ok | {error, Reason}</name>
 
249
      <fsummary>Close a socket returned by <c>transport_accept/[1,2]</c>, <c>connect/3/4</c>, or <c>listen/2</c>.</fsummary>
 
250
      <type>
 
251
        <v>Socket = sslsocket()</v>
 
252
      </type>
 
253
      <desc>
 
254
        <p>Closes a socket returned by <c>transport_accept/[1,2]</c>,
 
255
        <c>connect/[3,4]</c>, or <c>listen/2</c></p>
 
256
      </desc>
 
257
    </func>
 
258
    <func>
 
259
      <name>connect(Address, Port, Options) -> {ok, Socket} | {error, Reason}</name>
 
260
      <name>connect(Address, Port, Options, Timeout) -> {ok, Socket} | {error, Reason}</name>
 
261
      <fsummary>Connect to <c>Port</c>at <c>Address</c>.</fsummary>
 
262
      <type>
 
263
        <v>Address = address()</v>
 
264
        <v>Port = integer()</v>
 
265
        <v>Options = [connect_option()]</v>
 
266
        <v>connect_option() = {mode, list} | {mode, binary} | binary | {packet, packettype()} | {header, integer()} | {nodelay, boolean()} | {active, activetype()} | {ip, ipaddress()} | {port, integer()} | {verify, code()} | {depth, depth()} | {certfile, path()} | {keyfile, path()} | {password, string()} | {cacertfile, path()} | {ciphers, string()}</v>
 
267
        <v>Timeout = integer()</v>
 
268
        <v>Socket = sslsocket()</v>
 
269
      </type>
 
270
      <desc>
 
271
        <p>Connects to <c>Port</c> at <c>Address</c>. If the optional 
 
272
          <c>Timeout</c> argument is specified, and a connection could not
 
273
          be established within the given time, <c>{error, timeout}</c> is
 
274
          returned. The default value for <c>Timeout</c> is <c>infinity</c>.
 
275
          </p>
 
276
        <p>The <c>ip</c> and <c>port</c> options are for binding to a 
 
277
          particular <em>local</em> address and port, respectively.</p>
 
278
      </desc>
 
279
    </func>
 
280
    <func>
 
281
      <name>connection_info(Socket) -> {ok, {Protocol, Cipher}} | {error, Reason}</name>
 
282
      <fsummary>Get current protocol version and cipher.</fsummary>
 
283
      <type>
 
284
        <v>Socket = sslsocket()</v>
 
285
        <v>Protocol = protocol()</v>
 
286
        <v>Cipher = string()</v>
 
287
      </type>
 
288
      <desc>
 
289
        <p>Gets the chosen protocol version and cipher for an established
 
290
          connection (accepted och connected). </p>
 
291
      </desc>
 
292
    </func>
 
293
    <func>
 
294
      <name>controlling_process(Socket, NewOwner) -> ok | {error, Reason}</name>
 
295
      <fsummary>Assign a new controlling process to the socket.</fsummary>
 
296
      <type>
 
297
        <v>Socket = sslsocket()</v>
 
298
        <v>NewOwner = pid()</v>
 
299
      </type>
 
300
      <desc>
 
301
        <p>Assigns a new controlling process to <c>Socket</c>. A controlling
 
302
          process is the owner of a socket, and receives all messages from
 
303
          the socket.</p>
 
304
      </desc>
 
305
    </func>
 
306
    <func>
 
307
      <name>format_error(ErrorCode) -> string()</name>
 
308
      <fsummary>Return an error string.</fsummary>
 
309
      <type>
 
310
        <v>ErrorCode = term()</v>
 
311
      </type>
 
312
      <desc>
 
313
        <p>Returns a diagnostic string describing an error.</p>
 
314
      </desc>
 
315
    </func>
 
316
    <func>
 
317
      <name>getopts(Socket, OptionsTags) -> {ok, Options} | {error, Reason}</name>
 
318
      <fsummary>Get options set for socket</fsummary>
 
319
      <type>
 
320
        <v>Socket = sslsocket()</v>
 
321
        <v>OptionTags = [optiontag()]()</v>
 
322
      </type>
 
323
      <desc>
 
324
        <p>Returns the options the tags of which are <c>OptionTags</c> for
 
325
          for the socket <c>Socket</c>. </p>
 
326
      </desc>
 
327
    </func>
 
328
    <func>
 
329
      <name>listen(Port, Options) -> {ok, ListenSocket} | {error, Reason}</name>
 
330
      <fsummary>Set up a socket to listen on a port on the local host.</fsummary>
 
331
      <type>
 
332
        <v>Port = integer()</v>
 
333
        <v>Options = [listen_option()]</v>
 
334
        <v>listen_option() = {mode, list} | {mode, binary} | binary | {packet, packettype()} | {header, integer()} | {active, activetype()} | {backlog, integer()} | {ip, ipaddress()} | {verify, code()} | {depth, depth()} | {certfile, path()} | {keyfile, path()} | {password, string()} | {cacertfile, path()} | {ciphers, string()}</v>
 
335
        <v>ListenSocket = sslsocket()</v>
 
336
      </type>
 
337
      <desc>
 
338
        <p>Sets up a socket to listen on port <c>Port</c> at the local host.
 
339
          If <c>Port</c> is zero, <c>listen/2</c> picks an available port
 
340
          number (use <c>port/1</c> to retrieve it).
 
341
          </p>
 
342
        <p>The listen queue size defaults to 5. If a different value is 
 
343
          wanted, the option <c>{backlog, Size}</c> should be added to the 
 
344
          list of options.
 
345
          </p>
 
346
        <p>An empty <c>Options</c> list is considered an error, and
 
347
          <c>{error, enooptions}</c> is returned.
 
348
          </p>
 
349
        <p>The returned <c>ListenSocket</c> can only be used in calls to 
 
350
          <c>transport_accept/[1,2]</c>.</p>
 
351
      </desc>
 
352
    </func>
 
353
    <func>
 
354
      <name>peercert(Socket) -> {ok, Cert} |  {error, Reason}</name>
 
355
      <fsummary>Return the peer certificate.</fsummary>
 
356
      <type>
 
357
        <v>Socket = sslsocket()</v>
 
358
        <v>Cert = binary()()</v>
 
359
        <v>Subject = term()()</v>
 
360
      </type>
 
361
      <desc>
 
362
        <p>Returns the DER encoded peer certificate, the certificate can be decoded with
 
363
          <c>public_key:pkix_decode_cert/2</c>.
 
364
        </p>
 
365
      </desc>
 
366
    </func>
 
367
    <func>
 
368
      <name>peername(Socket) -> {ok, {Address, Port}} | {error, Reason}</name>
 
369
      <fsummary>Return peer address and port.</fsummary>
 
370
      <type>
 
371
        <v>Socket = sslsocket()</v>
 
372
        <v>Address = ipaddress()</v>
 
373
        <v>Port = integer()</v>
 
374
      </type>
 
375
      <desc>
 
376
        <p>Returns the address and port number of the peer.</p>
 
377
      </desc>
 
378
    </func>
 
379
    <func>
 
380
      <name>pid(Socket) -> pid()</name>
 
381
      <fsummary>Return the pid of the socket process.</fsummary>
 
382
      <type>
 
383
        <v>Socket = sslsocket()</v>
 
384
      </type>
 
385
      <desc>
 
386
        <p>Returns the pid of the socket process. The returned pid should
 
387
          only be used for receiving exit messages.</p>
 
388
      </desc>
 
389
    </func>
 
390
    <func>
 
391
      <name>recv(Socket, Length) -> {ok, Data} | {error, Reason}</name>
 
392
      <name>recv(Socket, Length, Timeout) -> {ok, Data} | {error, Reason}</name>
 
393
      <fsummary>Receive data on socket.</fsummary>
 
394
      <type>
 
395
        <v>Socket = sslsocket()</v>
 
396
        <v>Length = integer() >= 0</v>
 
397
        <v>Timeout = integer()</v>
 
398
        <v>Data = bytes() | binary()</v>
 
399
      </type>
 
400
      <desc>
 
401
        <p>Receives data on socket <c>Socket</c> when the socket is in
 
402
          passive mode, i.e. when the option <c>{active, false}</c>
 
403
          has been specified.
 
404
          </p>
 
405
        <p>A notable return value is <c>{error, closed}</c> which
 
406
          indicates that the socket is closed.
 
407
          </p>
 
408
        <p>A positive value of the <c>Length</c> argument is only
 
409
          valid when the socket is in raw mode (option <c>{packet, 0}</c> is set, and the option <c>binary</c> is <em>not</em>
 
410
          set); otherwise it should be set to 0, whence all available
 
411
          bytes are returned.
 
412
          </p>
 
413
        <p>If the optional <c>Timeout</c> parameter is specified, and
 
414
          no data was available within the given time, <c>{error, timeout}</c> is returned. The default value for
 
415
          <c>Timeout</c> is <c>infinity</c>.</p>
 
416
      </desc>
 
417
    </func>
 
418
    <func>
 
419
      <name>seed(Data) -> ok | {error, Reason}</name>
 
420
      <fsummary>Seed the ssl random generator.</fsummary>
 
421
      <type>
 
422
        <v>Data = iolist() | binary()</v>
 
423
      </type>
 
424
      <desc>
 
425
        <p>Seeds the ssl random generator.
 
426
          </p>
 
427
        <p>It is strongly advised to seed the random generator after
 
428
          the ssl application has been started, and before any
 
429
          connections are established. Although the port program
 
430
          interfacing to the OpenSSL libraries does a "random" seeding
 
431
          of its own in order to make everything work properly, that
 
432
          seeding is by no means random for the world since it has a 
 
433
          constant value which is known to everyone reading the source
 
434
          code of the seeding. 
 
435
          </p>
 
436
        <p>A notable return value is <c>{error, edata}}</c> indicating that
 
437
          <c>Data</c> was not a binary nor an iolist.</p>
 
438
      </desc>
 
439
    </func>
 
440
    <func>
 
441
      <name>send(Socket, Data) -> ok | {error, Reason}</name>
 
442
      <fsummary>Write data to a socket.</fsummary>
 
443
      <type>
 
444
        <v>Socket = sslsocket()</v>
 
445
        <v>Data = iolist() | binary()</v>
 
446
      </type>
 
447
      <desc>
 
448
        <p>Writes <c>Data</c> to <c>Socket</c>. </p>
 
449
        <p>A notable return value is <c>{error, closed}</c> indicating that
 
450
          the socket is closed.</p>
 
451
      </desc>
 
452
    </func>
 
453
    <func>
 
454
      <name>setopts(Socket, Options) -> ok | {error, Reason}</name>
 
455
      <fsummary>Set socket options.</fsummary>
 
456
      <type>
 
457
        <v>Socket = sslsocket()</v>
 
458
        <v>Options = [socketoption]()</v>
 
459
      </type>
 
460
      <desc>
 
461
        <p>Sets options according to <c>Options</c> for the socket 
 
462
          <c>Socket</c>. </p>
 
463
      </desc>
 
464
    </func>
 
465
    <func>
 
466
      <name>ssl_accept(Socket) -> ok | {error, Reason}</name>
 
467
      <name>ssl_accept(Socket, Timeout) -> ok | {error, Reason}</name>
 
468
      <fsummary>Perform server-side SSL handshake and key exchange</fsummary>
 
469
      <type>
 
470
        <v>Socket = sslsocket()</v>
 
471
        <v>Timeout = integer()</v>
 
472
        <v>Reason = atom()</v>
 
473
      </type>
 
474
      <desc>
 
475
        <p>The <c>ssl_accept</c> function establish the SSL connection
 
476
          on the server side. It should be called directly after
 
477
          <c>transport_accept</c>, in the spawned server-loop.</p>
 
478
        <p>Note that the ssl connection is not complete until <c>ssl_accept</c>
 
479
          has returned <c>true</c>, and if an error is returned, the socket
 
480
          is unavailable and for instance <c>close/1</c> will crash.</p>
 
481
      </desc>
 
482
    </func>
 
483
    <func>
 
484
      <name>sockname(Socket) -> {ok, {Address, Port}} | {error, Reason}</name>
 
485
      <fsummary>Return the local address and port.</fsummary>
 
486
      <type>
 
487
        <v>Socket = sslsocket()</v>
 
488
        <v>Address = ipaddress()</v>
 
489
        <v>Port = integer()</v>
 
490
      </type>
 
491
      <desc>
 
492
        <p>Returns the local address and port number of the socket
 
493
          <c>Socket</c>.</p>
 
494
      </desc>
 
495
    </func>
 
496
    <func>
 
497
      <name>transport_accept(Socket) -> {ok, NewSocket} | {error, Reason}</name>
 
498
      <name>transport_accept(Socket, Timeout) -> {ok, NewSocket} | {error, Reason}</name>
 
499
      <fsummary>Accept an incoming connection and prepare for <c>ssl_accept</c></fsummary>
 
500
      <type>
 
501
        <v>Socket = NewSocket = sslsocket()</v>
 
502
        <v>Timeout = integer()</v>
 
503
        <v>Reason = atom()</v>
 
504
      </type>
 
505
      <desc>
 
506
        <p>Accepts an incoming connection request on a listen socket.
 
507
          <c>ListenSocket</c> must be a socket returned from <c>listen/2</c>.
 
508
          The socket returned should be passed to <c>ssl_accept</c> to
 
509
          complete ssl handshaking and establishing the connection.</p>
 
510
        <warning>
 
511
          <p>The socket returned can only be used with <c>ssl_accept</c>,
 
512
            no traffic can be sent or received before that call.</p>
 
513
        </warning>
 
514
        <p>The accepted socket inherits the options set for <c>ListenSocket</c>
 
515
          in <c>listen/2</c>.</p>
 
516
        <p>The default value for <c>Timeout</c> is <c>infinity</c>. If 
 
517
          <c>Timeout</c> is specified, and no connection is accepted within
 
518
          the given time, <c>{error, timeout}</c> is returned.</p>
 
519
      </desc>
 
520
    </func>
 
521
    <func>
 
522
      <name>version() -> {ok, {SSLVsn, CompVsn, LibVsn}}</name>
 
523
      <fsummary>Return the version of SSL.</fsummary>
 
524
      <type>
 
525
        <v>SSLVsn = CompVsn = LibVsn = string()()</v>
 
526
      </type>
 
527
      <desc>
 
528
        <p>Returns the SSL application version (<c>SSLVsn</c>), the library
 
529
          version used when compiling the SSL application port program
 
530
          (<c>CompVsn</c>), and the actual library version used when
 
531
          dynamically linking in runtime (<c>LibVsn</c>).
 
532
          </p>
 
533
        <p>If the SSL application has not been started, <c>CompVsn</c> and
 
534
          <c>LibVsn</c> are empty strings.
 
535
          </p>
 
536
      </desc>
 
537
    </func>
 
538
  </funcs>
 
539
 
 
540
  <section>
 
541
    <title>ERRORS</title>
 
542
    <p>The possible error reasons and the corresponding diagnostic strings 
 
543
      returned by <c>format_error/1</c> are either the same as those defined
 
544
      in the <c>inet(3)</c> reference manual, or as follows:
 
545
      </p>
 
546
    <taglist>
 
547
      <tag><c>closed</c></tag>
 
548
      <item>
 
549
        <p>Connection closed for the operation in question.
 
550
          </p>
 
551
      </item>
 
552
      <tag><c>ebadsocket</c></tag>
 
553
      <item>
 
554
        <p>Connection not found (internal error).
 
555
          </p>
 
556
      </item>
 
557
      <tag><c>ebadstate</c></tag>
 
558
      <item>
 
559
        <p>Connection not in connect state (internal error).
 
560
          </p>
 
561
      </item>
 
562
      <tag><c>ebrokertype</c></tag>
 
563
      <item>
 
564
        <p>Wrong broker type (internal error).
 
565
          </p>
 
566
      </item>
 
567
      <tag><c>ecacertfile</c></tag>
 
568
      <item>
 
569
        <p>Own CA certificate file is invalid.
 
570
          </p>
 
571
      </item>
 
572
      <tag><c>ecertfile</c></tag>
 
573
      <item>
 
574
        <p>Own certificate file is invalid.
 
575
          </p>
 
576
      </item>
 
577
      <tag><c>echaintoolong</c></tag>
 
578
      <item>
 
579
        <p>The chain of certificates provided by peer is too long.
 
580
          </p>
 
581
      </item>
 
582
      <tag><c>ecipher</c></tag>
 
583
      <item>
 
584
        <p>Own list of specified ciphers is invalid.
 
585
          </p>
 
586
      </item>
 
587
      <tag><c>ekeyfile</c></tag>
 
588
      <item>
 
589
        <p>Own private key file is invalid.
 
590
          </p>
 
591
      </item>
 
592
      <tag><c>ekeymismatch</c></tag>
 
593
      <item>
 
594
        <p>Own private key does not match own certificate.
 
595
          </p>
 
596
      </item>
 
597
      <tag><c>enoissuercert</c></tag>
 
598
      <item>
 
599
        <p>Cannot find certificate of issuer of certificate provided
 
600
          by peer.
 
601
          </p>
 
602
      </item>
 
603
      <tag><c>enoservercert</c></tag>
 
604
      <item>
 
605
        <p>Attempt to do accept without having set own certificate.
 
606
          </p>
 
607
      </item>
 
608
      <tag><c>enotlistener</c></tag>
 
609
      <item>
 
610
        <p>Attempt to accept on a non-listening socket.
 
611
          </p>
 
612
      </item>
 
613
      <tag><c>enoproxysocket</c></tag>
 
614
      <item>
 
615
        <p>No proxy socket found (internal error).
 
616
          </p>
 
617
      </item>
 
618
      <tag><c>enooptions</c></tag>
 
619
      <item>
 
620
        <p>The list of options is empty.
 
621
          </p>
 
622
      </item>
 
623
      <tag><c>enotstarted</c></tag>
 
624
      <item>
 
625
        <p>The SSL application has not been started.
 
626
          </p>
 
627
      </item>
 
628
      <tag><c>eoptions</c></tag>
 
629
      <item>
 
630
        <p>Invalid list of options.
 
631
          </p>
 
632
      </item>
 
633
      <tag><c>epeercert</c></tag>
 
634
      <item>
 
635
        <p>Certificate provided by peer is in error.
 
636
          </p>
 
637
      </item>
 
638
      <tag><c>epeercertexpired</c></tag>
 
639
      <item>
 
640
        <p>Certificate provided by peer has expired.
 
641
          </p>
 
642
      </item>
 
643
      <tag><c>epeercertinvalid</c></tag>
 
644
      <item>
 
645
        <p>Certificate provided by peer is invalid.
 
646
          </p>
 
647
      </item>
 
648
      <tag><c>eselfsignedcert</c></tag>
 
649
      <item>
 
650
        <p>Certificate provided by peer is self signed.
 
651
          </p>
 
652
      </item>
 
653
      <tag><c>esslaccept</c></tag>
 
654
      <item>
 
655
        <p>Server SSL handshake procedure between client and server failed.
 
656
          </p>
 
657
      </item>
 
658
      <tag><c>esslconnect</c></tag>
 
659
      <item>
 
660
        <p>Client SSL handshake procedure between client and server failed.
 
661
          </p>
 
662
      </item>
 
663
      <tag><c>esslerrssl</c></tag>
 
664
      <item>
 
665
        <p>SSL protocol failure. Typically because of a fatal alert 
 
666
          from peer.
 
667
          </p>
 
668
      </item>
 
669
      <tag><c>ewantconnect</c></tag>
 
670
      <item>
 
671
        <p>Protocol wants to connect, which is not supported in
 
672
          this version of the SSL application.
 
673
          </p>
 
674
      </item>
 
675
      <tag><c>ex509lookup</c></tag>
 
676
      <item>
 
677
        <p>Protocol wants X.509 lookup, which is not supported in
 
678
          this version of the SSL application.
 
679
          </p>
 
680
      </item>
 
681
      <tag><c>{badcall, Call}</c></tag>
 
682
      <item>
 
683
        <p>Call not recognized for current mode (active or passive) and
 
684
          state of socket.
 
685
          </p>
 
686
      </item>
 
687
      <tag><c>{badcast, Cast}</c></tag>
 
688
      <item>
 
689
        <p>Call not recognized for current mode (active or passive) and
 
690
          state of socket. 
 
691
          </p>
 
692
      </item>
 
693
      <tag><c>{badinfo, Info}</c></tag>
 
694
      <item>
 
695
        <p>Call not recognized for current mode (active or passive) and
 
696
          state of socket.
 
697
          </p>
 
698
      </item>
 
699
    </taglist>
 
700
  </section>
 
701
 
 
702
  <section>
 
703
    <title>SEE ALSO</title>
 
704
    <p>gen_tcp(3), inet(3) public_key(3) </p>
 
705
  </section>
 
706
  
 
707
</erlref>
 
708
 
 
709