testssl 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/bin/sh
  2. if [ "$1" = "" ]; then
  3. key=../apps/server.pem
  4. else
  5. key="$1"
  6. fi
  7. if [ "$2" = "" ]; then
  8. cert=../apps/server.pem
  9. else
  10. cert="$2"
  11. fi
  12. ssltest="./ssltest -key $key -cert $cert -c_key $key -c_cert $cert"
  13. if ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then
  14. dsa_cert=YES
  15. else
  16. dsa_cert=NO
  17. fi
  18. if [ "$3" = "" ]; then
  19. CA="-CApath ../certs"
  20. else
  21. CA="-CAfile $3"
  22. fi
  23. #############################################################################
  24. echo test sslv2
  25. $ssltest -ssl2 || exit 1
  26. echo test sslv2 with server authentication
  27. $ssltest -ssl2 -server_auth $CA || exit 1
  28. if [ $dsa_cert = NO ]; then
  29. echo test sslv2 with client authentication
  30. $ssltest -ssl2 -client_auth $CA || exit 1
  31. echo test sslv2 with both client and server authentication
  32. $ssltest -ssl2 -server_auth -client_auth $CA || exit 1
  33. fi
  34. echo test sslv3
  35. $ssltest -ssl3 || exit 1
  36. echo test sslv3 with server authentication
  37. $ssltest -ssl3 -server_auth $CA || exit 1
  38. echo test sslv3 with client authentication
  39. $ssltest -ssl3 -client_auth $CA || exit 1
  40. echo test sslv3 with both client and server authentication
  41. $ssltest -ssl3 -server_auth -client_auth $CA || exit 1
  42. echo test sslv2/sslv3
  43. $ssltest || exit 1
  44. echo test sslv2/sslv3 with server authentication
  45. $ssltest -server_auth $CA || exit 1
  46. echo test sslv2/sslv3 with client authentication
  47. $ssltest -client_auth $CA || exit 1
  48. echo test sslv2/sslv3 with both client and server authentication
  49. $ssltest -server_auth -client_auth $CA || exit 1
  50. echo test sslv2 via BIO pair
  51. $ssltest -bio_pair -ssl2 || exit 1
  52. echo test sslv2 with server authentication via BIO pair
  53. $ssltest -bio_pair -ssl2 -server_auth $CA || exit 1
  54. if [ $dsa_cert = NO ]; then
  55. echo test sslv2 with client authentication via BIO pair
  56. $ssltest -bio_pair -ssl2 -client_auth $CA || exit 1
  57. echo test sslv2 with both client and server authentication via BIO pair
  58. $ssltest -bio_pair -ssl2 -server_auth -client_auth $CA || exit 1
  59. fi
  60. echo test sslv3 via BIO pair
  61. $ssltest -bio_pair -ssl3 || exit 1
  62. echo test sslv3 with server authentication via BIO pair
  63. $ssltest -bio_pair -ssl3 -server_auth $CA || exit 1
  64. echo test sslv3 with client authentication via BIO pair
  65. $ssltest -bio_pair -ssl3 -client_auth $CA || exit 1
  66. echo test sslv3 with both client and server authentication via BIO pair
  67. $ssltest -bio_pair -ssl3 -server_auth -client_auth $CA || exit 1
  68. echo test sslv2/sslv3 via BIO pair
  69. $ssltest || exit 1
  70. if [ $dsa_cert = NO ]; then
  71. echo test sslv2/sslv3 w/o DHE via BIO pair
  72. $ssltest -bio_pair -no_dhe || exit 1
  73. fi
  74. echo test sslv2/sslv3 with 1024bit DHE via BIO pair
  75. $ssltest -bio_pair -dhe1024dsa -v || exit 1
  76. echo test sslv2/sslv3 with server authentication
  77. $ssltest -bio_pair -server_auth $CA || exit 1
  78. echo test sslv2/sslv3 with client authentication via BIO pair
  79. $ssltest -bio_pair -client_auth $CA || exit 1
  80. echo test sslv2/sslv3 with both client and server authentication via BIO pair
  81. $ssltest -bio_pair -server_auth -client_auth $CA || exit 1
  82. #############################################################################
  83. if ../apps/openssl no-dh; then
  84. echo skipping anonymous DH tests
  85. else
  86. echo test tls1 with 1024bit anonymous DH, multiple handshakes
  87. $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time || exit 1
  88. fi
  89. if ../apps/openssl no-rsa; then
  90. echo skipping RSA tests
  91. else
  92. echo test tls1 with 1024bit RSA, no DHE, multiple handshakes
  93. ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -num 10 -f -time || exit 1
  94. if ../apps/openssl no-dh; then
  95. echo skipping RSA+DHE tests
  96. else
  97. echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
  98. ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time || exit 1
  99. fi
  100. fi
  101. exit 0