Method for automatically updating a password of a WiFi device by an old password
By improving the Wi-Fi four-way handshake and WPS protocol, the PTK is calculated using the BSSID and PMK in the stored list, and the Wi-Fi device password is automatically updated. This solves the problem of time-consuming and labor-intensive Wi-Fi configuration updates, and achieves more secure and efficient automatic configuration.
Patent Information
- Application Number
- CN202211436964.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-17
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-11-17
AI Technical Summary
The existing WiFi configuration update process is time-consuming and labor-intensive, especially when passwords are frequently changed in enterprises or public places. Traditional methods require manual operation or cannot use the easymesh protocol, resulting in low configuration efficiency.
Using the existing Wi-Fi four-way handshake and WPS protocol, the PTK is calculated by storing the BSSID and PMK recorded in the list. The password is automatically updated using the WPS protocol. The Configuration Method and Device Password ID of the WPS protocol are modified, and the PTK is used instead of the PIN code to calculate the PSK.
The process of automatically updating WiFi device passwords is made more secure and efficient, reducing manual operations, suitable for multi-device configuration scenarios, and improving configuration efficiency.
Smart Images

Figure CN115714971B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular to a method for automatically updating a password of a WiFi device using an old password. Background Art
[0002] Current WiFi configuration requires updating information such as the SSID and key through a web interface or WPS, or using EasyMesh to update STA WiFi configuration information. Using the web interface or WPS requires manual configuration, requiring each device to be configured individually, which is time-consuming and labor-intensive. Furthermore, many devices do not support EasyMesh, which requires a link to be established before IEEE 1905 can be established. This means that IEEE 1905 packets can only be transmitted after a WiFi or wired connection is established, potentially preventing WiFi configuration updates. For security reasons, many businesses, public spaces, and homes frequently update AP WiFi passwords at regular intervals. WiFi password updates are typically communicated via email or other means, requiring personnel to manually change the password, which is time-consuming and labor-intensive. Summary of the Invention
[0003] The present invention aims to provide a method for automatically updating a WiFi device's password using an old password. This method requires only minor modifications to existing protocols and uses the same algorithms as the existing WiFi four-way handshake and WPS protocols, eliminating the need for new algorithms. This method is more secure and less complex than the current WiFi configuration process using WPS.
[0004] To achieve the above objectives, the present invention provides the following technical solution: a method for automatically updating a password of a WiFi device using an old password, the method involving a STA and an AP; the STA having previously established a connection with the AP using the old password; the AP having a storage list; the storage list storing the BSSID and first PMK of the STAs that have previously established a connection with the AP;
[0005] The method is:
[0006] Step 1: The AP and STA perform a four-way handshake based on the Wi-Fi four-way handshake protocol. If the four-way handshake succeeds, the AP and STA establish a connection. If the four-way handshake fails and the stored list contains the STA's BSSID and first PMK, the AP and STA calculate the first PTK based on the first PMK.
[0007] Step 2: The AP and STA use the WPS protocol to exchange information from M1 to M8. The STA obtains the new AP password through WPS and establishes a connection with the AP.
[0008] During the information exchange process between M1 and M8, PSK1 and PSK2 are calculated using the first PTK.
[0009] In the above-mentioned method for automatically updating a password using an old password on a WiFi device, step 1 is specifically as follows:
[0010] Step 11: The AP sends Message 1 to the STA. Message 1 contains the random number ANonce.
[0011] Step 12: After receiving Message1, the STA uses the random number ANonce, the SNonce generated by the STA, and the first PMK to calculate the first PTK. It then calculates the first MIC based on the first PTK and sends Message2 containing the first MIC to the AP. The first PMK is calculated based on the SSID and the password used by the STA.
[0012] Step 13: After receiving Message2, the AP uses the random numbers ANonce and SNonce and the second PMK to calculate the second PTK, and then calculates the second MIC based on the second PTK. It then determines whether the first MIC and the second MIC are equal. If not, it proceeds to step 14. The second PMK is calculated based on the SSID and the password used by the AP.
[0013] Step 14: The AP searches the stored list for the STA's BSSID and first PMK. Using ANonce, SNonce, and the first PMK, the AP calculates a third PTK, and then a third MIC based on the third PTK. The AP determines whether the third MIC is equal to the first MIC. If so, it generates Message 3 and sends it to the STA. The AP initiates WPS.
[0014] Step 15: After receiving Message 3, the STA starts WPS and obtains a new password through the WPS function.
[0015] In the above-mentioned method for automatically updating a password using an old password on a WiFi device, step 2 is specifically as follows:
[0016] Step 21: The STA sends WPS M1 to the AP. After receiving WPS M1, the AP sends WPS M2 to the STA. The STA and AP complete authentication by exchanging information via WPS M1 and WPS M2.
[0017] Step 22: The STA calculates the fourth PTK using the first PTK and N1, N2, MAC1, and MAC2 in the WPS protocol. It uses the KEK and TK of the fourth PTK to generate the first PSK1 and first PSK2, respectively. It then calculates E-Hash1 and E-Hash2 using the first PSK1 and first PSK2. The STA then sends WPS M3 to the AP. WPS M3 contains E-Hash1 and E-Hash2.
[0018] Step 23: After receiving WPS M3, the AP calculates the fifth PTK using the third PTK and N1, N2, MAC1, and MAC2 in the WPS protocol. It uses the KEK and TK of the fifth PTK to generate the second PSK1 and the second PSK2, respectively. It then calculates R-Hash1 and R-Hash2 using the second PSK1 and the second PSK2. The AP then sends WPS M4 to the STA. WPS M4 contains R-Hash1 and R-Hash2.
[0019] Step 24: After receiving WPS M4, the STA uses the first PSK1 to verify whether R-Hash1 is correct. If correct, it sends WPS M5 to the AP.
[0020] Step 25: After receiving WPS M5, the AP verifies whether E-Hash1 is correct using the second PSK1. If correct, it sends WPS M6 to the STA.
[0021] Step 26: After receiving WPS M6, the STA uses the first PSK2 to verify whether R-Hash2 is correct. If correct, it sends WPS M7 to the AP.
[0022] Step 27: After receiving WPS M7, the AP also verifies whether E-Hash2 is correct using the second PSK2. If correct, it sends WPS M8 to the STA. M8 contains security configuration information. The security configuration information is used for the STA and AP to establish a connection based on the new password.
[0023] Step 28: The STA receives WPS M8 and uses the security configuration information to establish a connection with the AP.
[0024] In the above-mentioned method in which the WiFi device automatically updates the password using the old password, when the STA establishes a connection with the AP, the AP refreshes the storage list.
[0025] In the above method of automatically updating the password of the WiFi device using the old password, in WPS M1, WPS M2, WPS M3, WPS M4, WPS M5, WPS M6, WPS M7, and WPS M8, the Configuration Method is changed to 0x808 and the DevicePassword ID value is changed to 0x09;
[0026] After the Configuration Method is changed to 0x808 and the Device Password ID value is changed to 0x09, the AP and STA use the fourth PTK and fifth PTK instead of the PIN code to calculate the first PSK1 and first PSK2, and the second PSK1 and second PSK2.
[0027] In the above-mentioned method for automatically updating the password of a WiFi device using the old password, the first two bits of the reserved field of the keyinformation of Message3 are filled with 1, and 1 is written in the error column and 0 is written in the install column to indicate that the AP has rejected Message2 and the STA automatically updates the password through the WPS function.
[0028] In the above-mentioned method for automatically updating a WiFi device's password using an old password, the storage list also records the STA's mode, PTK, validity period, and last leave time. The mode specifies whether the STA can initiate the WPS protocol; the validity period specifies whether the STA is allowed to automatically update its password using the old password using the WPS protocol within the validity period.
[0029] Compared with the prior art, the present invention has the following beneficial effects:
[0030] The Wi-Fi device of the present invention can be updated to a new password using an old password with only minor changes to the existing protocol. Furthermore, the new method can be added by utilizing the reserved bits of the existing four-way handshake and WPS protocols. The algorithms used are the same as those in the existing Wi-Fi four-way handshake and WPS protocols, eliminating the need for new algorithms. This makes Wi-Fi configuration more secure and hassle-free than the current Wi-Fi configuration via WPS. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is a flow chart of an embodiment of the present invention;
[0032] Figure 2 This is a flowchart of step 1 of an embodiment of the present invention;
[0033] Figure 3 This is a flowchart of step 2 of an embodiment of the present invention;
[0034] Figure 4 This is a data interaction diagram between STA and AP during a four-way handshake of Wi-Fi under normal circumstances;
[0035] Figure 5 This is the information structure diagram of Message3;
[0036] Figure 6 This is the data interaction diagram between STA and AP implemented by the WPS function under normal circumstances;
[0037] Figure 7 This is a data interaction diagram of the present invention. DETAILED DESCRIPTION
[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0039] Before describing the embodiment of the present invention, this embodiment first describes the normal four-way handshake process of traditional Wi-Fi and the WPS protocol.
[0040] Normal four-way handshake process, please refer to Figure 4 :
[0041] Explanation of special terms:
[0042] PSK: Pre-shared key, calculated from the password and SSID;
[0043] PMK: Pairwise Master Key, the highest level of key, the same as PSK in WPA2 / PSK;
[0044] GMK: Generated by the authenticator (i.e., the router) and is the seed of the group transient key (GTK);
[0045] PTK / GTK: Pairwise transient key / group transient key, ultimately used for encrypted unicast / broadcast keys (usually AES encryption algorithm);
[0046] Nonce: A randomly generated value that is used only once;
[0047] KCK: the front part of PTK, 128 bits;
[0048] KEK: the middle part of PTK, 128 bits;
[0049] TK: The latter part of PTK, 128 bits or 256 bits, the encryption TKIP bit is 256 bits, and CCMP is 128 bits;
[0050] MIC: Message Integrity Check, a hash value calculated for a set of data that needs to be protected, used to prevent data tampering.
[0051] Certification process:
[0052] 1. The supplicant (STA) and authenticator (AP) each use a password -> psk -> pmk (the authenticator will also have a gmk). If the passwords are the same, the resulting pmk is the same, so the next step is to verify that the pmk is the same.
[0053] 2. Four-way handshake process:
[0054] The authenticator generates a random number (ANonce) and sends it to the requester.
[0055] The requester also generates a random number (SNonce), which is then used to generate the PTK using a pseudo-random function (PRF). The parameters include the PMK, SNNoce, ANonce, the requester's MAC address, and the authenticator's MAC address. (These parameters can be obtained through packet capture, provided someone is connecting to the router and the password is correct.) The PTK is decomposed into the KCK, which is then used to calculate the MIC. The requester then sends the SNonce and MIC to the authenticator for authentication.
[0056] <c>The authenticator also has two nonces (SNonce and ANonce) and uses the same algorithm to calculate PTK -> KCK -> MIC. After successful authentication, it sends a message (including GTK) to the requester, instructing the requester to authenticate and install PTK and GTK.
[0057] <d>After the supplicant installs the PTK and GTK, it sends a confirmation message to the authenticator. After receiving the confirmation message, the authenticator also installs the PTK and GTK. The handshake is complete.
[0058] WPS protocol, please refer to< / d> < / c> Figure 6 :
[0059] <1> After the WSC on the AP side starts working, it broadcasts a beacon packet with the WSC IE field to declare that the AP supports WSC.
[0060] <2> If an Enrollee (i.e., STA) receives a beacon packet from the AP, it parses the WSC IE in the beacon packet and sends a unicast Probe Request packet to the AP (including the Request Type attribute, which is generally 0x01, indicating that the device is an Enrollee). The packet contains the Configuration Methods attribute, which supports the WSC configuration method, and the Device Password ID attribute, which is used to identify the device password type. The default value is PIN (0x0000). Normally, the PIN code is used as the data source for PSK calculation. Password IDs are generally 0x00-0x08. 0x09-0x0f are reserved.
[0061] Configuration Methods has the values described in Table 1 below. The high bit 0x800 is useless, so 0x808 is used in the present invention.
[0062] Table 1
[0063]
[0064] <3> After the AP receives the Probe Request packet with WSC IE, it will reply to the Probe Request packet with a Probe Response frame with WSC IE. This packet has the same properties as the Probe Request.
[0065] <4> Association and authentication are temporary association authentication and are used for subsequent M1-M8 data communication.
[0066] <5> EAPOL-Start starts the WPS authentication process.
[0067] <6> The AP sends an EAP-Request / Identity to determine the STA's ID.
[0068] <7> For STA using WSC authentication method, it needs to set Identity to "WFA-SimpleConfig-Enrollee-1-0" in the reply EAP-Response / Identity package.
[0069] <8> After the AP determines that the Enrollee's Identity is "WFA-SimpleConfig-Enrollee-1-0," it sends an EAPRequest / WSC_Start packet to initiate the EAP-WSC authentication process. The following is the interaction between M1 and M8.
[0070] <9> The Enrollee sends the M1 message to the AP. M1 = Version | N1 | | Description | | PK E ,M1 contains several important information N1 is a string of random numbers generated by STA, which is used for subsequent key derivation and other tasks, PK E It is the DH public key generated by Enrollee. Registrar receives PK E K_tmp can be calculated when
[0071] <10> AP sends M2 information to Enrollee, M2 = Version || N1 || N2 || Description || PK R
[0072] [ || ConfigData ] || HMACAuthKey(M1 || M2*) N2 is a random number generated by the AP, PK R It is the DH public key generated by AP. Enrollee receives PK R After that, the value of the shared key K_tmp can also be calculated correctly.
[0073] HMAC AuthKey (M1 || M2 * ):It is a message authentication code, used to determine whether the received information is correct, which is obtained by adding M1 to M2 * (M2 removes the message authentication code) The message passes through HMAC AuthKey Perform calculations.
[0074] <11> Enrollee sends M3 information to AP, M3 = Version || N2 || E-Hash1 || E-Hash2 || HMAC AuthKey (M2 || M3 * ).
[0075] E-Hash1 = HMAC AuthKey (E-S1 || PSK1 || PK E || PK R ) It consists of the first half of the device password (for example, the first 4 digits of the PIN method, such as PIN=12345670, PSK1 = first128 bits of HMAC AuthKey (1234)) and the 128-bit random number (E-S1) generated by Enrollee as input, AuthKey as parameter key, combined with PK E and PK R Authentication code calculated using the HMAC-SHA-256 algorithm
[0076] E-Hash2: E-Hash2 = HMAC AuthKey (E-S2 || PSK2 || PK E || PK R ) is composed of the second half of the device password (for example, the last 4 digits of the PIN method, such as PIN=12345670, PSK2 = first 128 bits of HMAC AuthKey (5670)) and the 128-bit random number (E-S2) generated by Enrollee as input, AuthKey as parameter key, combined with PK E and PK R The authentication code calculated using the HMAC-SHA-256 algorithm.
[0077] HMAC AuthKey (M2 || M3 * ): Use the M2||M3 (M3 without the authentication code) message and the authentication code generated by AuthKey to verify whether the message is transmitted correctly.
[0078] <12> AP sends M4 information to Enrollee, M4 = Version || N1 || R-Hash1 || R-Hash2 || ENCKey WrapKey (R-S1) || HMAC AuthKey (M3 || M4 * )
[0079] Hash1: R-Hash1 = HMAC AuthKey (R-S1 || PSK1 || PK E || PK R ) It consists of the first half of the device password (for example, the first 4 digits of the PIN method, such as PIN=12345670, PSK1= first 128 bits of HMAC AuthKey (1234)) and a 128-bit random number (R-S1) generated by the registrar as input, AuthKey as the parameter key, and the authentication code calculated using the HMAC-SHA-256 algorithm combined with PKE and PKR. R-Hash2: R-Hash2 = HMAC AuthKey (R-S2 || PSK2 || PK E || PK R ) It consists of the first half of the device password (for example, the last 4 digits of the PIN method, such as PIN=12345670, PSK1= first 128 bits of HMAC AuthKey (1234)) and the 128-bit random number (R-S1) generated by the registrar as input, AuthKey as the parameter key, combined with PK E and PK R The authentication code calculated using the HMAC-SHA-256 algorithm. WrapKe y(R-S1): This formula is the result of symmetric encryption of R-S1 using KeyWrapKey as the secret key. The encryption algorithm is AES-CBC per FIPS 197, with PKCS#5 v2.0 padding.
[0080] Regarding KeyWrapKey, KDK = HMAC-SHA-256DHKey (N1 || EnrolleeMAC || N2). KeyWrapKey is used for two-way data encryption. Its length is 128 bits and it is used to encrypt private nonce or ConfigData. Its calculation parameters are K_tmp, N1, Enrollee MAC and N2. Regarding R-S1, it is a 128-bit random number generated by the registrar. The Enrollee uses it in combination with R-Hash1 to confirm whether the first half of the device password is correct. That is, according to the formula R-Hash1 = HMAC AuthKey (R-S1 || PSK1 || PK E || PK R ) Enrollee knows AuthKey, PSK1, PK E , PK R Under the conditions of R-S1 and R-Hash1, after receiving R-S1 sent by Registrar at the same time, Enrollee can calculate a new R-Hash and compare it with R-Hash1. If they are equal, it can be confirmed that the first half of the device password is correct; if they are different, it will send a fail message and stop the interaction.
[0081] <13> Enrollee sends M5 information to AP, M5 = Version || N2 || ENCKeyWrapKey (E-S1) || HMACAuthKey (M4 || M5*)
[0082] ENC KeyWrapKey (E-S1): When Registrar receives E-S1, according to the equation E-Hash1 = HMAC AuthKey (E-S1 || PSK1 || PK E || PK R ) Registrar can use AuthKey, E-S1, PSK1, PK E , PK R A new E-Hash is calculated and compared with E-Hash1. If they are equal, the first half of the device password is confirmed to be correct. If they are different, a fail message is issued and further interaction is stopped. In fact, M4 and M5 are used to confirm the first half of the device password between the Enrollee and the Registrar (PSK1 = first 128 bits of HMAC AuthKey (1234)) is correct.
[0083] <14> AP sends M6 information to Enrollee, M6 = Version || N1 || ENC KeyWrapKey (R-S2) ||HMACAuthKey (M5 || M6 * )
[0084] ENC KeyWrapKey (R-S2): When Enrollee receives R-S2, according to the equation R-Hash2 = HMAC AuthKey (R-S2 || PSK2 || PK E || PK R ) Enrollee can use AuthKey, R-S2, PSK2, PK E , PK R A new R-Hash is calculated and compared with R-HashR. If they are equal, it can be confirmed that the first half of the devicepassword is correct; if they are different, a fail message will be issued and further interaction will be stopped.
[0085] Encryped Settings is the AP using KeyWrapKey to encrypt R-S2.
[0086] <15> Enrollee sends M7 information to AP, M7 = Version || N2 || ENCKeyWrapKey (E-S2[||ConfigData]) || HMAC AuthKey (M6 || M7 * )
[0087] ENC KeyWrapKey (E-S2 [||ConfigData]): Similarly, the corresponding equation is E-Hash2 = HMAC AuthKey (E-S2|| PSK2|| PK E || PK R ) However, the difference here is the addition of the conditional item [||ConfigData]. If the current Enrollee is an AP, this attribute will be carried in M7. However, we generally use standalone mode, so this situation will not occur. In fact, M6 and M7 are used to confirm the second half of the device password (PSK1 = first 128 bits of HMAC) between the Enrollee and the Registrar. AuthKey (5670)) is correct.
[0088] <16> AP sends M8 information to Enrollee: M8 = Version || N1 || [ENC KeyWrapKey (ConfigData)] || HMAC AuthKey (M7 || M8 * )
[0089] N1: can be regarded as session ID to avoid sending to the wrong object [ENC KeyWrapKey (ConfigData)]: Secure configuration information encrypted with KeyWrapKey. ConfigData is what we ultimately need to obtain.
[0090] Security configuration information includes the SSID, Authentication Type, Encryption Type, Network Key, and MAC Address. For STAs, obtaining this security configuration information allows them to connect to the AP. This security configuration information is stored in the Encrypted Settings field, which is encrypted using the KeyWrapKey. The WSC specification stipulates that when the Enrollee is a STA (for the Registrar, the AP is also the Enrollee), the Encrypted Settings field contains several attributes, the most important of which is the Credential attribute set.
[0091] Example 1
[0092] refer to Figure 1 and Figure 7 A method for automatically updating a password of a WiFi device using an old password, the method involving a STA (station connected to a wireless access point) and an AP (wireless access point); the STA has previously established a connection with the AP based on the old password;
[0093] A list (table list) is stored in the AP, which records the information of each STA that has established a connection with the AP, including BSSID, last leave time, validity period (available interval), mode (mode: deny or allow), first PMK (first PMK, PMK: Pairwise Master Key) and third PTK; the first PMK mentioned here refers to the PMK used by the STA and AP to successfully establish a connection last time; the third PTK is the PTK used to calculate the third MIC again after the four-way handshake fails after the AP changes the password. The validity period and mode can be set by the associated personnel. The validity period is generally one week, but can also be longer. After the AP changes the password, the STA can obtain the new password through the old password within the validity period. The mode is: the password can be updated through the WPS function, and the password update through the WPS function is prohibited; the last leave time can be used by the AP to determine whether the STA is in the validity period;
[0094] The above-mentioned Wi-Fi four-way handshake and WPS protocol are the basis for implementing the present invention. The method of the present invention is specifically as follows:
[0095] Step 1: The AP and STA perform a four-way handshake based on the Wi-Fi four-way handshake protocol. If the four-way handshake succeeds, the AP and STA establish a connection. If the four-way handshake fails and the stored list contains the STA's BSSID and first PMK, the AP and STA calculate the first PTK based on the first PMK.
[0096] refer to Figure 2 , step 1 is as follows:
[0097] Step 11: The AP sends Message 1 to the STA. Message 1 contains the random number ANonce.
[0098] Step 12: After receiving Message1, the STA uses the random number ANonce, the SNonce generated by the STA, and the first PMK to calculate the first PTK. It then calculates the first MIC based on the first PTK and sends Message2 containing the first MIC to the AP. The first PMK is calculated based on the SSID and the password used by the STA.
[0099] Step 13: After receiving Message2, the AP uses the random numbers ANonce and SNonce and the second PMK to calculate the second PTK, and then calculates the second MIC based on the second PTK. It then determines whether the first MIC and the second MIC are equal. If not, it proceeds to step 14. The second PMK is calculated based on the SSID and the password used by the AP.
[0100] If the first MIC and the second MIC are equal, it means that the password of the STA and the password of the AP are the same, and the normal four-way handshake process described above can be completed, and the STA and AP are connected;
[0101] If the first MIC and the second MIC are not equal, it means that the password of the STA is different from the password of the AP. In this case, proceed to step 14 for further determination.
[0102] Step 14: The AP searches the stored list for the STA's BSSID and first PMK. Using ANonce, SNonce, and the first PMK, the AP calculates a third PTK, and then a third MIC based on the third PTK. The AP determines whether the third MIC is equal to the first MIC. If so, it generates Message 3 and sends it to the STA. The AP initiates WPS.
[0103] If the third MIC is equal to the first MIC, it means that the STA has an old password that is within the validity period. In this case, the AP and STA can enable the WPS protocol to obtain a new password.
[0104] If the third MIC is not equal to the first MIC, the STA cannot proceed to any subsequent steps and terminates at this step. The STA and AP cannot use the old password to obtain the new password through WPS.
[0105] Step 15: After receiving Message 3, the STA starts WPS and obtains a new password through the WPS function.
[0106] The information structure of Message3 can be referred to Figure 5 ;
[0107] Figure 4 The first two bits of the reserved key information are filled with 1, and the error column is written as 1, and the install column is written as 0 to indicate that the AP has rejected Message 2. The STA automatically updates the password through the WPS function.
[0108] Step 2: The AP and STA use the WPS protocol to exchange information from M1 to M8. The STA obtains the AP's new password through WPS and establishes a connection with the AP. During the information exchange from M1 to M8, PSK1 and PSK2 are calculated using the first PTK.
[0109] An important improvement in the present invention is that the WPS protocol is adjusted to utilize the unused configuration data space of ConfigurationMethod and Device Password ID. ConfigurationMethods uses the reserved bit 0x800 plus 0x08 to get 0x808, and Device Password ID uses 0x09 from the reserved bit 0x09-0x0f.
[0110] This configuration change primarily takes effect in WPS M3 and WPS M4. The traditional WPS protocol's PIN-based PSK1 and PSK2 calculation method is disabled, and PTK is used instead. E-Hash1, E-Hash2, R-Hash1, and R-Hash2 are then calculated. During the subsequent WPS M5-WPS M7 interaction, E-Hash1, E-Hash2, R-Hash1, and R-Hash2 are authenticated. Once authentication is successful, security configuration information can be transmitted. Upon receiving the security configuration information, the STA can establish a connection with the AP.
[0111] After the AP sends Message 3 of the four-way handshake, the STA and AP should start the WPS service as soon as possible, within a limit of 30 seconds. After starting the WPS protocol, the entire WPS exchange process follows the standard WPS protocol exchange process, which takes a maximum of 120 seconds.
[0112] 1. In Figure 5 In the interaction process from Beacon to Association response, the properties Configuration Method and Device Password ID in WSC IE still use normal values, such as PIN code WPS.
[0113] 2. When the Enrollee (i.e., STA) sends an EAPOL-Start packet to the AP, if the AP receives this packet for more than 30 seconds, it will send a fail packet and stop the interaction. Ordinary WPS is not subject to this limitation.
[0114] 3. When the Enrollee receives the EAP-Request, if it takes more than 30 seconds, it sends a fail packet and stops the interaction. Ordinary WPS is not subject to this limitation.
[0115] 4. If the Enrollee is WPS with a PTK code, the Configuration Method is 0x808 in WPS M1, WPS M3, WPS M5, and WPS M7. The Device Password ID value is 0x09.
[0116] 5. For the same AP that uses PTK-enabled WPS, the Configuration Method is 0x808 in WPS M2, WPS M4, WPS M6, and WPS M8. The Device Password ID value is 0x09.
[0117] The M1-M8 interaction process is the same as the current technology WPS protocol using PIN code interaction, and the PIN code is replaced by the PTK code.
[0118] Specifically, refer to Figure 3 , the step 2 is specifically as follows:
[0119] Step 21: The STA sends WPS M1 to the AP. After receiving WPS M1, the AP sends WPS M2 to the STA. The STA and AP complete authentication by exchanging information via WPS M1 and WPS M2.
[0120] Step 22: The STA calculates the fourth PTK using the first PTK and N1, N2, MAC1, and MAC2 in the WPS protocol. It uses the KEK and TK of the fourth PTK to generate the first PSK1 and first PSK2, respectively. It then calculates E-Hash1 and E-Hash2 using the first PSK1 and first PSK2. The STA then sends WPS M3 to the AP. WPS M3 contains E-Hash1 and E-Hash2.
[0121] The first 128 bits of the first PTK are used to generate the fourth PTK using a key derivation algorithm based on N1 (the 128-bit random number sent by the STA in WPS M1), N2 (the 128-bit random number sent by the AP in WPS M2), MAC1 (the STA's BSSID), and MAC2 (the AP's BSSID). The KEK and TK derived from the fourth PTK are then used to generate PSK1 and PSK2, respectively.
[0122] PSK1 = first 128 bits of HMACAuthKey(KEK)
[0123] PSK2 = first 128 bits of HMACAuthKey(TK)
[0124] Step 23: After receiving WPS M3, the AP calculates the fifth PTK using the third PTK and N1, N2, MAC1, and MAC2 in the WPS protocol. It uses the KEK and TK of the fifth PTK to generate the second PSK1 and the second PSK2, respectively. It then calculates R-Hash1 and R-Hash2 using the second PSK1 and the second PSK2. The AP then sends WPS M4 to the STA. WPS M4 contains R-Hash1 and R-Hash2.
[0125] The AP calculates the second PSK1 and second PSK2 as follows:
[0126] The fifth PTK is recalculated based on N1, N2, MAC1, and MAC2 using the first 128 bits of the first PTK, and the KEK and TK of the fifth PTK are used to generate the second PSK1 and the second PSK2 respectively.
[0127] In the normal WPS protocol, the first half of the PIN code generates PSK1, and the second half generates PSK2.
[0128] This article directly uses PTK for generation. Since the AP and STA input parameters are the same when generating the new PTK from the old PMK, the PSK1 and PSK2 on both sides are theoretically the same.
[0129] Through the PSK1 and PSK2 generated by the STA and AP, it can be determined whether the E-Hash1 and E-Hash2, R-Hash1 and R-Hash2 generated by the STA and AP are correct. If they are all correct, the M1-M8 exchange can be established normally.
[0130] Specifically, as follows:
[0131] Step 24: After receiving WPS M4, the STA uses the first PSK1 to verify whether R-Hash1 is correct. If correct, it sends WPS M5 to the AP.
[0132] Step 25: After receiving WPS M5, the AP verifies whether E-Hash1 is correct using the second PSK1. If correct, it sends WPS M6 to the STA.
[0133] Step 26: After receiving WPS M6, the STA uses the first PSK2 to verify whether R-Hash2 is correct. If correct, it sends WPS M7 to the AP.
[0134] Step 27: After receiving WPS M7, the AP also verifies whether E-Hash2 is correct using the second PSK2. If correct, it sends WPS M8 to the STA. M8 contains security configuration information. The security configuration information is used for the STA and AP to establish a connection based on the new password.
[0135] Step 28: The STA receives WPS M8 and uses the security configuration information to establish a connection with the AP.
[0136] As can be seen from steps 22-27 above, steps 22-27 are similar to normal WPS functions. The difference is that during WPS M3 and WPS M4 interactions between the STA and AP, the PSK is calculated using the STA's old PTK and the AP's old PTK. Whether the PTK is used to calculate the PSK is determined by combining the Device Password ID value of 0x09. This ensures that both the AP and STA use the PTK to calculate the PSK.
[0137] From the above analysis, it can be seen that the present invention is an improvement and optimization based on the existing algorithm function, which has the advantages of simple modification, safety and reliability.
[0138] To summarize, based on the Wi-Fi four-way handshake, this case reconfigures the unused configuration data space of the Configuration Method and Device Password ID of the WPS protocol, and modifies the parameters to 0x808 and 0x9. During the data interaction between M1 and M8, the confirmed PTK generated during the four-way handshake is used instead of the PIN code to obtain the AP password and realize the connection between the AP and the STA.
[0139] The above method does not require major changes to the existing protocol and can automatically obtain a new password, which is much simpler than the traditional method.
Claims
1. A method for automatically updating a password of a WiFi device using an old password, characterized in that: The method involves an STA and an AP; the STA has previously established a connection with the AP based on an old password; the AP has a storage list; the storage list stores the BSSID and the first PMK of the STA that has previously established a connection with the AP; The method is: Step 1: The AP and STA perform a four-way handshake based on the Wi-Fi four-way handshake protocol. If the four-way handshake succeeds, the AP and STA establish a connection; If the four-way handshake fails and the storage list contains the STA's BSSID and the first PMK, the AP and the STA calculate the first PTK based on the first PMK; Step 2: The AP and STA use the WPS protocol to exchange information from M1 to M8. The STA obtains the new AP password through WPS and establishes a connection with the AP. During the information exchange process between M1 and M8, PSK1 and PSK2 are calculated using the first PTK.
2. The method for automatically updating a password of a WiFi device using an old password according to claim 1, wherein: The step 1 is specifically as follows: Step 11: The AP sends Message 1 to the STA. Message 1 contains the random number ANonce. Step 12: After receiving Message1, the STA uses the random number ANonce, the SNonce generated by the STA, and the first PMK to calculate the first PTK. It then calculates the first MIC based on the first PTK and sends Message2 containing the first MIC to the AP. The first PMK is calculated based on the SSID and the password used by the STA. Step 13: After receiving Message2, the AP uses the random numbers ANonce and SNonce and the second PMK to calculate the second PTK, and then calculates the second MIC based on the second PTK. It then determines whether the first MIC and the second MIC are equal. If not, it proceeds to step 14. The second PMK is calculated based on the SSID and the password used by the AP. Step 14: The AP searches the stored list for the STA's BSSID and first PMK. Using ANonce, SNonce, and the first PMK, the AP calculates a third PTK, and then a third MIC based on the third PTK. The AP determines whether the third MIC is equal to the first MIC. If so, it generates Message 3 and sends it to the STA. The AP initiates WPS. Step 15: After receiving Message 3, the STA starts WPS and obtains a new password through the WPS function.
3. The method for automatically updating a password of a WiFi device using an old password according to claim 2, wherein: The step 2 is specifically as follows: Step 21: The STA sends WPS M1 to the AP. After receiving WPS M1, the AP sends WPS M2 to the STA. The STA and AP complete authentication by exchanging information about WPS M1 and WPS M2. Step 22: The STA calculates the fourth PTK using the first PTK and N1, N2, MAC1, and MAC2 in the WPS protocol. It uses the KEK and TK of the fourth PTK to generate the first PSK1 and first PSK2, respectively. It then calculates E-Hash1 and E-Hash2 using the first PSK1 and first PSK2. The STA then sends WPS M3 to the AP. WPS M3 contains E-Hash1 and E-Hash2. Step 23: After receiving WPS M3, the AP calculates the fifth PTK using the third PTK and N1, N2, MAC1, and MAC2 in the WPS protocol. It uses the KEK and TK of the fifth PTK to generate the second PSK1 and the second PSK2, respectively. It then calculates R-Hash1 and R-Hash2 using the second PSK1 and the second PSK2. The AP then sends WPS M4 to the STA. WPS M4 contains R-Hash1 and R-Hash2. Step 24: After receiving WPS M4, the STA uses the first PSK1 to verify whether R-Hash1 is correct. If correct, it sends WPSM5 to the AP. Step 25: After receiving WPS M5, the AP verifies whether E-Hash1 is correct using the second PSK1. If correct, it sends WPS M6 to the STA. Step 26: After receiving WPS M6, the STA uses the first PSK2 to verify whether R-Hash2 is correct. If correct, it sends WPSM7 to the AP. Step 27: After receiving WPS M7, the AP also verifies whether E-Hash2 is correct using the second PSK2. If correct, it sends WPS M8 to the STA. M8 contains security configuration information. The security configuration information is used for the STA and AP to establish a connection based on the new password. Step 28: The STA receives WPS M8 and uses the security configuration information to establish a connection with the AP.
4. The method for automatically updating a password of a WiFi device using an old password according to claim 3, wherein: When the STA establishes a connection with the AP, the AP refreshes the storage list.
5. The method for automatically updating a password of a WiFi device using an old password according to claim 3, wherein: In WPSM1, WPS M2, WPS M3, WPS M4, WPS M5, WPS M6, WPS M7, and WPS M8, the Configuration Method is changed to 0x808, and the Device Password ID value is changed to 0x9. When the Configuration Method is changed to 0x808 and the Device Password ID value is changed to 0x9, the AP and STA use the fourth PTK and fifth PTK instead of the PIN code to calculate the first PSK1 and first PSK2, and the second PSK1 and second PSK2.
6. The method for automatically updating a password of a WiFi device using an old password according to claim 2, wherein: The first two bits of the reserved key information of Message 3 are filled with 1, and 1 is written in the error column and 0 is written in the install column, which is used to indicate that the AP rejects Message 2 and the STA automatically updates the password through the WPS function.
7. The method for automatically updating a password of a WiFi device using an old password according to claim 1, wherein: The storage list also records the STA's mode, PTK, validity period, and last leave time; the mode is used to specify whether the STA can start the WPS protocol; the validity period is used to specify whether the STA is allowed to use the WPS protocol to automatically update the password with the old password within a validity period.
Citation Information
Patent Citations
Method and device for key negotiation of wireless network
CN103888941A
Configuration information processing method and device, storage medium and electronic equipment
CN114189859A