Skip to content

Commit

Permalink
Update ssl_hello_world example certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
essen committed Jan 26, 2024
1 parent a0314a6 commit 1c46408
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 54 deletions.
7 changes: 4 additions & 3 deletions examples/ssl_hello_world/README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ $ make run

Then point your browser to https://localhost:8443

You will need to temporarily trust the root certificate authority,
which can also be found in `priv/ssl/cowboy-ca.crt`.
You will be greeted by a security message. You can ask for more
information and ultimately accept to access localhost. This is
due to the example using a self-signed certificate.

Recent browsers will communicate using HTTP/2. Older browsers
will use HTTP/1.1.
Expand All @@ -19,7 +20,7 @@ will use HTTP/1.1.

[source,bash]
----
$ curl --cacert priv/ssl/cowboy-ca.crt -i https://localhost:8443
$ curl -k -i https://localhost:8443
HTTP/1.1 200 OK
connection: keep-alive
server: Cowboy
Expand Down
20 changes: 20 additions & 0 deletions examples/ssl_hello_world/priv/ssl/cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDTzCCAjegAwIBAgIUD7jNyCgABo8GlnEojOSTFWZzkJswDQYJKoZIhvcNAQEL
BQAwNzELMAkGA1UEBhMCRlIxEzARBgNVBAgMClNvbWUtU3RhdGUxEzARBgNVBAoM
Ck5pbmUgTmluZXMwHhcNMjQwMTI2MTQyODExWhcNMzcxMDA0MTQyODExWjA3MQsw
CQYDVQQGEwJGUjETMBEGA1UECAwKU29tZS1TdGF0ZTETMBEGA1UECgwKTmluZSBO
aW5lczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKfNEwF0v1Gm2e6a
M4hqI3JhmerZSNYWw8NiaUybR5hVUS9X4Chk+/y8kBLX2OYbGGlAxgbOZJa5D+kf
H1iakoUQaILinxPx3yxtIOePS3q/Xi5/EBVTdwLOoI26oSdzY2RTKKAPO1PCcAjq
6gDpw2u7q26sSU1kul6dD4Wle6+yNtnJdNKo9zLCLXr6TtuHdvbAU1oblLCKZ1Db
/uLkhGaUI/EUNeU1ZJrPmnoneYkTcG5mC5PMFVhqJ3bNYez5Hgr2Ra1Fz0dVgmRM
FpJ8NF6UQgA9dAs2Oh1uWbTjJiX0tO92RslXlhpLHS2VKZWsxiN2bniNXsNKzQ9M
ty0qnxkCAwEAAaNTMFEwHQYDVR0OBBYEFKuBPzB9rBCJNAnUyQMXjkVKIMJlMB8G
A1UdIwQYMBaAFKuBPzB9rBCJNAnUyQMXjkVKIMJlMA8GA1UdEwEB/wQFMAMBAf8w
DQYJKoZIhvcNAQELBQADggEBAHWXDKlY39csROTQ2Dm3CnTj14tj3cW4onsOYTKW
FSlVdMOk3+ionB4vZA/Ino8OjrjiZ2dB3Tvl2J+AxEea3ltDbdh6qVuqSwvQZCeV
8gWp05wzyTfIpQRD10ZwOU6dzR89T+o7oG/7D8Ydk3nzecthF1aU0YBW8OtuZFog
lC/PIIoVEyUiTEnFJrkQge1OmZWiAuImIed+cEmkw9ZAN2/9i/OxWZKAGoKrmfPq
kzdOoxxFRLnqHo2OYdA0IPpSuGK5ayjYrLgXW0Wa4FKzmDh7Gy+JSrvLuFur9PEi
D0Encva2uX1hAcFQDrzICTsD6ANuIbw0cmlrCJYH6E21PrM=
-----END CERTIFICATE-----
16 changes: 0 additions & 16 deletions examples/ssl_hello_world/priv/ssl/cowboy-ca.crt

This file was deleted.

28 changes: 28 additions & 0 deletions examples/ssl_hello_world/priv/ssl/key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCnzRMBdL9Rptnu
mjOIaiNyYZnq2UjWFsPDYmlMm0eYVVEvV+AoZPv8vJAS19jmGxhpQMYGzmSWuQ/p
Hx9YmpKFEGiC4p8T8d8sbSDnj0t6v14ufxAVU3cCzqCNuqEnc2NkUyigDztTwnAI
6uoA6cNru6turEl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MEFCKiwoY+wKBgGb+
kTjLt/er9yKskJEk8nF/WX58RpZ3xteWgRbVoNFcjPDQX3UlM9U5oR52HP1HHbb4
ASFQfKbtvW1F84o/BdE4YnfPQrN7d779U3+5+hvdQNPLmnNgLHxDVVJFodU++U8W
Jt66uKChQL88JnEXQcZAaMtSr01x3wmRVHY4Xs5hAoGBAMPfa+rcGukjbMF+MZ0P
ZV1Pq7AxVJ/C0XINnpZrsN+e6dO52Y2VXbnQkML7PKZXzSY88QwunBp88VoPlDux
llmLZc54zUFlsC1iHrEzt+hoxFG0tfL83vic5kSx6u5oZdxjZ2InqTzE8TmORU3v
6/ik7Q4VeDQ5uLnR4GiLW+qj
-----END PRIVATE KEY-----
17 changes: 0 additions & 17 deletions examples/ssl_hello_world/priv/ssl/server.crt

This file was deleted.

15 changes: 0 additions & 15 deletions examples/ssl_hello_world/priv/ssl/server.key

This file was deleted.

5 changes: 2 additions & 3 deletions examples/ssl_hello_world/src/ssl_hello_world_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ start(_Type, _Args) ->
PrivDir = code:priv_dir(ssl_hello_world),
{ok, _} = cowboy:start_tls(https, [
{port, 8443},
{cacertfile, PrivDir ++ "/ssl/cowboy-ca.crt"},
{certfile, PrivDir ++ "/ssl/server.crt"},
{keyfile, PrivDir ++ "/ssl/server.key"}
{certfile, PrivDir ++ "/ssl/cert.pem"},
{keyfile, PrivDir ++ "/ssl/key.pem"}
], #{env => #{dispatch => Dispatch}}),
ssl_hello_world_sup:start_link().

Expand Down

0 comments on commit 1c46408

Please sign in to comment.