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