2 # Tests ECC cipher suites using ssltest. Requires one argument which could
3 # be aecdh or ecdh-ecdsa or ecdhe-ecdsa or ecdh-rsa or ecdhe-rsa.
4 # A second optional argument can be one of ssl2 ssl3 or tls1
7 (echo "Usage: $0 test [ protocol ]"
8 echo " where test is one of aecdh, ecdh-ecdsa, ecdhe-ecdsa, ecdh-rsa, ecdhe-rsa"
9 echo " and protocol (optional) is one of ssl2, ssl3, tls1"
10 echo "Run RSAcertgen.sh, ECC-RSAcertgen.sh, ECCcertgen.sh first."
18 SSLTEST
=$OPENSSL_DIR/test
/ssltest
19 # SSL protocol version to test (one of ssl2 ssl3 or tls1)"
22 # These don't really require any certificates
23 AECDH_CIPHER_LIST
="AECDH-AES256-SHA AECDH-AES128-SHA AECDH-DES-CBC3-SHA AECDH-RC4-SHA AECDH-NULL-SHA"
25 # These require ECC certificates signed with ECDSA
26 # The EC public key must be authorized for key agreement.
27 ECDH_ECDSA_CIPHER_LIST
="ECDH-ECDSA-AES256-SHA ECDH-ECDSA-AES128-SHA ECDH-ECDSA-DES-CBC3-SHA ECDH-ECDSA-RC4-SHA ECDH-ECDSA-NULL-SHA"
29 # These require ECC certificates.
30 # The EC public key must be authorized for digital signature.
31 ECDHE_ECDSA_CIPHER_LIST
="ECDHE-ECDSA-AES256-SHA ECDHE-ECDSA-AES128-SHA ECDHE-ECDSA-DES-CBC3-SHA ECDHE-ECDSA-RC4-SHA ECDHE-ECDSA-NULL-SHA"
33 # These require ECC certificates signed with RSA.
34 # The EC public key must be authorized for key agreement.
35 ECDH_RSA_CIPHER_LIST
="ECDH-RSA-AES256-SHA ECDH-RSA-AES128-SHA ECDH-RSA-DES-CBC3-SHA ECDH-RSA-RC4-SHA ECDH-RSA-NULL-SHA"
37 # These require RSA certificates.
38 # The RSA public key must be authorized for digital signature.
39 ECDHE_RSA_CIPHER_LIST
="ECDHE-RSA-AES256-SHA ECDHE-RSA-AES128-SHA ECDHE-RSA-DES-CBC3-SHA ECDHE-RSA-RC4-SHA ECDHE-RSA-NULL-SHA"
41 # List of Elliptic curves over which we wish to test generation of
42 # ephemeral ECDH keys when using AECDH or ECDHE ciphers
43 # NOTE: secp192r1 = prime192v1 and secp256r1 = prime256v1
44 #ELLIPTIC_CURVE_LIST="secp112r1 sect113r2 secp128r1 sect131r1 secp160k1 sect163r2 wap-wsg-idm-ecid-wtls7 c2pnb163v3 c2pnb176v3 c2tnb191v3 secp192r1 prime192v3 sect193r2 secp224r1 wap-wsg-idm-ecid-wtls10 sect239k1 prime239v2 secp256r1 prime256v1 sect283k1 secp384r1 sect409r1 secp521r1 sect571r1"
45 ELLIPTIC_CURVE_LIST
="sect163k1 sect163r1 sect163r2 sect193r1 sect193r2 sect233k1 sect233r1 sect239k1 sect283k1 sect283r1 sect409k1 sect409r1 sect571k1 sect571r1 secp160k1 secp160r1 secp160r2 secp192k1 prime192v1 secp224k1 secp224r1 secp256k1 prime256v1 secp384r1 secp521r1"
47 DEFAULT_CURVE
="sect163r2"
49 if [ "$2" = "" ]; then
50 if [ "$SSL_VERSION" = "" ]; then
53 SSL_VERSION
="-$SSL_VERSION"
59 #==============================================================
60 # Anonymous cipher suites do not require key or certificate files
61 # but ssltest expects a cert file and complains if it can't
62 # open the default one.
63 SERVER_PEM
=$OPENSSL_DIR/apps
/server.pem
65 if [ "$1" = "aecdh" ]; then
66 for cipher
in $AECDH_CIPHER_LIST
68 echo "Testing $cipher"
69 $SSLTEST $SSL_VERSION -cert $SERVER_PEM -cipher $cipher
71 #--------------------------------------------------------------
72 for curve
in $ELLIPTIC_CURVE_LIST
74 echo "Testing AECDH-NULL-SHA (with $curve)"
75 $SSLTEST $SSL_VERSION -cert $SERVER_PEM \
76 -named_curve $curve -cipher AECDH-NULL-SHA
79 for curve
in $ELLIPTIC_CURVE_LIST
81 echo "Testing AECDH-RC4-SHA (with $curve)"
82 $SSLTEST $SSL_VERSION -cert $SERVER_PEM \
83 -named_curve $curve -cipher AECDH-RC4-SHA
87 #==============================================================
88 # Both ECDH-ECDSA and ECDHE-ECDSA cipher suites require
89 # the server to have an ECC certificate signed with ECDSA.
90 CA_PEM
=$CERTS_DIR/secp160r1TestCA.pem
91 SERVER_PEM
=$CERTS_DIR/secp160r2TestServer.pem
92 CLIENT_PEM
=$CERTS_DIR/secp160r2TestClient.pem
94 if [ "$1" = "ecdh-ecdsa" ]; then
95 for cipher
in $ECDH_ECDSA_CIPHER_LIST
97 echo "Testing $cipher (with server authentication)"
98 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
99 -cert $SERVER_PEM -server_auth \
102 echo "Testing $cipher (with server and client authentication)"
103 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
104 -cert $SERVER_PEM -server_auth \
105 -c_cert $CLIENT_PEM -client_auth \
110 #==============================================================
111 if [ "$1" = "ecdhe-ecdsa" ]; then
112 for cipher
in $ECDHE_ECDSA_CIPHER_LIST
114 echo "Testing $cipher (with server authentication)"
115 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
116 -cert $SERVER_PEM -server_auth \
117 -cipher $cipher -named_curve $DEFAULT_CURVE
119 echo "Testing $cipher (with server and client authentication)"
120 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
121 -cert $SERVER_PEM -server_auth \
122 -c_cert $CLIENT_PEM -client_auth \
123 -cipher $cipher -named_curve $DEFAULT_CURVE
126 #--------------------------------------------------------------
127 for curve
in $ELLIPTIC_CURVE_LIST
129 echo "Testing ECDHE-ECDSA-AES128-SHA (2-way auth with $curve)"
130 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
131 -cert $SERVER_PEM -server_auth \
132 -c_cert $CLIENT_PEM -client_auth \
133 -cipher ECDHE-ECDSA-AES128-SHA
-named_curve $curve
137 #==============================================================
138 # ECDH-RSA cipher suites require the server to have an ECC
139 # certificate signed with RSA.
140 CA_PEM
=$CERTS_DIR/rsa1024TestCA.pem
141 SERVER_PEM
=$CERTS_DIR/sect163r1-rsaTestServer.pem
142 CLIENT_PEM
=$CERTS_DIR/sect163r1-rsaTestClient.pem
144 if [ "$1" = "ecdh-rsa" ]; then
145 for cipher
in $ECDH_RSA_CIPHER_LIST
147 echo "Testing $cipher (with server authentication)"
148 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
149 -cert $SERVER_PEM -server_auth \
152 echo "Testing $cipher (with server and client authentication)"
153 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
154 -cert $SERVER_PEM -server_auth \
155 -c_cert $CLIENT_PEM -client_auth \
160 #==============================================================
161 # ECDHE-RSA cipher suites require the server to have an RSA cert.
162 CA_PEM
=$CERTS_DIR/rsa1024TestCA.pem
163 SERVER_PEM
=$CERTS_DIR/rsa1024TestServer.pem
164 CLIENT_PEM
=$CERTS_DIR/rsa1024TestClient.pem
166 if [ "$1" = "ecdhe-rsa" ]; then
167 for cipher
in $ECDHE_RSA_CIPHER_LIST
169 echo "Testing $cipher (with server authentication)"
170 echo $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
171 -cert $SERVER_PEM -server_auth \
172 -cipher $cipher -named_curve $DEFAULT_CURVE
173 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
174 -cert $SERVER_PEM -server_auth \
175 -cipher $cipher -named_curve $DEFAULT_CURVE
177 echo "Testing $cipher (with server and client authentication)"
178 $SSLTEST $SSL_VERSION -CAfile $CA_PEM \
179 -cert $SERVER_PEM -server_auth \
180 -c_cert $CLIENT_PEM -client_auth \
181 -cipher $cipher -named_curve $DEFAULT_CURVE
184 #==============================================================