Я хочу подключиться к локальному устройству, которое поддерживает только TLS 1.0. Прошивку устройства невозможно обновить, поэтому я придерживаюсь этой версии протокола.
SSLContext sslContext = SSLContext.getInstance("TLSv1");
sslContext.init(null, null, null);
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
URL url = new URL("https://192.168.1.10/command?action=2");
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setSSLSocketFactory(sslSocketFactory);
// Create an InputStreamReader to read the response
BufferedReader reader = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream()));
// Read the response line by line and append it to the StringBuilder
StringBuilder result = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
result.append(line);
}
// Close the reader and connection
reader.close();
httpsURLConnection.disconnect();
return result.toString();
javax.net.ssl.SSLHandshakeException: Read error: ssl=0x79b5fc7008: Failure in SSL library, usually a protocol error
error:100000f0:SSL routines:OPENSSL_internal:UNSUPPORTED_PROTOCOL (external/boringssl/src/ssl/handshake_client.cc:714 0x7ad8a4ad53:0x00000000)
at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:356)
Есть ли способ подключиться к серверу с помощью TLS v1 в Android?
С уважением,
Я хочу подключиться к локальному устройству, которое поддерживает только TLS 1.0. Прошивку устройства невозможно обновить, поэтому я придерживаюсь этой версии протокола. [code]SSLContext sslContext = SSLContext.getInstance("TLSv1"); sslContext.init(null, null, null); SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
// Create an InputStreamReader to read the response BufferedReader reader = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream()));
// Read the response line by line and append it to the StringBuilder StringBuilder result = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { result.append(line); }
// Close the reader and connection reader.close(); httpsURLConnection.disconnect(); return result.toString(); [/code] Но этот код вызывает следующее исключение: [code]javax.net.ssl.SSLHandshakeException: Read error: ssl=0x79b5fc7008: Failure in SSL library, usually a protocol error error:100000f0:SSL routines:OPENSSL_internal:UNSUPPORTED_PROTOCOL (external/boringssl/src/ssl/handshake_client.cc:714 0x7ad8a4ad53:0x00000000) at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:356) [/code] Есть ли способ подключиться к серверу с помощью TLS v1 в Android? С уважением,