From ea356c5d58ed102d3c8258553ea41c20a4ba21a8 Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Thu, 7 Jun 2018 16:30:39 +0200 Subject: public_key: Extend test case pkix_verify_hostname_subjAltName --- lib/public_key/test/public_key_SUITE.erl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'lib/public_key') diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl index fcc9bdc080..073bd6f4a2 100644 --- a/lib/public_key/test/public_key_SUITE.erl +++ b/lib/public_key/test/public_key_SUITE.erl @@ -989,8 +989,17 @@ pkix_verify_hostname_subjAltName(Config) -> %% Check that a dns_id does not match a DNS subjAltName wiht wildcard false = public_key:pkix_verify_hostname(Cert, [{dns_id,"other.example.org"}]), - %% Check that a dns_id does nmatches a DNS subjAltName wiht wildcard with matchfun + %% Check that a dns_id does match a DNS subjAltName wiht wildcard with matchfun true = public_key:pkix_verify_hostname(Cert, [{dns_id,"other.example.org"}], + [{match_fun, public_key:pkix_verify_hostname_match_fun(https)} + ] + ), + + %% Check that a uri_id does not match a DNS subjAltName wiht wildcard + false = public_key:pkix_verify_hostname(Cert, [{uri_id,"https://other.example.org"}]), + + %% Check that a dns_id does match a DNS subjAltName wiht wildcard with matchfun + true = public_key:pkix_verify_hostname(Cert, [{uri_id,"https://other.example.org"}], [{match_fun, public_key:pkix_verify_hostname_match_fun(https)} ] ). @@ -1040,7 +1049,14 @@ pkix_verify_hostname_options(Config) -> end}]), true = public_key:pkix_verify_hostname(Cert, [{uri_id,"https://example.com"}], [{fqdn_fun, fun(_) -> default end}]), - false = public_key:pkix_verify_hostname(Cert, [{uri_id,"some://very.wrong.domain"}]). + false = public_key:pkix_verify_hostname(Cert, [{uri_id,"some://very.wrong.domain"}]), + + true = public_key:pkix_verify_hostname(Cert, [{dns_id,"example.com"}]), + true = public_key:pkix_verify_hostname(Cert, [{dns_id,"abb.bar.example.com"}]), + false = public_key:pkix_verify_hostname(Cert, [{dns_id,"example.com"}, + {dns_id,"abb.bar.example.com"}], + [{fqdn_fun,fun(_)->undefined end}]). + %%-------------------------------------------------------------------- %% To generate the PEM file contents: -- cgit v1.2.3