【发布时间】:2021-07-25 14:01:20
【问题描述】:
我正在尝试解决方案
Use SSL in gRPC client server communication
将 SSL 添加到 gRPC Helloworld 示例,但由于找不到 read_keycert 函数(未在此范围内声明“read_keycert”)而无法编译。
我需要包含什么头文件?
【问题讨论】:
我正在尝试解决方案
Use SSL in gRPC client server communication
将 SSL 添加到 gRPC Helloworld 示例,但由于找不到 read_keycert 函数(未在此范围内声明“read_keycert”)而无法编译。
我需要包含什么头文件?
【问题讨论】:
基于来自该站点的文档,https://grpc.github.io/grpc/cpp/structgrpc_1_1_ssl_server_credentials_options_1_1_pem_key_cert_pair.html。我想read_keycert 只是一个自定义函数,用于读取 .key 文件的内容并将其存储在字符串中
std::string read_ketcert(const char* filename)
{
std::ifstream file(filename);
std::string temp;
std::getline(file, temp);
file.close();
return temp;
}
注意:此函数仅从您的 .key 或 .cert 文件中读取一行或一行。
将此添加到您的程序中,程序应该可以正常编译
【讨论】: