gRPC with .net framework

110 views
Skip to first unread message

rajco...@gmail.com

unread,
Jun 15, 2020, 12:05:46 AM6/15/20
to grpc.io
While we want to move to .net core in the future, we would like to use grpc with .net framework. However this needs PEM file during service start, is there any workaround/solution that doesn't need PEM file? Also, why does gRPC with .Net core not require the PEM file and why is PEM file only needed when using gRPC with .Net framework?
            SslServerCredentials sslServerCredentials = new SslServerCredentials(new List<KeyCertificatePair>() { new KeyCertificatePair(certificatePem, certificateKey) }, null, false);
            Grpc.Core.Server server = new Grpc.Core.Server
            {
                Services = { service.BindService(new Server()) },
                Ports = { new ServerPort(server.Host, server.Port, sslServerCredentials) }
            };
            server.Start();

Jan Tattermusch

unread,
Jun 15, 2020, 11:59:39 AM6/15/20
to grpc.io
Not sure what exactly is the concern:

1. if you're concerned that you need a PEM + KEY file pair instead of using PFX (which is what ASP.NET core uses when starting a secure server), then please note that these formats are interchangeable and you can convert them back and forth (e.g. using the openssl command line tool - see https://github.com/grpc/grpc-dotnet/blob/master/testassets/Certs/InteropTests/README.md). So this shouldn't really be limiting for you.
2. If you're concerned that you need a certificate and a private key at all to setup a secure server, then note that this is simply required by TLS. You cannot have a secure server that doesn't have a cert/private key, because otherwise it wouldn't be able to prove its identity to the client. If this is a problem for you, you'll have to use an insecure server (regardless of what framework you're using).
Reply all
Reply to author
Forward
0 new messages