相关疑难解决方法(0)

如何为gRPC启用服务器端SSL?

gRPC的新功能,无法找到有关如何在服务器端启用SSL的任何示例.我使用openssl生成了一个密钥对,但它抱怨私钥无效.

D0608 16:18:31.390303 Grpc.Core.Internal.UnmanagedLibrary Attempting to load native library "...\grpc_csharp_ext.dll"
D0608 16:18:31.424331 Grpc.Core.Internal.NativeExtension gRPC native library loaded successfully.
E0608 16:18:43.307324 0 ..\src\core\lib\tsi\ssl_transport_security.c:644: Invalid private key.
E0608 16:18:43.307824 0 ..\src\core\lib\security\security_connector.c:821: Handshaker factory creation failed with TSI_INVALID_ARGUMENT.
E0608 16:18:43.307824 0 ..\src\core\ext\transport\chttp2\server\secure\server_secure_chttp2.c:188: Unable to create secure server with credentials of type Ssl.
Run Code Online (Sandbox Code Playgroud)

这是我的代码

var keypair = new KeyCertificatePair(
            File.ReadAllText(@"root-ca.pem"),
            File.ReadAllText(@"ssl-private.key"));
SslServerCredentials creds = new SslServerCredentials(new List<KeyCertificatePair>() {keypair});
Server server = new Server
{
    Services = { GrpcTest.BindService(new GrpcTestImpl()) },
    Ports = { new …
Run Code Online (Sandbox Code Playgroud)

c# ssl-certificate grpc

8
推荐指数
2
解决办法
7762
查看次数

标签 统计

c# ×1

grpc ×1

ssl-certificate ×1