1*e7be843bSPierre ProncheryThe OpenSSL Guide Demos 2*e7be843bSPierre Pronchery======================= 3*e7be843bSPierre Pronchery 4*e7be843bSPierre ProncheryThe demos in this directory are the complete source code for the applications 5*e7be843bSPierre Proncherydeveloped in the OpenSSL Guide tutorials. Refer to the various tutorial pages in 6*e7be843bSPierre Proncherythe [guide] for an extensive discussion on the demos available here. 7*e7be843bSPierre Pronchery 8*e7be843bSPierre ProncheryThey must be built before they can be run. An example UNIX style Makefile is 9*e7be843bSPierre Proncherysupplied. Just type "make" from this directory on a Linux/UNIX system. 10*e7be843bSPierre Pronchery 11*e7be843bSPierre ProncheryRunning the TLS Demos 12*e7be843bSPierre Pronchery--------------------- 13*e7be843bSPierre Pronchery 14*e7be843bSPierre ProncheryTo run the demos when linked with a shared library (default) ensure that 15*e7be843bSPierre Proncherylibcrypto and libssl are on the library path. For example, assuming you have 16*e7be843bSPierre Proncheryalready built OpenSSL from this source and in the default location then to run 17*e7be843bSPierre Proncherythe tls-client-block demo do this: 18*e7be843bSPierre Pronchery 19*e7be843bSPierre ProncheryLD_LIBRARY_PATH=../.. ./tls-client-block hostname port 20*e7be843bSPierre Pronchery 21*e7be843bSPierre ProncheryIn the above replace "hostname" and "port" with the hostname and the port number 22*e7be843bSPierre Proncheryof the server you are connecting to. 23*e7be843bSPierre Pronchery 24*e7be843bSPierre ProncheryThe above assumes that your default trusted certificate store containing trusted 25*e7be843bSPierre ProncheryCA certificates has been properly setup and configured as described on the 26*e7be843bSPierre Pronchery[TLS Introduction] page. 27*e7be843bSPierre Pronchery 28*e7be843bSPierre ProncheryYou can run a test server to try out these demos using the "openssl s_server" 29*e7be843bSPierre Proncherycommand line utility and using the test server certificate and key provided in 30*e7be843bSPierre Proncherythis directory. For example: 31*e7be843bSPierre Pronchery 32*e7be843bSPierre ProncheryLD_LIBRARY_PATH=../.. ../../apps/openssl s_server -www -accept localhost:4443 -cert servercert.pem -key serverkey.pem 33*e7be843bSPierre Pronchery 34*e7be843bSPierre ProncheryThe test server certificate in this directory will use a CA that will not be in 35*e7be843bSPierre Proncheryyour default trusted certificate store. The CA certificate to use is also 36*e7be843bSPierre Proncheryavailable in this directory. To use it you can override the default trusted 37*e7be843bSPierre Proncherycertificate store like this: 38*e7be843bSPierre Pronchery 39*e7be843bSPierre ProncherySSL_CERT_FILE=rootcert.pem LD_LIBRARY_PATH=../.. ./tls-client-block localhost 4443 40*e7be843bSPierre Pronchery 41*e7be843bSPierre ProncheryIf the above command is successful it will connect to the test "s_server" and 42*e7be843bSPierre Proncherysend a simple HTTP request to it. The server will respond with a page of 43*e7be843bSPierre Proncheryinformation giving details about the TLS connection that was used. 44*e7be843bSPierre Pronchery 45*e7be843bSPierre ProncheryNote that the test server certificate used here is only suitable for use on 46*e7be843bSPierre Pronchery"localhost". 47*e7be843bSPierre Pronchery 48*e7be843bSPierre ProncheryThe tls-client-non-block demo can be run in exactly the same way. Just replace 49*e7be843bSPierre Pronchery"tls-client-block" in the above example commands with "tls-client-non-block". 50*e7be843bSPierre Pronchery 51*e7be843bSPierre ProncheryRunning the QUIC Demos 52*e7be843bSPierre Pronchery---------------------- 53*e7be843bSPierre Pronchery 54*e7be843bSPierre ProncheryThe QUIC demos can be run in a very similar way to the TLS demos. 55*e7be843bSPierre Pronchery 56*e7be843bSPierre ProncheryWhile in the demos directory the QUIC server can be run like this: 57*e7be843bSPierre Pronchery 58*e7be843bSPierre ProncheryLD_LIBRARY_PATH=../.. ./quic-server-block 4443 ./chain.pem ./pkey.pem 59*e7be843bSPierre Pronchery 60*e7be843bSPierre ProncheryThe QUIC demos can then be run in the same was as the TLS demos. For example 61*e7be843bSPierre Proncheryto run the quic-client-block demo: 62*e7be843bSPierre Pronchery 63*e7be843bSPierre ProncherySSL_CERT_FILE=chain.pem LD_LIBRARY_PATH=../.. ./quic-client-block localhost 4443 64*e7be843bSPierre Pronchery 65*e7be843bSPierre ProncheryNotes on the quic-hq-interop demo 66*e7be843bSPierre Pronchery--------------------------------- 67*e7be843bSPierre Pronchery 68*e7be843bSPierre ProncheryThe quic-hq-interop demo is effectively the same as the quic-client-nonblock 69*e7be843bSPierre Proncherydemo, but is specifically constructed to use the hq-interop alpn for the 70*e7be843bSPierre Proncherypurposes of interacting with other demonstration containers found in the 71*e7be843bSPierre ProncheryQUIC working group [interop runner](https://github.com/quic-interop/quic-interop-runner) 72*e7be843bSPierre ProncheryIt is run as follows: 73*e7be843bSPierre Pronchery 74*e7be843bSPierre ProncherySSL_CERT_FILE=ca.pem LD_LIBRARY_PATH=../../ ./quic-hq-interop host port file 75*e7be843bSPierre Pronchery 76*e7be843bSPierre ProncheryThe demo will then do the following: 77*e7be843bSPierre Pronchery 78*e7be843bSPierre Pronchery1. Connect to the server at host/port 79*e7be843bSPierre Pronchery2. Negotiates the hq-interop alpn 80*e7be843bSPierre Pronchery3. Issues an HTTP 1.0 GET request of the form "GET /$FILE" 81*e7be843bSPierre Pronchery3. Reads any response from the server and write it verbatim to stdout 82*e7be843bSPierre Pronchery 83*e7be843bSPierre ProncheryThis demo can be used for any hq-interop negotiating server, but its use can 84*e7be843bSPierre Proncherymost easily be seen in action in our quic interop container, buildable from 85*e7be843bSPierre Pronchery./test/quic_interop_openssl in this source tree. 86*e7be843bSPierre Pronchery 87*e7be843bSPierre Pronchery<!-- Links --> 88*e7be843bSPierre Pronchery 89*e7be843bSPierre Pronchery[guide]: https://www.openssl.org/docs/manmaster/man7/ossl-guide-introduction.html 90*e7be843bSPierre Pronchery[TLS Introduction]: https://www.openssl.org/docs/manmaster/man7/ossl-guide-tls-introduction.html 91