Я столкнулся с этим безобразным исключением, когда читал HTML контент с веб-страницы. Ошибка относится к Utils. java: 316 в библиотеке Retrofit, но упомянутая проблема не решает мою проблему.
Это ошибка, которую я получаю: javax.net.ssl.SSLProtocolException: Read error: ssl=0xb7f88188: Failure in SSL library, usually a protocol error
2020-04-16 17:54:01.413 16735-16818/com.lukasanda.aismobile W/System.err: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT (third_party/openssl/boringssl/src/crypto/fipsmodule/cipher/e_aes.c:1040 0xbd1d2c0b:0x00000000)
2020-04-16 17:54:01.413 16735-16818/com.lukasanda.aismobile W/System.err: error:1000008b:SSL routines:OPENSSL_internal:DECRYPTION_FAILED_OR_BAD_RECORD_MAC (third_party/openssl/boringssl/src/ssl/tls_record.cc:298 0xbd1d2c0b:0x00000000)
2020-04-16 17:54:01.413 16735-16818/com.lukasanda.aismobile W/System.err: at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_read(Native Method)
2020-04-16 17:54:01.413 16735-16818/com.lukasanda.aismobile W/System.err: at com.google.android.gms.org.conscrypt.NativeSsl.read(:com.google.android.gms@200914040@20.09.14 (120700-300565878):3)
2020-04-16 17:54:01.414 16735-16818/com.lukasanda.aismobile W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(:com.google.android.gms@200914040@20.09.14 (120700-300565878):6)
2020-04-16 17:54:01.414 16735-16818/com.lukasanda.aismobile W/System.err: at okio.Okio$2.read(Okio.java:140)
2020-04-16 17:54:01.414 16735-16818/com.lukasanda.aismobile W/System.err: at okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
2020-04-16 17:54:01.414 16735-16818/com.lukasanda.aismobile W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:51)
2020-04-16 17:54:01.414 16735-16818/com.lukasanda.aismobile W/System.err: at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read(Http1ExchangeCodec.java:389)
2020-04-16 17:54:01.414 16735-16818/com.lukasanda.aismobile W/System.err: at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.read(Http1ExchangeCodec.java:427)
2020-04-16 17:54:01.414 16735-16818/com.lukasanda.aismobile W/System.err: at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.java:286)
2020-04-16 17:54:01.414 16735-16818/com.lukasanda.aismobile W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:51)
2020-04-16 17:54:01.415 16735-16818/com.lukasanda.aismobile W/System.err: at okio.ForwardingSource.read(ForwardingSource.java:35)
2020-04-16 17:54:01.415 16735-16818/com.lukasanda.aismobile W/System.err: at retrofit2.OkHttpCall$ExceptionCatchingResponseBody$1.read(OkHttpCall.java:288)
2020-04-16 17:54:01.416 16735-16818/com.lukasanda.aismobile W/System.err: at okio.RealBufferedSource.readAll(RealBufferedSource.java:176)
2020-04-16 17:54:01.422 16735-16818/com.lukasanda.aismobile W/System.err: at retrofit2.Utils.buffer(Utils.java:316)
2020-04-16 17:54:01.424 16735-16818/com.lukasanda.aismobile W/System.err: at retrofit2.BuiltInConverters$BufferingResponseBodyConverter.convert(BuiltInConverters.java:103)
2020-04-16 17:54:01.424 16735-16818/com.lukasanda.aismobile W/System.err: at retrofit2.BuiltInConverters$BufferingResponseBodyConverter.convert(BuiltInConverters.java:96)
2020-04-16 17:54:01.424 16735-16818/com.lukasanda.aismobile W/System.err: at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:225)
2020-04-16 17:54:01.424 16735-16818/com.lukasanda.aismobile W/System.err: at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:121)
2020-04-16 17:54:01.425 16735-16818/com.lukasanda.aismobile W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
2020-04-16 17:54:01.425 16735-16818/com.lukasanda.aismobile W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
2020-04-16 17:54:01.425 16735-16818/com.lukasanda.aismobile W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2020-04-16 17:54:01.425 16735-16818/com.lukasanda.aismobile W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2020-04-16 17:54:01.425 16735-16818/com.lukasanda.aismobile W/System.err: at java.lang.Thread.run(Thread.java:919)
Это мои настройки для модернизации и охтп:
OkHttpClient.Builder().apply {
// cache(get())
//sslSocketFactory(TLSSocketFactoryCompat())
sslSocketFactory(getSSLFactory())
connectionSpecs(
listOf(
ConnectionSpec.Builder(ConnectionSpec.COMPATIBLE_TLS)
.supportsTlsExtensions(true)
.tlsVersions(TlsVersion.TLS_1_2, TlsVersion.TLS_1_1, TlsVersion.TLS_1_0)
.allEnabledCipherSuites()
.cipherSuites(
CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
CipherSuite.TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,
CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,
CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
CipherSuite.TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
CipherSuite.TLS_RSA_WITH_AES_256_GCM_SHA384,
CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA256,
CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA,
CipherSuite.TLS_RSA_WITH_CAMELLIA_256_CBC_SHA,
CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
CipherSuite.TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,
CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
CipherSuite.TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
CipherSuite.TLS_RSA_WITH_AES_128_GCM_SHA256,
CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA256,
CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA,
CipherSuite.TLS_RSA_WITH_CAMELLIA_128_CBC_SHA,
CipherSuite.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA
)
.build()
)
)
connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS)
writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS)
readTimeout(READ_TIMEOUT, TimeUnit.SECONDS)
followSslRedirects(true)
followRedirects(false)
retryOnConnectionFailure(true)
addInterceptor(EncodingInterceptor())
addInterceptor(AuthInterceptor(get()))
addInterceptor(get())
hostnameVerifier { hostname: String?, session: SSLSession? -> true }
addInterceptor(HttpLoggingInterceptor().apply {
if (BuildConfig.DEBUG) {
level = HttpLoggingInterceptor.Level.BASIC
}
})
}.build()
Retrofit.Builder()
.baseUrl("https://is.stuba.sk/")
//.addConverterFactory(GsonConverterFactory.create(get()))
// .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(get())
.build()
Я уже перепробовал все, с чем сталкивался. Я удалил ConnectionSpecs, я добавил их, я использовал пользовательский sslFactory, я не сделал, я использовал кеш, и я не сделал и так далее, и так далее.