aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/test/public_key_SUITE.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-09-28 16:46:42 +0200
committerHans Nilsson <[email protected]>2017-10-02 12:28:58 +0200
commit8cee0d079821288d3aa9b6a039b11497d315d390 (patch)
tree29ff9f5c8ef5bce5904f03f59911e416470e5983 /lib/public_key/test/public_key_SUITE.erl
parentc5fe2c9291e9f1f72045710f6389dad21e9270fb (diff)
downloadotp-8cee0d079821288d3aa9b6a039b11497d315d390.tar.gz
otp-8cee0d079821288d3aa9b6a039b11497d315d390.tar.bz2
otp-8cee0d079821288d3aa9b6a039b11497d315d390.zip
public_key: verify ip (both v4 and v6)
Diffstat (limited to 'lib/public_key/test/public_key_SUITE.erl')
-rw-r--r--lib/public_key/test/public_key_SUITE.erl24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl
index 6741a2e30c..0077c7908c 100644
--- a/lib/public_key/test/public_key_SUITE.erl
+++ b/lib/public_key/test/public_key_SUITE.erl
@@ -991,7 +991,7 @@ pkix_verify_hostname_options(Config) ->
%% openssl req -x509 -nodes -newkey rsa:1024 -keyout /dev/null -extensions SAN -config public_key_SUITE_data/verify_hostname_ip.conf 2>/dev/null > public_key_SUITE_data/pkix_verify_hostname_subjAltName_IP.pem
%%
%% Subject: C=SE, CN=example.com
-%% Subject Alternative Name: DNS:1.2.3.4, IP=5.6.7.8, URI:https://10.11.12.13
+%% Subject Alternative Name: DNS:1.2.3.4, DNS: abcd:ef::1, IP:5.6.7.8, URI:https://10.11.12.13
pkix_verify_hostname_subjAltName_IP(Config) ->
DataDir = proplists:get_value(data_dir, Config),
@@ -1000,28 +1000,24 @@ pkix_verify_hostname_subjAltName_IP(Config) ->
%% Print the tests that a matchfun has to handle
catch public_key:pkix_verify_hostname(Cert, [{some_tag,"some.domain"},
- {some_other_tag,[a,b,3,4]}],
+ {ip, {5,6,7,8}}
+ ],
[{match_fun,
fun(Ref,Pres) ->
ct:pal("~p:~p:~nRef : ~p~nPres: ~p",[?MODULE,?LINE,Ref,Pres]),
false
end}]),
- false = public_key:pkix_verify_hostname(Cert, [{uri_id,"https://10.11.12.14"}]),
+ false = public_key:pkix_verify_hostname(Cert, [{uri_id,"https://1.2.3.4"}]),
true = public_key:pkix_verify_hostname(Cert, [{uri_id,"https://10.11.12.13"}]),
true = public_key:pkix_verify_hostname(Cert, [{dns_id,"1.2.3.4"}]),
+ true = public_key:pkix_verify_hostname(Cert, [{dns_id,<<"1.2.3.4">>}]),
false = public_key:pkix_verify_hostname(Cert, [{dns_id,"5.6.7.8"}]),
- true = public_key:pkix_verify_hostname(Cert, [{ip,[5,6,7,8]}],
- [{match_fun,
- fun({ip,IPref},{iPAddress,IPpres}) ->
- ct:pal("~p:~p: IPref=~p, IPpres=~p",[?MODULE,?LINE,IPref,IPpres]),
- IPref == IPpres;
- (Ref,Pres) ->
- ct:pal("~p:~p:~nRef : ~p~nPres: ~p",[?MODULE,?LINE,Ref,Pres]),
- default
- end}]).
-
-
+ true = public_key:pkix_verify_hostname(Cert, [{ip, "aBcD:ef:0::0:1"}]),
+ true = public_key:pkix_verify_hostname(Cert, [{ip, {16#abcd,16#ef,0,0,0,0,0,1}}]),
+ true = public_key:pkix_verify_hostname(Cert, [{ip, "5.6.7.8"}]),
+ true = public_key:pkix_verify_hostname(Cert, [{ip, <<"5.6.7.8">>}]),
+ true = public_key:pkix_verify_hostname(Cert, [{ip, {5,6,7,8}}]).
%%--------------------------------------------------------------------