Juniper / grpc-c

C implementation of gRPC layered on top of core library
BSD 3-Clause "New" or "Revised" License
220 stars 59 forks source link

SSL credential setting sample needed #27

Closed manoharyes closed 6 years ago

manoharyes commented 6 years ago

I am trying to use this library to make a secure connection to my server. However I could not find any sample which does a secure connection to server in GRPC-C.

In C++ its straight forward: grpc::SslCredentialsOptions opts = {"zzz","xxxx","",""} auto channel_creds = grpc::SslCredentials(opts);

Unable to find any sample/example to achieve the same with GRPC-C. Is it supported? I am new to this, sorry if the question has a very straightforward answer.

ajhai commented 6 years ago

This project currently lacks documentation and I'm in the process of adding some. For creating a secure client, please take a look at the client API in lib/client.c

grpc_c_client_t grpc_c_client_init_by_host (const char hostname, const char client_id, grpc_channel_credentials creds, grpc_channel_args *channel_args)

You can create credentials object using gRPC core API. Please take a look at https://grpc.io/grpc/core/grpc__security_8h.html#a2dfd4a555352ff0e449ce9c38abd2f21 for more details on creating SSL credentials object.