Hi, thank you for bringing up this issue!
The "UNSUPPORTED_PROTOCOL" error is generated from OpenSSL, so most likely 
this is due to some TLS minimum version mismatch for your client and server 
OpenSSL configurations. You will probably want to check your OpenSSL 
configurations on both sides and make sure they are not conflicting with 
each other.
Feel free to let us know if anything else comes up. Thank you!

On Wednesday, May 11, 2022 at 3:46:10 PM UTC-7 Livius wrote:

> Hi!
>
> I implemented a simple gRPC client in C# .NET Framework  
> 4.7.2 (WinHttpHandler) and a gRPC server in Python3 (grpcio 1.46.0) for 
> testing.
>
> In C# .NET Framework i can use only client and it is mandantory to using 
> TLS with WinHttpHandler. Following code parts show my solution for it. I 
> could generate well the cert and key for my server, is my code correct to 
> use it for TLS client?
>
>
> WinHttpHandler handler = new WinHttpHandler()
> {
>     SslProtocols = SslProtocols.Tls,
>     WindowsProxyUsePolicy = WindowsProxyUsePolicy.DoNotUseProxy
> };
>
> X509Certificate2 cert = new X509Certificate2("server.crt");
> handler.ClientCertificates.Add(cert);
> GrpcChannelOptions options = new GrpcChannelOptions() { HttpHandler = 
> handler };
>
> this.channel = GrpcChannel.ForAddress(this.textBox_url.Text, options);
> this.client = new GExchange.GExchangeClient(this.channel);
>
>
> When i test it with my gRPC Python server and try to call a gRPC method, i 
> got an "A connection with the server could not be established" exception in 
> C# then i also got an "UNSUPPORTED_PROTOCOL" error in Python server log. 
> Can somebody help what is this issue? It seems to me gRPC Python server 
> requires an other cryptographic protocol for example TLS v1.3 maybe, but in 
> C# .NET Framework for WinHttpHandler i can use only TLS v1.0, v1.1, v1.2. 
> Can somebody help how can i change TLS version of my gRPC Python server to 
> any older version? By the way, if i test it in a Python client and Python 
> server everything is working well.
>
> gRPC Python server error:
> E0511 17:55:18.799000000 14676 
> src/core/tsi/ssl_transport_security.cc:1495] Handshake failed with fatal 
> error SSL_ERROR_SSL: error:100000f0:SSL 
> routines:OPENSSL_internal:UNSUPPORTED_PROTOCOL.
> D0511 17:55:18.802000000 14676 
> src/core/lib/security/transport/security_handshaker.cc:181] Security 
> handshake failed: 
> {"created":"@1652284518.802000000","description":"Handshake 
> failed","file":"src/core/lib/security/transport/security_handshaker.cc","file_line":377,"tsi_code":10,"tsi_error":"TSI_PROTOCOL_FAILURE"}
> D0511 17:55:18.806000000 14676 
> src/core/ext/transport/chttp2/server/chttp2_server.cc:427] Handshaking 
> failed: {"created":"@1652284518.802000000","description":"Handshake 
> failed","file":"src/core/lib/security/transport/security_handshaker.cc","file_line":377,"tsi_code":10,"tsi_error":"TSI_PROTOCOL_FAILURE"}
>
> C# .NET Framework exception:
> Status(StatusCode="Internal", Detail="Error starting gRPC call. 
> HttpRequestException: An error occurred while sending the request. 
> WinHttpException: Error 12029 calling 
> WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, 'A connection with the server could 
> not be established'.", 
> DebugException="System.Net.Http.HttpRequestException: An error occurred 
> while sending the request. ---> System.Net.Http.WinHttpException: Error 
> 12029 calling WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, 'A connection with the 
> server could not be established'.
>    at System.Threading.Tasks.RendezvousAwaitable`1.GetResult()
>    at System.Net.Http.WinHttpHandler.<StartRequestAsync>d__122.MoveNext()
>    --- End of inner exception stack trace ---
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task 
> task)
>    at 
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>  
> task)
>    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
>    at Grpc.Net.Client.Internal.GrpcCall`2.<RunCall>d__73.MoveNext() in 
> /_/src/Grpc.Net.Client/Internal/GrpcCall.cs:line 493")
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/cf0f8a99-90b4-4aad-a3e2-e3bcbdab3c31n%40googlegroups.com.

Reply via email to