Encryption mode selection method and apparatus, and terminal device and computer-readable storage medium

The method of selecting the encryption method through scoring solves the problem that terminal devices cannot switch encryption methods when communication is abnormal, thereby improving the stability and security of communication connections.

WO2026149045A1PCT designated stage Publication Date: 2026-07-16SHENZHEN TCL DIGITAL TECH CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
SHENZHEN TCL DIGITAL TECH CO LTD
Filing Date
2025-11-24
Publication Date
2026-07-16

AI Technical Summary

Technical Problem

Once a terminal device establishes a communication connection using a specific encryption method, it is unable to switch encryption methods, especially when communication is abnormal, as it cannot automatically select a more stable or secure encryption method to repair the connection.

Method used

By calculating the scores of different encryption methods in the event of communication anomalies between terminal devices and network devices, the target encryption method is selected for communication connection, thereby achieving automatic switching of encryption methods.

Benefits of technology

It improves user experience, meets user needs, and ensures the stability and security of communication connections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025137243_16072026_PF_FP_ABST
    Figure CN2025137243_16072026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present application are an encryption mode selection method and apparatus, and a terminal device and a computer-readable storage medium. The method comprises: determining a first encryption mode of a terminal device; on the basis of the first encryption mode, establishing a communication connection with a network device; determining that communication with the network device is interrupted, calculating a first score for the first encryption mode, and calculating a second score for a second encryption mode; and on the basis of the first score and the second score, selecting a target encryption mode from the first encryption mode and the second encryption mode. The encryption mode selection method provided in an embodiment of the present application enables a terminal device to, when communication with a network device is abnormal, calculate scores for available encryption modes, and select a target encryption mode on the basis of the scores to establish a communication connection.
Need to check novelty before this filing date? Find Prior Art

Description

Encryption method selection, device, terminal equipment, and computer-readable storage medium

[0001] This application claims priority to Chinese Patent Application No. 202510041905.1, filed on January 8, 2025, entitled "Encryption Method Selection Method, Apparatus, Terminal Equipment and Computer-Readable Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of communication technology, specifically to an encryption method selection method, apparatus, terminal device, and computer-readable storage medium. Background Technology

[0003] Wireless network connectivity (Wi-Fi connectivity) has become a widely used and relied-upon wireless connectivity technology in daily life. Many devices and applications support the use of Wi-Fi connectivity and rely on Wi-Fi connectivity to further realize their functions and technologies.

[0004] In existing technologies, the main encryption methods used in Wi-Fi connections include OPEN, WEP, WPA, WPA2, and WPA3, with OPEN, WPA2, and WPA3 being the most widely used. Furthermore, existing network devices, such as routers, are increasingly supporting multiple hybrid encryption methods, such as WPA / WPA2, WPA2 / WPA3, and WEP / WPA / WPA2. Therefore, when a network device's encryption mode is configured to support multiple encryption methods simultaneously, the terminal device can also choose different encryption methods for communication connections, provided its system supports them.

[0005] However, once the terminal device establishes a communication connection using the chosen encryption method, it cannot switch between encryption methods. Technical solutions

[0006] This application provides an encryption method selection method, apparatus, terminal device, and computer-readable storage medium, which enables the terminal device to calculate the score of selectable encryption methods and select the target encryption method for communication connection based on the score when communication with network devices is abnormal.

[0007] In a first aspect, embodiments of this application provide an encryption method selection method applied to a terminal device, the method comprising:

[0008] Determine the first encryption method of the terminal device;

[0009] Establish a communication connection with the network device according to the first encryption method;

[0010] A communication interruption with the network device is determined, a first score for the first encryption method is calculated, and a second score for the second encryption method is calculated.

[0011] Based on the first score and the second score, select the target encryption method from the first encryption method and the second encryption method.

[0012] Optionally, in some embodiments of this application, determining the first encryption method of the terminal device includes:

[0013] If the terminal device has a preset encryption method, the preset encryption method is determined to be the first encryption method, and the preset encryption method includes at least one of the following: WPA2 method, or WPA3 method.

[0014] Optionally, in some embodiments of this application, determining the first encryption method of the terminal device includes:

[0015] If the terminal device does not have a preset encryption method, determine the initial state of the target control of the terminal device;

[0016] The first encryption method is determined based on the initial state.

[0017] Optionally, in some embodiments of this application, determining the first encryption method based on the initial state includes:

[0018] If the initial state of the target control is the open state, then the WPA2 method is determined to be the first encryption method;

[0019] If the initial state of the target control is closed, the WPA3 method is determined to be the first encryption method.

[0020] Optionally, in some embodiments of this application, calculating the first score of the first encryption method and calculating the second score of the second encryption method includes:

[0021] The first score and the second score are calculated based on one or more of the following: communication between the terminal device and the network device is interrupted, whether the first encryption method is the preset encryption method, or the initial state of the target control.

[0022] Optionally, in some embodiments of this application, calculating the first score of the first encryption method and calculating the second score of the second encryption method includes:

[0023] In the event of a communication interruption between the terminal device and the network device, the first score is reduced by a first value;

[0024] If the first encryption method is the preset encryption method, a second value is added to the first score;

[0025] Based on the initial state of the target control, either add a third value to the first score, or add the third value to the second score.

[0026] Optionally, in some embodiments of this application, adding a third value to the first score or adding the third value to the second score based on the initial state of the target control includes:

[0027] When the initial state of the target control is the open state and the first encryption method is the WPA2 method, the third value is added to the first score;

[0028] If the initial state of the target control is closed and the first encryption method is WPA2, the third value is added to the second score;

[0029] If the initial state of the target control is the open state and the first encryption method is the WPA3 method, the third value is added to the second score;

[0030] If the initial state of the target control is closed and the first encryption method is WPA3, the third value is added to the first score.

[0031] Optionally, in some embodiments of this application, the step of selecting a target encryption method from the first encryption method and the second encryption method based on the first score and the second score includes:

[0032] If the first score is greater than the second score, the first encryption method is determined to be the target encryption method, and the first encryption method is used as the preset encryption method.

[0033] If the second score is greater than the first score, the second encryption method is determined to be the target encryption method, and the second encryption method is used as the preset encryption method.

[0034] Secondly, embodiments of this application also provide an encryption method selection device, applied to a terminal device, the device comprising:

[0035] The processing module is used to determine the first encryption method of the terminal device;

[0036] The processing module is further configured to establish a communication connection with the network device according to the first encryption method;

[0037] The processing module is further configured to determine a communication interruption with the network device, calculate a first score for the first encryption method, and calculate a second score for the second encryption method;

[0038] The processing module is further configured to select a target encryption method from the first encryption method and the second encryption method based on the first score and the second score.

[0039] Optionally, in some embodiments of this application, the processing module is further configured to:

[0040] If the terminal device has a preset encryption method, the preset encryption method is determined to be the first encryption method, and the preset encryption method includes at least one of the following: WPA2 method, or WPA3 method.

[0041] Optionally, in some embodiments of this application, the processing module is further configured to:

[0042] If the terminal device does not have a preset encryption method, determine the initial state of the target control of the terminal device;

[0043] The first encryption method is determined based on the initial state.

[0044] Optionally, in some embodiments of this application, the processing module is further configured to:

[0045] If the initial state of the target control is the open state, then the WPA2 method is determined to be the first encryption method;

[0046] If the initial state of the target control is closed, the WPA3 method is determined to be the first encryption method.

[0047] Optionally, in some embodiments of this application, the processing module is further configured to:

[0048] The first score and the second score are calculated based on one or more of the following: communication between the terminal device and the network device is interrupted, whether the first encryption method is the preset encryption method, or the initial state of the target control.

[0049] Optionally, in some embodiments of this application, the processing module is further configured to:

[0050] In the event of a communication interruption between the terminal device and the network device, the first score is reduced by a first value;

[0051] If the first encryption method is the preset encryption method, a second value is added to the first score;

[0052] Based on the initial state of the target control, either add a third value to the first score, or add the third value to the second score.

[0053] Optionally, in some embodiments of this application, the processing module is further configured to:

[0054] When the initial state of the target control is the open state and the first encryption method is the WPA2 method, the third value is added to the first score;

[0055] If the initial state of the target control is closed and the first encryption method is WPA2, the third value is added to the second score;

[0056] If the initial state of the target control is the open state and the first encryption method is the WPA3 method, the third value is added to the second score;

[0057] If the initial state of the target control is closed and the first encryption method is WPA3, the third value is added to the first score.

[0058] Optionally, in some embodiments of this application, the processing module is further configured to:

[0059] If the first score is greater than the second score, the first encryption method is determined to be the target encryption method, and the first encryption method is used as the preset encryption method.

[0060] If the second score is greater than the first score, the second encryption method is determined to be the target encryption method, and the second encryption method is used as the preset encryption method.

[0061] Thirdly, embodiments of this application also provide a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps in the encryption method selection method described above.

[0062] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the encryption method selection method described above.

[0063] Fifthly, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described in embodiments of this application.

[0064] In summary, this application embodiment, by determining a first encryption method for the terminal device; establishing a communication connection with the network device based on the first encryption method; determining a communication interruption with the network device; calculating a first score for the first encryption method and a second score for the second encryption method; and selecting a target encryption method from the first and second encryption methods based on the first and second scores, enables the terminal device to calculate the scores of selectable encryption methods and select a target encryption method for communication connection when a communication connection with the network device is abnormal. This achieves the technical effect of switching to another encryption method to attempt to repair the communication connection when the selected encryption method fails, thereby improving user experience and meeting user needs. Attached Figure Description

[0065] To more clearly illustrate the technical solutions in this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0066] Figure 1 is a schematic diagram of a scenario for the encryption method selection method provided in an embodiment of this application;

[0067] Figure 2 is a schematic diagram of a scenario in which a terminal device, according to an embodiment of this application, executes the encryption method selection method;

[0068] Figure 3 is a schematic diagram of the overall process of the encryption method selection method provided in the embodiment of this application;

[0069] Figure 4 is a schematic diagram of the encryption method selection device provided in an embodiment of this application;

[0070] Figure 5 is a schematic diagram of the structure of the terminal device provided in the embodiment of this application.

[0071] Implementation methods of this application

[0072] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0073] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" and "second" may explicitly or implicitly include one or more of the aforementioned features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0074] In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0075] First, let's explain the terms used in this application:

[0076] WPA2 (Wi-Fi Protected Access II) is a wireless network security protocol introduced by the Wi-Fi Alliance to improve the security of wireless networks. WPA2 is an improvement over the earlier WPA (Wi-Fi Protected Access), primarily employing stronger encryption mechanisms and authentication methods. WPA2 is widely supported, from home routers to enterprise-level network equipment and various Wi-Fi terminal devices (such as laptops, smartphones, and tablets).

[0077] WPA3 (Wi-Fi Protected Access III) is a next-generation wireless network security protocol introduced by the Wi-Fi Alliance. It aims to replace and improve upon WPA2 to address increasingly complex security threats and enhance user network security. WPA3 introduces a series of new features and improvements to provide greater security and ease of use. In some mixed environments, some devices may not support WPA3. In such cases, a WPA2 / WPA3 hybrid mode can be used to ensure compatibility, but it's crucial to ensure a successful transition to a pure WPA3 environment.

[0078] AP: Access Point, short for Wireless Access Point. A wireless access point is a device in a wireless local area network (WLAN) that allows wireless devices (such as laptops, smartphones, tablets, etc.) to connect to a wired network. It acts as a bridge, connecting wireless devices to a wired network that is connected to the internet or a local area network (LAN). Network devices include, but are not limited to, routers, smartphones, etc., in AP mode for any specific Wi-Fi network.

[0079] STA: Station, typically used to refer to client devices in a wireless network, i.e., terminal devices, also known as Wi-Fi terminal devices. STA devices include, but are not limited to, any smartphones, tablets, laptops, etc., that have Wi-Fi STA mode.

[0080] BSSID: Basic Service Set Identifier, is a key concept in wireless networks. It is used to uniquely identify a wireless access point (AP) or a basic service set (BSS) within a wireless network. BSSID is typically the MAC address (Media Access Control address) of the wireless access point, used to distinguish different wireless networks and access points, especially in environments with multiple wireless network coverage.

[0081] This application provides an encryption method selection method, apparatus, terminal device, and computer-readable storage medium. Specifically, this application provides an encryption method selection apparatus applicable to the encryption method selection method. The encryption method selection apparatus includes a processing module for a terminal device, which can be a laptop, smartphone, tablet, or other device capable of connecting to a wired network via a wireless access point.

[0082] In the current technology, with the popularization and version upgrades of WPA3, both terminal devices and network devices have shown different preferences for WPA2 and WPA3. WPA2 and WPA3 each have their advantages and disadvantages. Because WPA2 has been used for a long time and has undergone many years of use and iteration, most network devices now support WPA2, and its connection process is relatively stable. Its disadvantage is relatively poor security, as it can be cracked by intercepting related information. WPA3, on the other hand, is a newer encryption method. Some network devices on the market do not yet support WPA3, and the compatibility of some network devices with WPA3 is not perfect. Its connection stability is relatively worse than WPA2, but WPA3 has better security; its complex encryption algorithm is not easy to crack.

[0083] Stability and security are characteristics of WPA2 and WPA3, respectively, and the degree of emphasis on these two features varies in different usage environments. For WPA2 / WPA3 hybrid encryption, terminal devices can choose to use either WPA2 or WPA3 encryption.

[0084] For example, as the Android operating system continues to upgrade, support for WPA3 has been gradually added in different versions of Android. When a terminal device supports WPA3, it will prioritize the use of WPA3 encryption. Therefore, under the WPA2 / WPA3 hybrid encryption method, there is a logic for choosing between WPA2 and WPA3. In an Android device, when attempting to connect to a Wi-Fi network and updating an old configuration, WPA3 is prioritized. If the configuration information of the network device (AP, Access Point) to be connected to before connection uses the KeyMgmt (Key Management) encryption algorithm PSK (Pre-Shared Key) and the terminal device's own system supports WPA3 upgrade functionality, then the encryption algorithm will be upgraded from PSK to SAE (Simultaneous Authentication of Equals), that is, WPA2 will be upgraded to WPA3. In practical applications, the terminal device triggers a scan of the surrounding environment's access points (APs) to obtain and search for the SSID (Service Set Identifier) ​​of the AP to be connected to. If there is an AP that supports WPA3 in the set of APs with the same name, and there is no AP that only supports WPA2, then WPA2 can be upgraded to use WPA3.

[0085] For example, in Apple's iOS system, when a phone is used as a hotspot (in this case, the terminal device is an access point (AP) device, not a standalone (STA) device), there is a maximum compatibility setting in its settings interface. When maximum compatibility is enabled, the hotspot is configured to use the 2.4GHz band with WPA2 encryption; when maximum compatibility is disabled, the hotspot is configured to use the 5GHz band with WPA2 / WPA3 hybrid encryption. It is evident that in the current environment, Apple's system can change the encryption method for hotspots according to user needs.

[0086] However, existing encryption upgrade methods only include the upgrade logic for WPA2 to WPA3. Furthermore, Apple's maximum compatibility settings do not apply to network connections on STA devices.

[0087] Therefore, existing encryption method selection or upgrade methods have technical problems such as the terminal device being unable to select the preferred encryption method according to the user's settings preferences, and the terminal device being unable to automatically switch encryption methods when one of the encryption methods fails to connect after determining the encryption method for communication.

[0088] This application provides an encryption method selection method, apparatus, terminal device, and computer-readable storage medium. The method involves: determining a first encryption method for the terminal device; establishing a communication connection with a network device based on the first encryption method; determining that communication with the network device is interrupted; calculating a first score for the first encryption method and a second score for a second encryption method; and selecting a target encryption method from the first and second encryption methods based on the first and second scores.

[0089] In summary, the encryption method selection method in this application embodiment enables the terminal device to calculate the score of the selectable encryption methods when communication with the network device is abnormal, and select the target encryption method to establish a communication connection based on the score. This achieves the technical effect of switching to another encryption method to attempt to repair the communication connection when the selected encryption method fails to establish a communication connection, thereby improving the user experience and meeting user needs.

[0090] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the priority of the embodiments.

[0091] Please refer to Figure 1, which is a schematic diagram of a scenario illustrating the encryption method selection method provided in this application embodiment. The encryption method selection system may include a terminal device 100 and a processing module 200. The terminal device 100 and the processing module 200 can communicate with each other in any way, including but not limited to signal communication via electronic circuits or wireless signals. Wireless signals can be computer network communication using the TCP / IP protocol suite (TCP / IP) or User Datagram Protocol (UDP). The terminal device 100 can receive control signals from a remote control or control panel, and it can also receive instruction information sent by the processing module 200. The terminal device 100 can perform corresponding operations based on the corresponding instruction information.

[0092] In this embodiment of the application, the terminal device 100 includes, but is not limited to, devices such as laptops, smartphones, and tablets that can connect to a wired network via a wireless access point.

[0093] Those skilled in the art will understand that the application environment shown in Figure 1 is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may include more or fewer terminal devices than those shown in Figure 1. For example, only one terminal device is shown in Figure 1, but this is not specifically limited here.

[0094] In addition, as shown in Figure 1, the processing module 200 may include any hardware device capable of data processing and instruction sending, such as a CPU or microcontroller embedded in the terminal device; no specific limitation is made here.

[0095] It should be noted that the scenario diagram of the encryption method selection system shown in Figure 1 is merely an example. The encryption method selection system and scenario described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of encryption method selection systems and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

[0096] Specifically, please refer to Figure 2, which is a schematic diagram of a scenario in which a terminal device according to an embodiment of this application executes the encryption method selection method. The specific execution process of the terminal device executing the encryption method selection method is as follows:

[0097] S201: Determine the first encryption method for the terminal device.

[0098] In this embodiment, the terminal device can periodically scan for network devices in the surrounding environment, match the network device to be connected using the BSSID of the wireless access point, and determine a suitable encryption method as the first encryption method by reading the Capabilities variable (a variable representing the functionality or capability of a system, device, or program) from the scanned data of the wireless access point. For example, if the variable contains PSK, it indicates that the encryption method supports WPA2; as another example, if the variable contains SAE, it indicates that the encryption method supports WPA3. Furthermore, it can be determined whether the network device uses WPA2 / WPA3 hybrid encryption by judging whether both PSK and SAE are present.

[0099] It should be noted that the terminal device in this embodiment supports WPA2 / WPA3 hybrid encryption, and the network device in this embodiment also supports WPA2 / WPA3 hybrid encryption. Only when both the terminal device and the network device support hybrid encryption can the user be provided with the option to choose an encryption method.

[0100] It should also be noted that the hybrid encryption method can be a combination of multiple different encryption methods. In this embodiment, only the case of WPA2 / WPA3 hybrid encryption is used as an example. In practical applications, it can also be a hybrid encryption method composed of other encryption methods, such as WPA / WPA2, WPA2 / WPA3, WEP / WPA / WPA2, etc.

[0101] In this embodiment of the application, when the terminal device matches the network device to be connected and determines that both the terminal device and the network device support hybrid encryption, the first encryption method to be used in this communication connection is first determined.

[0102] Optionally, the encryption method selection method provided in this application embodiment further includes: when the terminal device has a preset encryption method, determining the preset encryption method as the first encryption method.

[0103] In this embodiment of the application, taking the case of WPA2 / WPA3 hybrid encryption as an example, the preset encryption method includes at least one of the following: WPA2 method, or WPA3 method. As shown in Figure 3, which is a schematic diagram of the overall process of the encryption method selection method, if the terminal device has a preset encryption method, the preset encryption method can be directly selected as the first encryption method to enable the terminal device to establish a communication connection with the network device.

[0104] Optionally, if the terminal device and the network device are not establishing a communication connection for the first time, and a previous communication connection was established using WPA2 encryption, with WPA2 set as the default encryption method (marking WPA2 as a fixed encryption method for the network device), then in this communication connection, WPA2 can be directly selected to establish a communication connection with the network device.

[0105] Correspondingly, if WPA3 encryption was selected in a previous communication connection and set as the default encryption method (marking WPA3 as a fixed encryption method for the network device), then WPA3 can also be directly selected to communicate with the network device in this current communication connection.

[0106] As an optional embodiment, if the terminal device and the network device are establishing a communication connection for the first time, and the terminal device determines that WPA2 is the best encryption method based on information obtained from scanning the network device, then WPA2 can be directly set as the preset encryption method. That is, WPA2 is marked as a fixed encryption method for the network device, and the current communication connection can be directly encrypted using WPA2. WPA3 is also applicable.

[0107] Optionally, the encryption method selection method provided in this application embodiment further includes: determining the initial state of the target control of the terminal device when there is no preset encryption method in the terminal device; and determining the first encryption method based on the initial state.

[0108] In this embodiment of the application, as shown in Figure 3, if the terminal device does not have a preset encryption method, that is, the terminal device has not marked a fixed encryption method for the network device, the initial state of the target control of the terminal device is determined, and then the first encryption method is selected from the selectable encryption methods according to the initial state of the target control.

[0109] It should be noted that the target control can be set in the Wi-Fi settings interface of the terminal device, such as the "Maximum Compatibility" control. The terminal device can record and read the state of this control. When maximum compatibility is enabled, WPA2 will be given priority when connecting to WPA2 / WPA3 network devices. When maximum compatibility is disabled, WPA3 will be given priority when connecting to WPA2 / WPA3 network devices.

[0110] Optionally, the encryption method selection method provided in this application embodiment further includes: determining WPA2 as the first encryption method when the initial state of the target control is open; and determining WPA3 as the first encryption method when the initial state of the target control is closed.

[0111] In this embodiment of the application, the system of different terminal devices can set the initial default state of this control according to the needs of the system or user, including: on state and off state.

[0112] As an optional embodiment, taking a smartphone as an example, users can enable or disable the "maximum compatibility" control as needed. For example, to ensure stable communication, the control can be enabled, and when maximum compatibility is enabled, WPA2 will be prioritized when connecting to network devices. Conversely, to ensure information security during communication, the control can be disabled, and when maximum compatibility is disabled, WPA3 will be prioritized when connecting to network devices.

[0113] As an optional embodiment, taking a smartwatch as an example, the smartwatch may not have a Wi-Fi settings interface. In this case, the user cannot manually enable or disable the "maximum compatibility" control. However, the terminal device can automatically control the "maximum compatibility" control to be enabled or disabled based on its own system configuration. Similarly, when maximum compatibility is enabled, WPA2 is preferentially used when connecting to network devices; when maximum compatibility is disabled, WPA3 is preferentially used when connecting to network devices.

[0114] It should be noted that when connecting, if the network device is marked with a fixed encryption method (preset encryption method), the maximum compatibility switch state will not be considered. That is, the priority of marking a fixed encryption method is higher than the priority of the maximum compatibility switch logic.

[0115] S202: Establish a communication connection with the network device according to the first encryption method.

[0116] In this embodiment of the application, after determining the first encryption method, a communication connection is established with the network device using the first encryption method to perform data interaction.

[0117] It should be noted that the encryption method in the communication connection process, that is, the Wi-Fi connection process, refers to a technology used to protect the security of data transmission in the wireless network. The encryption method defines how data is encrypted and decrypted in the wireless network to prevent unauthorized access and data leakage.

[0118] S203: Determine if communication with the network device is interrupted, calculate a first score for the first encryption method, and calculate a second score for the second encryption method.

[0119] In this embodiment, as shown in Figure 3, when a connection fails using an encryption method—that is, when the first encryption method fails—an encryption method scoring mechanism is activated. Points are added to either the first or second encryption method based on the configuration information, and points are deducted for connection failures. The scores of different encryption methods are compared. If the highest-scoring encryption method remains unchanged from the currently used encryption method, a reconnection is triggered directly; if the highest-scoring encryption method has changed, a different encryption method is used to attempt a connection.

[0120] It should be noted that connection failures include not only unsuccessful connection attempts, but also communication interruptions, data encryption / decryption failures, and other situations affecting data interaction. Configuration information refers to details such as whether a preset encryption method exists and whether the target control is enabled.

[0121] Optionally, the encryption method selection method provided in this application embodiment further includes: calculating a first score and a second score based on one or more of the following: communication interruption between the terminal device and the network device, whether the first encryption method is a preset encryption method, or the initial state of the target control.

[0122] In this embodiment of the application, when the communication is interrupted in the first encryption method, the score of the first encryption method can be reduced. In addition, the first encryption method and the selectable second encryption method can be scored according to information such as the preset encryption method and the initial state of the target control.

[0123] Optionally, the encryption method selection method provided in this application embodiment further includes: reducing the first score by a first value when communication between the terminal device and the network device is interrupted; increasing the first score by a second value when the first encryption method is a preset encryption method; increasing the first score by a third value according to the initial state of the target control, or increasing the second score by a third value.

[0124] In this embodiment, when one or more abnormal situations such as communication interruption or connection failure occur between the terminal device and the network device, the first score corresponding to the first encryption method is reduced by a first value. It is then determined whether the first encryption method is a preset encryption method; if so, the first score corresponding to the first encryption method is increased by a second value.

[0125] It should be noted that terminal devices can also set the same or different initial scores for different encryption methods.

[0126] Optionally, taking an initial score of 10 points as an example, when one or more abnormal situations occur, such as communication interruption or connection failure, between the terminal device and the network device, the first score corresponding to the first encryption method is reduced by 30 points. If the first encryption method is a preset encryption method, the first score is increased by 50 points. If there is no preset encryption method, neither the first nor the second score is increased. Further, based on the initial state of the target control, it is determined whether a third value is added to the first score of the first encryption method or the second score of the second encryption method.

[0127] It should be noted that the above scores are for illustrative purposes only, and the scores may be modified or adjusted according to the actual situation during application.

[0128] Optionally, the encryption method selection method provided in this application embodiment further includes: adding a third value to the first score when the initial state of the target control is open and the first encryption method is WPA2; adding a third value to the second score when the initial state of the target control is closed and the first encryption method is WPA2; adding a third value to the second score when the initial state of the target control is open and the first encryption method is WPA3; and adding a third value to the first score when the initial state of the target control is closed and the first encryption method is WPA3.

[0129] In this embodiment of the application, if the initial state of the target control is the open state and the first encryption method is WPA2, then a third value is added to the first score corresponding to the first encryption method (WPA2).

[0130] In this embodiment of the application, if the initial state of the target control is closed and the first encryption method is WPA2, then a third value is added to the second score corresponding to the second encryption method (WPA3).

[0131] In this embodiment of the application, if the initial state of the target control is the open state and the first encryption method is WPA3, then a third value is added to the second score corresponding to the second encryption method (WPA2).

[0132] In this embodiment of the application, if the initial state of the target control is closed and the first encryption method is WPA3, then a third value is added to the first score corresponding to the first encryption method (WPA3).

[0133] Optionally, taking an initial score of 10 points and WPA2 as the first encryption method as an example, when one or more abnormal situations such as communication interruption or connection failure occur between the terminal device and the network device, the first score corresponding to WPA2 is reduced by 30 points; if WPA2 is the preset encryption method, the first score is increased by 50 points; if the target control is initially in the open state, the first score is increased by 30 points; at this time, the total score of the first score is 60 points, and the total score of the second score is 10 points.

[0134] Optionally, taking an initial score of 10 points and WPA3 as the first encryption method as an example, when one or more abnormal situations such as communication interruption or connection failure occur between the terminal device and the network device, the first score corresponding to WPA3 will be reduced by 30 points; if there is no preset encryption method, neither the first nor the second score will be added; if the target control is initially in the open state, the second score will be added by 30 points; at this time, the total score of the first score is -20 points, and the total score of the second score is 40 points.

[0135] It should be noted that the above scores are for illustrative purposes only, and the scores may be modified or adjusted according to the actual situation during application.

[0136] S204: Select the target encryption method from the first encryption method and the second encryption method based on the first score and the second score.

[0137] In this embodiment of the application, as shown in Figure 3, after calculating the first score and the second score, the first score and the second score are compared. If the encryption method of the highest score has not changed, the first encryption method can be selected to directly trigger a reconnection; if the encryption method of the highest score has changed, the second encryption method can be switched to try to connect.

[0138] Optionally, the encryption method selection method provided in this application embodiment further includes: if the first score is greater than the second score, determining the first encryption method as the target encryption method and using the first encryption method as the preset encryption method; if the second score is greater than the first score, determining the second encryption method as the target encryption method and using the second encryption method as the preset encryption method.

[0139] In this embodiment of the application, if the first score is greater than the second score, the first encryption method is still used as the target encryption method for reconnection; if the second score is greater than the first score, the second encryption method is switched as the target encryption method for communication connection.

[0140] In addition, the terminal device can set the first encryption method or the second encryption method as the preset encryption method based on the calculated score.

[0141] Optionally, when attempting to connect using the second encryption method, if the connection is successful on the first attempt, the currently used second encryption method is recorded for the network device and marked as a fixed encryption method. As long as this network is not forgotten or cleared, subsequent connections will use the marked encryption method, thus achieving connection self-healing and ensuring the stability of subsequent connections.

[0142] Optionally, when a connection is successfully established, the first score corresponding to the first encryption method can be cleared, and the second score corresponding to the second encryption method can be cleared.

[0143] In this embodiment, a technical solution is implemented by determining a first encryption method for the terminal device; establishing a communication connection with the network device based on the first encryption method; determining a communication interruption with the network device; calculating a first score for the first encryption method and a second score for the second encryption method; and selecting a target encryption method from the first and second encryption methods based on the first and second scores. This allows the terminal device to calculate the scores of selectable encryption methods and select a target encryption method for communication connection when a communication connection with the network device is abnormal. This achieves the technical effect of switching to another encryption method to attempt to repair the communication connection when the selected encryption method is abnormal, thereby improving user experience and meeting user needs.

[0144] To facilitate better implementation of the encryption method selection method of this application, this application also provides an encryption method selection device based on the above encryption method selection method. The meanings of the terms used are the same as in the above encryption method selection method, and specific implementation details can be found in the description of the method embodiments.

[0145] Please refer to Figure 4, which is a schematic diagram of the encryption method selection device provided in an embodiment of this application. The encryption method selection device 40 is applied to a terminal device, and can be specifically as follows:

[0146] Processing module 200 is used to determine the first encryption method of the terminal device;

[0147] The processing module 200 is also used to establish a communication connection with the network device according to the first encryption method;

[0148] The processing module 200 is also used to determine the communication interruption with the network device, calculate the first score of the first encryption method, and calculate the second score of the second encryption method;

[0149] The processing module 200 is also used to select a target encryption method from the first encryption method and the second encryption method based on the first score and the second score.

[0150] Optionally, in some embodiments of this application, the processing module 200 is further configured to:

[0151] If the terminal device has a preset encryption method, the preset encryption method is determined as the first encryption method. The preset encryption method includes at least one of the following: WPA2 method or WPA3 method.

[0152] Optionally, in some embodiments of this application, the processing module 200 is further configured to:

[0153] In the absence of a preset encryption method on the terminal device, determine the initial state of the target control on the terminal device;

[0154] The first encryption method is determined based on the initial state.

[0155] Optionally, in some embodiments of this application, the processing module 200 is further configured to:

[0156] If the target control is initially enabled, WPA2 is selected as the first encryption method.

[0157] If the target control is initially in a closed state, WPA3 is selected as the first encryption method.

[0158] Optionally, in some embodiments of this application, the processing module 200 is further configured to:

[0159] The first score and the second score are calculated based on one or more of the following: communication interruption between the terminal device and the network device, whether the first encryption method is the preset encryption method, or the initial state of the target control.

[0160] Optionally, in some embodiments of this application, the processing module 200 is further configured to:

[0161] In the event of a communication interruption between the terminal device and the network device, the first score will be reduced by the first value.

[0162] If the first encryption method is the preset encryption method, add a second value to the first score;

[0163] Based on the initial state of the target control, add a third value to the first score, or add a third value to the second score.

[0164] Optionally, in some embodiments of this application, the processing module 200 is further configured to:

[0165] If the target control is initially enabled and the first encryption method is WPA2, add a third value to the first score.

[0166] If the target control is initially closed and the first encryption method is WPA2, add a third value to the second score.

[0167] If the target control is initially enabled and the first encryption method is WPA3, add a third value to the second score.

[0168] If the target control is initially closed and the first encryption method is WPA3, add a third value to the first score.

[0169] Optionally, in some embodiments of this application, the processing module 200 is further configured to:

[0170] If the first score is greater than the second score, the first encryption method is determined as the target encryption method, and the first encryption method is also used as the preset encryption method.

[0171] If the second score is greater than the first score, the second encryption method is determined as the target encryption method, and the second encryption method is used as the preset encryption method.

[0172] In this embodiment, the processing module 200 first determines the first encryption method of the terminal device. Then, the processing module 200 establishes a communication connection with the network device according to the first encryption method. Subsequently, the processing module 200 determines that the communication with the network device is interrupted, calculates the first score of the first encryption method, and calculates the second score of the second encryption method. Then, the processing module 200 selects the target encryption method from the first encryption method and the second encryption method according to the first score and the second score.

[0173] In this embodiment, the technical solution involves determining a first encryption method for the terminal device; establishing a communication connection with a network device based on the first encryption method; determining a communication interruption with the network device; calculating a first score for the first encryption method and a second score for the second encryption method; and selecting a target encryption method from the first and second encryption methods based on the first and second scores. This allows the terminal device to calculate the scores of selectable encryption methods and select a target encryption method for communication connection when a communication connection with a network device fails. This achieves the technical effect of switching to another encryption method to attempt to repair the communication connection when the selected encryption method fails, thereby improving user experience and meeting user needs.

[0174] In addition, this application also provides a terminal device, as shown in Figure 5, which illustrates the structural diagram of the terminal device involved in this application. Specifically:

[0175] The terminal device may include components such as a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will understand that the terminal device structure shown in FIG5 does not constitute a limitation on the terminal device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0176] The processor 501 is the control center of the terminal device. It connects various parts of the terminal device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 502, and by calling data stored in the memory 502, thereby providing overall monitoring of the terminal device. Optionally, the processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 501.

[0177] The memory 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 502 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.

[0178] The terminal device also includes a power supply 503 that supplies power to the various components. Preferably, the power supply 503 can be logically connected to the processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 503 may also include one or more DC or AC power supplies, recharging systems, power equipment debugging circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0179] The terminal device may also include an input unit 504, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0180] Although not shown, the terminal device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 501 in the terminal device loads the executable files corresponding to the processes of one or more applications into the memory 502 according to the following instructions, and the processor 501 runs the applications stored in the memory 502, thereby implementing the steps in any of the encryption method selection methods provided in the embodiments of this application.

[0181] In this embodiment, a technical solution is implemented by determining a first encryption method for the terminal device; establishing a communication connection with a network device based on the first encryption method; determining a communication interruption with the network device; calculating a first score for the first encryption method and a second score for the second encryption method; and selecting a target encryption method from the first and second encryption methods based on the first and second scores. This allows the terminal device to calculate the scores of selectable encryption methods and select a target encryption method for communication connection when a communication connection with a network device fails. This achieves the technical effect of switching to another encryption method to attempt to repair the communication connection when the selected encryption method fails, thereby improving user experience and meeting user needs.

[0182] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0183] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0184] Therefore, this application provides a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps in any of the encryption method selection methods provided in this application.

[0185] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0186] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0187] Since the instructions stored in the computer-readable storage medium can execute the steps in any of the encryption method selection methods provided in this application, the beneficial effects that any of the encryption method selection methods provided in this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0188] The above provides a detailed description of an encryption method selection method, apparatus, terminal device, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for selecting an encryption method, wherein, Applied to a terminal device, the method includes: Determine the first encryption method of the terminal device; Establish a communication connection with the network device according to the first encryption method; A communication interruption with the network device is determined, a first score for the first encryption method is calculated, and a second score for the second encryption method is calculated. Based on the first score and the second score, select the target encryption method from the first encryption method and the second encryption method.

2. The method according to claim 1, wherein, Determining the first encryption method for the terminal device includes: If the terminal device has a preset encryption method, the preset encryption method is determined to be the first encryption method, and the preset encryption method includes at least one of the following: WPA2 method, or WPA3 method.

3. The method according to claim 2, wherein, Determining the first encryption method for the terminal device includes: If the terminal device does not have a preset encryption method, determine the initial state of the target control of the terminal device; The first encryption method is determined based on the initial state.

4. The method according to claim 3, wherein, Determining the first encryption method based on the initial state includes: If the initial state of the target control is the open state, then the WPA2 method is determined to be the first encryption method; If the initial state of the target control is closed, the WPA3 method is determined to be the first encryption method.

5. The method according to claim 4, wherein, The calculation of the first score for the first encryption method and the calculation of the second score for the second encryption method include: The first score and the second score are calculated based on one or more of the following: communication between the terminal device and the network device is interrupted, whether the first encryption method is the preset encryption method, or the initial state of the target control.

6. The method according to claim 5, wherein, The calculation of the first score for the first encryption method and the calculation of the second score for the second encryption method include: In the event of a communication interruption between the terminal device and the network device, the first score is reduced by a first value; If the first encryption method is the preset encryption method, a second value is added to the first score; Based on the initial state of the target control, either add a third value to the first score, or add the third value to the second score.

7. The method according to claim 6, wherein, The step of adding a third value to the first score, or adding the third value to the second score, based on the initial state of the target control, includes: When the initial state of the target control is the open state and the first encryption method is the WPA2 method, the third value is added to the first score; If the initial state of the target control is closed and the first encryption method is WPA2, the third value is added to the second score; If the initial state of the target control is the open state and the first encryption method is the WPA3 method, the third value is added to the second score; If the initial state of the target control is closed and the first encryption method is WPA3, the third value is added to the first score.

8. The method according to claim 1, wherein, The step of selecting a target encryption method from the first encryption method and the second encryption method based on the first score and the second score includes: If the first score is greater than the second score, the first encryption method is determined to be the target encryption method, and the first encryption method is used as the preset encryption method. If the second score is greater than the first score, the second encryption method is determined to be the target encryption method, and the second encryption method is used as the preset encryption method.

9. The method according to claim 1, wherein, The method further includes: If the connection is successfully established on the first attempt by switching to the second encryption method, then the second encryption method will be marked as the fixed encryption method for the current network. In response to a connection request from the current network, a connection is established using the fixed encryption method.

10. An encryption method selection device, wherein, Applied to a terminal device, the device includes: The processing module is used to determine the first encryption method of the terminal device; The processing module is further configured to establish a communication connection with the network device according to the first encryption method; The processing module is further configured to determine a communication interruption with the network device, calculate a first score for the first encryption method, and calculate a second score for the second encryption method; The processing module is further configured to select a target encryption method from the first encryption method and the second encryption method based on the first score and the second score.

11. The encryption method selection device according to claim 10, wherein, The processing module is further configured to determine a first encryption method for the terminal device, including: If the terminal device has a preset encryption method, the preset encryption method is determined to be the first encryption method, and the preset encryption method includes at least one of the following: WPA2 method, or WPA3 method.

12. The encryption method selection device according to claim 11, wherein, The processing module is further configured to determine a first encryption method for the terminal device, including: If the terminal device does not have a preset encryption method, determine the initial state of the target control of the terminal device; The first encryption method is determined based on the initial state.

13. The encryption method selection device according to claim 12, wherein, The processing module is further configured to determine the first encryption method based on the initial state, including: If the initial state of the target control is the open state, then the WPA2 method is determined to be the first encryption method; If the initial state of the target control is closed, the WPA3 method is determined to be the first encryption method.

14. The encryption method selection device according to claim 13, wherein, The processing module is further configured to calculate a first score for the first encryption method and a second score for the second encryption method, including: The first score and the second score are calculated based on one or more of the following: communication between the terminal device and the network device is interrupted, whether the first encryption method is the preset encryption method, or the initial state of the target control.

15. The encryption method selection device according to claim 14, wherein, The processing module is further configured to calculate a first score for the first encryption method and a second score for the second encryption method, including: In the event of a communication interruption between the terminal device and the network device, the first score is reduced by a first value; If the first encryption method is the preset encryption method, a second value is added to the first score; Based on the initial state of the target control, either add a third value to the first score, or add the third value to the second score.

16. The encryption method selection device according to claim 15, wherein, The processing module is further configured to add a third value to the first score, or add the third value to the second score, based on the initial state of the target control, including: When the initial state of the target control is the open state and the first encryption method is the WPA2 method, the third value is added to the first score; If the initial state of the target control is closed and the first encryption method is WPA2, the third value is added to the second score; If the initial state of the target control is the open state and the first encryption method is the WPA3 method, the third value is added to the second score; If the initial state of the target control is closed and the first encryption method is WPA3, the third value is added to the first score.

17. The encryption method selection device according to claim 10, wherein, The processing module is further configured to select a target encryption method from the first encryption method and the second encryption method based on the first score and the second score, including: If the first score is greater than the second score, the first encryption method is determined to be the target encryption method, and the first encryption method is used as the preset encryption method. If the second score is greater than the first score, the second encryption method is determined to be the target encryption method, and the second encryption method is used as the preset encryption method.

18. The encryption method selection device according to claim 18, wherein, The processing module is further configured to, if switching to the second encryption method to attempt a connection and successfully connecting on the first attempt, mark the second encryption method as the fixed encryption method of the current network; In response to a connection request from the current network, a connection is established using the fixed encryption method.

19. A terminal device, wherein, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the encryption method selection method as described in any one of claims 1-9.

20. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the encryption method selection method as described in any one of claims 1-9.