diff options
author | moparisthebest <admin@moparisthebest.com> | 2014-11-24 19:30:09 +0100 |
---|---|---|
committer | Patrick Monnerat <pm@datasphere.ch> | 2014-11-24 19:30:09 +0100 |
commit | be1a5051890b7ad9339b0208424b94aa32c64776 (patch) | |
tree | d98e121223d1959808a8446e9000ecacaf70a1c8 /tests | |
parent | 2008c92513cee98ded80ed9ffaf984edc0c97c33 (diff) |
SSL: Add PEM format support for public key pinning
Diffstat (limited to 'tests')
-rw-r--r-- | tests/certs/Makefile.am | 8 | ||||
-rw-r--r-- | tests/certs/Server-localhost-sv.pub.pem | 6 | ||||
-rw-r--r-- | tests/certs/Server-localhost.nn-sv.pub.pem | 6 | ||||
-rw-r--r-- | tests/certs/Server-localhost0h-sv.pub.pem | 6 | ||||
-rwxr-xr-x | tests/certs/scripts/genserv.sh | 3 | ||||
-rw-r--r-- | tests/data/Makefile.inc | 2 | ||||
-rw-r--r-- | tests/data/test2034 | 2 | ||||
-rw-r--r-- | tests/data/test2035 | 2 | ||||
-rw-r--r-- | tests/data/test2037 | 58 | ||||
-rw-r--r-- | tests/data/test2038 | 44 |
10 files changed, 133 insertions, 4 deletions
diff --git a/tests/certs/Makefile.am b/tests/certs/Makefile.am index cd35bdff2..ddb5c9fb1 100644 --- a/tests/certs/Makefile.am +++ b/tests/certs/Makefile.am @@ -40,6 +40,8 @@ CERTFILES = \ Server-localhost-sv.p12 \ Server-localhost-sv.pem \ Server-localhost-sv.prm \ + Server-localhost-sv.pub.der \ + Server-localhost-sv.pub.pem \ Server-localhost.nn-sv.crl \ Server-localhost.nn-sv.crt \ Server-localhost.nn-sv.csr \ @@ -48,6 +50,8 @@ CERTFILES = \ Server-localhost.nn-sv.key \ Server-localhost.nn-sv.pem \ Server-localhost.nn-sv.prm \ + Server-localhost.nn-sv.pub.der \ + Server-localhost.nn-sv.pub.pem \ Server-localhost0h-sv.crl \ Server-localhost0h-sv.crt \ Server-localhost0h-sv.csr \ @@ -56,7 +60,9 @@ CERTFILES = \ Server-localhost0h-sv.key \ Server-localhost0h-sv.p12 \ Server-localhost0h-sv.pem \ - Server-localhost0h-sv.prm + Server-localhost0h-sv.prm \ + Server-localhost0h-sv.pub.der \ + Server-localhost0h-sv.pub.pem SRPFILES = \ srp-verifier-conf \ diff --git a/tests/certs/Server-localhost-sv.pub.pem b/tests/certs/Server-localhost-sv.pub.pem new file mode 100644 index 000000000..2384643d6 --- /dev/null +++ b/tests/certs/Server-localhost-sv.pub.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwJ3kmLLnk0YEKCdJ2/prhBWgB +s3J3lzjkYBxxnZn3JnshtW2qnxR2B2ykKi197vZviljEk97+oSUP/1dJwNmU2Qd5 +v4xt+vEYgmegP9cxA4LsuTlpB+zskxdbGnKRk7JrmGZj/mEp562GDgS6v4tVV2Gl +SvbK58bRuGVCq2dkFwIDAQAB +-----END PUBLIC KEY----- diff --git a/tests/certs/Server-localhost.nn-sv.pub.pem b/tests/certs/Server-localhost.nn-sv.pub.pem new file mode 100644 index 000000000..3131e9539 --- /dev/null +++ b/tests/certs/Server-localhost.nn-sv.pub.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDT1E7bY1w/OjpeOAmU5k1wnQ2v +SeaCXQe39c2g369x8c+/1Zq9r3x4XVU/FL27LA5zndaCmtXm9iFdCJKicV+AX1zO +8MI3N3kPTT3U8oBtRzZF0dKLei4ScUtHhvWMma/nDs+1yU16dfeydAxB46u7LJ1v +VAgTWjrvfCf3PwsLcQIDAQAB +-----END PUBLIC KEY----- diff --git a/tests/certs/Server-localhost0h-sv.pub.pem b/tests/certs/Server-localhost0h-sv.pub.pem new file mode 100644 index 000000000..c403ac575 --- /dev/null +++ b/tests/certs/Server-localhost0h-sv.pub.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMqZErIuiQK+VM3K5t2kzzMsyl +aGdaO7mGo5WIPuhjw+0AYBkDK11bVoraIV5xXNHj3lEYwRcUsTOQAFya5XMLqIic +0AtUvOo6Od32ZYFLKZlMcdP3aX+A6OhtYUGDh+usLL0P6xv9ojeXbTFWuktR3bEB +64n4Jd5bo+WyP0x3UwIDAQAB +-----END PUBLIC KEY----- diff --git a/tests/certs/scripts/genserv.sh b/tests/certs/scripts/genserv.sh index 463952c57..80876ec51 100755 --- a/tests/certs/scripts/genserv.sh +++ b/tests/certs/scripts/genserv.sh @@ -78,6 +78,9 @@ echo pseudo secrets generated echo "openssl rsa -in $PREFIX-sv.key -pubout -outform DER -out $PREFIX-sv.pub.der" $OPENSSL rsa -in $PREFIX-sv.key -pubout -outform DER -out $PREFIX-sv.pub.der +echo "openssl rsa -in $PREFIX-sv.key -pubout -outform PEM -out $PREFIX-sv.pub.pem" +$OPENSSL rsa -in $PREFIX-sv.key -pubout -outform PEM -out $PREFIX-sv.pub.pem + echo "openssl x509 -set_serial $SERIAL -extfile $PREFIX-sv.prm -days $DURATION -CA $CAPREFIX-ca.cacert -CAkey $CAPREFIX-ca.key -in $PREFIX-sv.csr -req -out $PREFIX-sv.crt -text -nameopt multiline -sha1" $OPENSSL x509 -set_serial $SERIAL -extfile $PREFIX-sv.prm -days $DURATION -CA $CAPREFIX-ca.cacert -CAkey $CAPREFIX-ca.key -in $PREFIX-sv.csr -req -out $PREFIX-sv.crt -text -nameopt multiline -sha1 diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 3edeceb2a..ee2d84fab 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -158,4 +158,4 @@ test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \ test2008 test2009 test2010 test2011 test2012 test2013 test2014 test2015 \ test2016 test2017 test2018 test2019 test2020 test2021 test2022 test2023 \ test2024 test2025 test2026 test2027 test2028 test2029 test2030 test2031 \ -test2032 test2033 test2034 test2035 test2036 +test2032 test2033 test2034 test2035 test2036 test2037 test2038 diff --git a/tests/data/test2034 b/tests/data/test2034 index 965c9a1b1..9bf0a817c 100644 --- a/tests/data/test2034 +++ b/tests/data/test2034 @@ -31,7 +31,7 @@ SSLpinning https Server-localhost-sv.pem </server> <name> -simple HTTPS GET with public key pinning +simple HTTPS GET with DER public key pinning </name> <command> --cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.pub.der https://localhost:%HTTPSPORT/2034 diff --git a/tests/data/test2035 b/tests/data/test2035 index 64282fabe..7002a5b8e 100644 --- a/tests/data/test2035 +++ b/tests/data/test2035 @@ -23,7 +23,7 @@ SSLpinning https Server-localhost-sv.pem </server> <name> -HTTPS wrong pinnedpubkey but right CN +HTTPS wrong DER pinnedpubkey but right CN </name> <command> --cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.der https://localhost:%HTTPSPORT/2035 diff --git a/tests/data/test2037 b/tests/data/test2037 new file mode 100644 index 000000000..d630538e2 --- /dev/null +++ b/tests/data/test2037 @@ -0,0 +1,58 @@ +<testcase> +<info> +<keywords> +HTTPS +HTTP GET +PEM certificate +</keywords> +</info> + +# +# Server-side +<reply> +<data> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Content-Length: 7 + +MooMoo +</data> +</reply> + +# +# Client-side +<client> +<features> +SSL +SSLpinning +</features> +<server> +https Server-localhost-sv.pem +</server> + <name> +simple HTTPS GET with PEM public key pinning + </name> + <command> +--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.pub.pem https://localhost:%HTTPSPORT/2037 +</command> +# Ensure that we're running on localhost because we're checking the host name +<precheck> +perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );" +</precheck> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /2037 HTTP/1.1
+Host: localhost:%HTTPSPORT
+Accept: */*
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test2038 b/tests/data/test2038 new file mode 100644 index 000000000..63d935add --- /dev/null +++ b/tests/data/test2038 @@ -0,0 +1,44 @@ +<testcase> +<info> +<keywords> +HTTPS +HTTP GET +PEM certificate +</keywords> +</info> + +# +# Server-side +<reply> +</reply> + +# +# Client-side +<client> +<features> +SSL +SSLpinning +</features> +<server> +https Server-localhost-sv.pem +</server> + <name> +HTTPS wrong PEM pinnedpubkey but right CN + </name> + <command> +--cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --pinnedpubkey %SRCDIR/certs/Server-localhost-sv.pem https://localhost:%HTTPSPORT/2038 +</command> +# Ensure that we're running on localhost because we're checking the host name +<precheck> +perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );" +</precheck> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<errorcode> +90 +</errorcode> +</verify> +</testcase> |