WO2015172329A1 - 一种终端配对方法及配对终端 - Google Patents

一种终端配对方法及配对终端 Download PDF

Info

Publication number
WO2015172329A1
WO2015172329A1 PCT/CN2014/077444 CN2014077444W WO2015172329A1 WO 2015172329 A1 WO2015172329 A1 WO 2015172329A1 CN 2014077444 W CN2014077444 W CN 2014077444W WO 2015172329 A1 WO2015172329 A1 WO 2015172329A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
peer
pairing
secret value
peer end
Prior art date
Application number
PCT/CN2014/077444
Other languages
English (en)
French (fr)
Inventor
丁志明
陆苏
方平
李小仙
陈济
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201480004670.9A priority Critical patent/CN105359154B/zh
Priority to JP2016568093A priority patent/JP6249428B2/ja
Priority to PCT/CN2014/077444 priority patent/WO2015172329A1/zh
Priority to US15/111,525 priority patent/US10574637B2/en
Priority to EP14892077.0A priority patent/EP3082058B1/en
Publication of WO2015172329A1 publication Critical patent/WO2015172329A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • H04B5/70Near-field transmission systems, e.g. inductive or capacitive transmission systems specially adapted for specific purposes
    • H04B5/72Near-field transmission systems, e.g. inductive or capacitive transmission systems specially adapted for specific purposes for local intradevice communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/44Program or device authentication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • H04L63/061Network architectures or network communication protocols for network security for supporting key management in a packet data network for key exchange, e.g. in peer-to-peer networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/06Authentication
    • H04W12/069Authentication using certificates or pre-shared keys
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/20Services signaling; Auxiliary data signalling, i.e. transmitting data via a non-traffic channel
    • H04W4/21Services signaling; Auxiliary data signalling, i.e. transmitting data via a non-traffic channel for social networking applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a terminal pairing method and a pairing terminal. Background technique
  • NFC Near Field Communication
  • the present invention provides a terminal pairing method and a pairing terminal, which can accurately achieve terminal pairing without using an NFC interface.
  • the technical solution adopted by the present invention is:
  • the present invention provides a terminal pairing method, where the method includes:
  • the terminal uses the pairing secret value of the terminal itself to implement pairing with the peer end.
  • the terminal when the terminal detects a preset pairing trigger event, acquiring, by the terminal, the pairing secret value of the terminal itself associated with the pairing trigger event, including:
  • the terminal When the terminal detects a preset pairing trigger event, the terminal acquires the duration of the terminal itself obtained from the peer based on the common reference time point relative to the occurrence time of the event; and/or
  • the terminal When the terminal detects a preset pairing trigger event, the terminal acquires a motion direction value of the terminal itself.
  • the terminal when the terminal detects a preset pairing trigger event, the terminal acquires a common reference time with the peer end
  • the duration of the terminal itself relative to the time of occurrence of the event includes: when the terminal detects a preset pairing trigger event, acquiring an occurrence time of the pairing trigger event as the first of the terminal itself Time point
  • the terminal acquires the duration of the terminal itself, and the duration of the terminal itself is a time interval between the first time point of the terminal itself and the second time point of the terminal itself.
  • the terminal further includes:
  • the terminal randomly delays the time r after detecting the pairing trigger event, and sends a discovery request message to the peer through the wireless interface.
  • the terminal randomly delays the time r after detecting the pairing trigger event, and sends the discovery to the peer end by using a wireless interface. After requesting the message, it also includes:
  • the terminal receives the discovery response message from the peer end, and the discovery response message is sent after the delay time R is received by the peer end after receiving the discovery request message, and the R is greater than the r.
  • the terminal acquires, according to any message that interacts with the peer end, the location that is based on the message with the peer end.
  • the second time point of the terminal itself is specifically:
  • the terminal acquires, according to any message that interacts with the peer end on the preset channel, a second time point of the terminal itself based on the message according to the peer end.
  • the terminal acquires a duration of the terminal itself, and the duration of the terminal itself is a first time point of the terminal itself. After the time interval from the second time point of the terminal itself, the method further includes:
  • the terminal adopts a preset regularization method to regulate the duration of the terminal itself.
  • the terminal uses the terminal itself
  • the pairing secret value is paired with the peer, including:
  • the terminal uses the pairing secret value of the terminal itself and the information from the peer end to obtain the public key of the peer end, and the information from the peer end includes the pairing secret value of the peer end;
  • the terminal generates a shared key of the terminal by using the public key of the peer end and the private key of the terminal itself;
  • the terminal performs pairing with the peer by verifying the shared key of the terminal itself and the shared key of the peer.
  • the method further includes:
  • the terminal obtains a public key of the peer end by using a pairing secret value of the terminal itself and information from the peer end, where The information from the peer includes the pairing secret value of the peer, including:
  • the terminal uses the pairing secret value of the terminal itself and the random number of the peer end to decrypt the first secret value to obtain the public key of the opposite end.
  • the terminal obtains a public key of the peer end by using a pairing secret value of the terminal itself and information from the peer end.
  • the information from the peer includes the pairing secret value of the peer, including:
  • the terminal receives a first secret value and a first operation value that are sent by the peer end, where the first secret value includes a value obtained by encrypting the public key of the peer end by using a pairing secret value of the peer end, where the first operation value is obtained.
  • the terminal obtains a pairing secret value of the peer end by using a first operation value from the peer end and a pairing secret value of the terminal itself;
  • the terminal uses the pairing secret value of the peer to decrypt the first secret value from the peer to obtain the public key of the peer.
  • the terminal uses the terminal itself Pairing the hidden value to achieve pairing with the peer, including:
  • the terminal uses the information from the peer end and the information of the terminal itself to obtain a pairing secret value of the peer end, where the information from the peer end includes the public key of the peer end and the pairing secret value, and the information of the terminal itself includes The private key of the terminal itself;
  • the terminal performs pairing with the peer by comparing the pairing secret value of the terminal itself with the pairing secret value of the peer.
  • the terminal by using information from the peer end and the information of the terminal itself, obtain a pairing secret value of the peer end,
  • the information from the peer end includes the public key and the pairing secret value of the peer end, and the information of the terminal itself includes the private key of the terminal itself, including:
  • the terminal receives the first message from the peer end, the first message from the peer end includes a public key and a second secret value of the peer end, and the second secret value of the peer end includes a preset key that uses the peer end Encrypting the value obtained by pairing the hidden value of the opposite end;
  • the terminal generates a shared key of the terminal by using the private key of the terminal and the public key of the peer;
  • the first message from the peer end further includes a first message integrity code of the peer end, where the peer end
  • the first message integrity code includes a value obtained by the peer end encrypting the digest information of the first message from the peer end by using a pairing secret value of the peer end;
  • the terminal After the terminal decrypts the second secret value of the peer end by using the preset key of the peer end to obtain the pairing secret value of the peer end, the terminal further includes:
  • the terminal verifies the first message integrity code of the peer by using the pairing secret value of the peer.
  • the terminal performs pairing with the peer end by comparing the pairing secret value of the terminal itself with the pairing secret value of the peer end, including:
  • the terminal implements pairing with the opposite end.
  • the second message from the peer end further includes a second message integrity code of the peer end,
  • the second message integrity code of the peer end includes a value obtained by the peer end encrypting the digest information of the second message from the peer end by using the shared key of the peer end;
  • the terminal After receiving the second message from the peer, the terminal further includes:
  • the present invention provides a pairing terminal, where the terminal includes a detecting unit, an acquiring unit, and a pairing unit;
  • the detecting unit is configured to detect an event that triggers pairing with the peer end
  • the acquiring unit is configured to: when the detecting unit detects the event that the trigger is paired with the peer end, acquire a pairing secret value of the terminal itself associated with the event that is triggered to be paired with the peer end; And a pairing unit, configured to implement pairing with the peer end by using a pairing secret value of the terminal itself.
  • the acquiring unit includes: a first acquiring subunit, configured to acquire, when the detecting unit detects an event that is paired with the peer end, The length of the terminal itself obtained relative to the occurrence time of the event based on a common reference time point;
  • a second acquiring subunit configured to acquire a motion direction value of the terminal itself when the detecting unit detects an event that triggers pairing with the peer end.
  • the first acquiring subunit includes: a third obtaining sub-unit, configured to: when the detecting unit detects an event that triggers pairing with the peer end, acquire an occurrence time of the event that the triggering pair is paired with the peer end, as the first time point of the terminal itself;
  • a fourth obtaining subunit configured to acquire, according to any message that interacts with the peer, a second time point of the terminal itself based on the message with the peer end;
  • the fifth obtaining sub-unit is configured to acquire the duration of the terminal itself, and the duration of the terminal itself is a time interval between the first time point of the terminal itself and the second time point of the terminal itself.
  • the first acquiring sub-unit further includes:
  • the first sending subunit is configured to: after detecting the event that the trigger is paired with the peer, randomly delay the time r, and send a discovery request message to the peer through the wireless interface.
  • the first acquiring sub-unit further includes:
  • a first receiving subunit configured to receive a discovery response message from the peer end, where the discovery response message is sent by the peer end after receiving the discovery request message, and the R is greater than the r.
  • the fourth acquiring sub-unit is specifically, according to any message that interacts with the peer end on a preset channel. And acquiring, by the peer, a unit of the second time point of the terminal itself based on the message.
  • the terminal further includes:
  • the regular subunit is used to adjust the duration of the terminal itself by using a preset regularization method.
  • the pairing unit includes: a sixth acquiring subunit, configured to obtain the public end of the peer by using a pairing secret value of the terminal itself and information from the peer end Key, the information from the peer includes a pairing secret value of the peer; a first generating subunit, configured to generate a shared key of the terminal by using a public key of the peer and a private key of the terminal itself;
  • the first pairing subunit is configured to implement pairing with the peer end by verifying the shared key of the terminal itself and the shared key of the peer end.
  • the terminal further includes a sending unit
  • the sending unit is configured to send, to the peer end, a pairing secret value of the terminal itself, so that the peer end implements pairing with the terminal.
  • the sixth acquiring subunit includes:
  • a second receiving subunit configured to receive a first secret value and any random number sent by the peer end, where the first secret value is used to encrypt the public key of the peer end and the random number by using a pairing secret value of the peer end Get
  • the first decryption subunit is configured to use the pairing secret value of the terminal itself and the random number of the peer end to decrypt the first secret value to obtain the public key of the opposite end.
  • the sixth acquiring subunit includes:
  • a third receiving subunit configured to receive a first secret value and a first operation value sent by the peer end, where the first secret value includes a value obtained by encrypting the public key of the peer end by using a pairing secret value of the peer end, where The first operation value includes a value obtained by using a pairing secret value of the terminal itself and a pairing secret value of the peer end by a preset budget method;
  • a second generating subunit configured to obtain a pairing secret value of the peer end by using a first operation value from the peer end and a pairing secret value of the terminal itself;
  • a second decryption subunit configured to use the pairing secret value of the peer to decrypt the first secret value from the peer to obtain the public key of the peer.
  • the pairing unit includes: a third generating subunit, configured to use the information from the peer end and the information of the terminal itself to obtain the pairing secret of the peer end a value, the information from the peer includes a public key and a pairing secret value of the peer, and the information of the terminal itself includes a private key of the terminal itself;
  • a second pairing subunit configured to perform pairing with the peer end by comparing a pairing secret value of the terminal itself with a pairing secret value of the peer end.
  • the third generating subunit includes:
  • a fourth receiving subunit configured to receive a first message from the peer end, where the first message from the peer end includes a public key and a second secret value of the peer end, and the second secret value of the peer end includes a usage center Determining, by the opposite terminal, a value obtained by encrypting the paired secret value of the opposite end;
  • a fourth generation subunit configured to generate a shared key of the terminal by using a private key of the terminal itself and a public key of the peer end;
  • a fifth receiving subunit configured to receive a second message from the peer end, where the second message from the peer end includes a third secret value of the peer end, and the third secret value of the peer end includes using the peer end
  • the shared key encrypts the value obtained by the peer's preset key
  • a third decryption subunit configured to decrypt the third secret value of the peer by using the shared key of the terminal to obtain a preset key of the peer, and decrypt the pair by using the preset key of the peer.
  • the first message from the peer end further includes a first message integrity code of the peer end, where the peer end
  • the first message integrity code includes a value obtained by the peer end encrypting the digest information of the first message from the peer end by using a pairing secret value of the peer end;
  • the third generation subunit further includes a first verification subunit
  • the first verification subunit is configured to verify the first message integrity code of the peer by using a pairing secret value of the peer.
  • the second pairing subunit includes:
  • a determining subunit configured to determine whether a difference between the pairing secret value of the terminal itself and a pairing secret value of the peer end is within a preset allowable error range
  • a third pairing subunit configured to: when the difference is within a preset allowable error range and the first message integrity code of the peer end passes verification, the terminal implements pairing with the peer end.
  • the second message from the peer end further includes a second message integrity code of the peer end,
  • the second message integrity code of the peer end includes a value obtained by the peer end encrypting the digest information of the second message from the peer end by using the shared key of the peer end;
  • the third generation subunit further includes a second verification subunit
  • the second verification subunit is configured to verify the second message integrity code of the peer by using the shared key of the terminal itself.
  • the terminal when the terminal detects a pairing trigger event that is paired with the peer, the terminal first First, the pairing secret value of the terminal itself associated with the pairing trigger event is obtained, and then the pairing secret value of the terminal itself is used to implement a pairing process with the peer end.
  • the present invention can accurately achieve pairing without using an NFC interface, thereby saving the cost of the terminal.
  • FIG. 1 is a flowchart of a terminal pairing method according to an embodiment of the present invention
  • FIG. 2 is a schematic structural view of a first terminal and a second terminal mounted with two Hall devices and two magnets according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a method for implementing a terminal to acquire a duration based on a preset pairing trigger event according to an embodiment of the present invention
  • FIG. 4 is a method interaction diagram for implementing a method for acquiring, by a terminal, a duration based on a preset pairing trigger event according to an embodiment of the present invention
  • FIG. 5 is an interaction diagram of a terminal pairing method according to an embodiment of the present invention.
  • FIG. 6 is an interaction diagram of a terminal pairing method according to an embodiment of the present invention.
  • FIG. 7 is an interaction diagram of a terminal pairing method according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a pairing terminal according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of a paired terminal according to an embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of a paired terminal according to an embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of a pairing terminal according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a terminal pairing method according to an embodiment of the present disclosure.
  • the method includes: S101: When a terminal detects a preset pairing trigger event, acquiring a pairing trigger event The associated pairing secret value of the terminal itself.
  • S102 The terminal uses the pairing secret value of the terminal to implement pairing with the peer.
  • the terminals that need to be paired are the first terminal and the second terminal respectively, and the pairing trigger event is set in the first terminal and the second terminal respectively, for example, the first terminal and the second terminal are touched. Pair trigger events, etc.
  • the first terminal and the second terminal perform the touch
  • the first terminal and the second terminal respectively record the pairing secret value of the terminal itself associated with the pairing trigger event
  • the pairing secret value of the terminal itself may be The duration of the terminal itself obtained by the first terminal and the second terminal based on a common reference point with respect to the time when the pairing trigger event occurs, and may also be the first terminal and the second terminal when the pairing trigger event occurs.
  • Direction of movement value is the duration of the terminal itself obtained by the first terminal and the second terminal based on a common reference point with respect to the time when the pairing trigger event occurs.
  • the first terminal and the second terminal may respectively record the motion direction value of the terminal itself, for example, the CPU may periodically read the three-axis accelerometer and the gravity sensor.
  • Sensing data of a sensing device such as an electronic compass, when detecting that the terminal moves rapidly in one direction, and then the moving speed drops to zero in the moving direction or suddenly changes to a reverse motion, it is determined that a touch event occurs.
  • the motion direction is analyzed according to a series of sensor data previously read. For example, the first terminal detects that the motion direction is 5 degrees north to the east and 3 degrees above, and the motion direction of the second terminal is 5 degrees south and south. When the angle is 3 degrees, the directions of motion of the two terminals are opposite. There are some errors in the angle of the motion direction allowed in the actual judgment.
  • the following describes the specific content of the terminal to obtain the duration based on the point in time when the pairing trigger event occurs:
  • the first is to get the point in time when the touch event occurs.
  • an accelerometer can be used to determine the timing of the occurrence of a touch event.
  • the usual practice is to periodically read the acceleration value of the accelerometer by the CPU (central processing unit). If the acceleration value changes drastically and a significant inflection point occurs, such as A direction moves faster and then stops, indicating that a touch event has occurred on the terminal.
  • the terminal in this embodiment records the system time when the touch event occurs, for example, the CPU system time, accurate to microseconds, after determining the touch event according to the change in the acceleration value.
  • the time difference between the two devices detecting the occurrence of a touch event by an inductor such as an accelerometer may be between 1 and 20 milliseconds.
  • the occurrence time of the touch event can also be detected by using Hall sensing.
  • at least one Hall device and one magnet need to be installed in each terminal, wherein the magnet can be an electromagnet.
  • each terminal can also be installed with two Hall devices and two magnetic Iron, as shown in Fig. 2,
  • Fig. 2 is a schematic view showing the structure of a first terminal and a second terminal in which two Hall devices and two magnets are mounted.
  • the Hall device 1 of the first device detects that the magnet 2 of the second terminal is close, and sends a signal to the CPU of the first terminal to generate a touch event, and at the same time, the second terminal
  • the Hall device 2 detects that the magnet 1 of the first terminal is approaching, and signals the occurrence of a touch event to the CPU of the second terminal.
  • the Hall devices of the two devices simultaneously detect the touch event, and the time point error of the two touch events can be as small as several milliseconds or less. .
  • the present embodiment can also detect a touch event by using other techniques, and the present invention does not limit the technical implementation method for detecting a touch event.
  • the very small time error can be recorded as D, and the unit of D can be taken as microseconds, and the smaller the value of D, the better, for example, 100 microseconds.
  • the second is to obtain the duration based on a common reference point.
  • the common reference point is a time point obtained by the two terminals through a message exchanged by the first wireless communication interface, and the time elapsed from the time point when the touch event occurs to the common reference point is the duration.
  • the first wireless communication interface can be opened before the pairing trigger event occurs, for example, a program for sharing content opens the first wireless communication interface at runtime and waits for the occurrence of a pairing trigger event.
  • the first wireless communication interface may also be opened after the pairing trigger event occurs, that is, the first wireless communication interface is opened after detecting the pairing trigger event.
  • the first wireless communication interface may be a wireless communication technology such as WiFi or Bluetooth.
  • the first wireless communication interface may be the same or different from the second wireless interface that transmits the shared content after the pairing succeeds, for example, the first wireless communication interface and the second wireless communication interface are both WiFi interfaces, or before the pairing trigger event occurs.
  • Open the BLE English: Bluetooth Low Energy, Chinese: Bluetooth low energy
  • complete the pairing process through the BLE interface and then open the WiFi interface to complete the content transmission, which can save the terminal's power consumption.
  • FIG. 3 is a flowchart of a method for the terminal to obtain a duration of an event occurrence time based on a preset trigger and a peer pairing according to the embodiment, where the method may include:
  • S302 The terminal obtains, according to any message that interacts with the peer, the The second time point of the terminal itself of the message.
  • the terminal acquires the duration of the terminal itself, and the duration of the terminal itself is a time interval between the first time point of the terminal itself and the second time point of the terminal itself.
  • the two terminals that need to be paired first trigger a preset pairing trigger event, such as touching two terminals.
  • the two terminals respectively record the time point of the pairing trigger event, and the time of occurrence is The point is determined as the first point in time of the terminal itself.
  • the two terminals respectively record the second time point of the terminal itself based on the message. Since the message travels at the speed of light, and the distance between the two terminals is very close, it may be assumed that the two devices leave 1 meter away after the touch, and the time required for the signal to reach from one terminal to the other terminal is only 3.3 nanoseconds, which is negligible.
  • the transmitting terminal of the message in this embodiment records the system time as the second time point when the message is sent, and the receiving terminal of the message records the system time as the second time point when receiving the message, It is considered that the second time points recorded by the two terminals are the same, or very close.
  • the two terminals since the first time point and the second time point respectively recorded by the two terminals in the pairing trigger event are the same, the two terminals respectively obtain the respective durations in the embodiment, and the duration is the respective The time interval between a time point and a second time point, it can be understood that the duration of the two terminals in which the pairing trigger event occurs should theoretically be the same.
  • FIG. 4 is a method interaction diagram for implementing a terminal to obtain a duration based on a preset pairing trigger event, where the paired terminals are respectively the first terminal. And the second terminal, the method includes:
  • a pairing trigger event occurs in the first terminal and the second terminal, such as a touch event.
  • the first message is sent through a wireless interface such as WiFi or Bluetooth, and the first message is usually a discovery request (English: Discovery Request) message.
  • the discovery request message may be a probe request frame defined in IEEE 802.11.
  • the purpose of sending the first message after the first terminal randomly delays the time r is to prevent the attacker from guessing the time point when the touch event occurs by intercepting the first message, and the counterfeit second terminal and the first terminal are paired.
  • the first terminal can quickly send the first message three times. Second, and it is best to ensure that the last time the first message is sent must be completed before the preset time.
  • the first terminal may be configured to send the discovery request message only on a preset specific wireless channel, and the second terminal only listens to the discovery request message on the specific wireless channel. It is worth noting that since the first terminal usually does not know the address of the second terminal, the discovery request message is usually broadcast.
  • the second terminal After receiving the discovery request message, the second terminal sends a response message to the first terminal to the first terminal, that is, a discovery response message. At the same time, the second terminal records the system time as the second time point when the discovery response message is sent, and the first terminal records the system time as the second time point when receiving the discovery response message.
  • the second terminal records the system time as the second time point when starting to send the discovery response message
  • the first terminal records the system time as the second time point when starting to receive the discovery response message.
  • the first terminal may record a third time point when determining that the discovery response message is received, and subtract a time required to receive the discovery response message to determine a second time point of the first terminal.
  • both terminals record the transmission time points at the beginning of the same message.
  • Their error is the time when the message originating end propagates in the air plus the delay of possible circuit processing. This error can be very small.
  • the method of obtaining the actual second time point may also adopt other methods.
  • both devices record the transmission time point of the end of the discovery response message, that is, the time point at which the second device completes sending the discovery response message and the first device completes receiving.
  • the point in time at which the discovery response message is sent It is also possible to obtain a second point in time based on the discovery request message or a subsequent message of the discovery response message.
  • R is the preset fixed time value
  • r can be set to be less than or equal to R.
  • the response message to the first message is usually a discovery response message.
  • the discovery response message may be a probe response frame defined in IEEE 802.11.
  • the purpose of sending the discovery response message after the second terminal delays the time R is to prevent the attacker from sending the discovery request message to trigger the second terminal to issue the discovery response message immediately after the pairing trigger event occurs, thereby making it easier for the attacker to guess.
  • the counterfeit first terminal and the second terminal are paired.
  • the S403 and S404 probing processes that is, the Probe Request and Probe Response procedures, may also have an 802.11 authentication frame (English: Authentication frames) and an association process (English: Association frames), which are not described here.
  • S405 The first terminal and the second terminal respectively calculate a duration, where the duration is a time interval between the first time point and the second time point of each of the first terminal and the second terminal.
  • the duration is a duration of a time point at which the first terminal and the second terminal occur based on a common reference point relative to the touch event.
  • This common reference point in this embodiment is implemented by a certain message, such as a discovery request message or a discovery response message.
  • the time point at which the terminal records the transmission or reception of a wireless interface frame needs to be implemented in the wireless interface chip, because if the CPU knows that the wireless interface chip sends or receives a wireless interface frame, Reading the system time will result in a large error.
  • the program in the wireless interface chip such as the WiFi chip cannot read the system time of the CPU, and the program running in the CPU can read the time stamp information in the WiFi chip, so the first time point and the second time are acquired.
  • the terminal directly reads the timestamp in the iFi chip as the first time point when detecting the pairing trigger event.
  • the time stamp information of the WiFi chip can be directly obtained as a second time point by using a program in the WiFi chip, and then the obtained second time point is transmitted to the program in the CPU.
  • the first time point of each terminal can be run through the CPU.
  • the program obtains the current system time Tal of the CPU as the first time point, and when the WiFi interface is completed, the CPU system time Ta2 and the time stamp information TSFal of the WiFi chip are acquired by the program running in the CPU (English: timing synchronization function, Chinese: Time synchronization function), the time count after the iFi chip is started, in microseconds.
  • the first terminal and the second terminal can use a communication technology such as BLE (English: Bluetooth Low Energy, Chinese: Bluetooth low energy) to complete the device after the pairing trigger event.
  • BLE Bluetooth Low Energy
  • the discovery process and the acquisition of the duration are completed, and the subsequent authentication process using the duration or the data transmission of the shared content may use another communication technology such as WiFi.
  • WiFi Wireless Fidelity
  • Due to the existence of the error the lengths of the first terminal and the second terminal respectively are actually difficult to be equal. This error mainly comes from the possible time when the two terminals detect the pairing trigger event after the pairing trigger event occurs, and the subsequent time-acquisition process based on the common reference time point also generates an error.
  • the error between the durations of the first terminal and the second terminal must be eliminated as much as possible, so that the durations of the two devices are equal in value. Or closer, in order to calculate.
  • the present invention adopts a preset regularization method, and the regularization is described.
  • the duration that is, the time length is converted into a value of a larger time unit. Specifically, the time length can be converted into a value in units of 200 microseconds.
  • the two original values within the allowable error range must obtain the same value after being calculated by the above conversion method, and are not within the allowable error range.
  • the original values must be different after each calculation by this conversion method.
  • the two original values are indeed within the allowable error range, but their values are not equal after the error is eliminated, and / Or in other cases, the error of the two original values exceeds the allowable error range, but the same value is obtained after the error is eliminated. In this case, we call the allowable error inaccurate and the inaccurate value interval. It is called the allowable error and the interval is not allowed.
  • the allowable error is 1000 microseconds
  • the possibility of misjudgment is large, and when it is converted into units of 200 microseconds, the misjudgment is The possibility is smaller.
  • the allowed error itself is small, for example, only 1 microsecond (the obtained unit of time is also microseconds), there is no need for regularity at all, and there is no misjudgment.
  • the allowed error refers to the maximum error that actually exists due to technical factors.
  • the duration can be normalized by dividing the duration by "D/S" (D divided by S).
  • D/S is actually to take a suitable unit of regular duration.
  • D is the maximum error allowed by the duration of the first terminal and the second terminal, and the unit is microsecond.
  • D is the maximum error allowed by the duration of the first terminal and the second terminal, and the unit is microsecond.
  • D is the maximum error allowed by the duration of the first terminal and the second terminal, and the unit is microsecond.
  • D the maximum error allowed by the duration of the first terminal and the second terminal, and the unit is microsecond.
  • the regular length of the two terminals allows the difference to be between 0 and S.
  • the uncertainty interval still exists, but the value of S is larger. The smaller the interval, the less likely the misjudgment is.
  • S should be controlled within the appropriate range, S is too large, and the calculation process is more computationally intensive.
  • the terminal when the terminal detects the preset pairing trigger event, the pairing secret value of the terminal itself associated with the pairing trigger event is obtained, and the pairing secret value of the terminal itself is used to achieve pairing with the peer end. process.
  • the present invention can accurately achieve pairing without using an NFC interface, thereby saving the cost of terminal pairing.
  • the terminal uses the pairing secret value of the terminal itself and the information from the peer to obtain the public key of the peer, and the information from the peer includes the pairing secret value of the peer;
  • the terminal generates a shared key of the terminal by using the public key of the peer and the private key of the terminal itself.
  • the terminal verifies the shared key of the terminal and the shared secret of the peer by verifying the shared key of the terminal itself.
  • the key implements pairing with the peer.
  • FIG. 5 is an interaction diagram of a terminal pairing method according to an embodiment of the present disclosure, where the paired terminals are respectively a first terminal and a second terminal, and the method includes:
  • the first terminal and the second terminal acquire a pairing secret value of the terminal itself based on a preset pairing trigger event occurrence time, where the pairing secret value may be a duration.
  • the first terminal and the second terminal respectively receive the first secret value and any random number sent by the peer end, where the first secret value of the second terminal received by the first terminal may be used by the second terminal by using the second
  • the regular length of the terminal encrypts the key exchange algorithm public key (the public key of the second terminal) of the second terminal and the random number of the second terminal.
  • the second terminal receives the first secret value from the first terminal, and the first terminal encrypts the key exchange algorithm public key of the first terminal by using the regular duration of the first terminal.
  • the key) and the random number of the first terminal are obtained. It can be seen that the first secret value of the first terminal and the first secret value of the second terminal are generally not the same.
  • may be used to indicate the pairing secret value of the first terminal
  • ⁇ 3 ⁇ 4 represents the pairing secret value of the second terminal
  • ⁇ and ⁇ 3 ⁇ 4 are the results after the DS method described in the first embodiment, wherein S is taken
  • the value is 5.
  • the random number of the first terminal may be represented by Na, the random number of the second terminal by Nb, the public key of the first terminal by PKa, and the public key of the second terminal by PKb.
  • the first secret value of the first terminal may be represented by AT a (PKa, Na)
  • the first secret value of the second terminal may be represented by Tb (PKb, Nb).
  • the sending of the first secret value and the random number may not be performed in the same message.
  • the first secret value may be sent first, and the peer sends the random number after receiving the first secret value. It can be understood that the embodiment does not specifically limit the order in which the first secret value and the random number are transmitted.
  • the random number in this embodiment may be related to the current time of the terminal generating the random number, the specific counter, etc., but in general its value is random.
  • this step can use DH (English: Diffie - Hellman key exchange, Chinese: Diffie-Hellman key exchange) key exchange algorithm. It allows the parties to establish a key over the unsecured channel without any prior information from the other party. This key can be used as a symmetric key to encrypt the communication content in subsequent communications. Since the process of exchanging public keys by DH may be attacked by a middleman, this embodiment uses ⁇ and ⁇ 3 ⁇ 4 to protect the process of exchanging public keys, so that an attacker must guess ⁇ or ⁇ 3 ⁇ 4 to perform a man-in-the-middle attack, and the attacker is not easy. Guess the value of ⁇ or ⁇ 3 ⁇ 4, so that man-in-the-middle attacks are difficult to implement.
  • DH English: Diffie - Hellman key exchange, Chinese: Diffie-Hellman key exchange
  • the above DH key exchange algorithm may also be replaced by other key exchange algorithms, for example, using the enhanced DH algorithm ECDH algorithm, which is not limited in the present invention.
  • S503 The first terminal and the second terminal respectively decrypt the received first secret value by using the pairing secret value and the received random number, thereby obtaining the public key of the opposite end.
  • the received first secret value is decrypted by trial and error.
  • the decrypted public key PKa, and the random number Na', A a' can be taken as integer values from ATb-5 to ATb+5. If the random number Na' calculated by the decryption is the same as the received Na, it is proved that the public key PKa calculated at this time is the public key PKa of the first terminal, and at this time, the value of ⁇ is the value of ATa. If the second terminal tries to calculate all ⁇ and does not successfully decrypt and obtains Na' equal to Na, then the process is terminated, the second terminal may not respond, or send a message to the first terminal, for feeding back the pairing to the first terminal. The result of the failure.
  • PKa' , Na' AT a' (ATa(PKa,Na)), use Vl to decrypt VTa(PKa, Na) to get PKa' and Na,
  • the operation of the first terminal is the same as that of the second terminal, and details are not described herein again.
  • the step of decrypting the first secret value may be performed by a terminal first. If the terminal can obtain the public key of the peer end, then the random number or the first secret value is sent to the opposite end, so that the peer end performs the key again. Get. This can improve the pairing efficiency, so that the incorrectly paired terminal gets the result of the pairing failure faster.
  • the first terminal and the second terminal respectively generate a shared key by using the decrypted public key of the peer end and the private key of the peer end.
  • the first terminal calculates the DH shared key DHKeya using the private key Ka corresponding to the public key PKa and the public key PKb of the second terminal obtained by decryption, and the second terminal uses the public key PKb corresponding thereto.
  • the private key Kb, the public key PKa of the first terminal calculates the DH shared key DHKeyb. According to the characteristics of the DH algorithm, DHKeya and DHKeyb should be equal.
  • the calculation of the shared key can also be combined with Na and Nb so that the shared key calculated in the case where the public key exchanged each time between the first terminal and the second terminal is not fixed.
  • the attacker cannot guess T a and/or ⁇ 3 ⁇ 4 in S502 at one time, the attack is unsuccessful. Even if the attacker obtains the plaintext Na and Nb and then calculates T a and ⁇ 3 ⁇ 4 offline, thus obtaining PKa and PKb, but this is not useful for the attacker, because the attacker cannot know the private key corresponding to PKa and PKb, and thus cannot obtain The shared key between the first terminal and the second terminal, and thus the secret data of the subsequent interaction between the first terminal and the second terminal cannot be obtained. In this embodiment, the accuracy of the pairing is further ensured by sharing the key.
  • the first terminal and the second terminal respectively determine pairing with the peer by verifying the shared key.
  • the first terminal and the second terminal calculate the shared key, it is necessary to verify whether the shared keys of the two parties are consistent. If they are consistent, the terminal is successfully paired. Otherwise, it may be an abnormal situation such as a man-in-the-middle attack.
  • the first terminal can protect the subsequent data interaction with the shared key obtained by directly exchanged the public key with the second terminal.
  • the subsequent message includes a message integrity code, where the message integrity code is a shared key.
  • the summary information of the message is encrypted. If data interaction can be completed between the first terminal and the second terminal, both parties hold the same shared key.
  • the two terminals can also verify whether the other party holds a shared key that is consistent with itself.
  • the four-step handshake process in the 802.11 specification can be performed, and the shared key DHKey is regarded as the PMK defined in the 802.11 specification.
  • Pairwise Master Key Chinese: The master key between a pair of nodes
  • the temporary session key PTK will be generated after a successful four-step handshake (English: Pairwise Transient Key, Chinese: temporary key between a pair of nodes) , use PTK to protect subsequent data interactions.
  • both parties can successfully obtain a new key, the pairing is successful.
  • the two parties can also exchange the business card under the protection of the shared key or the session key, including the user's identifier such as the user's name, so that the terminal user can further determine that the pairing of the device is successful.
  • the present invention is not limited.
  • FIG. 5 is only a specific implementation manner of terminal pairing, and the execution order of each step in FIG. 5 is not unique for implementing terminal pairing.
  • Embodiment 2
  • FIG. 6 is an interaction diagram of a terminal pairing method according to the embodiment, where the paired terminals are respectively a first terminal and a second terminal, and the method includes:
  • the first terminal and the second terminal acquire a pairing secret value of the terminal itself based on a preset pairing trigger event occurrence time, and the pairing secret value may be a duration.
  • the second terminal After acquiring the pairing secret value and the public key of the first terminal, the second terminal obtains the first operation value by using a preset pairing secret value and the pairing secret value of the first terminal by using a preset operation method.
  • the method for the second terminal to obtain the pairing secret value and the public key of the first terminal may be referred to the second embodiment, and details are not described herein again.
  • the operation method preset in this embodiment may be a reversible operation, and the operator may be represented by an arithmetic addition, a subtraction, a multiplication, or the like.
  • the first terminal parses the first operation value by using its own pairing secret value, and obtains a pairing secret value of the second terminal.
  • the first terminal uses the pairing secret value of the second terminal to decrypt the first secret value from the second terminal, and obtains the public key of the second terminal, where the first secret value of the second terminal may be utilized.
  • the pairing secret value of the second terminal encrypts its public key.
  • the first secret value received by the first terminal from the second terminal may be obtained by encrypting the public key by the pairing secret value, or may be obtained by encrypting the public key and the random number by the pairing secret value.
  • the first terminal calculates ⁇ 3 ⁇ 4 according to dT and its own ⁇
  • the first secret value from the second terminal can be decrypted directly by using ⁇ 3 ⁇ 4 to obtain the public key of the second terminal.
  • the first terminal and the second terminal respectively generate a shared key by using the private key of the peer and the public key of the peer.
  • S606 The first terminal and the second terminal respectively determine the pairing with the peer by verifying the shared key.
  • S605 and S606 reference may be made to the description in Embodiment 1, and details are not described herein again.
  • the order of execution of the respective steps in the embodiment may not be limited.
  • FIG. 7 is an interaction diagram of a terminal pairing method according to an embodiment, where The terminals are the first terminal and the second terminal, respectively, and the method includes:
  • the first terminal and the second terminal acquire a pairing secret value of the terminal itself based on a preset pairing trigger event occurrence time, and the pairing secret value may be a duration and a motion direction value.
  • the first terminal and the second terminal respectively receive the first message from the peer end, where the first message includes a public key and a second secret value of the DH key exchange algorithm of the opposite end, where the second secret value includes using The peer's preset key encrypts the value obtained by the peer's pairing secret value.
  • the first terminal encrypts ⁇ and/or Ma with a key SKA of an encryption/decryption algorithm that is preset or randomly generated by itself to obtain a second secret value SKA (ATa and/or Ma), and ATa indicates the duration of the first terminal.
  • SKA secret value
  • Ma is used to indicate the direction of motion of the first terminal.
  • the encrypted information and the public key PKa are combined to form a first message to the second terminal.
  • the second terminal sends the first message to the first terminal, and the specific implementation is the same as the first terminal.
  • the first message sent by the two terminals may further include a first message integrity code MIC1.
  • the MIC1 is used by the sender to calculate the summary information of the first message by using the ATa and/or the Ma, for example, Encryption operations, etc.
  • the generation of MIC1 can also participate in SKA.
  • the SKA can be a symmetric key or an asymmetric key. If it is an asymmetric key, the SKA here actually refers to the private key part used for encryption, which can be recorded as SKAe, so the second secret and the secret value are actually Is SKAe ( ⁇ and / or Ma).
  • S703 The first terminal and the second terminal respectively generate a shared key by using the private key of the peer and the public key of the peer.
  • the first terminal and the second terminal may combine their own private key and the public key of the opposite end (for example, the second terminal uses the private key Kb corresponding to its own PKb and the first terminal.
  • the public key PKa) generates the shared key DHKey.
  • this embodiment can also use other key exchange algorithms to obtain a shared key, which should be understood by those skilled in the art, and is not enumerated here.
  • S704 The first terminal and the second terminal respectively receive the second message from the peer end, where the second message includes a third secret value, where the third secret value includes the peer end encrypting the pair by using the shared key of the opposite end The value obtained by the encryption and decryption key of the end.
  • the first terminal encrypts its own key SKA using the generated shared key DHKey.
  • a third secret value DHKey (SKA) is obtained, and a second message is generated and sent to the second terminal.
  • the first terminal may also encrypt the SKA by using the first derived key of the shared key DHKey.
  • the implementation process of the second terminal is the same as that of the first terminal, and the third secret value generated by the second terminal may be DHKey (SKB). If the SKA is an asymmetric key, the public key part of the SKA is encrypted and sent here, SKA. The public key portion can be written as SKAd, so the third secret value is actually DHKey (SKBd).
  • the second message sent by the two terminals may further include a second message integrity code MIC2.
  • the MIC2 is obtained by the sender using the generated DHKey to perform the operation of the digest information of the second message, such as an encryption operation.
  • the MIC2 is obtained by the sender calculating the digest information of the second message by using the second derived key of the generated DHKey.
  • S705 The first terminal and the second terminal respectively decrypt the third secret value by using the shared key of the peer to obtain the key of the opposite end, and use the key of the opposite end to decrypt the second secret value to obtain the Paired secret value of the opposite end.
  • the first terminal decrypts the third secret value DHKey (SKB) in the second message by using the generated shared key DHKey to obtain the preset key SKB of the second terminal. If the first terminal is capable of decrypting the third secret value from the second terminal, it is proved that the second terminal has the same shared key DHKey as itself. The first terminal further decrypts the second secret value by using the obtained key SKB of the second terminal to obtain the pairing secret value ⁇ 3 ⁇ 4 and/or Mb of the second terminal. Similarly, the implementation process of the second terminal is the same as that of the first terminal.
  • S705 may be performed after a terminal completes S705 and proves that the same shared key exists as the peer end, that is, as shown in FIG. 5.
  • the first terminal can not only prove that the second terminal has the same shared key DHKey as itself, but also needs to verify the second message if the second message further includes the second message integrity code MIC2.
  • the integrity code MIC2 is used to prove that the second terminal has the same DHKey as itself. Since the second message integrity code MIC2 is obtained by the peer end encrypting the digest information of the second message by using the shared key of the peer end, the embodiment may use the shared key of the peer to verify the second message integrity code MIC2. If it passes the verification, it proves that the peer has the same DHKey as itself.
  • S706 The first terminal and the second terminal respectively determine pairing with the peer according to the pairing secret value of the pair and the pairing secret value of the peer end.
  • the pairing of the opposite end is hidden.
  • the secret value is compared to its own paired secret value. If the difference between the durations of the two is within the allowable error range, it is proved that the opposite end has a pairing trigger event with itself; or if the direction of motion of the two indicates that the direction of motion of the two is opposite within the error range, the opposite end is proved.
  • a pairing trigger event occurs with itself; or, if both cases are satisfied at the same time, it proves that the peer end has a pairing trigger event with itself. If the terminal finds that the peer end is not the terminal that triggers the pairing trigger event with itself, the terminal may end the processing, that is, no more messages are sent to the peer end.
  • the embodiment further needs to verify the first message integrity code MIC1.
  • the first message integrity code MIC1 in the first message received is obtained by using the pairing secret value of the peer end and combined with the digest information of the first message, which may be obtained by using the pairing secret value as the key encryption summary information.
  • the paired secret value of the peer end is not immediately known when the first message is received. Therefore, the embodiment can verify the MIC1 after obtaining the pairing secret value of the peer end in S705.
  • the first message integrity code MIC1 is verified and the pairing secret values of the two terminals are also within the allowable error range, it can be proved that the two terminals are paired. If the MIC1 fails to pass the verification, it indicates that there may be an exception such as a man-in-the-middle attack. The terminal can end the process and no longer interact with the peer.
  • FIG. 8 is a schematic structural diagram of a pairing terminal according to the embodiment, where the terminal includes a detecting unit 801, an obtaining unit 802, and a pairing unit 803;
  • the detecting unit 801 is configured to detect a preset pairing trigger event
  • the acquiring unit 802 is configured to acquire, when the detecting unit detects a preset pairing trigger event, a pairing secret value of the terminal itself associated with the pairing trigger event;
  • the pairing unit 803 is configured to implement pairing with the peer by using the pairing secret value of the terminal itself.
  • the obtaining unit 802 includes:
  • a first acquiring subunit configured to: when the detecting unit detects a preset pairing trigger event, acquire, with respect to an occurrence time of the event obtained by the peer based on a common reference time point Describe the duration of the terminal itself;
  • a second acquiring subunit configured to acquire a motion direction value of the terminal itself when the detecting unit detects a preset pairing trigger event.
  • the first acquiring subunit includes:
  • a third acquiring sub-unit configured to: when the detecting unit detects a preset pairing triggering event, obtain an occurrence time of the preset pairing trigger event, as a first time point of the terminal itself; a sub-unit, configured to acquire, according to any message that interacts with the peer, a second time point of the terminal itself based on the message by the peer end;
  • the fifth obtaining sub-unit is configured to acquire the duration of the terminal itself, and the duration of the terminal itself is a time interval between the first time point of the terminal itself and the second time point of the terminal itself.
  • the first acquiring subunit further includes:
  • a first sending subunit configured to send a discovery request message to the peer end by using a wireless interface after detecting the preset pairing trigger event:
  • a first receiving subunit configured to receive a discovery response message from the peer end, where the discovery response message is sent by the peer end after receiving the discovery request message, and the R is greater than the r.
  • the fourth acquiring sub-unit may be configured to acquire, according to any message that interacts with the peer end on the preset channel, the second time of the terminal itself based on the message by the peer end.
  • the unit of the point may be configured to acquire, according to any message that interacts with the peer end on the preset channel, the second time of the terminal itself based on the message by the peer end. The unit of the point.
  • the terminal may further include:
  • FIG. 9 and FIG. 10 are respectively schematic structural diagrams of a paired terminal according to an embodiment of the present disclosure, where the terminal includes a detecting unit 801, an obtaining unit 802, and a pairing unit 803, where the pairing is performed.
  • Unit 803, comprising:
  • the sixth obtaining sub-unit 901 is configured to obtain the public key of the peer end by using the pairing secret value of the terminal itself and the information from the peer end, where the information from the peer end includes a pairing secret value of the peer end;
  • a first generating subunit 902 configured to use the public key of the peer end and the private key of the terminal itself Forming the shared key of the terminal itself;
  • the first pairing subunit 903 is configured to perform pairing with the peer by verifying the shared key of the terminal itself and the shared key of the peer.
  • the terminal further includes a sending unit,
  • the sending unit is configured to send, to the peer end, a pairing secret value of the terminal itself, so that the peer end implements pairing with the terminal.
  • the sixth obtaining subunit 901 may include:
  • the second receiving subunit 1001 is configured to receive a first secret value and any random number sent by the peer end, where the first secret value is used to encrypt the public key of the peer end and the random number by using a pairing secret value of the peer end Number obtained;
  • the first decryption subunit 1002 is configured to use the pairing secret value of the terminal itself and the random number of the peer end to decrypt the first secret value to obtain the public key of the opposite end.
  • the sixth obtaining subunit 901 may include:
  • the third receiving subunit 1101 is configured to receive a first secret value and a first operation value that are sent by the peer end, where the first secret value includes a value obtained by encrypting the public key of the peer end by using a pairing secret value of the peer end, where The first operation value includes a value obtained by using a pairing secret value of the terminal itself and a pairing secret value of the peer end by a preset budget method;
  • a second generating subunit 1102 configured to obtain a pairing secret value of the peer by using a first operation value from the peer end and a pairing secret value of the terminal itself;
  • the second decryption sub-unit 1103 is configured to use the pairing secret value of the peer to decrypt the first secret value from the peer to obtain the public key of the peer.
  • FIG. 11 is a schematic structural diagram of a paired terminal according to another embodiment.
  • the terminal includes a detecting unit 801, an obtaining unit 802, and a pairing unit 803.
  • the pairing unit 803 includes:
  • a third generation sub-unit 1201 configured to use the information from the peer end and the information of the terminal itself to obtain a pairing secret value of the peer end, where the information from the peer end includes the public key of the opposite end and a pairing secret value.
  • the information of the terminal itself includes the private key of the terminal itself;
  • the second pairing sub-unit 1202 is configured to implement pairing with the peer end by comparing the pairing secret value of the terminal itself with the pairing secret value of the peer end.
  • the third generation subunit 1201 includes:
  • a fourth receiving subunit 1301 configured to receive a first message from a peer end, where the first message from the peer end includes a public key and a second secret value of the peer end, and the second secret value of the peer end includes using the The preset key of the peer end encrypts the value obtained by the paired secret value of the peer end;
  • a fourth generation sub-unit 1302 configured to generate a shared key of the terminal itself by using a private key of the terminal itself and a public key of the peer end;
  • a fifth receiving sub-unit 1303, configured to receive a second message from the peer end, where the second message from the peer end includes a third secret value of the peer end, and the third secret value of the peer end includes using the pair The shared key of the end encrypts the value obtained by the preset key of the peer end;
  • a third decryption sub-unit 1304 configured to decrypt the third secret value of the peer end by using the shared key of the terminal itself to obtain a preset key of the peer end, and decrypt the The second secret value of the peer end obtains the pairing secret value of the peer.
  • the first message from the peer end further includes a first message integrity code of the peer end, where the first message integrity code of the peer end includes the peer end encrypting the source with the pairing secret value of the peer end The value obtained from the summary information of the first message of the peer;
  • the third generation subunit 1201 further includes a first verification subunit 1305;
  • the first verification subunit 1305 is configured to verify the first message integrity code of the peer by using a pairing secret value of the peer.
  • the second pairing subunit 1202 includes:
  • the determining subunit 1401 is configured to determine whether the difference between the pairing secret value of the terminal itself and the matching secret value of the peer end is within a preset allowable error range;
  • the third pairing subunit 1402 is configured to: when the difference is within a preset allowable error range and the first message integrity code of the peer end passes verification, the terminal implements pairing with the peer end.
  • the second message from the peer end further includes a second message integrity code of the peer end, where the second message integrity code of the peer end includes the peer end using the shared key of the peer end Encrypting the value obtained from the digest information of the second message of the peer end;
  • the third generation subunit 1201 further includes a second verification subunit 1306;
  • the second verification subunit 1306 is configured to verify the second message integrity code of the peer by using the shared key of the terminal itself.
  • this embodiment when the terminal detects a preset pairing trigger event, acquiring the preset with the preset Pairing the secret value of the terminal itself associated with the triggering event, and using the pairing secret value of the terminal itself to implement a pairing process with the peer. Compared with the prior art, this embodiment does not need to use the NFC interface to accurately implement pairing, which saves the cost of terminal pairing.
  • One less processor such as a CPU
  • at least one wireless network interface such as a Wi-Fi Protected Access Memory
  • a pairing trigger event detecting device such as a Wi-Fi Protected Access Memory
  • the processor is for executing executable modules stored in the memory, such as a computer program.
  • the memory may include a high speed random access memory (RAM: Random Access Memory) and may also include a non-volatile memory such as at least one disk memory.
  • program instructions are stored in the memory, and the program instructions may be executed by the processor, wherein the program instructions may include an obtaining unit 802 and a pairing unit 803.
  • the program instructions may include an obtaining unit 802 and a pairing unit 803.
  • the program instructions may include an obtaining unit 802 and a pairing unit 803.
  • an optical disk, etc. comprising instructions for causing a computer device (which may be a personal computer, a server, or a network communication device such as a media gateway, etc.) to perform the various embodiments of the present invention or portions of the embodiments described herein. method.
  • a computer device which may be a personal computer, a server, or a network communication device such as a media gateway, etc.
  • the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments.
  • the device and the system embodiment since it is basically similar to the method embodiment, it is described in a relatively simple manner, and the relevant parts can be referred to the description of the method embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明公开了一种终端配对方法及配对终端,所述方法包括:当终端检测到预设的配对触发事件时,获取与所述预设的配对触发事件相关联的所述终端自身的配对隐秘值;所述终端利用所述终端自身的配对隐秘值实现与所述对端的配对。与现有技术相比,本发明不需要使用NFC接口即可准确实现配对,节约了终端配对的成本。

Description

一种终端配对方法及配对终端
技术领域
本发明涉及通信技术领域, 具体涉及一种终端配对方法及配对终端。 背景技术
随着网络技术的发展, 人与人之间习惯了分享彼此的数据信息。 通常, 人们只是通过彩信、 邮件、 聊天软件如 QQ、 微信等方式与其他终端共享数 据或媒体内容。 目前, 面对面的用户也可以通过终端之间的筒单触碰或者摇 晃等操作完成内容的共享。 但是, 在内容共享之前, 如何实现内容共享终端 的配对是目前比较棘手的问题。
目前, 存在一种 4吏用 NFC (英文: Near Field Communication, 中文: 近 场通信) 接口交换隐秘数据的终端配对方法。 由于 NFC接口通信距离短, 第 三方难以侦听, 更难以进行中间人攻击, 因此利用 NFC接口就能够完成终端 的配对。 但是, 由于 NFC接口的成本较高, 使得该方案不容易在各类终端中 被普及。
发明内容
本发明提供了一种终端配对方法及配对终端, 能够在不使用 NFC接口的 条件下, 准确地实现终端的配对。
为了解决以上技术问题, 本发明采取的技术方案是:
第一方面, 本发明提供了一种终端配对方法, 所述方法包括:
当终端检测到预设的配对触发事件时, 获取与所述配对触发事件相关联 的所述终端自身的配对隐秘值;
所述终端利用所述终端自身的配对隐秘值实现与对端的配对。
在第一方面的第一种可能的实现方式中, 所述当终端检测到预设的配对 触发事件时,获取与所述配对触发事件相关联的所述终端自身的配对隐秘值, 包括:
当终端检测到预设的配对触发事件时, 所述终端获取与所述对端基于共 同参考时间点获得的相对于所述事件的发生时间的所述终端自身的时长; 和\或,
当终端检测到预设的配对触发事件时, 所述终端获取所述终端自身的运 动方向值。 结合第一方面的第一种可能的实现方式, 在第二种可能的实现方式中, 所述当终端检测到预设的配对触发事件时, 所述终端获取与所述对端基于共 同参考时间点的相对于所述事件的发生时间的所述终端自身的时长, 包括: 当终端检测到预设的配对触发事件时, 获取所述配对触发事件的发生时 间, 作为所述终端自身的第一时间点;
所述终端根据与所述对端交互的任一消息, 获取与所述对端基于所述消 息的所述终端自身的第二时间点;
所述终端获取所述终端自身的时长, 所述终端自身的时长为所述终端自 身的第一时间点与所述终端自身的第二时间点的时间间隔。
结合第一方面的第二种可能的实现方式, 在第三种可能的实现方式中, 所述获取所述配对触发事件的发生时间, 作为所述终端自身的第一时间点之 后, 且在所述终端根据与所述对端交互的任一消息, 获取与所述对端基于所 述消息的所述终端自身的第二时间点之前, 还包括:
所述终端在检测到所述配对触发事件后随机延迟时间 r,通过无线接口向 所述对端发送发现请求消息。
结合第一方面的第三种可能的实现方式, 在第四种可能的实现方式中, 所述终端在检测到所述配对触发事件后随机延迟时间 r,通过无线接口向所述 对端发送发现请求消息之后, 还包括:
所述终端接收来自所述对端的发现响应消息, 所述发现响应消息为所述 对端在接收到所述发现请求消息后延迟时间 R后发送的, 所述 R大于所述 r。
结合第一方面的第二种可能的实现方式, 在第五种可能的实现方式中, 所述终端根据与所述对端交互的任一消息, 获取与所述对端基于所述消息的 所述终端自身的第二时间点, 具体为:
所述终端根据在预设的信道上与所述对端交互的任一消息, 获取与所述 对端基于所述消息的所述终端自身的第二时间点。
结合第一方面的第二种可能的实现方式, 在第六种可能的实现方式中, 所述终端获取所述终端自身的时长, 所述终端自身的时长为所述终端自身的 第一时间点与所述终端自身的第二时间点的时间间隔之后, 还包括:
所述终端采用预设的规整方法, 规整所述终端自身的时长。
在第一方面的第七种可能的实现方式中, 所述终端利用所述终端自身的 配对隐秘值实现与对端的配对, 包括:
所述终端利用所述终端自身的配对隐秘值和来自对端的信息, 获取所述 对端的公钥, 所述来自对端的信息包括所述对端的配对隐秘值;
所述终端利用所述对端的公钥和所述终端自身的私钥生成所述终端自身 的共享密钥;
所述终端通过验证所述终端自身的共享密钥和所述对端的共享密钥实现 与所述对端的配对。
结合第一方面的第七种可能的实现方式, 在第八种可能的实现方式中, 所述方法还包括:
所述终端向所述对端发送所述终端自身的配对隐秘值, 以使所述对端实 现与所述终端的配对。
结合第一方面的第七种可能的实现方式, 在第九种可能的实现方式中, 所述终端利用所述终端自身的配对隐秘值和来自对端的信息, 获取所述对端 的公钥, 所述来自对端的信息包括所述对端的配对隐秘值, 包括:
所述终端接收对端发送的第一秘密值和任一随机数, 所述第一秘密值为 利用所述对端的配对隐秘值加密所述对端的公钥和所述随机数得到;
所述终端利用所述终端自身的配对隐秘值和所述对端的随机数, 解密所 述第一秘密值得到所述对端的公钥。
结合第一方面的第七种可能的实现方式, 在第十种可能的实现方式中, 所述终端利用所述终端自身的配对隐秘值和来自对端的信息, 获取所述对端 的公钥, 所述来自对端的信息包括所述对端的配对隐秘值, 包括:
所述终端接收对端发送的第一秘密值和第一运算值, 所述第一秘密值包 括利用所述对端的配对隐秘值加密所述对端的公钥得到的值, 所述第一运算 值包括利用所述终端自身的配对隐秘值和所述对端的配对隐秘值通过预设的 预算方法得到的值;
所述终端利用来自所述对端的第一运算值和所述终端自身的配对隐秘值 得到所述对端的配对隐秘值;
所述终端利用所述对端的配对隐秘值, 解密来自所述对端的第一秘密值 得到所述对端的公钥。
在第一方面的第十一种可能的实现方式中, 所述终端利用所述终端自身 的配对隐秘值实现与对端的配对, 包括:
所述终端利用来自对端的信息和所述终端自身的信息, 得到所述对端的 配对隐秘值, 所述来自对端的信息包括所述对端的公钥和配对隐秘值, 所述 终端自身的信息包括所述终端自身的私钥;
所述终端通过比较所述终端自身的配对隐秘值和所述对端的配对隐秘值 实现与所述对端的配对。
结合第一方面的第十一种可能的实现方式, 在第十二种可能的实现方式 中, 所述终端利用来自对端的信息和所述终端自身的信息, 得到所述对端的 配对隐秘值, 所述来自对端的信息包括所述对端的公钥和配对隐秘值, 所述 终端自身的信息包括所述终端自身的私钥, 包括:
所述终端接收来自对端的第一消息, 所述来自对端的第一消息包括所述 对端的公钥和第二秘密值, 所述对端的第二秘密值包括利用所述对端的预设 密钥加密所述对端的配对隐秘值得到的值;
所述终端利用所述终端自身的私钥和所述对端的公钥生成所述终端自身 的共享密钥;
所述终端接收来自所述对端的第二消息, 来自所述对端的第二消息包括 所述对端的第三秘密值, 所述对端的第三秘密值包括利用所述对端的共享密 钥加密所述对端的预设密钥得到的值;
所述终端利用所述终端自身的共享密钥解密所述对端的第三秘密值得到 所述对端的预设密钥, 并利用所述对端的预设密钥解密所述对端的第二秘密 值得到所述对端的配对隐秘值。
结合第一方面的第十二种可能的实现方式, 在第十三种可能的实现方式 中, 所述来自对端的第一消息还包括所述对端的第一消息完整性码, 所述对 端的第一消息完整性码包括所述对端利用所述对端的配对隐秘值加密所述来 自对端的第一消息的摘要信息得到的值;
所述终端利用所述对端的预设密钥解密所述对端的第二秘密值得到所述 对端的配对隐秘值之后, 还包括:
所述终端利用所述对端的配对隐秘值验证所述对端的第一消息完整性 码。
结合第一方面的第十三种可能的实现方式, 在第十四种可能的实现方式 中, 所述终端通过比较所述终端自身的配对隐秘值和所述对端的配对隐秘值 实现与所述对端的配对, 包括:
所述终端判断所述终端自身的配对隐秘值和所述对端的配对隐秘值的差 别是否在预设的允许误差范围内;
当所述差别在预设的允许误差范围内以及所述对端的第一消息完整性码 通过验证时, 所述终端实现与所述对端的配对。
结合第一方面的第十二种可能的实现方式, 在第十五种可能的实现方式 中, 所述来自所述对端的第二消息还包括所述对端的第二消息完整性码, 所 述对端的第二消息完整性码包括所述对端利用所述对端的共享密钥加密所述 来自所述对端的第二消息的摘要信息得到的值;
所述终端接收来自所述对端的第二消息之后, 还包括:
所述终端利用所述终端自身的共享密钥验证所述对端的第二消息完整性 码。 第二方面, 本发明提供了一种配对终端, 所述终端包括检测单元、 获取 单元和配对单元;
所述检测单元, 用于检测触发与对端配对的事件;
所述获取单元, 用于当所述检测单元检测到所述触发与对端配对的事件 时,获取与所述触发与对端配对的事件相关联的所述终端自身的配对隐秘值; 所述配对单元, 用于利用所述终端自身的配对隐秘值实现与所述对端的 配对。
在第二方面的第一种可能的实现方式中, 所述获取单元, 包括: 第一获取子单元, 用于当所述检测单元检测到触发与对端配对的事件时, 获取与所述对端基于共同参考时间点获得的相对于所述事件的发生时间的所 述终端自身的时长;
和\或,
第二获取子单元, 用于当所述检测单元检测到触发与对端配对的事件时, 获取所述终端自身的运动方向值。
结合第二方面的第一种可能的实现方式, 在第二种可能的实现方式中, 所述第一获取子单元, 包括: 第三获取子单元, 用于当所述检测单元检测到触发与对端配对的事件时, 获取所述触发与对端配对的事件的发生时间, 作为所述终端自身的第一时间 点;
第四获取子单元, 用于根据与所述对端交互的任一消息, 获取与所述对 端基于所述消息的所述终端自身的第二时间点;
第五获取子单元, 用于获取所述终端自身的时长, 所述终端自身的时长 为所述终端自身的第一时间点与所述终端自身的第二时间点的时间间隔。
结合第二方面的第二种可能的实现方式, 在第三种可能的实现方式中, 所述第一获取子单元, 还包括:
第一发送子单元, 用于在检测到所述触发与对端配对的事件后随机延迟 时间 r, 通过无线接口向所述对端发送发现请求消息。
结合第二方面的第三种可能的实现方式, 在第四种可能的实现方式中, 所述第一获取子单元, 还包括:
第一接收子单元, 用于接收来自所述对端的发现响应消息, 所述发现响 应消息为所述对端在接收到所述发现请求消息后延迟时间 R后发送的, 所述 R大于所述 r。
结合第二方面的第二种可能的实现方式, 在第五种可能的实现方式中, 所述第四获取子单元, 具体为根据在预设的信道上与所述对端交互的任一消 息, 获取与所述对端基于所述消息的所述终端自身的第二时间点的单元。
结合第二方面的第二种可能的实现方式, 在第六种可能的实现方式中, 所述终端还包括:
规整子单元, 用于采用预设的规整方法, 规整所述终端自身的时长。 在第二方面的第七种可能的实现方式中, 所述配对单元, 包括: 第六获取子单元, 用于利用所述终端自身的配对隐秘值和来自对端的信 息, 获取所述对端的公钥, 所述来自对端的信息包括所述对端的配对隐秘值; 第一生成子单元, 用于利用所述对端的公钥和所述终端自身的私钥生成 所述终端自身的共享密钥;
第一配对子单元, 用于通过验证所述终端自身的共享密钥和所述对端的 共享密钥实现与所述对端的配对。
结合第二方面的第七种可能的实现方式, 在第八种可能的实现方式中, 所述终端还包括发送单元,
所述发送单元, 用于向所述对端发送所述终端自身的配对隐秘值, 以使 所述对端实现与所述终端的配对。
结合第二方面的第七种可能的实现方式, 在第九种可能的实现方式中, 所述第六获取子单元, 包括:
第二接收子单元, 用于接收对端发送的第一秘密值和任一随机数, 所述 第一秘密值为利用所述对端的配对隐秘值加密所述对端的公钥和所述随机数 得到;
第一解密子单元, 用于利用所述终端自身的配对隐秘值和所述对端的随 机数, 解密所述第一秘密值得到所述对端的公钥。
结合第二方面的第七种可能的实现方式, 在第十种可能的实现方式中, 所述第六获取子单元, 包括:
第三接收子单元, 用于接收对端发送的第一秘密值和第一运算值, 所述 第一秘密值包括利用所述对端的配对隐秘值加密所述对端的公钥得到的值, 所述第一运算值包括利用所述终端自身的配对隐秘值和所述对端的配对隐秘 值通过预设的预算方法得到的值;
第二生成子单元, 用于利用来自所述对端的第一运算值和所述终端自身 的配对隐秘值得到所述对端的配对隐秘值;
第二解密子单元, 用于利用所述对端的配对隐秘值, 解密来自所述对端 的第一秘密值得到所述对端的公钥。
在第二方面的第十一种可能的实现方式中, 所述配对单元, 包括: 第三生成子单元, 用于利用来自对端的信息和所述终端自身的信息, 得 到所述对端的配对隐秘值, 所述来自对端的信息包括所述对端的公钥和配对 隐秘值, 所述终端自身的信息包括所述终端自身的私钥;
第二配对子单元, 用于通过比较所述终端自身的配对隐秘值和所述对端 的配对隐秘值实现与所述对端的配对。
结合第二方面的第十一种可能的实现方式, 在第十二种可能的实现方式 中, 所述第三生成子单元, 包括:
第四接收子单元, 用于接收来自对端的第一消息, 所述来自对端的第一 消息包括所述对端的公钥和第二秘密值, 所述对端的第二秘密值包括利用所 述对端的预设密钥加密所述对端的配对隐秘值得到的值;
第四生成子单元, 用于利用所述终端自身的私钥和所述对端的公钥生成 所述终端自身的共享密钥;
第五接收子单元, 用于接收来自所述对端的第二消息, 来自所述对端的 第二消息包括所述对端的第三秘密值, 所述对端的第三秘密值包括利用所述 对端的共享密钥加密所述对端的预设密钥得到的值;
第三解密子单元, 用于利用所述终端自身的共享密钥解密所述对端的第 三秘密值得到所述对端的预设密钥, 并利用所述对端的预设密钥解密所述对 端的第二秘密值得到所述对端的配对隐秘值。
结合第二方面的第十二种可能的实现方式, 在第十三种可能的实现方式 中, 所述来自对端的第一消息还包括所述对端的第一消息完整性码, 所述对 端的第一消息完整性码包括所述对端利用所述对端的配对隐秘值加密所述来 自对端的第一消息的摘要信息得到的值;
所述第三生成子单元还包括第一验证子单元;
所述第一验证子单元, 用于利用所述对端的配对隐秘值验证所述对端的 第一消息完整性码。
结合第二方面的第十三种可能的实现方式, 在第十四种可能的实现方式 中, 所述第二配对子单元, 包括:
判断子单元, 用于判断所述终端自身的配对隐秘值和所述对端的配对隐 秘值的差别是否在预设的允许误差范围内;
第三配对子单元, 用于当所述差别在预设的允许误差范围内以及所述对 端的第一消息完整性码通过验证时, 所述终端实现与所述对端的配对。
结合第二方面的第十二种可能的实现方式, 在第十五种可能的实现方式 中, 所述来自所述对端的第二消息还包括所述对端的第二消息完整性码, 所 述对端的第二消息完整性码包括所述对端利用所述对端的共享密钥加密所述 来自所述对端的第二消息的摘要信息得到的值;
所述第三生成子单元还包括第二验证子单元;
所述第二验证子单元, 用于利用所述终端自身的共享密钥验证所述对端 的第二消息完整性码。
本发明中当终端检测到触发与对端配对的配对触发事件时, 所述终端首 先获取与所述配对触发事件相关联的所述终端自身的配对隐秘值, 然后利用 所述终端自身的配对隐秘值实现与对端的配对过程。 与现有技术相比, 本发 明不需要使用 NFC接口即可准确实现配对, 节约了终端的成本。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作筒单地介绍, 显而易见地, 下面 描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1是本发明实施例提供的终端配对方法流程图;
图 2 是本发明实施例提供的安装有二个霍尔器件和二个磁铁的第一终端 和第二终端结构示意图;
图 3 是本发明实施例提供的实现终端获取基于预设的配对触发事件发生 时间的时长的方法流程图;
图 4 是本发明实施例提供的实现终端获取基于预设的配对触发事件的发 生时间的时长的方法交互图;
图 5是本发明实施例提供的一种终端配对方法交互图;
图 6是本发明实施例提供的一种终端配对方法交互图;
图 7是本发明实施例提供的一种终端配对方法交互图;
图 8是本发明实施例提供的一种配对终端结构示意图;
图 9是本发明实施例提供的配对终端在一种实现方式中的结构示意图; 图 10是本发明实施例提供的配对终端在一种实现方式中的结构示意图; 图 11 是本发明实施例提供的配对终端在另一种实现方式中的结构示意 图;
图 12是本发明实施例提供的配对终端构成示意图。
具体实施方式
为了使本技术领域的人员更好地理解本发明实施例的方案, 下面结合附 图和实施方式对本发明实施例作进一步的详细说明。
实施例一
参考图 1, 图 1为本实施例提供的终端配对方法流程图, 所述方法包括: S101 : 当终端检测到预设的配对触发事件时, 获取与所述配对触发事件 相关联的所述终端自身的配对隐秘值。
S102 : 所述终端利用所述终端自身的配对隐秘值实现与对端配对。
本实施例中, 假设需要实现配对的终端分别为第一终端和第二终端, 首 先在第一终端和第二终端分别设置配对触发事件, 如将第一终端与第二终端 进行触碰设置为配对触发事件等。 当第一终端和第二终端进行触碰时, 第一 终端和第二终端分别记录与所述配对触发事件相关联的所述终端自身的配对 隐秘值, 所述终端自身的配对隐秘值可以为第一终端和第二终端分别基于一 个共同参考点获得的相对于所述配对触发事件发生时间的所述终端自身的时 长, 也可以为所述配对触发事件发生时第一终端和第二终端的运动方向值。
具体的, 当预设的配对触发事件发生时, 第一终端和第二终端可以分别 记录在所述终端自身的运动方向值, 例如, 可以通过 CPU周期性读取三轴加 速度计、 重力感应器、 电子罗盘等传感装置的传感数据, 当检测到终端在一 个方向上快速运动, 然后在运动方向上运动速度驟降为 0或驟然变为反向运 动, 则判定发生触碰事件, 可在此时依据此前读取的一系列传感器数据分析 运动方向, 例如第一终端检测到运动方向为东偏北 5度、 上仰 3度, 而第二 终端运动方向为西偏南 5度、 下俯 3度, 则两个终端的运动方向是相向的。 实际判断时允许运动方向的角度存在一些误差。
以下用于介绍终端获取基于配对触发事件发生时间点的时长的具体内 容:
首先是获取触碰事件发生时间点。
实际应用中, 可以使用加速度计确定触碰事件的发生时间点, 通常的做 法是由 CPU (中央处理器) 周期性读取加速度计的加速度值, 如果加速度值 剧烈变化并发生显著拐点, 如向一个方向较快运动然后驟停, 此时说明终端 发生了触碰事件。 本实施例中的终端在根据加速度值的变化判断出触碰事件 后立即记录所述触碰事件发生时的系统时间, 例如 CPU系统时间, 精确到微 秒。 两个设备通过加速度计等感应器检测出触碰事件发生时间点所产生的时 间误差可能在 1至 20毫秒之间。
另外,本实施例也可以 4吏用霍尔感应的方式检测触碰事件的发生时间点, 具体的, 每个终端至少需要安装一个霍尔器件和一个磁铁, 其中, 所述磁铁 可以是电磁铁, 为了方便使用, 每个终端还可以安装二个霍尔器件和二个磁 铁, 如图 2所示, 图 2为安装有二个霍尔器件和二个磁铁的第一终端和第二 终端结构示意图。 当第一终端和第二终端进行触碰时, 第一设备的霍尔器件 1检测到第二终端的磁铁 2靠近, 向第一终端的 CPU发出触碰事件发生的信 号, 同时, 第二终端的霍尔器件 2检测到第一终端的磁铁 1 靠近, 向第二终 端的 CPU发出触碰事件发生的信号。 当第一终端和第二终端进行良好的触碰 时, 两个设备的霍尔器件会同时检测到触碰事件, 这两个触碰事件的发生时 间点误差可以小到数个毫秒或更低。
除上述两种检测触碰事件发生时间点的方法, 本实施例也可以 4吏用其它 技术检测触碰事件, 本发明不限制检测触碰事件的技术实现方法。 只要对于 相互触碰的两个终端能够以非常小的时间误差同时检测到触碰事件的发生时 间点, 都可以适用于本发明的方案。 本实施例可以将所述非常小的时间误差 记为 D, D的单位可以取为微秒, D的值越小越好, 例如 100微秒。
其次是依据一个共同参考点获取时长。
所述共同参考点是两个终端通过第一无线通信接口交互的某个消息而获 得的时间点, 从触碰事件发生时间点到这个共同参考点所经历的时间就是所 述的时长。 所述第一无线通信接口可以在所述配对触发事件发生之前就已经 打开, 例如用于分享内容的程序在运行时就打开所述第一无线通信接口, 并 等待配对触发事件的发生。 所述第一无线通信接口也可以在所述配对触发事 件发生之后打开, 即检测到所述配对触发事件之后打开所述第一无线通信接 口。 所述第一无线通信接口可以是 WiFi或蓝牙等无线通信技术。 所述第一无 线通信接口与配对成功后传输分享内容的第二无线接口可以相同或不同, 例 如所述第一无线通信接口和第二无线通信接口都是 WiFi接口, 或者在配对触 发事件发生前就打开 BLE (英文: Bluetooth Low Energy, 中文: 蓝牙低功耗) 接口, 通过 BLE接口完成配对过程, 之后再打开 WiFi接口完成内容传输, 这样可以节约终端的耗电量。
参考图 3,图 3为本实施例提供的实现终端获取基于预设触发与对端配对 的事件发生时间的时长的方法流程图, 所述方法可以包括:
S301 : 当终端检测到配对触发事件时, 获取所述配对触发事件的发生时 间, 并确定为所述终端自身的第一时间点。
S302 : 所述终端根据与所述对端交互的任一消息, 获取与所述对端基于 所述消息的所述终端自身的第二时间点。
S303 : 所述终端获取所述终端自身的时长, 所述终端自身的时长为所述 终端自身的第一时间点与所述终端自身的第二时间点的时间间隔。
实际应用中, 需要配对的两个终端首先触发预设的配对触发事件, 如将 两个终端进行触碰, 此时, 两个终端分别记录所述配对触发事件发生时间点, 并将该发生时间点确定为所述终端自身的第一时间点。 其次, 通过两个终端 之间交互的任意一条消息, 所述两个终端分别记录基于该消息的终端自身的 第二时间点。 由于消息以光速传播, 而两个终端的距离很近, 不妨假设触碰 后两个设备离开 1 米远, 信号从一个终端到达另一个终端所需的时间仅仅为 3.3纳秒, 可以忽略不计。 因此, 本实施例的所述消息的发送终端在发送所述 消息时记录系统时间作为第二时间点, 同时所述消息的接收终端在接收所述 消息时记录系统时间作为第二时间点, 可以认为两个终端分别记录的第二时 间点相同, 或者非常接近。 最后, 由于理论上发生配对触发事件的两个终端 分别记录的第一时间点和第二时间点均相同, 所以, 本实施例中两个终端分 别获取各自的时长,所述时长为各自的第一时间点和第二时间点的时间间隔, 可以理解的是, 两个发生配对触发事件的终端的时长理论上应该也是相同的。
以下介绍上述获取时长方法的一种具体实施方式, 参考图 4, 图 4为实现 终端获取基于预设的配对触发事件的发生时间的时长的方法交互图, 其中实 现配对的终端分别为第一终端和第二终端, 所述方法包括:
S401 : 第一终端和第二终端发生配对触发事件, 如触碰事件。
S402 : 在所述配对触发事件发生时, 第一终端和第二终端分别将所述配 对触发事件发生时的系统时间确定为第一时间 , ^。
S403 : 第一终端随机延迟时间 r后, 通过 WiFi或蓝牙等无线接口发送首 个消息, 所述首个消息通常为发现请求 (英文: Discovery Request) 消息。 具 体地, 所述发现请求消息可以是 IEEE 802.11 中定义的探测请求帧 (英文: Probe Request frame)。
其中, 第一终端随机延迟时间 r后发送首个消息的目的是防止攻击者通 过侦听首个消息的方式猜测到触碰事件发生的时间点, 假冒第二终端与第一 终端实现配对。
为了保证首个消息发送的成功率, 第一终端可以将首个消息快速连发三 次, 并最好保证最后一次发送首个消息的时间点必须在预设的时间点之前完 成。
另外, 为了加快终端配对过程, 可以设定第一终端只在预先设定的特定 无线通道上发送发现请求消息, 而第二终端也只在所述特定的无线通道上侦 听所述发现请求消息。 值得注意的是, 由于第一终端通常不知道第二终端的 地址, 因此所述发现请求消息通常是广播的。
S404 : 第二终端收到发现请求消息后, 延迟时间 R向第一终端发送对所 述发现请求消息的响应消息即发现响应消息。 同时, 所述第二终端在发出所 述发现响应消息时记录系统时间为第二时间点, 所述第一终端在接收到所述 发现响应消息时记录系统时间为第二时间点。
更具体地, 所述第二终端在开始发送所述发现响应消息时记录系统时间 为第二时间点, 所述第一终端在开始接收到所述发现响应消息时记录系统时 间为第二时间点, 当然, 所述第一终端可以在确定接收到所述发现响应消息 时记录第三时间点, 減去接收所述发现响应消息所需要的时间来确定所述第 一终端的第二时间点。 如此, 两个终端记录的都是同一个消息起始端的传输 时间点, 它们的误差是消息起始端在空中传播的时间加上可能存在的电路处 理产生的延迟, 这个误差可以非常小。 实际第二时间点的获得也可以采用其 它方法, 例如两个设备都记录所述发现响应消息末端的传输时间点, 即第二 设备完成发送所述发现响应消息的时间点和第一设备完成接收所述发现响应 消息的时间点。 也可以才艮据所述发现请求消息或所述发现响应消息后续的某 个消息获得第二时间点。
其中 R为预设的固定时间值, 并可以设 r小于等于 R。
实际应用中, 对首个消息的响应消息通常就是发现响应消息。 具体地, 所述发现响应消息可以是 IEEE 802.11 中定义的探测响应帧 (英文: Probe Response frame)。
其中, 第二终端延迟时间 R后再发送发现响应消息的目的是防止攻击者 通过持续发送发现请求消息触发第二终端在发生配对触发事件后立即发出发 现响应消息,从而使得攻击者比较容易地猜测到配对触发事件的发生时间点, 假冒第一终端与第二终端实现配对。 如按照 IEEE 802.11 规范, S403和 S404探测过程即 Probe Request和 Probe Response过程之后还可以存在 802.11认证过程 (英文: Authentication frames) 和关联过程 (英文: Association frames) , 这里不再伴细描述。
S405 : 第一终端和第二终端分别计算时长, 所述时长为第一终端和第二 终端各自的第一时间点和第二时间点之间的时间间隔。
本实施例中, 时长是第一终端和第二终端基于一个共同参考点相对触碰 事件发生时间点的时长。 本实施例中的这个共同参考点是通过某一条消息来 实现的, 例如发现请求消息或者发现响应消息。
本实施例在实际实现的过程中, 终端记录发送出或者接收到一个无线接 口帧的时间点需要在无线接口芯片内实现, 因为如果等到 CPU知道无线接口 芯片发送或收到一个无线接口帧时再读取系统时间, 则会产生较大的误差。 但是, 通常无线接口芯片例如 WiFi芯片中的程序不能读取 CPU的系统时间, 而 CPU 中运行的程序却可以读取 WiFi芯片中的时间戳信息, 因此在获取有 关第一时间点和第二时间点时需采取一些技巧。
具体来说, 实际实现中, 如果各个终端在发生配对触发事件之前已经打 开无线接口例如 WiFi接口, 则终端在检测到配对触发事件时直接读取 iFi 芯片中的时间戳作为所述第一时间点, 而在发送或者接收 WiFi帧时可以通过 WiFi芯片内的程序直接获取 WiFi芯片的时间戳信息作为第二时间点,之后再 将获得的第二时间点传递给 CPU中的程序。
实际实现中, 如果各个终端在发生配对触发事件之前尚未打开无线接口 例如 WiFi接口而是在发送首个消息之前打开 WiFi 的, 这种情况下, 各个终 端的第一时间点可以通过 CPU 中运行的程序获取 CPU 当时的系统时间 Tal 作为第一时间点, 并且在打开 WiFi接口完成时同时由 CPU 中运行的程序获 取 CPU 系统时间 Ta2 和 WiFi 芯片的时间戳信息 TSFal (英文: timing synchronization function, 中文: 时间同步功能), iFi芯片启动后的时间计数, 单位为微秒。 之后, 各个终端的第二时间点可以通过 WiFi芯片内运行的程序 获取 WiFi芯片的时间戳信息 TSFa2而得到。 可以理解的是, 上述实施方式确 定的时长可以通过以下公式得到: 时长 =TSFa2-TSFal +Ta2-Tal。
实际应用中, 第一终端和第二终端可以使用一种通信技术例如 BLE (英 文: Bluetooth Low Energy, 中文: 蓝牙低功耗) 完成配对触发事件后的设备 发现过程并完成时长的获取, 而后续利用时长实现的认证过程或者分享内容 的数据传输可以使用另一种通信技术例如 WiFi。 由于误差的存在, 第一终端和第二终端分别得到的时长实际上是难以相 等。 这个误差主要来自配对触发事件发生后两个终端检测到该配对触发事件 的时间可能存在先后, 同时后续的基于共同参考时间点的时长获得过程也会 产生误差。 因此, 为了方便后续将时长用作隐秘数据进行本发明所描述的配 对匹配过程, 必须尽量消除第一终端和第二终端得到的时长之间的误差, 使 得两个设备的时长在取值上相等或比较接近, 以便计算。 例如, 当两个终端 检测出配对触发事件发生时间允许相差 1000微秒的情况下, 为了使得合理误 差范围内的时长在取值上更进一步接近, 本发明采用预设的规整方法, 规整 所述时长, 也就是将时长换算成较大时间单位的值, 具体的, 可以将时长换 算成以 200微秒为单位的值。
具体的, 由于尾数的取值关系, 不存在一个确定的计算方法, 使得两个 在允许误差范围内的原始数值在各自通过上述换算方法计算之后一定得到相 同的数值, 同时不在允许误差范围内的原始数值在各自通过这个换算方法计 算之后一定得到不相同的数值, 总是存在某些情况下两个原始数值确实在允 许的误差范围内,但消除误差后它们的取值并不相等,和 /或在另一些情况下, 两个原始数值的误差超出了允许的误差范围,但消除误差后却获得相同的值, 这种情况我们称之为允许误差判不准, 判不准的取值区间称之为允许误差判 不准区间, 筒称判不准区间。 因此, 当允许的误差为 1000微秒时, 如果将所 获得的时长换算成以 1000微秒为单位的值,误判的可能性较大,而换算成 200 微秒为单位时, 误判的可能性就较小。 当然, 如果允许的误差本身就很小, 例如只有 1微秒 (所获得的时长单位也是微秒), 则完全不需要规整, 也就不 会有误判。 允许的误差指因为技术因素而实际上会存在的最大误差。
本实施例中, 可以将时长除以 "D/S" (D除以 S) 对所述时长进行规整, "D/S" 的目的实际上是取一个合适的规整后的时长的单位。 其中, D 表示 第一终端和第二终端得到的时长允许的最大误差值, 单位是微秒, 例如可以 假设 D 的取值为 1000, S为 5。 如此计算后, 两个终端的规整后的时长允许 差值就在 0到 S之间。 这样计算后, 判不准区间仍然存在, 但 S取值越大, 判不准区间越小, 误判的可能性越小。 但 S要控制在合适的范围内, S 取值 过大, 判断过程计算量越大。 通常 S取为 5比较合适, S的其他取值本实施例 也并没有进行限制。 不妨将上述规整方法称为 DS方法。
本实施例中当终端检测到预设的配对触发事件时, 获取与所述配对触发 事件相关联的所述终端自身的配对隐秘值, 并利用所述终端自身的配对隐秘 值实现与对端的配对过程。 与现有技术相比, 本发明不需要使用 NFC接口即 可准确实现配对, 节约了终端配对的成本。
实施例二
本实施例中, 首先, 所述终端利用所述终端自身的配对隐秘值和来自对 端的信息, 获取所述对端的公钥, 所述来自对端的信息包括所述对端的配对 隐秘值; 其次, 所述终端利用所述对端的公钥和所述终端自身的私钥生成所 述终端自身的共享密钥; 最后, 所述终端通过验证所述终端自身的共享密钥 和所述对端的共享密钥实现与所述对端的配对。
具体实现方式参考图 5, 图 5 为本实施例提供的一种终端配对方法交互 图, 其中, 实现配对的终端分别为第一终端和第二终端, 所述方法包括:
S501 : 第一终端和第二终端获取基于预设配对触发事件发生时间的终端 自身的配对隐秘值, 所述配对隐秘值可以为时长。
本步驟中的配对隐秘值的获取方法在实施例一中已经介绍, 在此不再赘 述。
S502 : 第一终端和第二终端分别接收对端发送的第一秘密值和任一随机 数, 其中第一终端接收到的第二终端的第一秘密值可以为第二终端利用所述 第二终端的规整后的时长加密所述第二终端的密钥交换算法公钥(筒称公钥) 和第二终端的所述随机数得到。 同理, 第二终端接收到来自第一终端的的第 一秘密值为第一终端利用所述第一终端的规整后的时长加密所述第一终端的 密钥交换算法公钥 (筒称公钥) 和第一终端的所述随机数得到。 可知, 所述 第一终端的第一秘密值和所述第二终端的第一秘密值通常不会相同。
本实施例中, 可以用 ΔΤίΐ表示第一终端的配对隐秘值, ΔΊ¾表示第二终 端的配对隐秘值, 且 ΔΤίΐ和 ΔΊ¾是经过实施例一中描述的 DS方法规整之后 的结果, 其中设 S取值为 5。 可以用 Na表示第一终端的随机数, Nb表示第 二终端的随机数, PKa表示第一终端的公钥, PKb表示第二终端的公钥。 则 第一终端的第一秘密值可以用 ATa(PKa, Na)表示, 第二终端的第一秘密值可 以用 Tb(PKb, Nb)表示。
实际应用中, 第一秘密值和随机数的发送可以不在同一条消息进行, 具 体的, 可以先发送第一秘密值, 对端在收到第一秘密值后再发送随机数。 可 以理解的是, 本实施例对第一秘密值和随机数的发送顺序不做具体限制。
本实施例中的随机数可以与产生该随机数的终端的当前时间、 特定计数 器等信息相关, 但总体上它的取值是随机的。
实际应用中, 本步驟可以采用 DH (英文: Diffie - Hellman key exchange, 中文: 迪菲一赫尔曼密钥交换) 密钥交换算法。 它可以让双方在完全没有对 方任何预先信息的条件下通过不安全信道建立起一个密钥, 这个密钥可以在 后续的通讯中作为对称密钥来加密通讯内容。 由于 DH交换公钥的过程可能 被中间人攻击, 因此, 本实施例使用 ΔΤίΐ和 ΔΊ¾来保护交换公钥的过程, 这 样, 攻击者必须猜中 ΔΤίΐ或 ΔΊ¾才能进行中间人攻击, 而攻击者并不容易猜 到 ΔΤίΐ或 ΔΊ¾的值, 这样中间人攻击就难以实施。
以上 DH密钥交换算法也可以使用其它的密钥交换算法代替, 例如使用 增强的 DH算法 ECDH算法, 本发明不作限定。
S503 : 第一终端和第二终端分别利用自身的配对隐秘值和接收的随机数, 解密接收的第一秘密值, 从而得到对端的公钥。
具体的, 本实施例采用试算的方式对接收的第一秘密值进行解密。 理论 上, 如果第一终端和第二终端是发生配对触发事件的两个终端, 则这两个终 端的 Ta和 ΔΊ¾在允许的误差范围内, 那么, 正确的 Ta的取值范围应该是 大于等于 ΔΊ¾ _ 5, 并且小于等于 ΔΊ¾+5, 也就是 ΔΤΙ 5 = <ATa <=ATb+50 所以, 本实施例中的第二终端可用 Δΐ 对接收的第一秘密值进行解密计算, 从而得到解密后的公钥 PKa, 和随机数 Na' , A a' 的取值可以依次从 ATb - 5到 ATb+5之间取整数值。 如果解密算出的随机数 Na' 与接收的 Na 相同, 则证明此时算出的公钥 PKa, 就是第一终端的公钥 PKa, 同时, 此时 Δΐ 的取值就是 ATa的值。如果第二终端试算所有 Δΐ 后没有成功解密获 得与 Na相等的 Na' , 则就此终止过程, 第二终端可不作任何响应, 或者向 第一终端发一个消息, 用于向第一终端反馈配对失败的结果。
本实施例可以使用下列伪代码来表示第二设备试算 ΔΤίΐ的过程: △Ta, = ATb - 5
While (ATa, < = ATb+5) do
(PKa' , Na' ) = AT a' (ATa(PKa,Na))〃用 Vl 解密 VTa(PKa, Na) 得到 PKa' 和 Na,
If (Na' == Na)
Return SUCCESS 〃成功
Endif
△Ta, =△ , + 1
Endwhile
Return FAIL //失败
同理, 第一终端的操作与第二终端相同, 在此不再赘述。
值得注意的是, 解密第一秘密值的步驟可以由一个终端先执行, 如果该 终端可以得到对端的公钥, 则再向对端发送随机数或者第一秘密值, 以便对 端再进行密钥的获取。 这样可以提高配对效率, 使得非正确配对的终端较快 得到配对失败的结果。
S504 : 第一终端和第二终端分别利用解密得到的对端的公钥和自身的私 钥生成共享密钥。
本实施例中, 第一终端使用自身的公钥 PKa对应的私钥 Ka、 解密得到的 第二终端的公钥 PKb来计算 DH共享密钥 DHKeya, 而第二终端则使用其公 钥 PKb对应的私钥 Kb、 第一终端的公钥 PKa来计算 DH共享密钥 DHKeyb。 按照 DH算法特性, DHKeya和 DHKeyb应该是相等。
另外, 共享密钥的计算还可以结合 Na和 Nb, 使得在第一终端和第二终 端每次交换的公钥都不变的情况下算得的共享密钥也不是固定不变的。
实际应用中, 如果攻击者不能在 S502中一次性猜中 Ta和 /或 ΔΊ¾, 攻 击就不成功。 即使攻击者得到明文的 Na和 Nb后离线算出 Ta和 ΔΊ¾, 从而 得到 PKa和 PKb, 但这对于攻击者是没有用的, 因为攻击者并不能知道 PKa 和 PKb对应的私钥, 从而无法得到第一终端和第二终端之间的共享密钥, 因 而无法获取后续第一终端和第二终端交互的秘密数据。 本实施例通过共享密 钥的方式进一步确保双方配对的准确性。
S505 : 第一终端和第二终端分别通过验证共享密钥确定与所述对端配对。 本实施例中, 第一终端和第二终端通过计算得到共享密钥后, 需要验证 双方的共享密钥是否一致, 如果一致则证明终端配对成功, 否则可能是中间 人攻击等非正常情况。
实际应用中, 第一终端可以和第二终端直接用公钥交换后得到的共享密 钥保护后续的数据交互, 通常后续的消息中会包含消息完整性码, 其中消息 完整性码为共享密钥对消息的摘要信息加密得到。 如果第一终端和第二终端 间可以完成数据交互, 则说明双方持有相同的共享密钥。
另外, 两个终端也可以先验证一下对方是否持有与自己一致的共享密钥, 例如可以执行 802.11规范中的四步握手过程,将共享密钥 DHKey视为 802.11 规范中定义的 PMK (英文: Pairwise Master Key, 中文: 一对节点间的主密钥) 即可, 在成功的四步握手之后会产生临时会话密钥 PTK (英文: Pairwise Transient Key, 中文:一对节点间的临时密钥), 用 PTK保护后续的数据交互。 也可以在双方获得共享密钥后, 使用共享密钥由一方向另一方发送一个配置 信息, 其中包含一个新的密钥, 这个新的密钥用于后续的连接。 如果双方都 能够成功获取新的密钥, 则证明配对成功。 另外, 双方还可以在共享密钥或 会话密钥的保护下交换一下名片, 其中包括用户的标识如用户姓名, 以便终 端用户进一步确定设备双方配对成功。 总之, 利用共享密钥验证配对的方法 很多, 本发明不作限制。
值得注意的是, 图 5仅是终端配对的一种具体实施方式, 图 5 中各个步 驟的执行顺序对于实现终端配对而言不是唯一。 实施例二
参考图 6, 图 6为本实施例提供的终端配对方法交互图, 其中, 实现配对 的终端分别为第一终端和第二终端, 所述方法包括:
S601 : 第一终端和第二终端获取基于预设的配对触发事件发生时间的终 端自身的配对隐秘值, 所述配对隐秘值可以为时长。
本步驟中的配对隐秘值的获取方法在实施例一中已经介绍, 在此不再赘 述。
S602 : 第二终端获取第一终端的配对隐秘值和公钥后, 利用自身的配对 隐秘值和所述第一终端的配对隐秘值通过预设的运算方法得到第一运算值。 实际应用中, 第二终端获取第一终端的配对隐秘值和公钥的方法可以参 考实施例二, 在此不再赘述。
本实施例中预设的运算方法可以为一种可逆运算, 运算符可以用 表 示, 具体可以为算术加法、 減法、 乘法等。 具体的, 第一运算值可以使用 dT 表示, dT=ATa*ATb, ΔΤίΐ和 ΔΊ¾分别表示第一终端和第二终端的时长。
S603 : 第一终端利用自身的配对隐秘值解析第一运算值, 并得到第二终 端的配对隐秘值。
下表列出了第二终端计算 dT的方法对应的第一终端计算 ΔΊ¾的方法 (此 表中的 表示算术乘法, xor表示逐比特异或), 如下:
Figure imgf000021_0001
S604 : 第一终端利用所述第二终端的配对隐秘值, 解密来自第二终端的 第一秘密值, 得到所述第二终端的公钥, 其中, 第二终端的第一秘密值可以 为利用所述第二终端的配对隐秘值加密其公钥得到。
实际应用中, 第一终端接收的来自第二终端的第一秘密值可以由配对隐 秘值加密公钥得到, 也可以由配对隐秘值加密公钥和随机数得到。 当第一终 端根据 dT和自身的 Δ , 计算得到 ΔΊ¾后, 可以直接利用 ΔΊ¾解密来自第 二终端的第一秘密值, 得到所述第二终端的公钥。
S605 : 第一终端和第二终端分别利用自身的私钥和对端的公钥生成共享 密钥。
S606: 第一终端和第二终端分别通过验证共享密钥确定与所述对端配对。 S605和 S606的实现方式可参照实施例一中的描述,在此不再赘述。另外, 本实施例中各个步驟的执行顺序可以不受限制。 实施例四
参考图 7, 图 7为本实施例提供的终端配对方法交互图, 其中, 实现配对 的终端分别为第一终端和第二终端, 所述方法包括:
S701 : 第一终端和第二终端获取基于预设的配对触发事件发生时间的终 端自身的配对隐秘值, 所述配对隐秘值可以为时长和\或运动方向值。
本步驟中的配对隐秘值的获取方法在实施例一中已经介绍, 在此不再赘 述。
S702 : 第一终端和第二终端分别接收来自对端的第一消息, 所述第一消 息包括所述对端的 DH密钥交换算法的公钥和第二秘密值, 所述第二秘密值 包含利用对端的预设密钥加密所述对端的配对隐秘值得到的值。
实际应用中, 第一终端利用自身预设或随机生成的一个加解密算法的密 钥 SKA加密 ΔΤίΐ和 /或 Ma得到第二秘密值 SKA (ATa和 /或 Ma), ATa表示 第一终端的时长, Ma用于表示第一终端的运动方向值。 并将加密的信息和公 钥 PKa—同组成第一消息发送至第二终端。 同理, 第二终端也将第一消息发 送至第一终端, 具体实现形式与第一终端相同。
另外, 两个终端分别发送的第一消息中还可以包括第一消息完整性码 MIC1, 具体的, 所述 MIC1为发送方使用 ATa和 /或 Ma对第一消息的摘要信 息进行运算所得,例如加密运算等。 同时 MIC1 的生成还可以有 SKA的参与。 SKA可以为对称密钥,也可以是不对称密钥,如果是不对称密钥,这里的 SKA 实际指用于加密的私钥部分, 可以记为 SKAe, 因此所述第二秘、密值实际为 SKAe (ΔΤίΐ和 /或 Ma)。
S703 : 第一终端和第二终端分别利用自身的私钥和对端的公钥生成共享 密钥。
本实施例中, 第一终端和第二终端在得到对端的公钥后, 可结合自身的 私钥和对端的公钥 (例如第二终端利用自己的 PKb对应的私钥 Kb和第一终 端的公钥 PKa) 生成共享密钥 DHKey, 具体的实现方式可参考实施例二。 当 然, 本实施例也可以使用其它的密钥交换算法获得共享密钥, 本领域技术人 员应可理解, 这里不——列举。
S704 : 第一终端和第二终端分别接收来自对端的第二消息, 所述第二消 息包括第三秘密值, 所述第三秘密值包含对端利用所述对端的共享密钥加密 所述对端的加解密密钥得到的值。
本实施例中,第一终端使用生成的共享密钥 DHKey加密自身的密钥 SKA 得到第三秘密值 DHKey (SKA) , 并生成第二消息发送至第二终端。 另外, 第一终端也可以利用共享密钥 DHKey的第一衍生密钥对 SKA加密。 同理, 第二终端的实现过程与第一终端相同,其生成的第三秘密值可以为 DHKey (SKB) o 如果 SKA是不对称密钥, 则这里加密发送的是 SKA的公钥部分, SKA的公钥部分可以记为 SKAd,因此所述第三秘密值实际为 DHKey(SKBd)。
另外, 两个终端发送的第二消息中还可以包括第二消息完整性码 MIC2。 所述 MIC2 为发送方使用生成的 DHKey 对第二消息的摘要信息进行运算所 得, 例如加密运算等。 或者, 所述 MIC2为发送方使用生成的 DHKey的第二 衍生密钥对第二消息的摘要信息进行运算所得。
S705 : 第一终端和第二终端分别利用自身的共享密钥解密所述第三秘密 值得到所述对端的密钥, 并利用所述对端的密钥对应解密所述第二秘密值得 到所述对端的配对隐秘值。
实际应用中, 第一终端在接收到第二消息后, 利用生成的共享密钥 DHKey解密所述第二消息中的第三秘密值 DHKey (SKB), 得到第二终端的 预设密钥 SKB, 如果第一终端能够解密来自第二终端的第三秘密值, 则证明 第二终端和自己有相同的共享密钥 DHKey。 第一终端进一步利用得到的第二 终端的密钥 SKB解密第二秘密值,得到第二终端的配对隐秘值 ΔΊ¾和 /或 Mb。 同理, 第二终端的实现过程与第一终端相同。
值得注意的是, 本实施例为了提高终端匹配效率, 可以在一个终端完成 S705并证明与对端存在相同的共享密钥之后再执行 S704, 即如图 5所示。
另外, 第一终端不仅可以通过上述方式证明第二终端和自己有相同的共 享密钥 DHKey, 而且如果第二消息还包括第二消息完整性码 MIC2, 本实施 例还需要验证所述第二消息完整性码 MIC2,以证明第二终端和自己有相同的 DHKey。 由于第二消息完整性码 MIC2 为对端利用对端的共享密钥加密所述 第二消息的摘要信息得到, 所以本实施例可以使用自身的共享密钥对第二消 息完整性码 MIC2 进行验证, 如果通过验证, 则证明对端和自己有相同的 DHKey。
S706: 第一终端和第二终端分别根据自身的配对隐秘值和对端的配对隐 秘值确定与对端配对。
本实施例中, 两个终端分别获得对端的配对隐秘值后, 将对端的配对隐 秘值与自身的配对隐秘值进行比较。 如果两者的时长的差值在允许误差范围 内, 则证明对端与自己发生配对触发事件; 或者, 如果在误差范围内两者的 运动方向值指示两者的运动方向相对,则证明对端与自己发生配对触发事件; 或者, 上述两种情况同时满足, 则证明对端与自己发生配对触发事件。 如果 终端根据上述比较发现对端不是与自己发生配对触发事件的终端, 则可以结 束处理过程, 即不再向对端发送任何消息。
另外, 如果第一消息中还包括第一消息完整性码 MIC1 , 本实施例还需要 验证所述第一消息完整性码 MIC1。由于接收到的第一消息中的第一消息完整 性码 MIC1 为对端利用其配对隐秘值参与并结合第一消息的摘要信息运算得 到, 具体可以是将配对隐秘值作为密钥加密摘要信息得到, 而对端的配对隐 秘值在接收到第一消息时并不能立刻获知, 所以本实施例可以在 S705中获得 了对端的配对隐秘值之后验证 MIC1。 当第一消息完整性码 MIC1通过验证, 同时两个终端的配对隐秘值也在允许的误差范围内时, 则可以证明两个终端 实现配对。 如果 MIC1 没有通过验证, 则表示可能存在中间人攻击等异常情 况, 终端可以结束处理过程, 不再和对端交互任何消息。
需要说明的是, 本实施例中的时长例如 1^和 1¾并不需要进行规整, 因为它们被秘密传输, 直接用于比较, 而不需要进行实施例二和三中所说的 试算过程。 实施例五
参考图 8, 图 8为本实施例提供的一种配对终端结构示意图, 所述终端包 括检测单元 801、 获取单元 802和配对单元 803 ;
所述检测单元 801, 用于检测预设的配对触发事件;
所述获取单元 802, 用于当所述检测单元检测到预设的配对触发事件时, 获取与所述配对触发事件相关联的所述终端自身的配对隐秘值;
所述配对单元 803,用于利用所述终端自身的配对隐秘值实现与所述对端 的配对。
其中, 所述获取单元 802, 包括:
第一获取子单元, 用于当所述检测单元检测到预设的配对触发事件时, 获取与所述对端基于共同参考时间点获得的相对于所述事件的发生时间的所 述终端自身的时长;
和\或,
第二获取子单元, 用于当所述检测单元检测到预设的配对触发事件时, 获取所述终端自身的运动方向值。
实际应用中, 所述第一获取子单元, 包括:
第三获取子单元, 用于当所述检测单元检测到预设的配对触发事件时, 获取所述预设的配对触发事件的发生时间,作为所述终端自身的第一时间点; 第四获取子单元, 用于根据与所述对端交互的任一消息, 获取与所述对 端基于所述消息的所述终端自身的第二时间点;
第五获取子单元, 用于获取所述终端自身的时长, 所述终端自身的时长 为所述终端自身的第一时间点与所述终端自身的第二时间点的时间间隔。
其中, 所述第一获取子单元, 还包括:
第一发送子单元, 用于在检测到所述预设的配对触发事件后随机延迟时 间 r, 通过无线接口向所述对端发送发现请求消息;
第一接收子单元, 用于接收来自所述对端的发现响应消息, 所述发现响 应消息为所述对端在接收到所述发现请求消息后延迟时间 R后发送的, 所述 R大于所述 r。
同时, 所述第四获取子单元, 具体可以为根据在预设的信道上与所述对 端交互的任一消息, 获取与所述对端基于所述消息的所述终端自身的第二时 间点的单元。
另外, 所述终端还可以包括:
修正子单元, 用于采用允许误差判不准方法, 修正所述终端自身的时长。 参考图 9和图 10,图 9和图 10分别为本实施例提供的配对终端在一种实 现方式中的结构示意图, 所述终端包括检测单元 801、 获取单元 802和配对单 元 803, 所述配对单元 803, 包括:
第六获取子单元 901,用于利用所述终端自身的配对隐秘值和来自对端的 信息, 获取所述对端的公钥, 所述来自对端的信息包括所述对端的配对隐秘 值;
第一生成子单元 902,用于利用所述对端的公钥和所述终端自身的私钥生 成所述终端自身的共享密钥;
第一配对子单元 903,用于通过验证所述终端自身的共享密钥和所述对端 的共享密钥实现与所述对端的配对。
所述终端还包括发送单元,
所述发送单元, 用于向所述对端发送所述终端自身的配对隐秘值, 以使 所述对端实现与所述终端的配对。
其中, 所述第六获取子单元 901, 可以包括:
第二接收子单元 1001, 用于接收对端发送的第一秘密值和任一随机数, 所述第一秘密值为利用所述对端的配对隐秘值加密所述对端的公钥和所述随 机数得到;
第一解密子单元 1002, 用于利用所述终端自身的配对隐秘值和所述对端 的随机数, 解密所述第一秘密值得到所述对端的公钥。
或者, 所述第六获取子单元 901, 可以包括:
第三接收子单元 1101, 用于接收对端发送的第一秘密值和第一运算值, 所述第一秘密值包括利用所述对端的配对隐秘值加密所述对端的公钥得到的 值, 所述第一运算值包括利用所述终端自身的配对隐秘值和所述对端的配对 隐秘值通过预设的预算方法得到的值;
第二生成子单元 1102, 用于利用来自所述对端的第一运算值和所述终端 自身的配对隐秘值得到所述对端的配对隐秘值;
第二解密子单元 1103, 用于利用所述对端的配对隐秘值, 解密来自所述 对端的第一秘密值得到所述对端的公钥。 参考图 11,图 11为本实施例提供的配对终端在另一种实现方式中的结构 示意图, 所述终端包括检测单元 801、 获取单元 802和配对单元 803, 所述配 对单元 803, 包括:
第三生成子单元 1201,用于利用来自对端的信息和所述终端自身的信息, 得到所述对端的配对隐秘值, 所述来自对端的信息包括所述对端的公钥和配 对隐秘值, 所述终端自身的信息包括所述终端自身的私钥;
第二配对子单元 1202, 用于通过比较所述终端自身的配对隐秘值和所述 对端的配对隐秘值实现与所述对端的配对。 其中, 所述第三生成子单元 1201, 包括:
第四接收子单元 1301, 用于接收来自对端的第一消息, 所述来自对端的 第一消息包括所述对端的公钥和第二秘密值, 所述对端的第二秘密值包括利 用所述对端的预设密钥加密所述对端的配对隐秘值得到的值;
第四生成子单元 1302, 用于利用所述终端自身的私钥和所述对端的公钥 生成所述终端自身的共享密钥;
第五接收子单元 1303, 用于接收来自所述对端的第二消息, 来自所述对 端的第二消息包括所述对端的第三秘密值, 所述对端的第三秘密值包括利用 所述对端的共享密钥加密所述对端的预设密钥得到的值;
第三解密子单元 1304, 用于利用所述终端自身的共享密钥解密所述对端 的第三秘密值得到所述对端的预设密钥, 并利用所述对端的预设密钥解密所 述对端的第二秘密值得到所述对端的配对隐秘值。
另外, 所述来自对端的第一消息还包括所述对端的第一消息完整性码, 所述对端的第一消息完整性码包括所述对端利用所述对端的配对隐秘值加密 所述来自对端的第一消息的摘要信息得到的值;
所述第三生成子单元 1201还包括第一验证子单元 1305 ;
所述第一验证子单元 1305, 用于利用所述对端的配对隐秘值验证所述对 端的第一消息完整性码。
另外, 所述第二配对子单元 1202, 包括:
判断子单元 1401, 用于判断所述终端自身的配对隐秘值和所述对端的配 对隐秘值的差别是否在预设的允许误差范围内;
第三配对子单元 1402, 用于当所述差别在预设的允许误差范围内以及所 述对端的第一消息完整性码通过验证时, 所述终端实现与所述对端的配对。
实际应用中, 所述来自所述对端的第二消息还包括所述对端的第二消息 完整性码, 所述对端的第二消息完整性码包括所述对端利用所述对端的共享 密钥加密所述来自所述对端的第二消息的摘要信息得到的值;
所述第三生成子单元 1201还包括第二验证子单元 1306 ;
所述第二验证子单元 1306, 用于利用所述终端自身的共享密钥验证所述 对端的第二消息完整性码。
本实施例中当终端检测到预设的配对触发事件时, 获取与所述预设的配 对触发事件相关联的所述终端自身的配对隐秘值, 并利用所述终端自身的配 对隐秘值实现与对端的配对过程。与现有技术相比,本实施例不需要使用 NFC 接口即可准确实现配对, 节约了终端配对的成本。
少一个处理器(例如 CPU ),至少一个无线网络接口,配对触发事件检测装置, 存储器, 和至少一个总线 (Bus ), 用于实现这些装置之间的信号传输。 处理 器用于执行存储器中存储的可执行模块, 例如计算机程序。 存储器可能包含 高速随机存取存储器 (RAM: Random Access Memory ), 也可能还包括非易 失存储器( non-volatile memory ), 例如至少一个磁盘存储器。
参见图 12, 在一些实施方式中, 存储器中存储了程序指令, 程序指令可 以被处理器执行, 其中, 程序指令可包括获取单元 802和配对单元 803。 各单 元的具体实现可参见图 8-11所揭示的相应单元, 这里不再赘述。 通过以上的实施方式的描述可知, 本领域的技术人员可以清楚地了解到 上述实施例方法中的全部或部分步驟可借助软件加必需的通用硬件平台的方 式来实现。 基于这样的理解, 本发明的技术方案本质上或者说对现有技术做 出贡献的部分可以以软件产品的形式体现出来, 该计算机软件产品可以存储 在存储介质中, 如 ROM/RAM、 磁碟、 光盘等, 包括若干指令用以使得一台 计算机设备 (可以是个人计算机, 服务器, 或者诸如媒体网关等网络通信设 备, 等等) 执行本发明各个实施例或者实施例的某些部分所述的方法。 实施例之间相同相似的部分互相参见即可, 每个实施例重点说明的都是与其 他实施例的不同之处。 尤其, 对于设备及系统实施例而言, 由于其基本相似 于方法实施例, 所以描述得比较筒单, 相关之处参见方法实施例的部分说明 即可。 以上所描述的设备及系统实施例仅仅是示意性的, 其中作为分离部件 是或者也可以不是物理单元, 即可以位于一个地方, 或者也可以分布到多个 网络单元上。 可以根据实际的需要选择其中的部分或者全部模块来实现本实 施例方案的目的。 本领域普通技术人员在不付出创造性劳动的情况下, 即可 以理解并实施。
以上所述仅为本发明的较佳实施例而已, 并非用于限定本发明的保护范 围。 凡在本发明的精神和原则之内所作的任何修改、 等同替换、 改进等, 均 包含在本发明的保护范围内。

Claims

权 利 要 求
1、 一种终端配对方法, 其特征在于, 所述方法包括:
当终端检测到预设的配对触发事件时, 获取与所述配对触发事件相关联 的所述终端自身的配对隐秘值;
所述终端利用所述终端自身的配对隐秘值实现与对端的配对。
2、 根据权利要求 1所述的方法, 其特征在于, 所述当终端检测到预设的 配对触发事件时, 获取与所述配对触发事件相关联的所述终端自身的配对隐 秘值, 包括:
当终端检测到预设的配对触发事件时, 所述终端获取与所述对端基于共 同参考时间点获得的相对于所述事件的发生时间的所述终端自身的时长; 和\或,
当终端检测到预设的配对触发事件时, 所述终端获取所述终端自身的运 动方向值。
3、 根据权利要求 2所述的方法, 其特征在于, 所述当终端检测到预设的 配对触发事件时, 所述终端获取与所述对端基于共同参考时间点的相对于所 述事件的发生时间的所述终端自身的时长, 包括:
当终端检测到预设的配对触发事件时, 获取所述配对触发事件的发生时 间, 作为所述终端自身的第一时间点;
所述终端根据与所述对端交互的任一消息, 获取与所述对端基于所述消 息的所述终端自身的第二时间点;
所述终端获取所述终端自身的时长, 所述终端自身的时长为所述终端自 身的第一时间点与所述终端自身的第二时间点的时间间隔。
4、 根据权利要求 3所述的方法, 其特征在于, 所述获取所述配对触发事 件的发生时间, 作为所述终端自身的第一时间点之后, 且在所述终端才艮据与 所述对端交互的任一消息, 获取与所述对端基于所述消息的所述终端自身的 第二时间点之前, 还包括:
所述终端在检测到所述配对触发事件后随机延迟时间 r,通过无线接口向 所述对端发送发现请求消息。
5、 根据权利要求 4所述的方法, 其特征在于, 所述终端在检测到所述配 对触发事件后随机延迟时间 r,通过无线接口向所述对端发送发现请求消息之 后, 还包括:
所述终端接收来自所述对端的发现响应消息, 所述发现响应消息为所述 对端在接收到所述发现请求消息后延迟时间 R后发送的, 所述 R大于所述 r。
6、 根据权利要求 3所述的方法, 其特征在于, 所述终端根据与所述对端 交互的任一消息, 获取与所述对端基于所述消息的所述终端自身的第二时间 点, 具体为:
所述终端根据在预设的信道上与所述对端交互的任一消息, 获取与所述 对端基于所述消息的所述终端自身的第二时间点。
7、 根据权利要求 3所述的方法, 其特征在于, 所述终端获取所述终端自 身的时长, 所述终端自身的时长为所述终端自身的第一时间点与所述终端自 身的第二时间点的时间间隔之后, 还包括:
所述终端采用预设的规整方法, 规整所述终端自身的时长。
8、 根据权利要求 1所述的方法, 其特征在于, 所述终端利用所述终端自 身的配对隐秘值实现与对端的配对, 包括:
所述终端利用所述终端自身的配对隐秘值和来自对端的信息, 获取所述 对端的公钥, 所述来自对端的信息包括所述对端的配对隐秘值;
所述终端利用所述对端的公钥和所述终端自身的私钥生成所述终端自身 的共享密钥;
所述终端通过验证所述终端自身的共享密钥和所述对端的共享密钥实现 与所述对端的配对。
9、 根据权利要求 8所述的方法, 其特征在于, 所述方法还包括: 所述终端向所述对端发送所述终端自身的配对隐秘值, 以使所述对端实 现与所述终端的配对。
10、 根据权利要求 8所述的方法, 其特征在于, 所述终端利用所述终端 自身的配对隐秘值和来自对端的信息, 获取所述对端的公钥, 所述来自对端 的信息包括所述对端的配对隐秘值, 包括:
所述终端接收对端发送的第一秘密值和任一随机数, 所述第一秘密值为 利用所述对端的配对隐秘值加密所述对端的公钥和所述随机数得到;
所述终端利用所述终端自身的配对隐秘值和所述对端的随机数, 解密所 述第一秘密值得到所述对端的公钥。
11、 根据权利要求 8所述的方法, 其特征在于, 所述终端利用所述终端 自身的配对隐秘值和来自对端的信息, 获取所述对端的公钥, 所述来自对端 的信息包括所述对端的配对隐秘值, 包括:
所述终端接收对端发送的第一秘密值和第一运算值, 所述第一秘密值包 括利用所述对端的配对隐秘值加密所述对端的公钥得到的值, 所述第一运算 值包括利用所述终端自身的配对隐秘值和所述对端的配对隐秘值通过预设的 预算方法得到的值;
所述终端利用来自所述对端的第一运算值和所述终端自身的配对隐秘值 得到所述对端的配对隐秘值;
所述终端利用所述对端的配对隐秘值, 解密来自所述对端的第一秘密值 得到所述对端的公钥。
12、 根据权利要求 1 所述的方法, 其特征在于, 所述终端利用所述终端 自身的配对隐秘值实现与对端的配对, 包括:
所述终端利用来自对端的信息和所述终端自身的信息, 得到所述对端的 配对隐秘值, 所述来自对端的信息包括所述对端的公钥和配对隐秘值, 所述 终端自身的信息包括所述终端自身的私钥;
所述终端通过比较所述终端自身的配对隐秘值和所述对端的配对隐秘值 实现与所述对端的配对。
13、 根据权利要求 12所述的方法, 其特征在于, 所述终端利用来自对端 的信息和所述终端自身的信息, 得到所述对端的配对隐秘值, 所述来自对端 的信息包括所述对端的公钥和配对隐秘值, 所述终端自身的信息包括所述终 端自身的私钥, 包括:
所述终端接收来自对端的第一消息, 所述来自对端的第一消息包括所述 对端的公钥和第二秘密值, 所述对端的第二秘密值包括利用所述对端的预设 密钥加密所述对端的配对隐秘值得到的值;
所述终端利用所述终端自身的私钥和所述对端的公钥生成所述终端自身 的共享密钥;
所述终端接收来自所述对端的第二消息, 来自所述对端的第二消息包括 所述对端的第三秘密值, 所述对端的第三秘密值包括利用所述对端的共享密 钥加密所述对端的预设密钥得到的值; 所述终端利用所述终端自身的共享密钥解密所述对端的第三秘密值得到 所述对端的预设密钥, 并利用所述对端的预设密钥解密所述对端的第二秘密 值得到所述对端的配对隐秘值。
14、 根据权利要求 13所述的方法, 其特征在于, 所述来自对端的第一消 息还包括所述对端的第一消息完整性码, 所述对端的第一消息完整性码包括 所述对端利用所述对端的配对隐秘值加密所述来自对端的第一消息的摘要信 息得到的值;
所述终端利用所述对端的预设密钥解密所述对端的第二秘密值得到所述 对端的配对隐秘值之后, 还包括:
所述终端利用所述对端的配对隐秘值验证所述对端的第一消息完整性 码。
15、 根据权利要求 14所述的方法, 其特征在于, 所述终端通过比较所述 终端自身的配对隐秘值和所述对端的配对隐秘值实现与所述对端的配对, 包 括:
所述终端判断所述终端自身的配对隐秘值和所述对端的配对隐秘值的差 别是否在预设的允许误差范围内;
当所述差别在预设的允许误差范围内以及所述对端的第一消息完整性码 通过验证时, 所述终端实现与所述对端的配对。
16、 根据权利要求 13所述的方法, 其特征在于, 所述来自所述对端的第 二消息还包括所述对端的第二消息完整性码, 所述对端的第二消息完整性码 包括所述对端利用所述对端的共享密钥加密所述来自所述对端的第二消息的 摘要信息得到的值;
所述终端接收来自所述对端的第二消息之后, 还包括:
所述终端利用所述终端自身的共享密钥验证所述对端的第二消息完整性 码。
17、 一种配对终端, 其特征在于, 所述终端包括检测单元、 获取单元和 配对单元;
所述检测单元, 用于检测触发与对端配对的事件;
所述获取单元, 用于当所述检测单元检测到所述触发与对端配对的事件 时,获取与所述触发与对端配对的事件相关联的所述终端自身的配对隐秘值; 所述配对单元, 用于利用所述终端自身的配对隐秘值实现与所述对端的 配对。
18、 根据权利要求 17所述的终端, 其特征在于, 所述获取单元, 包括: 第一获取子单元, 用于当所述检测单元检测到触发与对端配对的事件时, 获取与所述对端基于共同参考时间点获得的相对于所述事件的发生时间的所 述终端自身的时长;
和\或,
第二获取子单元, 用于当所述检测单元检测到触发与对端配对的事件时, 获取所述终端自身的运动方向值。
19、 根据权利要求 18所述的终端, 其特征在于, 所述第一获取子单元, 包括:
第三获取子单元, 用于当所述检测单元检测到触发与对端配对的事件时, 获取所述触发与对端配对的事件的发生时间, 作为所述终端自身的第一时间 点;
第四获取子单元, 用于根据与所述对端交互的任一消息, 获取与所述对 端基于所述消息的所述终端自身的第二时间点;
第五获取子单元, 用于获取所述终端自身的时长, 所述终端自身的时长 为所述终端自身的第一时间点与所述终端自身的第二时间点的时间间隔。
20、 根据权利要求 19所述的终端, 其特征在于, 所述第一获取子单元, 还包括:
第一发送子单元, 用于在检测到所述触发与对端配对的事件后随机延迟 时间 r, 通过无线接口向所述对端发送发现请求消息。
21、 根据权利要求 20所述的终端, 其特征在于, 所述第一获取子单元, 还包括:
第一接收子单元, 用于接收来自所述对端的发现响应消息, 所述发现响 应消息为所述对端在接收到所述发现请求消息后延迟时间 R后发送的, 所述 R大于所述 r。
22、 根据权利要求 19所述的终端, 其特征在于, 所述第四获取子单元, 具体为根据在预设的信道上与所述对端交互的任一消息, 获取与所述对端基 于所述消息的所述终端自身的第二时间点的单元。
23、 根据权利要求 19所述的终端, 其特征在于, 所述终端还包括: 规整子单元, 用于采用预设的规整方法, 规整所述终端自身的时长。
24、 根据权利要求 17所述的终端, 其特征在于, 所述配对单元, 包括: 第六获取子单元, 用于利用所述终端自身的配对隐秘值和来自对端的信 息, 获取所述对端的公钥, 所述来自对端的信息包括所述对端的配对隐秘值; 第一生成子单元, 用于利用所述对端的公钥和所述终端自身的私钥生成 所述终端自身的共享密钥;
第一配对子单元, 用于通过验证所述终端自身的共享密钥和所述对端的 共享密钥实现与所述对端的配对。
25、 根据权利要求 24所述的终端, 其特征在于, 所述终端还包括发送单 元,
所述发送单元, 用于向所述对端发送所述终端自身的配对隐秘值, 以使 所述对端实现与所述终端的配对。
26、 根据权利要求 24所述的终端, 其特征在于, 所述第六获取子单元, 包括:
第二接收子单元, 用于接收对端发送的第一秘密值和任一随机数, 所述 第一秘密值为利用所述对端的配对隐秘值加密所述对端的公钥和所述随机数 得到;
第一解密子单元, 用于利用所述终端自身的配对隐秘值和所述对端的随 机数, 解密所述第一秘密值得到所述对端的公钥。
27、 根据权利要求 24所述的终端, 其特征在于, 所述第六获取子单元, 包括:
第三接收子单元, 用于接收对端发送的第一秘密值和第一运算值, 所述 第一秘密值包括利用所述对端的配对隐秘值加密所述对端的公钥得到的值, 所述第一运算值包括利用所述终端自身的配对隐秘值和所述对端的配对隐秘 值通过预设的预算方法得到的值;
第二生成子单元, 用于利用来自所述对端的第一运算值和所述终端自身 的配对隐秘值得到所述对端的配对隐秘值;
第二解密子单元, 用于利用所述对端的配对隐秘值, 解密来自所述对端 的第一秘密值得到所述对端的公钥。
28、 根据权利要求 17所述的终端, 其特征在于, 所述配对单元, 包括: 第三生成子单元, 用于利用来自对端的信息和所述终端自身的信息, 得 到所述对端的配对隐秘值, 所述来自对端的信息包括所述对端的公钥和配对 隐秘值, 所述终端自身的信息包括所述终端自身的私钥;
第二配对子单元, 用于通过比较所述终端自身的配对隐秘值和所述对端 的配对隐秘值实现与所述对端的配对。
29、 根据权利要求 28所述的终端, 其特征在于, 所述第三生成子单元, 包括:
第四接收子单元, 用于接收来自对端的第一消息, 所述来自对端的第一 消息包括所述对端的公钥和第二秘密值, 所述对端的第二秘密值包括利用所 述对端的预设密钥加密所述对端的配对隐秘值得到的值;
第四生成子单元, 用于利用所述终端自身的私钥和所述对端的公钥生成 所述终端自身的共享密钥;
第五接收子单元, 用于接收来自所述对端的第二消息, 来自所述对端的 第二消息包括所述对端的第三秘密值, 所述对端的第三秘密值包括利用所述 对端的共享密钥加密所述对端的预设密钥得到的值;
第三解密子单元, 用于利用所述终端自身的共享密钥解密所述对端的第 三秘密值得到所述对端的预设密钥, 并利用所述对端的预设密钥解密所述对 端的第二秘密值得到所述对端的配对隐秘值。
30、 根据权利要求 29所述的终端, 其特征在于, 所述来自对端的第一消 息还包括所述对端的第一消息完整性码, 所述对端的第一消息完整性码包括 所述对端利用所述对端的配对隐秘值加密所述来自对端的第一消息的摘要信 息得到的值;
所述第三生成子单元还包括第一验证子单元;
所述第一验证子单元, 用于利用所述对端的配对隐秘值验证所述对端的 第一消息完整性码。
31、 根据权利要求 30所述的终端, 其特征在于, 所述第二配对子单元, 包括:
判断子单元, 用于判断所述终端自身的配对隐秘值和所述对端的配对隐 秘值的差别是否在预设的允许误差范围内;
第三配对子单元, 用于当所述差别在预设的允许误差范围内以及所述对 端的第一消息完整性码通过验证时, 所述终端实现与所述对端的配对。
32、 根据权利要求 29所述的方法, 其特征在于, 所述来自所述对端的第 二消息还包括所述对端的第二消息完整性码, 所述对端的第二消息完整性码 包括所述对端利用所述对端的共享密钥加密所述来自所述对端的第二消息的 摘要信息得到的值;
所述第三生成子单元还包括第二验证子单元;
所述第二验证子单元, 用于利用所述终端自身的共享密钥验证所述对端 的第二消息完整性码。
PCT/CN2014/077444 2014-05-14 2014-05-14 一种终端配对方法及配对终端 WO2015172329A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
CN201480004670.9A CN105359154B (zh) 2014-05-14 2014-05-14 一种终端配对方法及配对终端
JP2016568093A JP6249428B2 (ja) 2014-05-14 2014-05-14 端末ペアリング方法およびペアリング端末
PCT/CN2014/077444 WO2015172329A1 (zh) 2014-05-14 2014-05-14 一种终端配对方法及配对终端
US15/111,525 US10574637B2 (en) 2014-05-14 2014-05-14 Terminal pairing method and pairing terminal
EP14892077.0A EP3082058B1 (en) 2014-05-14 2014-05-14 Terminal matching method and matched terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/077444 WO2015172329A1 (zh) 2014-05-14 2014-05-14 一种终端配对方法及配对终端

Publications (1)

Publication Number Publication Date
WO2015172329A1 true WO2015172329A1 (zh) 2015-11-19

Family

ID=54479152

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/077444 WO2015172329A1 (zh) 2014-05-14 2014-05-14 一种终端配对方法及配对终端

Country Status (5)

Country Link
US (1) US10574637B2 (zh)
EP (1) EP3082058B1 (zh)
JP (1) JP6249428B2 (zh)
CN (1) CN105359154B (zh)
WO (1) WO2015172329A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109906561A (zh) * 2017-08-31 2019-06-18 华为技术有限公司 一种配对方法、取消配对方法、终端设备及外接设备
CN113691975A (zh) * 2021-08-24 2021-11-23 公安部第三研究所 针对蓝牙设备实现安全配对隐身连接的方法、装置、处理器及其计算机可读存储介质

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9779596B2 (en) 2012-10-24 2017-10-03 Apple Inc. Devices and methods for locating accessories of an electronic device
TWI536197B (zh) * 2015-08-28 2016-06-01 匿名性身分識別方法與系統
US10135964B2 (en) * 2016-08-22 2018-11-20 Adobe Systems Incorporated Touch and device orientation-based device pairing
JP2018067854A (ja) * 2016-10-21 2018-04-26 株式会社プラットフィールド 情報通信システム
CN108886685B (zh) * 2016-12-31 2021-02-09 华为技术有限公司 一种终端匹配方法、装置
US10764738B2 (en) * 2017-03-14 2020-09-01 Huawei Technologies Co., Ltd. Wireless communication connection method and terminal
US9949124B1 (en) * 2017-04-24 2018-04-17 Zihan Chen Method and device for authenticating wireless pairing and/or data transfer between two or more electronic devices
US11641563B2 (en) 2018-09-28 2023-05-02 Apple Inc. System and method for locating wireless accessories
CN109462846B (zh) * 2018-12-27 2022-03-18 飞天诚信科技股份有限公司 一种实现蓝牙设备安全配对的方法、系统及蓝牙设备
CN113812175A (zh) * 2019-04-17 2021-12-17 苹果公司 为无线附件共享密钥
US11863671B1 (en) 2019-04-17 2024-01-02 Apple Inc. Accessory assisted account recovery
US10893385B1 (en) 2019-06-07 2021-01-12 Snap Inc. Detection of a physical collision between two client devices in a location sharing system
CN115104283A (zh) * 2020-02-10 2022-09-23 三星电子株式会社 电子设备和用于在电子设备中执行对等服务的方法
US11889302B2 (en) 2020-08-28 2024-01-30 Apple Inc. Maintenance of wireless devices
US12073705B2 (en) 2021-05-07 2024-08-27 Apple Inc. Separation alerts for notification while traveling
US20230208633A1 (en) * 2021-12-28 2023-06-29 Munro Design & Technologies, Llc Methods for creating secret keys with a chief device and systems thereof

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102255896A (zh) * 2010-06-22 2011-11-23 微软公司 联网设备认证、配对以及资源共享
CN102461128A (zh) * 2009-05-04 2012-05-16 苹果公司 基于接近而配对移动设备的方法和装置
US20120317409A1 (en) * 2001-10-03 2012-12-13 Daniel Revel Mobile Printing

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6307936B1 (en) * 1997-09-16 2001-10-23 Safenet, Inc. Cryptographic key management scheme
US6801924B1 (en) * 1999-08-19 2004-10-05 National Semiconductor Corporation Formatting denormal numbers for processing in a pipelined floating point unit
US7427926B2 (en) * 2006-01-26 2008-09-23 Microsoft Corporation Establishing communication between computing-based devices through motion detection
US9843351B2 (en) * 2007-07-26 2017-12-12 Nokia Technologies Oy Gesture activated close-proximity communication
JP2012500403A (ja) * 2008-08-18 2012-01-05 ベックマン コールター, インコーポレイテッド 正規化された10進相当システムおよび方法
US8260261B2 (en) * 2009-08-31 2012-09-04 Qualcomm Incorporated Securing pairing verification of devices with minimal user interfaces
US20110126014A1 (en) * 2009-11-24 2011-05-26 Sony Ericsson Mobile Communications Ab Event Triggered Pairing of Wireless Communication Devices Based on Time Measurements
US8762715B2 (en) 2009-11-24 2014-06-24 Sony Corporation Event triggered pairing of wireless communication devices based on time measurements
US8260269B2 (en) * 2009-11-25 2012-09-04 Visa International Service Association Input device with an accelerometer
US20120128154A1 (en) * 2010-11-23 2012-05-24 Intuit Inc. Establishing a secure proximity pairing between electronic devices
US9813920B2 (en) * 2012-09-19 2017-11-07 Qualcomm, Incorporated Systems and methods for transmitting and receiving discovery messages
US9635603B2 (en) * 2012-11-21 2017-04-25 Intel Corporation Systems and methods for implementing multiple band service discovery
KR101314717B1 (ko) 2013-02-08 2013-10-08 주식회사 씽크풀 애플리케이션 시스템, 제어시스템, 및 사용자 단말기 제어방법
US10244459B2 (en) * 2013-03-08 2019-03-26 Qualcomm Incorporated Systems and methods for synchronization within a neighbor aware network
US8994498B2 (en) * 2013-07-25 2015-03-31 Bionym Inc. Preauthorized wearable biometric device, system and method for use thereof
US10726018B2 (en) * 2014-02-10 2020-07-28 Microsoft Technology Licensing, Llc Semantic matching and annotation of attributes
KR102196245B1 (ko) * 2014-02-10 2020-12-29 삼성전자주식회사 무선 통신 시스템에서 단말 탐색을 위한 채널 구조와 전력 제어 방법 및 장치

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120317409A1 (en) * 2001-10-03 2012-12-13 Daniel Revel Mobile Printing
CN102461128A (zh) * 2009-05-04 2012-05-16 苹果公司 基于接近而配对移动设备的方法和装置
CN102255896A (zh) * 2010-06-22 2011-11-23 微软公司 联网设备认证、配对以及资源共享

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3082058A4 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109906561A (zh) * 2017-08-31 2019-06-18 华为技术有限公司 一种配对方法、取消配对方法、终端设备及外接设备
US11310848B2 (en) 2017-08-31 2022-04-19 Huawei Technologies Co., Ltd. Pairing method, unpairing method, terminal device, and externally-connected device
CN113691975A (zh) * 2021-08-24 2021-11-23 公安部第三研究所 针对蓝牙设备实现安全配对隐身连接的方法、装置、处理器及其计算机可读存储介质
CN113691975B (zh) * 2021-08-24 2024-04-09 公安部第三研究所 针对蓝牙设备实现安全配对隐身连接的方法、装置、处理器及其计算机可读存储介质

Also Published As

Publication number Publication date
EP3082058A1 (en) 2016-10-19
EP3082058A4 (en) 2016-11-23
JP2017511083A (ja) 2017-04-13
US20160344712A1 (en) 2016-11-24
JP6249428B2 (ja) 2017-12-20
EP3082058B1 (en) 2018-02-28
CN105359154B (zh) 2018-06-26
CN105359154A (zh) 2016-02-24
US10574637B2 (en) 2020-02-25

Similar Documents

Publication Publication Date Title
WO2015172329A1 (zh) 一种终端配对方法及配对终端
US10462115B2 (en) System and method for non-replayable communication sessions
US11101999B2 (en) Two-way handshake for key establishment for secure communications
US11502816B2 (en) Generating new encryption keys during a secure communication session
CN109314705B (zh) 使用组加密密钥的用于大规模可伸缩动态多点虚拟私有网络的系统、装置和方法
CN107438230B (zh) 安全无线测距
EP2416524B1 (en) System and method for secure transaction of data between wireless communication device and server
US8750512B2 (en) Authenticating an ephemeral Diffie-Hellman using a trusted third party
US20150326547A1 (en) Method for secure communication using asymmetric &amp; symmetric encryption over insecure communications
EP2491672A2 (en) Low-latency peer session establishment
US10778432B2 (en) End-to-end encryption during a secure communication session
US20190273612A1 (en) Password based key derivation function for ntp
CN109309566B (zh) 一种认证方法、装置、系统、设备及存储介质
CN111654481B (zh) 一种身份认证方法、装置和存储介质
Niu et al. A novel user authentication scheme with anonymity for wireless communications
WO2018076798A1 (zh) 一种传输数据的方法和装置
CN116455561A (zh) 用于轻量装置的嵌入式tls协议
TWI761243B (zh) 群組即時通訊的加密系統和加密方法
CN112887375B (zh) 一种基于区块链的消息验证方法及设备
Mayrhofer et al. An authentication protocol using ultrasonic ranging
CN114765595B (zh) 聊天消息的显示方法、发送方法、装置、电子设备及介质
Zhao et al. Security analysis and enhancement for three‐party password‐based authenticated key exchange protocol
Wu et al. An improved authentication and key agreement scheme for session initial protocol
TWI514189B (zh) 網路認證系統及其方法
CN116458110A (zh) 用于支持用于物联网的密钥管理系统的设备和方法

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201480004670.9

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14892077

Country of ref document: EP

Kind code of ref document: A1

REEP Request for entry into the european phase

Ref document number: 2014892077

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2014892077

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 15111525

Country of ref document: US

ENP Entry into the national phase

Ref document number: 2016568093

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE