diff options
author | Ingela Anderton Andin <[email protected]> | 2012-11-27 09:10:16 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-11-27 09:10:16 +0100 |
commit | 680f37089808f002e92f14742c3e9d7a813c83be (patch) | |
tree | 47c8200406d7f0aa5c1b95742d877ecfb3d5506d /lib/ssl/test | |
parent | 6ab7a9e353f246f4b83537fe428eb2cd8c6accbf (diff) | |
parent | 4d0830eef8b9047ca44f8df1ce21c0a76185d416 (diff) | |
download | otp-680f37089808f002e92f14742c3e9d7a813c83be.tar.gz otp-680f37089808f002e92f14742c3e9d7a813c83be.tar.bz2 otp-680f37089808f002e92f14742c3e9d7a813c83be.zip |
Merge branch 'ia/ssl/peer-cert-server'
* ia/ssl/peer-cert-server:
ssl: Add test case for ssl:peercert with client certification
Diffstat (limited to 'lib/ssl/test')
-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 e84582cdd7..4c3548a703 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, @@ -789,6 +790,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) -> |