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