aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/doc/src/ssl.xml
blob: b8f750191539e428a662eae8c59763a78c5e6f86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1999</year><year>2015</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.

      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.

    </legalnotice>
    <title>ssl</title>
    <prepared></prepared>
    <docno></docno>
    <date></date>
    <rev></rev>
    <file>ssl.xml</file>
  </header>
  <module>ssl</module>
  <modulesummary>Interface Functions for Secure Socket Layer</modulesummary>
  <description>
    <p>This module contains interface functions for the SSL.</p>
  </description>
  
  <section>
    <title>SSL</title>

    <list type="bulleted">
      <item><c>ssl</c> requires the <c>crypto</c> and <c>public_key</c> 
      applications.</item>
      <item>Supported SSL/TLS-versions are SSL-3.0, TLS-1.0,
      TLS-1.1, and TLS-1.2.</item>
      <item>For security reasons SSL-2.0 is not supported.</item>
      <item>For security reasons SSL-3.0 is no longer supported by default,
      but can be configured.</item>
      <item>Ephemeral Diffie-Hellman cipher suites are supported,
      but not Diffie Hellman Certificates cipher suites.</item>
      <item>Elliptic Curve cipher suites are supported if the <c>crypto</c> 
      application supports it and named curves are used.
      </item>
      <item>Export cipher suites are not supported as the
      U.S. lifted its export restrictions in early 2000.</item>
      <item>IDEA cipher suites are not supported as they have
      become deprecated by the latest TLS specification so it is not 
      motivated to implement them.</item>
      <item>CRL validation is supported.</item>
      <item>Policy certificate extensions are not supported.</item>
      <item>'Server Name Indication' extension client side
      (RFC 6066, Section 3) is supported.</item>
    </list>
 
  </section>
  
  <section>
    <title>DATA TYPES</title>
    <p>The following data types are used in the functions for <c>ssl</c>:</p>

    <taglist>

      <tag><c>boolean()</c></tag>
      <item><p><c>= true | false</c></p></item>

      <tag><c>option()</c></tag>
      <item><p><c>= socketoption() | ssloption() | transportoption()</c></p>
      </item>

      <tag><c>socketoption()</c></tag>
      <item><p><c>= proplists:property()</c></p>
      <p>The default socket options are
      <c>[{mode,list},{packet, 0},{header, 0},{active, true}]</c>.</p>
      <p>For valid options, see the
      <seealso marker="kernel:inet">inet(3)</seealso> and
      <seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso> manual pages
      in <c>kernel</c>.</p></item>

      <tag><c>ssloption()</c></tag>
      <item><p><c>= {verify, verify_type()}</c></p>
      <p><c>| {verify_fun, {fun(), term()}}</c></p>
      <p><c>| {fail_if_no_peer_cert, boolean()} {depth, integer()}</c></p>
      <p><c>| {cert, der_encoded()}</c></p>
      <p><c>| {certfile, path()}</c></p>
      <p><c>| {key, {'RSAPrivateKey'| 'DSAPrivateKey' | 'ECPrivateKey' 
      | 'PrivateKeyInfo', der_encoded()}}</c></p>
      <p><c>| {keyfile, path()}</c></p>
      <p><c>| {password, string()}</c></p>
      <p><c>| {cacerts, [der_encoded()]}</c></p>
      <p><c>| {cacertfile, path()}</c></p>
      <p><c>| {dh, der_encoded()}</c></p>
      <p><c>| {dhfile, path()}</c></p>
      <p><c>| {ciphers, ciphers()}</c></p>
      <p><c>| {user_lookup_fun, {fun(), term()}}, {psk_identity, string()},
      {srp_identity, {string(), string()}}</c></p>
      <p><c>| {ssl_imp, ssl_imp()}</c></p>
      <p><c>| {reuse_sessions, boolean()}</c></p>
      <p><c>| {reuse_session, fun()} {next_protocols_advertised, [binary()]}</c></p>
      <p><c>| {client_preferred_next_protocols, {client | server,
      [binary()]} | {client | server, [binary()], binary()}}</c></p>
      <p><c>| {log_alert, boolean()}</c></p>
      <p><c>| {server_name_indication, hostname() | disable}</c></p></item>

      <tag><c>transportoption()</c></tag>
      <item><p><c>= {cb_info, {CallbackModule::atom(), DataTag::atom(),
      ClosedTag::atom(), ErrTag:atom()}}</c></p>
      <p>Defaults to <c>{gen_tcp, tcp, tcp_closed, tcp_error}</c>. Can be used
      to customize the transport layer. The callback module must implement a
      reliable transport protocol, behave as <c>gen_tcp</c>, and have functions
      corresponding to <c>inet:setopts/2</c>, <c>inet:getopts/2</c>,
      <c>inet:peername/1</c>, <c>inet:sockname/1</c>, and <c>inet:port/1</c>.
      The callback <c>gen_tcp</c> is treated specially and calls <c>inet</c>
      directly.</p>
      <taglist>
	<tag><c>CallbackModule</c></tag>
	<item><p><c>= atom()</c></p></item>
	<tag><c>DataTag</c></tag>
	<item><p><c>= atom()</c></p>
	<p>Used in socket data message.</p></item>
	<tag><c>ClosedTag</c></tag>
	<item><p><c>= atom()</c></p>
	<p>Used in socket close message.</p></item>
      </taglist>
      </item>

      <tag><c>verify_type()</c></tag>
      <item><p><c>= verify_none | verify_peer</c></p></item>

      <tag><c>path()</c></tag>
      <item><p><c>= string()</c></p>
      <p>Represents a file path.</p></item>

      <tag><c>der_encoded()</c></tag>
      <item><p><c>= binary()</c></p>
      <p>ASN.1 DER-encoded entity as an Erlang binary.</p></item>

      <tag><c>host()</c></tag>
      <item><p><c>= hostname() | ipaddress()</c></p></item>

      <tag><c>hostname()</c></tag>
      <item><p><c>= string()</c></p></item>

      <tag><c>ip_address()</c></tag>
      <item><p><c>= {N1,N2,N3,N4} % IPv4 | {K1,K2,K3,K4,K5,K6,K7,K8} % IPv6
      </c></p></item>

      <tag><c>sslsocket()</c></tag>
      <item><p>Opaque to the user.</p></item>

      <tag><c>protocol()</c></tag>
      <item><p><c>= sslv3 | tlsv1 | 'tlsv1.1' | 'tlsv1.2'</c></p></item>

      <tag><c>ciphers()</c></tag>
      <item><p><c>= [ciphersuite()] | string()</c></p>
      <p>According to old API.</p></item>

      <tag><c>ciphersuite()</c></tag>
      <item><p><c>= {key_exchange(), cipher(), hash()}</c></p></item>

      <tag><c>key_exchange()</c></tag>
      <item><p><c>= rsa | dhe_dss | dhe_rsa | dh_anon | psk | dhe_psk
      | rsa_psk | srp_anon | srp_dss | srp_rsa | ecdh_anon | ecdh_ecdsa
      | ecdhe_ecdsa | ecdh_rsa | ecdhe_rsa</c></p></item>

      <tag><c>cipher()</c></tag>
      <item><p><c>= rc4_128 | des_cbc | '3des_ede_cbc'
      | aes_128_cbc | aes_256_cbc | aes_128_gcm | aes_256_gcm</c></p></item>

      <tag><c>hash()</c></tag>
      <item><p><c>= md5 | sha</c></p></item>

      <tag><c>prf_random()</c></tag>
      <item><p><c>= client_random | server_random</c></p></item>

      <tag><c>srp_param_type()</c></tag>
      <item><p><c>= srp_1024 | srp_1536 | srp_2048 | srp_3072
      | srp_4096 | srp_6144 | srp_8192</c></p></item>

    </taglist>
  </section>

  <section>
    <title>SSL OPTION DESCRIPTIONS - COMMON for SERVER and CLIENT</title>

    <p>The following options have the same meaning in the client and 
    the server:</p>
    
    <taglist>

      <tag><c>{cert, der_encoded()}</c></tag>
      <item><p>The DER-encoded users certificate. If this option
      is supplied, it overrides option <c>certfile</c>.</p></item>
      
      <tag><c>{certfile, path()}</c></tag>
      <item><p>Path to a file containing the user certificate.</p></item>
      
      <tag><c>{key, {'RSAPrivateKey'| 'DSAPrivateKey' | 'ECPrivateKey'
      |'PrivateKeyInfo', der_encoded()}}</c></tag>
      <item><p>The DER-encoded user's private key. If this option 
      is supplied, it overrides option <c>keyfile</c>.</p></item>
      
      <tag><c>{keyfile, path()}</c></tag>
      <item><p>Path to the file containing the user's
      private PEM-encoded key. As PEM-files can contain several
      entries, this option defaults to the same file as given by
      option <c>certfile</c>.</p></item>

      <tag><c>{password, string()}</c></tag>
      <item><p>String containing the user's password. Only used if the 
      private keyfile is password-protected.</p></item>

      <tag><c>{cacerts, [der_encoded()]}</c></tag>
      <item><p>The DER-encoded trusted certificates. If this option
      is supplied it overrides option <c>cacertfile</c>.</p></item>

      <tag><c>{ciphers, ciphers()}</c></tag>
      <item><p>Supported cipher suites. The function
      <c>cipher_suites/0</c> can be used to find all ciphers that are
      supported by default. <c>cipher_suites(all)</c> can be called
      to find all available cipher suites. Pre-Shared Key 
      (<url href="http://www.ietf.org/rfc/rfc4279.txt">RFC 4279</url> and
      <url href="http://www.ietf.org/rfc/rfc5487.txt">RFC 5487</url>), 
      Secure Remote Password 
      (<url href="http://www.ietf.org/rfc/rfc5054.txt">RFC 5054</url>), 
      and anonymous cipher suites only work if explicitly enabled by
      this option; they are supported/enabled by the peer also.
      Anonymous cipher suites are supported for testing purposes
      only and are not be used when security matters.</p></item>

      <tag><c>{ssl_imp, new | old}</c></tag>
      <item><p>Has no longer any meaning as the old implementation is 
      removed; it is ignored.</p></item>

      <tag><c>{secure_renegotiate, boolean()}</c></tag>
      <item><p>Specifies if to reject renegotiation attempt that does
      not live up to 
      <url href="http://www.ietf.org/rfc/rfc5746.txt">RFC 5746</url>. 
      By default <c>secure_renegotiate</c> is set to <c>false</c>, 
      that is, secure renegotiation is used if possible,
      but it fallback to unsecure renegotiation if the peer
      does not support 
      <url href="http://www.ietf.org/rfc/rfc5746.txt">RFC 5746</url>.</p>
      </item>

      <tag><c>{depth, integer()}</c></tag>
      <item><p>Maximum number of non-self-issued
      intermediate certificates that can follow the peer certificate 
      in a valid certification path. So, if depth is 0 the PEER must 
      be signed by the trusted ROOT-CA directly; if 1 the path can 
      be PEER, CA, ROOT-CA; if 2 the path can be PEER, CA, CA, 
      ROOT-CA, and so on. The default value is 1.</p></item>

      <tag><c>{verify_fun, {Verifyfun :: fun(), InitialUserState ::
      term()}}</c></tag>
      <item><p>The verification fun is to be defined as follows:</p>

	<code>
fun(OtpCert :: #'OTPCertificate'{}, Event :: {bad_cert, Reason :: atom() | {revoked,
atom()}} |
	     {extension, #'Extension'{}}, InitialUserState :: term()) ->
	{valid, UserState :: term()} | {valid_peer, UserState :: term()} |
	{fail, Reason :: term()} | {unknown, UserState :: term()}.
	</code>

	<p>The verification fun is called during the X509-path
	validation when an error or an extension unknown to the <c>ssl</c>
	application is encountered. It is also called
	when a certificate is considered valid by the path validation
	to allow access to each certificate in the path to the user
	application. It differentiates between the peer
	certificate and the CA certificates by using <c>valid_peer</c> or
	<c>valid</c> as second argument to the verification fun. See the
	<seealso marker="public_key:cert_records">public_key User's
	Guide</seealso> for definition of <c>#'OTPCertificate'{}</c> and
	<c>#'Extension'{}</c>.</p>

	<list type="bulleted">
	  <item><p>If the verify callback fun returns <c>{fail, Reason}</c>,
	  the verification process is immediately stopped, an alert is
	  sent to the peer, and the TLS/SSL handshake terminates.</p></item>
	  <item><p>If the verify callback fun returns <c>{valid, UserState}</c>,
	  the verification process continues.</p></item> 
	  <item><p>If the verify callback fun always returns
	  <c>{valid, UserState}</c>, the TLS/SSL handshake does not
	  terminate regarding verification failures and the connection is
	  established.</p></item>
	  <item><p>If called with an extension unknown to the user application,
	  return value <c>{unknown, UserState}</c> is to be used.</p></item>
	</list>

	<p>Default option <c>verify_fun</c> in <c>verify_peer mode</c>:</p>

      <code>
{fun(_,{bad_cert, _} = Reason, _) ->
	 {fail, Reason};
    (_,{extension, _}, UserState) ->
	 {unknown, UserState};
    (_, valid, UserState) ->
	 {valid, UserState};
    (_, valid_peer, UserState) ->
         {valid, UserState}
 end, []}
      </code>

      <p>Default option <c>verify_fun</c> in mode <c>verify_none</c>:</p>

       <code>
{fun(_,{bad_cert, _}, UserState) ->
	 {valid, UserState};
    (_,{extension, _}, UserState) ->
	 {unknown, UserState};
    (_, valid, UserState) ->
	 {valid, UserState};
    (_, valid_peer, UserState) ->
         {valid, UserState}
 end, []}
      </code>

      <p>The possible path validation errors are given on form
      <c>{bad_cert, Reason}</c> where <c>Reason</c> is:</p>

      <taglist>
	<tag><c>unknown_ca</c></tag>
	<item><p>No trusted CA was found in the trusted store. The trusted CA is
	normally a so called ROOT CA, which is a self-signed certificate. Trust can
	be claimed for an intermediat CA (trusted anchor does not have to be
	self-signed according to X-509) by using option <c>partial_chain</c>.</p>
	</item>

	<tag><c>selfsigned_peer</c></tag>
	<item><p>The chain consisted only of one self-signed certificate.</p></item>

	<tag><c>PKIX X-509-path validation error</c></tag>
	<item><p>For possible reasons, see <seealso
marker="public_key:public_key#pkix_path_validation-3">public_key:pkix_path_validation/3</seealso>
	</p></item>
      </taglist>
      </item>

      <tag>{crl_check, boolean() | peer | best_effort }</tag>
      <item>
	Perform CRL (Certificate Revocation List) verification
	<seealso marker="public_key:public_key#pkix_crl_validate-3">
	(public_key:pkix_crls_validate/3)</seealso> on all the certificates during the path validation
	<seealso
	    marker="public_key:public_key#pkix_path_validation-3">(public_key:pkix_path_validation/3)
	</seealso>
	of the certificate chain. Defaults to false.
	
	<p><c>peer</c> - check is only performed on
	the peer certificate.</p>

	<p><c>best_effort</c> - if certificate revocation status can not be determined
	it will be accepted as valid.</p>

	<p>The CA certificates specified for the connection will be used to 
	construct the certificate chain validating the CRLs.</p>
 	
	<p>The CRLs will be fetched from a local or external cache
	<seealso marker="ssl:ssl_crl_cache_api">ssl_crl_cache_api(3)</seealso>.</p>
      </item>

      <tag>{crl_cache, {Module :: atom(), {DbHandle :: internal | term(), Args :: list()}}}</tag>
      <item>
	<p>Module defaults to ssl_crl_cache with <c> DbHandle </c> internal and an
	empty argument list. The following arguments may be specified for the internal cache.</p>
	<taglist>
	  <tag>{http, timeout()}</tag>
	  <item>
	    Enables fetching of CRLs specified as http URIs in<seealso 
	    marker="public_key:cert_records"> X509 cerificate extensions.</seealso>
	    Requires the OTP inets application.
	  </item>	    
	</taglist>    
      </item>

      <tag><c>{partial_chain, fun(Chain::[DerCert]) -> {trusted_ca, DerCert} |
      unknown_ca }</c></tag>
      <item><p>Claim an intermediate CA in the chain as trusted. TLS then
      performs <c>public_key:pkix_path_validation/3</c>
      with the selected CA as trusted anchor and the rest of the chain.</p></item>

      <tag><c>{versions, [protocol()]}</c></tag>
      <item><p>TLS protocol versions supported by started clients and servers.
      This option overrides the application environment option
      <c>protocol_version</c>. If the environment option is not set, it defaults
      to all versions, except SSL-3.0, supported by the <c>ssl</c> application.
      See also <seealso marker="ssl:ssl_app">ssl(6).</seealso></p></item>

      <tag><c>{hibernate_after, integer()|undefined}</c></tag>
      <item><p>When an integer-value is specified, <c>ssl_connection</c>
      goes into hibernation after the specified number of milliseconds
      of inactivity, thus reducing its memory footprint. When
      <c>undefined</c> is specified (this is the default), the process
      never goes into hibernation.</p></item>

      <tag><c>{user_lookup_fun, {Lookupfun :: fun(), UserState :: term()}}</c></tag>
      <item><p>The lookup fun is to defined as follows:</p>

	<code>
fun(psk, PSKIdentity ::string(), UserState :: term()) ->
	{ok, SharedSecret :: binary()} | error;
fun(srp, Username :: string(), UserState :: term()) ->
	{ok, {SRPParams :: srp_param_type(), Salt :: binary(), DerivedKey :: binary()}} | error.
	</code>

	<p>For Pre-Shared Key (PSK) cipher suites, the lookup fun is
	called by the client and server to determine the shared
	secret. When called by the client, <c>PSKIdentity</c> is set to the
	hint presented by the server or to undefined. When called by the
	server, <c>PSKIdentity</c> is the identity presented by the client.</p>

	<p>For Secure Remote Password (SRP), the fun is only used by the server to
	obtain parameters that it uses to generate its session keys.
	<c>DerivedKey</c> is to be derived according to
	<url href="http://tools.ietf.org/html/rfc2945#section-3"> RFC 2945</url> and
	<url href="http://tools.ietf.org/html/rfc5054#section-2.4"> RFC 5054</url>:
	<c>crypto:sha([Salt, crypto:sha([Username, &lt;&lt;$:&gt;&gt;, Password])])</c>
	</p>
      </item>

      <tag><c>{padding_check, boolean()}</c></tag>
      <item><p>Affects TLS-1.0 connections only.
      If set to <c>false</c>, it disables the block cipher padding check
      to be able to interoperate with legacy software.</p></item>

    </taglist>

        <warning><p>Using <c>{padding_check, boolean()}</c> makes TLS
	vulnerable to the Poodle attack.</p></warning>

  </section>
  
  <section>
    <title>SSL OPTION DESCRIPTIONS - CLIENT SIDE</title>

    <p>The following options are client-specific or have a slightly different
    meaning in the client than in the server:</p>

    <taglist>

      <tag><c>{verify, verify_type()}</c></tag>
      <item><p>In mode <c>verify_none</c> the default behavior is to allow
      all x509-path validation errors. See also option <c>verify_fun</c>.</p>
      </item>

      <tag><c>{reuse_sessions, boolean()}</c></tag>
      <item><p>Specifies if the client is to try to reuse sessions
      when possible.</p></item>
      
      <tag><c>{cacertfile, path()}</c></tag>
      <item><p>Path to a file containing PEM-encoded CA certificates. The CA
      certificates are used during server authentication and when building the
      client certificate chain.</p>
    </item>

      <tag>{alpn_advertised_protocols, [binary()]}</tag>
      <item>
      <p>The list of protocols supported by the client to be sent to the
      server to be used for an Application-Layer Protocol Negotiation (ALPN).
      If the server supports ALPN then it will choose a protocol from this
      list; otherwise it will fail the connection with a "no_application_protocol"
      alert. A server that does not support ALPN will ignore this value.</p>

      <p>The list of protocols must not contain an empty binary.</p>

      <p>The negotiated protocol can be retrieved using the <c>negotiated_protocol/1</c> function.</p>
      </item>

      <tag>{client_preferred_next_protocols, {Precedence :: server | client, ClientPrefs :: [binary()]}}</tag>
      <tag>{client_preferred_next_protocols, {Precedence :: server | client, ClientPrefs :: [binary()], Default :: binary()}}</tag>
	   <item>
	   <p>Indicates that the client is to try to perform Next Protocol
	   Negotiation.</p>

	   <p>If precedence is server, the negotiated protocol is the
	   first protocol to be shown on the server advertised list, which is
	   also on the client preference list.</p>

	   <p>If precedence is client, the negotiated protocol is the
	   first protocol to be shown on the client preference list, which is
	   also on the server advertised list.</p>

	   <p>If the client does not support any of the server advertised
	   protocols or the server does not advertise any protocols, the
	   client falls back to the first protocol in its list or to the
	   default protocol (if a default is supplied). If the
	   server does not support Next Protocol Negotiation, the
	   connection terminates if no default protocol is supplied.</p>
	   </item>

      <tag><c>{psk_identity, string()}</c></tag>
      <item><p>Specifies the identity the client presents to the server.
      The matching secret is found by calling <c>user_look_fun</c>.</p>
      </item>

      <tag><c>{srp_identity, {Username :: string(), Password :: string()}
      </c></tag>
      <item><p>Specifies the username and password to use to authenticate
      to the server.</p></item>

      <tag><c>{server_name_indication, hostname()}</c></tag>
      <item></item>
      <tag><c>{server_name_indication, disable}</c></tag>
      <item>
        <p>Can be specified when upgrading a TCP socket to a TLS
        socket to use the TLS Server Name Indication extension.</p>

        <p>When starting a TLS connection without upgrade, the Server Name
        Indication extension is sent if possible. This option can also be
        used to disable that behavior.</p>
      </item>
      <tag>{fallback, boolean()}</tag>
      <item>
	<p> Send special cipher suite TLS_FALLBACK_SCSV to avoid undesired TLS version downgrade.
	Defaults to false</p>
	<warning><p>Note this option is not needed in normal TLS usage and should not be used
	to implement new clients. But legacy clients that that retries connections in the following manner</p>

	<p><c> ssl:connect(Host, Port, [...{versions, ['tlsv2', 'tlsv1.1', 'tlsv1', 'sslv3']}])</c></p>
	<p><c>  ssl:connect(Host, Port, [...{versions, [tlsv1.1', 'tlsv1', 'sslv3']}, {fallback, true}])</c></p>
	<p><c>  ssl:connect(Host, Port, [...{versions, ['tlsv1', 'sslv3']}, {fallback, true}]) </c></p>
	<p><c>  ssl:connect(Host, Port, [...{versions, ['sslv3']}, {fallback, true}]) </c></p>
	 
	 <p>may use it to avoid undesired TLS version downgrade. Note that TLS_FALLBACK_SCSV must also
	 be supported by the server for the prevention to work.
	</p></warning>
      </item>
      
    </taglist>
   </section>

  <section>
    <title>SSL OPTION DESCRIPTIONS - SERVER SIDE</title>

    <p>The following options are server-specific or have a slightly different
    meaning in the server than in the client:</p>

    <taglist>
      
      <tag><c>{cacertfile, path()}</c></tag>
      <item><p>Path to a file containing PEM-encoded CA
      certificates. The CA certificates are used to build the server
      certificate chain and for client authentication. The CAs are
      also used in the list of acceptable client CAs passed to the
      client when a certificate is requested. Can be omitted if there
      is no need to verify the client and if there are no
      intermediate CAs for the server certificate.</p></item>
  
      <tag><c>{dh, der_encoded()}</c></tag>
      <item><p>The DER-encoded Diffie-Hellman parameters. If specified,
      it overrides option <c>dhfile</c>.</p></item>

      <tag><c>{dhfile, path()}</c></tag>
      <item><p>Path to a file containing PEM-encoded Diffie Hellman parameters
      to be used by the server if a cipher suite using Diffie Hellman key
      exchange is negotiated. If not specified, default parameters are used.
      </p></item>

      <tag><c>{verify, verify_type()}</c></tag>
      <item><p>A server only does x509-path validation in mode <c>verify_peer</c>,
      as it then sends a certificate request to the client
      (this message is not sent if the verify option is <c>verify_none</c>).
      You can then also want to specify option <c>fail_if_no_peer_cert</c>.
      </p></item>

      <tag><c>{fail_if_no_peer_cert, boolean()}</c></tag>
      <item><p>Used together with <c>{verify, verify_peer}</c> by an SSL server.
      If set to <c>true</c>, the server fails if the client does not have
      a certificate to send, that is, sends an empty certificate. If set to
      <c>false</c>, it fails only if the client sends an invalid
      certificate (an empty certificate is considered valid).</p>
      </item>

      <tag><c>{reuse_sessions, boolean()}</c></tag>
      <item><p>Specifies if the server is to agree to reuse sessions
      when requested by the clients. See also option <c>reuse_session</c>.
      </p></item>

      <tag><c>{reuse_session, fun(SuggestedSessionId,
      PeerCert, Compression, CipherSuite) -> boolean()}</c></tag>
      <item><p>Enables the SSL server to have a local policy
      for deciding if a session is to be reused or not.
      Meaningful only if <c>reuse_sessions</c> is set to <c>true</c>.
      <c>SuggestedSessionId</c> is a <c>binary()</c>, <c>PeerCert</c> is
      a DER-encoded certificate, <c>Compression</c> is an enumeration integer,
      and <c>CipherSuite</c> is of type <c>ciphersuite()</c>.</p></item>

      <tag>{alpn_preferred_protocols, [binary()]}</tag>
      <item>
      <p>Indicates the server will try to perform Application-Layer
      Protocol Negotiation (ALPN).</p>

      <p>The list of protocols is in order of preference. The protocol
      negotiated will be the first in the list that matches one of the
      protocols advertised by the client. If no protocol matches, the
      server will fail the connection with a "no_application_protocol" alert.</p>

      <p>The negotiated protocol can be retrieved using the <c>negotiated_protocol/1</c> function.</p>
      </item>

      <tag><c>{next_protocols_advertised, Protocols :: [binary()]}</c></tag>
      <item><p>List of protocols to send to the client if the client indicates that
      it supports the Next Protocol extension. The client can select a protocol
      that is not on this list. The list of protocols must not contain an empty
      binary. If the server negotiates a Next Protocol, it can be accessed
      using the <c>negotiated_next_protocol/1</c> method.</p></item>

      <tag><c>{psk_identity, string()}</c></tag>
      <item><p>Specifies the server identity hint, which the server presents to
      the client.</p></item>

      <tag><c>{log_alert, boolean()}</c></tag>
      <item><p>If set to <c>false</c>, error reports are not displayed.</p></item>

      <tag><c>{honor_cipher_order, boolean()}</c></tag>
      <item><p>If set to <c>true</c>, use the server preference for cipher
      selection. If set to <c>false</c> (the default), use the client
      preference.</p></item>

      
    </taglist>
  </section>
  
  <section>
    <title>General</title>
      
    <p>When an SSL socket is in active mode (the default), data from the
      socket is delivered to the owner of the socket in the form of
      messages:</p>

    <list type="bulleted">
      <item><p><c>{ssl, Socket, Data}</c></p></item>
      <item><p><c>{ssl_closed, Socket}</c></p></item>
      <item><p><c>{ssl_error, Socket, Reason}</c></p></item>
    </list>

    <p>A <c>Timeout</c> argument specifies a time-out in milliseconds. The
      default value for argument <c>Timeout</c> is <c>infinity</c>.</p>
  </section>
  
  <funcs>
    <func>
      <name>cipher_suites() -></name>
      <name>cipher_suites(Type) -> ciphers()</name>
      <fsummary>Returns a list of supported cipher suites.</fsummary>
      <type>
        <v>Type = erlang | openssl | all</v>
      </type>
      <desc><p>Returns a list of supported cipher suites.
	<c>cipher_suites()</c> is equivalent to <c>cipher_suites(erlang).</c>
	Type <c>openssl</c> is provided for backwards compatibility with the
	old SSL, which used OpenSSL. <c>cipher_suites(all)</c> returns
	all available cipher suites. The cipher suites not present
	in <c>cipher_suites(erlang)</c> but included in
	<c>cipher_suites(all)</c> are not used unless explicitly configured
	by the user.</p>
    </desc>
    </func>

    <func>
      <name>clear_pem_cache() -> ok </name>
      <fsummary> Clears the pem cache</fsummary>

      <desc><p>PEM files, used by ssl API-functions, are cached. The
      cache is regularly checked to see if any cache entries should be
      invalidated, however this function provides a way to
      unconditionally clear the whole cache.
      </p>
      </desc>
    </func>
   
    <func>
      <name>connect(Socket, SslOptions) -> </name>
      <name>connect(Socket, SslOptions, Timeout) -> {ok, SslSocket}
	| {error, Reason}</name>
      <fsummary>Upgrades a <c>gen_tcp</c>, or
	equivalent, connected socket to an SSL socket.</fsummary>
      <type>
	<v>Socket = socket()</v>
	<v>SslOptions = [ssloption()]</v>
	<v>Timeout = integer() | infinity</v>
	<v>SslSocket = sslsocket()</v>
	<v>Reason = term()</v>
      </type>
      <desc><p>Upgrades a <c>gen_tcp</c>, or equivalent,
	  connected socket to an SSL socket, that is, performs the
	  client-side ssl handshake.</p>
    </desc>
    </func>

    <func>
      <name>connect(Host, Port, Options) -></name>
      <name>connect(Host, Port, Options, Timeout) ->
	  {ok, SslSocket} | {error, Reason}</name>
      <fsummary>Opens an SSL connection to <c>Host</c>, <c>Port</c>.</fsummary>
      <type>
	  <v>Host = host()</v>
	  <v>Port = integer()</v>
	  <v>Options = [option()]</v>
	  <v>Timeout = integer() | infinity</v>
	  <v>SslSocket = sslsocket()</v>
	  <v>Reason = term()</v>
      </type>
      <desc><p>Opens an SSL connection to <c>Host</c>, <c>Port</c>.</p></desc>
    </func>

    <func>
      <name>close(SslSocket) -> ok | {error, Reason}</name>
      <fsummary>Closes an SSL connection.</fsummary>
      <type>
	  <v>SslSocket = sslsocket()</v>
	  <v>Reason = term()</v>
      </type>
      <desc><p>Closes an SSL connection.</p>
      </desc>
    </func>

    <func>
	<name>connection_info(SslSocket) ->
	  {ok, {ProtocolVersion, CipherSuite}} | {error, Reason}</name>
      <fsummary>Returns the Negotiated Protocol version and cipher suite.
      </fsummary>
      <type>
        <v>CipherSuite = ciphersuite()</v>
        <v>ProtocolVersion = protocol()</v>
      </type>
      <desc><p>Returns the Negotiated Protocol version and cipher suite.</p> 
      </desc>
    </func>

    <func>
      <name>controlling_process(SslSocket, NewOwner) ->
	ok | {error, Reason}</name>
	<fsummary>Assigns a new controlling process to the
	SSL socket.</fsummary>
	<type>
	  <v>SslSocket = sslsocket()</v>
	  <v>NewOwner = pid()</v>
	  <v>Reason = term()</v>
	</type>
	<desc><p>Assigns a new controlling process to the SSL socket. A
	controlling process is the owner of an SSL socket, and receives
	all messages from the socket.</p>
      </desc>
    </func>

    <func>
      <name>format_error(Reason) -> string()</name>
      <fsummary>Returns an error string.</fsummary>
      <type>
        <v>Reason = term()</v>
      </type>
      <desc>
        <p>Presents the error returned by an SSL function as a printable string.</p>
      </desc>
    </func>
   
    <func>
      <name>getopts(Socket, OptionNames) ->
	{ok, [socketoption()]} | {error, Reason}</name>
      <fsummary>Gets the values of the specified options.</fsummary>
      <type>
	<v>Socket = sslsocket()</v>
	<v>OptionNames = [atom()]</v>
      </type>
      <desc>
	<p>Gets the values of the specified socket options.
	</p>
      </desc>
    </func>

    <func>
      <name>listen(Port, Options) ->
	{ok, ListenSocket} | {error, Reason}</name>
      <fsummary>Creates an SSL listen socket.</fsummary>
      <type>
	<v>Port = integer()</v>
	<v>Options = options()</v>
	<v>ListenSocket = sslsocket()</v>
      </type>
      <desc>
	<p>Creates an SSL listen socket.</p>
      </desc>
    </func>

    <func>
      <name>negotiated_next_protocol(Socket) -> {ok, Protocol} | {error, next_protocol_not_negotiated}</name>
      <fsummary>Returns the Next Protocol negotiated.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>Protocol = binary()</v>
      </type>
      <desc>
        <p>Returns the Next Protocol negotiated.</p>
      </desc>
    </func>

    <func>
      <name>peercert(Socket) -> {ok, Cert} | {error, Reason}</name>
      <fsummary>Returns the peer certificate.</fsummary>
     <type>
        <v>Socket = sslsocket()</v>
        <v>Cert = binary()</v>
      </type>
      <desc>
        <p>The peer certificate is returned as a DER-encoded binary.
	  The certificate can be decoded with
	  <c>public_key:pkix_decode_cert/2</c>.</p>
      </desc>
    </func>

    <func>
      <name>peername(Socket) -> {ok, {Address, Port}} |
	{error, Reason}</name>
      <fsummary>Returns the peer address and port.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>Address = ipaddress()</v>
        <v>Port = integer()</v>
      </type>
      <desc>
        <p>Returns the address and port number of the peer.</p>
      </desc>
    </func>

    <func>
      <name>prf(Socket, Secret, Label, Seed, WantedLength) -> {ok, binary()} | {error, reason()}</name>
      <fsummary>Uses a session Pseudo-Random Function to generate key material.</fsummary>
      <type>
	<v>Socket = sslsocket()</v>
	<v>Secret = binary() | master_secret</v>
	<v>Label = binary()</v>
	<v>Seed = [binary() | prf_random()]</v>
	<v>WantedLength = non_neg_integer()</v>
      </type>
      <desc>
        <p>Uses the Pseudo-Random Function (PRF) of a TLS session to generate
	  extra key material. It either takes user-generated values for
	  <c>Secret</c> and <c>Seed</c> or atoms directing it to use a specific
	  value from the session security parameters.</p>
        <p>Can only be used with TLS connections; <c>{error, undefined}</c>
	  is returned for SSLv3 connections.</p>
      </desc>
    </func>
    
    <func>
      <name>recv(Socket, Length) -> </name>
      <name>recv(Socket, Length, Timeout) -> {ok, Data} | {error,
	Reason}</name>
      <fsummary>Receives data on a socket.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>Length = integer()</v>
        <v>Timeout = integer()</v>
        <v>Data = [char()] | binary()</v>
      </type>
      <desc>
        <p>Receives a packet from a socket in passive
          mode. A closed socket is indicated by return value
          <c>{error, closed}</c>.</p>
        <p>Argument <c>Length</c> is meaningful only when
          the socket is in mode <c>raw</c> and denotes the number of
          bytes to read. If <c>Length</c> = 0, all available bytes are
          returned. If <c>Length</c> &gt; 0, exactly <c>Length</c>
          bytes are returned, or an error; possibly discarding less
          than <c>Length</c> bytes of data when the socket gets closed
          from the other side.</p>
        <p>Optional argument <c>Timeout</c> specifies a time-out in
          milliseconds. The default value is <c>infinity</c>.</p>
      </desc>
    </func>
    
    <func>
      <name>renegotiate(Socket) -> ok | {error, Reason}</name>
      <fsummary>Initiates a new handshake.</fsummary>
      <type>
	<v>Socket = sslsocket()</v>
      </type>
      <desc><p>Initiates a new handshake. A notable return value is
      <c>{error, renegotiation_rejected}</c> indicating that the peer
      refused to go through with the renegotiation, but the connection
      is still active using the previously negotiated session.</p>
      </desc>
    </func>
    
    <func>
      <name>send(Socket, Data) -> ok | {error, Reason}</name>
      <fsummary>Writes data to a socket.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>Data = iodata()</v>
      </type>
      <desc>
        <p>Writes <c>Data</c> to <c>Socket</c>.</p>
        <p>A notable return value is <c>{error, closed}</c> indicating that
          the socket is closed.</p>
      </desc>
    </func>

    <func>
      <name>setopts(Socket, Options) -> ok | {error, Reason}</name>
      <fsummary>Sets socket options.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>Options = [socketoption]()</v>
      </type>
      <desc>
        <p>Sets options according to <c>Options</c> for socket
          <c>Socket</c>.</p>
      </desc>
    </func>

    <func>
      <name>shutdown(Socket, How) -> ok | {error, Reason}</name>
      <fsummary>Immediately closes a socket.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>How = read | write | read_write</v>
        <v>Reason = reason()</v>
      </type>
      <desc>
        <p>Immediately closes a socket in one or two directions.</p>
        <p><c>How == write</c> means closing the socket for writing,
          reading from it is still possible.</p>
        <p>To be able to handle that the peer has done a shutdown on
          the write side, option <c>{exit_on_close, false}</c>
          is useful.</p>
      </desc>
    </func>
    
    <func>
      <name>ssl_accept(Socket) -> </name>
      <name>ssl_accept(Socket, Timeout) -> ok | {error, Reason}</name>
      <fsummary>Performs server-side SSL/TLS handshake.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>Timeout = integer()</v>
        <v>Reason = term()</v>
      </type>
      <desc>
        <p>Performs the SSL/TLS server-side handshake.</p>
	<p><c>Socket</c> is a socket as returned by
	<seealso marker="#transport_accept-2">ssl:transport_accept/[1,2]</seealso>
	</p>
      </desc>
    </func>

    <func>
      <name>ssl_accept(Socket, SslOptions) -> </name>
      <name>ssl_accept(Socket, SslOptions, Timeout) -> {ok, Socket} | ok | {error, Reason}</name>
      <fsummary>Performs server-side SSL/TLS handshake.</fsummary>
      <type>
        <v>Socket = socket() | sslsocket() </v>
	<v>SslOptions = ssloptions()</v>
        <v>Timeout = integer()</v>
        <v>Reason = term()</v>
      </type>
      <desc>
        <p>If <c>Socket</c> is a <c>socket()</c>: upgrades a <c>gen_tcp</c>,
	or equivalent, socket to an SSL socket, that is, performs
        the SSL/TLS server-side handshake and returns the SSL socket.</p>
	
	<warning><p>The listen socket is to be in mode <c>{active, false}</c>
	before telling the client that the server is ready to upgrade
	by calling this function, else the upgrade succeeds or does not
	succeed depending on timing.</p></warning>
	
	<p>If <c>Socket</c> is an <c>sslsocket()</c>: provides extra SSL/TLS
	options to those specified in
	<seealso marker="#listen-2">ssl:listen/2 </seealso> and then performs
	the SSL/TLS handshake.
	</p>
      </desc>
    </func>
    
    <func>
      <name>sockname(Socket) -> {ok, {Address, Port}} |
	{error, Reason}</name>
      <fsummary>Returns the local address and port.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>Address = ipaddress()</v>
        <v>Port = integer()</v>
      </type>
      <desc>
        <p>Returns the local address and port number of socket
          <c>Socket</c>.</p>
      </desc>
    </func>
    
    <func>
      <name>start() -> </name>
      <name>start(Type) -> ok | {error, Reason}</name>
      <fsummary>Starts the <c>ssl</c>application.</fsummary>
      <type>
        <v>Type = permanent | transient | temporary</v>
      </type>
      <desc>
        <p>Starts the <c>ssl</c> application. Default type
          is <c>temporary</c>.</p>
      </desc>
    </func>

    <func>
      <name>stop() -> ok </name>
      <fsummary>Stops the <c>ssl</c> application.</fsummary>
      <desc>
        <p>Stops the <c>ssl</c> application.</p>
      </desc>
    </func>

    <func>
      <name>transport_accept(ListenSocket) -></name>
      <name>transport_accept(ListenSocket, Timeout) ->
	{ok, NewSocket} | {error, Reason}</name>
      <fsummary>Accepts an incoming connection and
	prepares for <c>ssl_accept</c>.</fsummary>
      <type>
        <v>ListenSocket = NewSocket = sslsocket()</v>
        <v>Timeout = integer()</v>
        <v>Reason = reason()</v>
      </type>
      <desc>
        <p>Accepts an incoming connection request on a listen socket.
	<c>ListenSocket</c> must be a socket returned from
	<seealso marker="#listen-2"> ssl:listen/2</seealso>.
	The socket returned is to be passed to
	<seealso marker="#ssl_accept-2"> ssl:ssl_accept[2,3]</seealso>
	to complete handshaking, that is,
	establishing the SSL/TLS connection.</p>
        <warning>
          <p>The socket returned can only be used with
	  <seealso marker="#ssl_accept-2"> ssl:ssl_accept[2,3]</seealso>.
	  No traffic can be sent or received before that call.</p>
        </warning>
        <p>The accepted socket inherits the options set for
	<c>ListenSocket</c> in
	<seealso marker="#listen-2"> ssl:listen/2</seealso>.</p>
	<p>The default
	value for <c>Timeout</c> is <c>infinity</c>. If
	<c>Timeout</c> is specified and no connection is accepted
	within the given time, <c>{error, timeout}</c> is
	returned.</p>
      </desc>
    </func>
    
    <func>
      <name>versions() -> [versions_info()]</name>
      <fsummary>Returns version information relevant for the
	<c>ssl</c> application.</fsummary>
      <type>
	<v>versions_info() = {app_vsn, string()} | {supported | available, [protocol()] </v>
      </type>
      <desc>
	<p>Returns version information relevant for the <c>ssl</c>
	application.</p>
	<taglist>
	  <tag>app_vsn</tag>
	  <item>The application version of the <c>ssl</c> application.</item>

	  <tag>supported</tag>
	  <item>TLS/SSL versions supported by default.
	  Overridden by a version option on
	  <seealso marker="#connect-2"> connect/[2,3,4]</seealso>,
	  <seealso marker="#listen-2"> listen/2</seealso>, and <seealso
	  marker="#ssl_accept-2">ssl_accept/[1,2,3]</seealso>.
	  For the negotiated TLS/SSL version, see <seealso
	  marker="#connection_info-1">ssl:connection_info/1
	  </seealso>.</item>
  
	  <tag>available</tag>
	  <item>All TLS/SSL versions supported by the <c>ssl</c> application.
	  TLS 1.2 requires sufficient support from the <c>crypto</c>
	  application.</item>
	</taglist>
      </desc>
    </func>
    <func>
      <name>negotiated_protocol(Socket) -> {ok, Protocol} | {error, protocol_not_negotiated}</name>
      <fsummary>Returns the protocol negotiated through ALPN or NPN extensions.</fsummary>
      <type>
        <v>Socket = sslsocket()</v>
        <v>Protocol = binary()</v>
      </type>
      <desc>
        <p>
          Returns the protocol negotiated through ALPN or NPN extensions.
        </p>
      </desc>
    </func>

  </funcs> 

  <section>
    <title>SEE ALSO</title>
    <p><seealso marker="kernel:inet">inet(3)</seealso> and
      <seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso>
    </p>
  </section>

</erlref>