1 | The OpenSSL Guide Demos
|
---|
2 | =======================
|
---|
3 |
|
---|
4 | The demos in this directory are the complete source code for the applications
|
---|
5 | developed in the OpenSSL Guide tutorials. Refer to the various tutorial pages in
|
---|
6 | the [guide] for an extensive discussion on the demos available here.
|
---|
7 |
|
---|
8 | They must be built before they can be run. An example UNIX style Makefile is
|
---|
9 | supplied. Just type "make" from this directory on a Linux/UNIX system.
|
---|
10 |
|
---|
11 | Running the TLS Demos
|
---|
12 | ---------------------
|
---|
13 |
|
---|
14 | To run the demos when linked with a shared library (default) ensure that
|
---|
15 | libcrypto and libssl are on the library path. For example, assuming you have
|
---|
16 | already built OpenSSL from this source and in the default location then to run
|
---|
17 | the tls-client-block demo do this:
|
---|
18 |
|
---|
19 | LD_LIBRARY_PATH=../.. ./tls-client-block hostname port
|
---|
20 |
|
---|
21 | In the above replace "hostname" and "port" with the hostname and the port number
|
---|
22 | of the server you are connecting to.
|
---|
23 |
|
---|
24 | The above assumes that your default trusted certificate store containing trusted
|
---|
25 | CA certificates has been properly setup and configured as described on the
|
---|
26 | [TLS Introduction] page.
|
---|
27 |
|
---|
28 | You can run a test server to try out these demos using the "openssl s_server"
|
---|
29 | command line utility and using the test server certificate and key provided in
|
---|
30 | this directory. For example:
|
---|
31 |
|
---|
32 | LD_LIBRARY_PATH=../.. ../../apps/openssl s_server -www -accept localhost:4443 -cert servercert.pem -key serverkey.pem
|
---|
33 |
|
---|
34 | The test server certificate in this directory will use a CA that will not be in
|
---|
35 | your default trusted certificate store. The CA certificate to use is also
|
---|
36 | available in this directory. To use it you can override the default trusted
|
---|
37 | certificate store like this:
|
---|
38 |
|
---|
39 | SSL_CERT_FILE=rootcert.pem LD_LIBRARY_PATH=../.. ./tls-client-block localhost 4443
|
---|
40 |
|
---|
41 | If the above command is successful it will connect to the test "s_server" and
|
---|
42 | send a simple HTTP request to it. The server will respond with a page of
|
---|
43 | information giving details about the TLS connection that was used.
|
---|
44 |
|
---|
45 | Note that the test server certificate used here is only suitable for use on
|
---|
46 | "localhost".
|
---|
47 |
|
---|
48 | The tls-client-non-block demo can be run in exactly the same way. Just replace
|
---|
49 | "tls-client-block" in the above example commands with "tls-client-non-block".
|
---|
50 |
|
---|
51 | Running the QUIC Demos
|
---|
52 | ----------------------
|
---|
53 |
|
---|
54 | The QUIC demos can be run in a very similar way to the TLS demos. However, a
|
---|
55 | different server implementation will need to be used.
|
---|
56 |
|
---|
57 | The OpenSSL source distribution includes a test QUIC server implementation for
|
---|
58 | use with the demos. Note that, although this server does get built when building
|
---|
59 | OpenSSL from source, it does not get installed via "make install". After
|
---|
60 | building OpenSSL from source you will find the "quicserver" utility in the
|
---|
61 | "util" sub-directory of the top of the build tree. This server utility is not
|
---|
62 | suitable for production use and exists for test purposes only. It will be
|
---|
63 | removed from a future version of OpenSSL.
|
---|
64 |
|
---|
65 | While in the demos directory the quic server can be run like this:
|
---|
66 |
|
---|
67 | ./../util/quicserver localhost 4443 servercert.pem serverkey.pem
|
---|
68 |
|
---|
69 | The QUIC demos can then be run in the same was as the TLS demos. For example
|
---|
70 | to run the quic-client-block demo:
|
---|
71 |
|
---|
72 | SSL_CERT_FILE=rootcert.pem LD_LIBRARY_PATH=../.. ./quic-client-block localhost 4443
|
---|
73 |
|
---|
74 | <!-- Links -->
|
---|
75 |
|
---|
76 | [guide]: https://www.openssl.org/docs/manmaster/man7/ossl-guide-introduction.html
|
---|
77 | [TLS Introduction]: https://www.openssl.org/docs/manmaster/man7/ossl-guide-tls-introduction.html
|
---|