• Home
Name Date Size #Lines LOC

..--

credentials/22-Oct-2025-6966

BUILDD22-Oct-20251.4 KiB5550

CMakeLists.txtD22-Oct-20252.4 KiB7868

README.mdD22-Oct-20251 KiB4027

helper.ccD22-Oct-2025935 3514

helper.hD22-Oct-2025801 275

ssl_client.ccD22-Oct-20253.6 KiB12274

ssl_server.ccD22-Oct-20253.2 KiB9561

README.md

1# Authentication Example
2
3## Overview
4
5SSL is a commonly used cryptographic protocol to provide end-to-end
6communication security. In the example, we show how to set up a server
7authenticated SSL connection to transmit RPC.
8
9We provide `grpc::SslServerCredentials` and `grpc::SslCredentials` types
10to use SSL connections.
11
12In our example, we use the public/private keys created ahead:
13* "localhost.crt" contains the server certificate (public key).
14* "localhost.key" contains the server private key.
15* "root.crt" contains the certificate (certificate authority)
16that can verify the server's certificate.
17
18### Try it!
19
20Once you have working gRPC, you can build this example using either bazel or cmake.
21Make sure to run those at this directory so that they can read credential files properly.
22
23Run the server, which will listen on port 50051:
24
25```sh
26$ ./ssl_server
27```
28
29Run the client (in a different terminal):
30
31```sh
32$ ./ssl_client
33```
34
35If things go smoothly, you will see the client output:
36
37```
38Greeter received: Hello world
39```
40