Okhttp: CipherSuite TLS_NULL_WITH_NULL_NULL

Created on 10 Sep 2019  ·  4Comments  ·  Source: square/okhttp

I met a problem.Here is the error message; This mistack happened 500 times.I have no idea to handle it.Please help me,Thank you!

# OkHttp Dispatcher(3730)  java.lang.IllegalArgumentException  
No enum constant okhttp3.CipherSuite.TLS_NULL_WITH_NULL_NULL

1 java.lang.Enum.valueOf(Enum.java:258)
2 okhttp3.CipherSuite.okhttp3.CipherSuite valueOf(java.lang.String)(SourceFile:32)
3 okhttp3.CipherSuite.okhttp3.CipherSuite forJavaName(java.lang.String)(SourceFile:381)
4 okhttp3.Handshake.okhttp3.Handshake get(javax.net.ssl.SSLSession)(SourceFile:53)
5 okhttp3.internal.io.RealConnection.void connectTls(int,int,okhttp3.internal.ConnectionSpecSelector)(SourceFile:242)
6 okhttp3.internal.io.RealConnection.void establishProtocol(int,int,okhttp3.internal.ConnectionSpecSelector)(SourceFile:198)
7 okhttp3.internal.io.RealConnection.void buildConnection(int,int,int,okhttp3.internal.ConnectionSpecSelector)(SourceFile:173)
8 okhttp3.internal.io.RealConnection.void connect(int,int,int,java.util.List,boolean)(SourceFile:113)
9 okhttp3.internal.http.StreamAllocation.okhttp3.internal.io.RealConnection findConnection(int,int,int,boolean)(SourceFile:188)
10 okhttp3.internal.http.StreamAllocation.okhttp3.internal.io.RealConnection findHealthyConnection(int,int,int,boolean,boolean)(SourceFile:124)
11 okhttp3.internal.http.StreamAllocation.okhttp3.internal.http.HttpStream newStream(int,int,int,boolean,boolean)(SourceFile:94)
12 okhttp3.internal.http.HttpEngine.okhttp3.internal.http.HttpStream connect()(SourceFile:301)
13 okhttp3.internal.http.HttpEngine.void sendRequest()(SourceFile:253)
14 okhttp3.RealCall.okhttp3.Response getResponse(okhttp3.Request,boolean)(SourceFile:254)
15 okhttp3.RealCall$ApplicationInterceptorChain.okhttp3.Response proceed(okhttp3.Request)(SourceFile:212)
16 okhttp3.RealCall.okhttp3.Response getResponseWithInterceptorChain(boolean)(SourceFile:171)
17 okhttp3.RealCall.access$100(SourceFile:31)
18 okhttp3.RealCall$AsyncCall.void execute()(SourceFile:135)
19 okhttp3.internal.NamedRunnable.void run()(SourceFile:33)
20 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
21 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
22 java.lang.Thread.run(Thread.java:784)


bug

All 4 comments

Are you connecting to a real server? Is there a proxy involved or aggressive company network?

This is the cipher suite 0x00,0x00:
https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml

We handle something nearby in SSLSession.handshake():

      val cipherSuiteString = checkNotNull(cipherSuite) { "cipherSuite == null" }
      if ("SSL_NULL_WITH_NULL_NULL" == cipherSuiteString) {
        throw IOException("cipherSuite == SSL_NULL_WITH_NULL_NULL")
      }

We also map the TLS_ prefix to the SSL_ prefix because Java wasn’t tracking the IANA names.

    private fun secondaryName(javaName: String): String {
      return when {
        javaName.startsWith("TLS_") -> "SSL_" + javaName.substring(4)
        javaName.startsWith("SSL_") -> "TLS_" + javaName.substring(4)
        else -> javaName
      }
    }

My hypothesis is that your host platform uses the proper TLS_ prefix for this and we don’t anticipate that. Fix coming.

@vittawang by the way, this issue appears to have been reported against a version of OkHttp that’s 3 years old or more.

Please update your open source libraries before reporting bugs. Reporting a bug against a 3-year old version is uncool and it makes me grumpy.

Thank you for your help. I have thought about what you replay to. Most of the requests in our app is proper TLS_ prefix, a small number of users encountered this mistake.

I will update my libraries based on your suggestion. Your team’s professionalism and processing speed are admirable.Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings