4
%% Copyright Ericsson AB 2003-2009. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
21
-module(old_ssl_peer_cert_SUITE).
33
-import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7,
35
-include("test_server.hrl").
36
-include("ssl_test_MACHINE.hrl").
39
init_per_testcase(_Case, Config) ->
40
WatchDog = ssl_test_lib:timetrap(?DEFAULT_TIMEOUT),
41
[{watchdog, WatchDog}| Config].
43
fin_per_testcase(_Case, Config) ->
44
WatchDog = ?config(watchdog, Config),
45
test_server:timetrap_cancel(WatchDog).
48
"Test of ssl verification and peer certificate retrieval.";
58
"Want to se what Config contains.";
62
io:format("Config: ~p~n", [Config]),
64
%% Check if SSL exists. If this case fails, all other cases are skipped
67
{error, {already_started, _}} -> ssl:stop();
68
Error -> ?t:fail({failed_starting_ssl,Error})
73
"This test case has no mission other than closing the conf case";
80
"Server closes after accept, Client waits for close. Both have certs "
81
"but both use the defaults for verify and depth, but still tries "
82
"to retreive each others certificates.";
85
cinit_plain(Config) when list(Config) ->
86
process_flag(trap_exit, true),
87
DataSize = 1000, LPort = 3456,
88
Timeout = 40000, NConns = 1,
90
?line {ok, {CsslOpts, SsslOpts}} = mk_ssl_cert_opts(Config),
92
?line {ok, Host} = inet:gethostname(),
94
LCmds = [{sockopts, [{backlog, NConns}]},
99
ACmds = [{timeout, Timeout},
104
CCmds = [{timeout, Timeout},
106
{connect, {Host, LPort}},
110
?line test_one_listener(NConns, LCmds, ACmds, CCmds, Timeout,
113
cinit_both_verify(doc) ->
114
"Server closes after accept, Client waits for close. Both have certs "
115
"and both verify each other.";
116
cinit_both_verify(suite) ->
118
cinit_both_verify(Config) when list(Config) ->
119
process_flag(trap_exit, true),
120
DataSize = 1000, LPort = 3456,
121
Timeout = 40000, NConns = 1,
123
?line {ok, {CsslOpts0, SsslOpts0}} = mk_ssl_cert_opts(Config),
124
?line CsslOpts = [{verify, 2}, {depth, 2} | CsslOpts0],
125
?line SsslOpts = [{verify, 2}, {depth, 3} | SsslOpts0],
127
?line {ok, Host} = inet:gethostname(),
129
LCmds = [{sockopts, [{backlog, NConns}]},
134
ACmds = [{timeout, Timeout},
139
CCmds = [{timeout, Timeout},
141
{connect, {Host, LPort}},
145
?line test_one_listener(NConns, LCmds, ACmds, CCmds, Timeout,
148
cinit_cnocert(doc) ->
149
"Client has no cert. Nor the client, nor the server is verifying its "
150
"peer. Server closes, client waits for close.";
151
cinit_cnocert(suite) ->
153
cinit_cnocert(Config) when list(Config) ->
154
process_flag(trap_exit, true),
155
DataSize = 1000, LPort = 3457,
156
Timeout = 40000, NConns = 1,
158
?line {ok, {_, SsslOpts0}} = mk_ssl_cert_opts(Config),
159
?line SsslOpts = [{verify, 0}, {depth, 2} | SsslOpts0],
161
?line {ok, Host} = inet:gethostname(),
163
LCmds = [{sockopts, [{backlog, NConns}]},
168
ACmds = [{timeout, Timeout},
172
CCmds = [{timeout, Timeout},
173
{connect, {Host, LPort}},
177
?line test_one_listener(NConns, LCmds, ACmds, CCmds, Timeout,