4
%% Copyright Ericsson AB 1999-2010. 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_verify_SUITE).
32
-import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7,
34
-include("test_server.hrl").
35
-include("ssl_test_MACHINE.hrl").
38
init_per_testcase(_Case, Config) ->
39
WatchDog = ssl_test_lib:timetrap(?DEFAULT_TIMEOUT),
40
[{watchdog, WatchDog}| Config].
42
fin_per_testcase(_Case, Config) ->
43
WatchDog = ?config(watchdog, Config),
44
test_server:timetrap_cancel(WatchDog).
47
"Test of ssl.erl interface in active mode.";
56
"Want to se what Config contains.";
60
io:format("Config: ~p~n", [Config]),
62
%% Check if SSL exists. If this case fails, all other cases are skipped
64
application:start(public_key),
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";
79
cinit_both_verify(doc) ->
80
"Server closes after accept, Client waits for close. Both have certs "
81
"and both verify each other.";
82
cinit_both_verify(suite) ->
84
cinit_both_verify(Config) when list(Config) ->
85
process_flag(trap_exit, true),
86
DataSize = 1000, LPort = 3456,
87
Timeout = 40000, NConns = 1,
89
?line {ok, {CsslOpts0, SsslOpts0}} = mk_ssl_cert_opts(Config),
90
?line CsslOpts = [{verify, 2}, {depth, 2} | CsslOpts0],
91
?line SsslOpts = [{verify, 2}, {depth, 3} | SsslOpts0],
93
?line {ok, Host} = inet:gethostname(),
95
LCmds = [{sockopts, [{backlog, NConns}]},
100
ACmds = [{timeout, Timeout},
104
CCmds = [{timeout, Timeout},
106
{connect, {Host, LPort}},
109
?line test_one_listener(NConns, LCmds, ACmds, CCmds, Timeout,
112
cinit_cnocert(doc) ->
113
"Client has no cert. Nor the client, nor the server is verifying its "
114
"peer. Server closes, client waits for close.";
115
cinit_cnocert(suite) ->
117
cinit_cnocert(Config) when list(Config) ->
118
process_flag(trap_exit, true),
119
DataSize = 1000, LPort = 3457,
120
Timeout = 40000, NConns = 1,
122
?line {ok, {_, SsslOpts0}} = mk_ssl_cert_opts(Config),
123
?line SsslOpts = [{verify, 0}, {depth, 2} | SsslOpts0],
125
?line {ok, Host} = inet:gethostname(),
127
LCmds = [{sockopts, [{backlog, NConns}]},
132
ACmds = [{timeout, Timeout},
136
CCmds = [{timeout, Timeout},
137
{connect, {Host, LPort}},
140
?line test_one_listener(NConns, LCmds, ACmds, CCmds, Timeout,