A method and system for secure interconnection of devices with pairwise secret derived passwords
Patent Information
- Application Number
- CN202611255545.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-18
- Publication Date
- 2026-10-09
AI Technical Summary
此类方案中比对码的作用是"确认本次配对没有被中间人替换",配对之后的数据保护依赖保存的密钥材料本身;比对码与后续会话的接入口令之间没有密码学派生关系,且配对关系的存续不提供"可连接范围"的协议层约束——任何知道地址与端口的外部设备仍可发起连接尝试,认证失败的探测成本由被连接方承担
[0029]1. 首次配对免口令抄录:配对秘密由第一设备在配对会话内随机生成、仅经加密信道下发,用户全程只需在发现列表中点击选择,无需约定、抄录或输入任何口令;
Smart Images

Figure CN122891231A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of secure interconnection technology for local area network devices, specifically to a secure interconnection method and system for pairing secret derived passwords, applicable to scenarios where two or more terminal devices without a central server or internet dependence discover, pair, and establish a long-term secure interconnection relationship in a local network link. Background Technology
[0002] When peer-to-peer transmission tools within a local area network (LAN) first connect, users typically need to manually obtain and enter the peer's address and connection password. The passwords mainly come from two sources: First, both users agree on the same fixed password offline. This password is valid for a long time and reused across multiple sessions; once leaked, it leaves the network vulnerable for an extended period, and word-of-mouth transmission itself is a potential source of leakage. Second, for each session, one end generates a temporary password, which the other end copies and enters while facing the screen. This method offers slightly better security, but requires manual operation for each connection, resulting in a noticeable interruption to the user experience.
[0003] Device pairing protocols (such as Bluetooth digital authentication and WPS PIN) offer an alternative approach: manual confirmation or input of a verification code during the initial pairing, and long-term key materials stored by both ends after pairing is complete. In this type of scheme, the verification code serves to "confirm that the pairing has not been replaced by a man-in-the-middle," and data protection after pairing relies on the stored key materials themselves; there is no cryptographic derivation relationship between the verification code and the access password for subsequent sessions, and the continuation of the pairing relationship does not provide protocol-level constraints on the "connectivity range"—any external device that knows the address and port can still initiate a connection attempt, and the detection cost of authentication failure is borne by the connected party.
[0004] Furthermore, in zero-trust LAN scenarios, if the announcement content of the device discovery layer is a long-term identity identifier, it will form a fixed beacon that can be tracked across time; if it is a random identifier, the legitimate peer will not be able to identify the device after roaming and relocation, and there is a tension between the two.
[0005] Therefore, a secure device interconnection solution is needed: the first pairing can be done without password copying, subsequent sessions can be done without manual password input, unpaired devices cannot pass access authentication, and the discovery layer does not leak traceable long-term secret identifiers. Summary of the Invention
[0006] Technical problems to be solved
[0007] 1. No manual agreement or transcription of connection password is required during the initial pairing, and the pairing secret is not disclosed through any plaintext or broadcast channels;
[0008] 2. In subsequent transmission sessions after pairing, the access password is derived by both ends from the pairing secret, eliminating the need for manual input, and is not the same as the pairing secret itself;
[0009] 3. Make "only paired devices can pass access authentication" a protocol layer constraint, so that unpaired devices cannot calculate the exit password and the probe will be rejected;
[0010] 4. The discovery layer declares that there is no secret material, while retaining the identifiability of paired devices after roaming and relocation.
[0011] Technical solution
[0012] To solve the above problems, the present invention adopts the following technical solution:
[0013] A method for secure interconnection of devices by pairing secret derived passwords, applied to a first device and a second device communicating via a link-local network, comprising:
[0014] Online announcement steps: While the user is online, the first device responds to multicast queries for the agreed service type, announcing its paired listening address and port via multicast response; the announcement content only includes pattern markers and device identification, and does not contain any secret materials; after the user turns off the online status, the first device stops responding;
[0015] Pairing session steps: The second device sends a multicast query and collects online announcements, deduplicating them by device identifier to form a list of pairable devices for the user to choose from; in response to the user's selection of the first device in the list, the second device initiates a pairing connection to the pairing listening port of the first device, the two ends complete a secure handshake to establish an encrypted channel, and exchange bidirectional device identities during the handshake process; the first device generates a secure random pairing secret, and sends the pairing secret to the second device only through the encrypted channel; the pairing secret does not appear in any plaintext messages or broadcast messages;
[0016] Device book registration steps: The first device and the second device each record the device identity of the other end and the corresponding pairing secret in their local connected device book;
[0017] Password derivation access steps: In subsequent transmission sessions, the first device and the second device each derive a transmission password from the stored pairing secret according to the same rules, and complete access authentication with the transmission password; the derivation of the transmission password does not require manual input, and the transmission password is not equal to the pairing secret itself; devices that do not hold the pairing secret cannot derive a transmission password and cannot pass access authentication.
[0018] Preferably, the derivation rule of the transmission password is as follows: perform a hash operation on the paired secret, convert the first preset number of bytes of the hash value into an integer, take the modulo of a preset power of ten, and obtain a decimal password with a fixed number of digits.
[0019] Preferably, the pairing secret also serves as a matching anchor for roaming rediscovery: the first device announces the hash truncated value of the pairing secret during the transmission session; when the connection between the second device and the first device is lost and reconnection with the cached address in the device book fails, a multicast query is sent, and the hash truncated value in the response is compared with the hash truncated value of the locally stored pairing secret. If the comparison matches, reconnection is performed using the address announced in the response.
[0020] Preferably, the online declaration and pairing discovery performs anti-abuse verification: only messages on the same link with an Internet Protocol Time-to-Live (IPL) field of 255 are processed; only messages whose source port is a multicast port and whose semantics are query-based are responded to; responses are rate-limited according to a preset minimum interval; text key-value pairs in the declaration content are consumed according to a whitelist, which only includes pattern markers, device identifiers, and device display names; the browsing party deduplicates according to the device identifier, and new responses from the same device overwrite old records and use the latest address as the standard.
[0021] Preferably, the pairing connection uses a separate pairing listening port, which is separate from the transmission port used by the transmission session.
[0022] Preferably, the pairing session is a zero-file session that does not transmit service data; the pairing secret is sent via the extended field of the control plane response message of the encrypted channel.
[0023] Preferably, the connected device book supports overwrite updates and removal based on device identifiers: when the same device identifier is repeatedly paired, its pairing secret and latest address are refreshed; after a device is removed from the device book, the pairing secret corresponding to that device is also deleted, and neither end can derive a transmission password, and the interconnection relationship is immediately disabled.
[0024] Preferably, password verification failure during access authentication is considered a fatal error and does not trigger automatic retry; only transient network errors are allowed to automatically reconnect.
[0025] The present invention also provides a device secure interconnection system for pairing secret derived passwords, including a first device and a second device, each configured to perform the corresponding steps in the above method.
[0026] The present invention also provides an electronic device and a computer-readable storage medium configured to implement the above-described method.
[0027] Beneficial effects
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] 1. No password copying required for initial pairing: The pairing secret is randomly generated by the first device during the pairing session and sent only through an encrypted channel. The user only needs to select it from the discovery list throughout the process, without having to agree on, copy, or enter any password.
[0030] 2. No manual password required for subsequent sessions: The transmission password is derived by both ends from the paired secret, eliminating the need for manual input; the password is not the same as the secret itself. Even if the password of a transmission session is obtained by an observer through exhaustive search, the paired secret cannot be deduced, and the security of other derived passwords is not affected.
[0031] 3. Protocol layer connectivity constraints: Devices without a pairing secret cannot derive a transmission password, and access authentication will inevitably fail. The "can only connect to paired devices" rule is guaranteed by the protocol rather than relying on interface prompts; removal from the device book disables the device, and disconnection takes effect immediately.
[0032] 4. Zero secrets and preserved identifiability at the discovery layer: Online declarations only contain pattern markers and display identity, without forming a traceable long-term secret beacon; the hash truncation value of the pairing secret serves as a roaming rediscovery anchor, and paired devices can still be identified by legitimate peers after relocation, and unfamiliar devices cannot forge matches. Attached Figure Description
[0033] Figure 1 is a schematic diagram of the online discovery list and pairing session timing according to an embodiment of the present invention;
[0034] Figure 2 is a flowchart of derived password access authentication and unpaired device rejection according to an embodiment of the present invention;
[0035] Figure 3 is a schematic diagram of the relationship between the connected device book and roaming rediscovery in an embodiment of the present invention. Detailed Implementation
[0036] The present invention will be further described below with reference to the embodiments. This embodiment takes two mobile terminals running E2EFort applications (the first device is the connected party / sender, and the second device is the initiator / receiver) interconnected via a local area network as an example.
[0037] Online Declaration and Discovery List (see Figure 1 for the formation of the discovery list and the timing of the pairing session). While the user is in "online" mode, the first device listens on port 5353 of the multicast address: it only processes in-link packets with an IP Time-to-Live (TTL) field of 255, and only responds to packets originating from port 5353 with query semantics (QR=0); it only declares itself with a multicast response when querying a PTR record for the agreed service type `_sptp._tcp.local`, with an interval of at least 1 second between responses. The declaration includes: a PTR record pointing to the service instance; an SRV record carrying the paired listening port 20347 and the hostname; an A record carrying the current IPv4 address; and a TXT record carrying only three whitelisted key values: pattern flag m=presence, device identifier id (8-digit hexadecimal), and device display name n (UTF-8, can contain Chinese characters), without any secret material. The device stops responding after the user closes the online state. The second device sends a multicast query every 2 seconds, collects online announcements within the browsing window (default 3 seconds), ignores all fields other than whitelist key values, removes duplicates by device identifier (new responses overwrite old records, using the latest address), and forms a list of pairable devices after filtering by local identifier.
[0038] Pairing Session (see Figure 1). After the user clicks on the first device in the list, the second device initiates a pairing connection to the first device's pairing listening port 20347. The pairing session is a zero-file session that does not transmit business data: both ends generate a one-time SM2 temporary key pair and exchange public keys to complete a secure handshake and establish an encrypted channel; both ends exchange bidirectional device identities (device identifier and device name) in the handshake message; the first device generates a 16-byte secure random pairing secret, which is sent to the second device via the extended field of the control plane response message (file list response) on the encrypted channel. The plaintext of the pairing secret does not appear in any plaintext messages or broadcast messages.
[0039] Device book registration (see Figure 3). Each end records the other end's device identifier, device name, most recent address, and pairing secret in its local connected device book; when the same device identifier is paired repeatedly, its pairing secret and most recent address are overwritten and refreshed. The device book is persisted by the platform layer. When a device is removed from the device book, its pairing secret is also deleted.
[0040] Password derivation for access authentication (see Figure 2 for the process). Subsequent transmission sessions use a transmission port 20346, independent of the paired port. Both ends derive the transmission password from the paired secret according to the same rules: perform a SHA-256 hash on the paired secret, convert the first 3 bytes of the hash value to an integer, and then... 6The modulo operation yields a 6-digit decimal password (leading zeros are reserved). The sender uses the derived password as the access authentication password, and the receiver includes the derived password in the authentication request; only after successful password verification can the transmission process begin. Password verification failure is a fatal error, resulting in immediate failure without triggering automatic retry; automatic reconnection is only permitted for transient network errors such as network outages, peer disappearance, and read / write timeouts. Devices without a pairing secret (e.g., unfamiliar devices that only know the demo password) cannot derive the transmission password, and access authentication will inevitably fail—the "can only be selected from the connected list" clause is endorsed by the protocol layer.
[0041] Roaming rediscovery (see Figure 3). The pairing secret also serves as the matching anchor for roaming rediscovery: During the transmission session, the first device uses the hash truncated value of the pairing secret (the hexadecimal encoding of the first 16 bytes of SHA-256) as an announcement identifier; when the connection between the second device and the first device is lost and reconnection with the cached address in the device book fails, it sends a multicast query to the agreed service type, compares the hash truncated value in the response with the hash truncated value of the locally stored pairing secret in a constant-time comparison, if the comparison matches, it reconnects with the address announced in the response and re-executes the full security handshake; if no match is found within the guard window, it falls back to the manually entered address. The hash truncated value cannot be used to deduce the pairing secret, and unfamiliar devices cannot forge a match.
[0042] The above embodiments are only used to illustrate the present invention. Parameters such as hash algorithm, number of truncated bytes, password length, speed limit interval, browsing window duration, and port number can be adjusted without departing from the concept of the present invention. All technical solutions formed by equivalent substitution or equivalent transformation fall within the protection scope of the present invention.
Claims
1. A method for secure interconnection of devices by pairing secret derived passwords, characterized in that, The method, applied to a first device and a second device communicating via a link-local network, includes: an online announcement step: during the online state, the first device responds to a multicast query for a pre-defined service type, announcing its own pairing listening address and port via multicast response. The announcement content only includes a pattern marker and device identification, without any secret material. After the online state is closed, the first device stops responding. A pairing session step: the second device sends a multicast query and collects online announcements, deduplicating them by device identifier to form a list of pairable devices. In response to the selection of the first device in the list, the second device initiates a pairing connection to the pairing listening port of the first device. The two ends complete a secure handshake to establish an encrypted channel and exchange bidirectional device identities. A secure, random pairing secret is generated and sent to the second device only through the encrypted channel. The pairing secret does not appear in any plaintext or broadcast messages. Device book registration step: The first and second devices each record the peer's device identity and the pairing secret in their local connected device book. Password derivation access step: In subsequent transmission sessions, the first and second devices each derive a transmission password from the stored pairing secret using the same rules and complete access authentication using the transmission password. The transmission password is derived without manual input, and the transmission password is not equal to the pairing secret. Devices without a pairing secret cannot derive the transmission password and cannot pass access authentication.
2. The method according to claim 1, characterized in that, The rules for the derived transmission password are as follows: perform a hash operation on the paired secret, convert the first preset number of bytes of the hash value into an integer, take the modulo of a preset power of ten, and obtain a decimal password with a fixed number of digits.
3. The method according to claim 1, characterized in that, The pairing secret also serves as a matching anchor for roaming rediscovery: the first device announces the hash truncated value of the pairing secret during the transmission session; when the second device loses connection with the first device and fails to reconnect using the address cached in the connected device book, it sends a multicast query to the agreed service type, compares the hash truncated value in the response with the hash truncated value of the locally stored pairing secret, and if the comparison matches, it reconnects to the first device using the address announced in the response and re-executes the security handshake.
4. The method according to claim 1, characterized in that, The online announcement step and pairing session step perform anti-abuse verification: only messages on the same link with an Internet Protocol Time-to-Live (IPL) field of 255 are processed; only messages whose source port is a multicast convention port and have query semantics are responded to; multicast responses are rate-limited according to a preset minimum interval; text key values in the announcement content are consumed according to a whitelist, which only includes pattern markers, device identifiers, and device display names; The second device deduplicates the collected responses according to the device identifier. New responses from the same device overwrite old records and are based on the latest declared address.
5. The method according to claim 1, characterized in that, The pairing connection uses a separate pairing listening port, which is separate from the transmission port used by the transmission session.
6. The method according to claim 1, characterized in that, The pairing session is a zero-file session that does not transmit service data; the pairing secret is sent via the extended field of the control plane response message of the encrypted channel.
7. The method according to claim 1, characterized in that, The connected device book supports updating and removing devices by device identifier: when the same device identifier is paired repeatedly, its pairing secret and latest address are refreshed; when a device is removed from the connected device book, the pairing secret corresponding to the device is also deleted, and neither end can derive the transmission password.
8. The method according to claim 1, characterized in that, Password verification failure in the access authentication is a fatal error and does not trigger automatic retry; only network-related transient errors trigger automatic reconnection.
9. A secure interconnection system for devices that pair secret derived passwords, characterized in that, The device includes a first device and a second device. The first device includes: an announcement module, configured to respond to multicast queries for a pre-defined service type during online status, announcing its own pairing listening address and port with a multicast response. The announcement content only includes a pattern flag and device identity display. It stops responding after the online status is closed. A pairing module, configured to complete a secure handshake to establish an encrypted channel and exchange bidirectional device identities during pairing connections, generating a secure random pairing secret and distributing it only through the encrypted channel. A first device book module, configured to record the peer device identity and pairing secret in the local connected device book. An access authentication module, configured to... In subsequent transmission sessions, a transmission password is derived from the pairing secret using the same rules, and access authentication is completed. The second device includes: a discovery module configured to send multicast queries, collect online announcements, and deduplicate devices according to device identifiers to form a list of pairable devices; a pairing initiation module configured to initiate a pairing connection in response to the selection of a first device in the list, establish an encrypted channel, and receive the pairing secret through the encrypted channel; a second device book module configured to record the peer device identity and pairing secret in the local connected device book; and an access module configured to derive a transmission password from the pairing secret using the same rules and initiate access authentication in subsequent transmission sessions.
10. An electronic device, characterized in that, The method includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the first device side and / or the second device side in the method of any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the first device side and / or the second device side in the method of any one of claims 1 to 8.