Reputation: 1218
With the Go gRPC library you can create a tls.Config using a specific common-name. However, using the gRPC C# library for ChannelCredentials I haven't been able to figure out how to pass the common name as part of the certificate.
Any help or pointers for how to use a common-name when creating a ChannelCredentials would be much appreciated!
Upvotes: 0
Views: 1057
Reputation: 1
SnowCrumble meant if you use this Nuget package to create gRpc-channel then you can set 'common-name' this way:
using Grpc.Core;
...
var channelCredentials = new SslCredentials(File.ReadAllText("server.pem"));
var option = new List<ChannelOption>
{
new ChannelOption(ChannelOptions.SslTargetNameOverride, "your-common-name")
};
channel = new Channel(address, channelCredentials, option);
This code override grpc.ssl_target_name_override channel argument. But as Jan Tattermusch said in his comment: beware of force changing 'common-name' because it should be a part of the certificate.
Upvotes: 0
Reputation: 11
var channelCredentials = new SslCredentials(File.ReadAllText("server.pem"));
var option = new List<ChannelOption>
{
new ChannelOption(ChannelOptions.SslTargetNameOverride, "your-common-name")
};
channel = new Channel(address, channelCredentials, option);
Upvotes: 1