gRPC C#服务器身份验证

gRPC C#服务器身份验证

问题描述:

我正在尝试使用gRPC执行服务器身份验证,但是我不确定如何进行. 我当前的设置是,我在一台计算机上运行一台服务器,而另一台计算机(两台Windows计算机)上运行一个客户端. 为了进行测试,我使用Windows makecert.exe生成了一个证书颁发机构和一个私有证书(来自此证书颁发机构). 这将生成.cer文件.

I'm attempting to perform server authentication using gRPC however I'm unsure of how to proceed. My current setup is that I have a server running on one machine and a client on another (both windows machines). For testing purposes I've generated a certificate authority and a private certificate (from this certificate authority) using the windows makecert.exe. This generates .cer file.

SslServerCredentials的文档没有有关.cer文件的任何规定.在这种情况下,我的KeyCertificatePair是什么?该文档尚不清楚. http://www.grpc.io/grpc/csharp/html/T_Grpc_Core_SslServerCredentials. htm

The documentation for SslServerCredentials does not have any provisions for a .cer file. What would be my KeyCertificatePair in this case ? The documentation is unclear on this. http://www.grpc.io/grpc/csharp/html/T_Grpc_Core_SslServerCredentials.htm

此外,我只希望服务器对其自身进行身份验证,在客户端gRPC调用上是否需要任何特殊规定?

Also, I only want the server to authenticate itself, do I need any special provision on the client gRPC call?

您将同时需要一个私钥和cert文件.您可以看到gRPC测试代码如何实现

You'll need both a private key and the cert file. You can see how the gRPC testing code does it here.