diff options
author | Matt Caswell <matt@openssl.org> | 2023-10-30 12:22:24 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-11-02 09:14:46 +0100 |
commit | a2b824730ef12cda4e018f5f7cde2ab52a4d255c (patch) | |
tree | d546ba6b5067fe32b3df9751e9fd8831e6954df3 /demos | |
parent | Amend the TLS demos to accept hostname/port as an argument (diff) | |
download | openssl-a2b824730ef12cda4e018f5f7cde2ab52a4d255c.tar.xz openssl-a2b824730ef12cda4e018f5f7cde2ab52a4d255c.zip |
Extend the README to describe how to run the TLS demos
We also supply some test certificates for use with the demos.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22552)
Diffstat (limited to 'demos')
-rw-r--r-- | demos/guide/README.md | 36 | ||||
-rw-r--r-- | demos/guide/rootcert.pem | 18 | ||||
-rw-r--r-- | demos/guide/rootkey.pem | 28 | ||||
-rw-r--r-- | demos/guide/servercert.pem | 19 | ||||
-rw-r--r-- | demos/guide/serverkey.pem | 28 |
5 files changed, 128 insertions, 1 deletions
diff --git a/demos/guide/README.md b/demos/guide/README.md index f1cbf1ea3b..a412585d34 100644 --- a/demos/guide/README.md +++ b/demos/guide/README.md @@ -5,11 +5,45 @@ The demos in this directory are the complete source code for the applications developed in the OpenSSL Guide tutorials. Refer to the various tutorial pages in the [guide] for an extensive discussion on the demos available here. +Running the TLS Demos +--------------------- + To run the demos when linked with a shared library (default) ensure that libcrypto and libssl are on the library path. For example, assuming you have already built OpenSSL from this source and in the default location then to run the tls-client-block demo do this: -LD_LIBRARY_PATH=../.. ./tls-client-block +LD_LIBRARY_PATH=../.. ./tls-client-block hostname port + +In the above replace "hostname" and "port" with the hostname and the port number +of the server you are connecting to. + +The above assumes that your default trusted certificate store containing trusted +CA certificates has been properly setup and configured as described on the +[TLS Introduction] page. + +You can run a test server to try out these demos using the "openssl s_server" +command line utility and using the test server certificate and key provided in +this directory. For example: + +LD_LIBRARY_PATH=../.. ../../apps/openssl s_server -www -accept localhost:4443 -cert servercert.pem -key serverkey.pem + +The test server certificate in this directory will use a CA that will not be in +your default trusted certificate store. The CA certificate to use is also +available in this directory. To use it you can override the default trusted +certificate store like this: + +SSL_CERT_FILE=rootcert.pem LD_LIBRARY_PATH=../.. ./tls-client-block localhost 4443 + +If the above command is successful it will connect to the test "s_server" and +send a simple HTTP request to it. The server will respond with a page of +information giving details about the TLS connection that was used. + +Note that the test server certificate used here is only suitable for use on +"localhost". + +The tls-client-non-block demo can be run in exactly the same way. Just replace +"tls-client-block" in the above example commands with "tls-client-non-block". [guide]: https://www.openssl.org/docs/manmaster/man7/ossl-guide-introduction.html +[TLS Introduction]: https://www.openssl.org/docs/manmaster/man7/ossl-guide-tls-introduction.html diff --git a/demos/guide/rootcert.pem b/demos/guide/rootcert.pem new file mode 100644 index 0000000000..2b90ddb3ee --- /dev/null +++ b/demos/guide/rootcert.pem @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIIC8TCCAdmgAwIBAgIBATANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDDAdSb290 +IENBMCAXDTE2MDExNDIyMjkwNVoYDzIxMTYwMTE1MjIyOTA1WjASMRAwDgYDVQQD +DAdSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv5oV1s3N +us7SINg7omu5AxueEgK97mh5PU3hgZpliSFaESmL2qLGeP609oXs/68XDXVW4utU +LCOjLh0np+5Xy3i3GRDXgBZ72QDe23WqqQqqaBlQVVm1WxG+amRtZJEWdSIsiFBt +k+8dBElHh2WQDhDOWqHGHQarQgJPxGB97MRhMSlbTwK1T5KAWOlqi5mJW5L6vNrQ +7Tra/YceH70fU0fJYOXhBxM92NwD1bbVd9GPYFSqrdrVj19bvo63XsxZduex5QHr +RkWqT5w5mgAHaEgCqWrS/64q9TR9UEwrB8kiZZg3k9/im+zBwEULTZu0r8oMEkpj +bTlXLmt8EMBqxwIDAQABo1AwTjAdBgNVHQ4EFgQUcH8uroNoWZgEIyrN6z4XzSTd +AUkwHwYDVR0jBBgwFoAUcH8uroNoWZgEIyrN6z4XzSTdAUkwDAYDVR0TBAUwAwEB +/zANBgkqhkiG9w0BAQsFAAOCAQEAuiLq2lhcOJHrwUP0txbHk2vy6rmGTPxqmcCo +CUQFZ3KrvUQM+rtRqqQ0+LzU4wSTFogBz9KSMfT03gPegY3b/7L2TOaMmUFRzTdd +c9PNT0lP8V3pNQrxp0IjKir791QkGe2Ux45iMKf/SXpeTWASp4zeMiD6/LXFzzaK +BfNS5IrIWRDev41lFasDzudK5/kmVaMvDOFyW51KkKkqb64VS4UA81JIEzClvz+3 +Vp3k1AXup5+XnTvhqu2nRhrLpJR5w8OXQpcn6qjKlVc2BXtb3xwci1/ibHlZy3CZ +n70e2NYihU5yYKccReP+fjLgVFsuhsDs/0hRML1u9bLp9nUbYA== +-----END CERTIFICATE----- diff --git a/demos/guide/rootkey.pem b/demos/guide/rootkey.pem new file mode 100644 index 0000000000..d85c96f898 --- /dev/null +++ b/demos/guide/rootkey.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC/mhXWzc26ztIg +2Duia7kDG54SAr3uaHk9TeGBmmWJIVoRKYvaosZ4/rT2hez/rxcNdVbi61QsI6Mu +HSen7lfLeLcZENeAFnvZAN7bdaqpCqpoGVBVWbVbEb5qZG1kkRZ1IiyIUG2T7x0E +SUeHZZAOEM5aocYdBqtCAk/EYH3sxGExKVtPArVPkoBY6WqLmYlbkvq82tDtOtr9 +hx4fvR9TR8lg5eEHEz3Y3APVttV30Y9gVKqt2tWPX1u+jrdezFl257HlAetGRapP +nDmaAAdoSAKpatL/rir1NH1QTCsHySJlmDeT3+Kb7MHARQtNm7SvygwSSmNtOVcu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IRyyDo4aKmTQKBgQCadq2JfICFIP9Q1aQn +93oD7Z4WcYs+KsLYO+/uJxWMrn0/gv90cGrSfstJqDOHnRq4WKUcgK9ErxaE4LkW +sD0mBhRM3SMxnRJZRO+6roRdehtjHkvzKu75KjcsuwefoMs2sFa4CLQ1YU2vO3Tx +dgzpnKS2bH/i5yLwhelRfddZ6Q== +-----END PRIVATE KEY----- diff --git a/demos/guide/servercert.pem b/demos/guide/servercert.pem new file mode 100644 index 0000000000..70da6711ca --- /dev/null +++ b/demos/guide/servercert.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDBTCCAe2gAwIBAgIBAjANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDDAdSb290 +IENBMCAXDTIzMTAzMDEwMjYxNloYDzIxMjMxMDMxMTAyNjE2WjAUMRIwEAYDVQQD +DAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCk6ujS +x/spB5QEiXy4gNe2ETgXFfWxk4WldQRb+pk6QBNMMLaIRG+bpN7bHnXxMKj5hmoj +gPYUYsUquWkv5RjDCRRty2uV/If8fGWfJnyiRWaiLcXu0GqxvQpISOOnSmAvwJEx +zl5rz8ESATYxGfedqJPXUHNa4CrMpAY5ugsisA0KuaD0xrRD2dQ8Ub8pbibEKey+ +M0/uVMSgMbyEthRmRTkv4UufHqwxeKk0LlGi6IeZa+rqCkBObkcFiErc7ms+1IKO +cJJ6ib2uiZt+1we8zIaob/iPekAjCakghY1Ba7ZBLpPxkM2tTfxPnE1KoiuludOq +4tZCoULHl1iJuIYHAgMBAAGjYjBgMB0GA1UdDgQWBBQtMXuC2ST9usgeZ0mpVcdJ +CxRPnjAfBgNVHSMEGDAWgBRwfy6ug2hZmAQjKs3rPhfNJN0BSTAJBgNVHRMEAjAA +MBMGA1UdJQQMMAoGCCsGAQUFBwMBMA0GCSqGSIb3DQEBCwUAA4IBAQCqXUb/TGdB +ARHt/MysFv4Tx3dOpdqR+buSvIfK3eRO3lmZdIVsPGWODZvpW2hAgkHSIevkhMi4 +VI97G8fk4SNDfg+O+rTA8/OlP1GBtbKXnAKdii5Y3RciQOtzp54BzM9rx2YhCzTu +vESEPzk3fAtAgKWFCAkj1Oh7fHykwNC7Xj0WgYcNlrIJKb6EQ76AgA0MHntnYZbY +Hr4D/TxjoGxhEisjPdYfagQhTtTeYDQiEDTr79Lnclj5EPLQ3Da8c7DG8TIjCVWf +KPyTW3uKTqCiGRkJPD+sCHSy9OvJFUf9XLpkaYL5UUpsKzswLZFjER+3VeARtbpN +VTr7JU5bxYhK +-----END CERTIFICATE----- diff --git a/demos/guide/serverkey.pem b/demos/guide/serverkey.pem new file mode 100644 index 0000000000..8dfe9da87e --- /dev/null +++ b/demos/guide/serverkey.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCk6ujSx/spB5QE +iXy4gNe2ETgXFfWxk4WldQRb+pk6QBNMMLaIRG+bpN7bHnXxMKj5hmojgPYUYsUq +uWkv5RjDCRRty2uV/If8fGWfJnyiRWaiLcXu0GqxvQpISOOnSmAvwJExzl5rz8ES +ATYxGfedqJPXUHNa4CrMpAY5ugsisA0KuaD0xrRD2dQ8Ub8pbibEKey+M0/uVMSg +MbyEthRmRTkv4UufHqwxeKk0LlGi6IeZa+rqCkBObkcFiErc7ms+1IKOcJJ6ib2u +iZt+1we8zIaob/iPekAjCakghY1Ba7ZBLpPxkM2tTfxPnE1KoiuludOq4tZCoULH +l1iJuIYHAgMBAAECggEACZE/NIs5fOXdpm27eJCw8vUIxf4WJNkkFbc2K4fcP87b +z727uSgPOX5VF20q9nUWOHOd0LV4kTIxsgrTmV23FAmAz+XPNgJSeUlWM+dtr5RL +Ifl51CLvLaSD5jGkU14zOlH3mmYYgDSrRLohRLP284SGHyWhq5H5qamSWuL6Jmbs +YWwgbHdHQvo+Rl7PVg2aUWdTHr+tb1S/S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