diff options
author | Ingela Anderton Andin <[email protected]> | 2012-11-22 16:07:03 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-11-22 16:07:03 +0100 |
commit | 4d0830eef8b9047ca44f8df1ce21c0a76185d416 (patch) | |
tree | 7ff6ecbb14ba0b1cf052f5ae9a5ada1028092d50 | |
parent | 75de9824a7c7ac8eeda37245f6e55198c147332f (diff) | |
download | otp-4d0830eef8b9047ca44f8df1ce21c0a76185d416.tar.gz otp-4d0830eef8b9047ca44f8df1ce21c0a76185d416.tar.bz2 otp-4d0830eef8b9047ca44f8df1ce21c0a76185d416.zip |
ssl: Add test case for ssl:peercert with client certification
-rw-r--r-- | lib/ssl/test/ssl_basic_SUITE.erl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index a202aca943..993aa02cb1 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -248,6 +248,7 @@ api_tests() -> [connection_info, peername, peercert, + peercert_with_client_cert, sockname, versions, controlling_process, @@ -788,6 +789,43 @@ peercert(Config) when is_list(Config) -> peercert_result(Socket) -> ssl:peercert(Socket). +%%-------------------------------------------------------------------- + +peercert_with_client_cert(doc) -> + [""]; +peercert_with_client_cert(suite) -> + []; +peercert_with_client_cert(Config) when is_list(Config) -> + ClientOpts = ?config(client_dsa_opts, Config), + ServerOpts = ?config(server_dsa_verify_opts, Config), + {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), + + Server = ssl_test_lib:start_server([{node, ClientNode}, {port, 0}, + {from, self()}, + {mfa, {?MODULE, peercert_result, []}}, + {options, ServerOpts}]), + Port = ssl_test_lib:inet_port(Server), + Client = ssl_test_lib:start_client([{node, ServerNode}, {port, Port}, + {host, Hostname}, + {from, self()}, + {mfa, {?MODULE, peercert_result, []}}, + {options, ClientOpts}]), + + ServerCertFile = proplists:get_value(certfile, ServerOpts), + [{'Certificate', ServerBinCert, _}]= ssl_test_lib:pem_to_der(ServerCertFile), + ClientCertFile = proplists:get_value(certfile, ClientOpts), + [{'Certificate', ClientBinCert, _}]= ssl_test_lib:pem_to_der(ClientCertFile), + + ServerMsg = {ok, ClientBinCert}, + ClientMsg = {ok, ServerBinCert}, + + test_server:format("Testcase ~p, Client ~p Server ~p ~n", + [self(), Client, Server]), + + ssl_test_lib:check_result(Server, ServerMsg, Client, ClientMsg), + + ssl_test_lib:close(Server), + ssl_test_lib:close(Client). %%-------------------------------------------------------------------- sockname(doc) -> |