CN116847350A - D2D communication method, terminal and medium - Google Patents

D2D communication method, terminal and medium Download PDF

Info

Publication number
CN116847350A
CN116847350A CN202310957331.3A CN202310957331A CN116847350A CN 116847350 A CN116847350 A CN 116847350A CN 202310957331 A CN202310957331 A CN 202310957331A CN 116847350 A CN116847350 A CN 116847350A
Authority
CN
China
Prior art keywords
terminal
hmac
key
message
core network
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202310957331.3A
Other languages
Chinese (zh)
Inventor
王涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202310957331.3A priority Critical patent/CN116847350A/en
Publication of CN116847350A publication Critical patent/CN116847350A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • 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
    • 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/0869Network architectures or network communication protocols for network security for authentication of entities for achieving mutual authentication
    • 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/0876Network architectures or network communication protocols for network security for authentication of entities based on the identity of the terminal or configuration, e.g. MAC address, hardware or software configuration or device fingerprint
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/04Key management, e.g. using generic bootstrapping architecture [GBA]
    • H04W12/047Key management, e.g. using generic bootstrapping architecture [GBA] without using a trusted network node as an anchor
    • H04W12/0471Key exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/70Services for machine-to-machine communication [M2M] or machine type communication [MTC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Power Engineering (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention discloses a D2D communication method, a terminal and a medium, and relates to the technical field of communication, wherein the method applied to a first terminal comprises the following steps: transmitting a broadcast message, wherein the broadcast message carries a first terminal identifier of a first terminal and a first Hash Message Authentication Code (HMAC), the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from core network equipment; under the condition that a discoverer discovery message sent by core network equipment is received and carries a second terminal identifier of a second terminal, carrying out key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message; under the condition that the mutual authentication of the first terminal and the second terminal is successful, a D2D communication link is established with the second terminal; and communicating with a second terminal based on the D2D communication link. The invention can realize quick authentication between terminals in D2D communication and improve the convenience and reliability of authentication.

Description

D2D communication method, terminal and medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a D2D communication method, a terminal, and a medium.
Background
In a 5G authentication and key agreement (5G Authentication and Key Agreement,5G-AKA) scenario, information transfer and exchange between terminals (UEs) may be directly completed through a Device-to-Device (D2D) technology. Communication using D2D technology, while improving overall cellular performance, also presents security threats, such as: impersonation attacks, man-in-the-middle attacks, pick-up attacks, replay attacks, etc., affect the security of the D2D communication link.
Disclosure of Invention
The embodiment of the invention provides a D2D communication method, a terminal and a medium, which are used for solving the problem of lower safety of a D2D communication link.
In order to solve the technical problems, the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a D2D communication method, applied to a first terminal, where the method includes:
transmitting a broadcast message, wherein the broadcast message carries a first terminal identifier and a first Hash Message Authentication Code (HMAC) of the first terminal, the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from core network equipment;
under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, carrying out key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message;
Establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, when the discoverer discovery message sent by the core network device is received and the discoverer discovery message carries the second terminal identifier of the second terminal, performing key exchange authentication with the second terminal based on the public HMAC key carried in the discoverer discovery message, where the key exchange authentication includes:
under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, sending a key exchange request message to the second terminal, wherein the key exchange request message carries first identifier information and second HMAC, the first identifier information comprises the first terminal identifier, the second terminal identifier and first authentication information, and the second HMAC is generated by the first terminal based on the first identifier information and the public HMAC key;
under the condition that a key exchange response message sent by the second terminal is received, acquiring a third HMAC and a first generated HMAC carried by the key exchange response message, wherein the first generated HMAC is generated by the first terminal based on second identification information carried by the key exchange response message and the public HMAC key;
And under the condition that the third HMAC and the first generated HMAC are the same, determining that the first terminal and the second terminal are mutually authenticated successfully.
Optionally, before the sending of the key exchange request message to the second terminal, the method further includes:
generating a first random number;
wherein the first authentication information further includes the first random number.
Optionally, before the sending of the key exchange request message to the second terminal, the method further includes:
performing elliptic curve key exchange operation (ECDH) based on a first private key of the first terminal to generate a first derivative key;
wherein the first authentication information further includes the first derivative key.
Optionally, the key exchange response message further carries a target token, where the target token is acquired from the core network device by the second terminal;
the determining that the first terminal and the second terminal mutually authenticate successfully when the third HMAC and the first generated HMAC are the same comprises:
transmitting first indication information to the core network device when the third HMAC and the first generated HMAC are the same, wherein the first indication information comprises the target token, and the first indication information is used for verifying the validity of mutual authentication between the first terminal and the second terminal by the core network device based on the target token;
And under the condition that second indication information sent by the core network equipment is received, determining that the mutual authentication between the first terminal and the second terminal is successful.
Optionally, before the D2D communication with the second terminal based on the D2D communication link, the method further includes:
acquiring a public symmetric session key;
the D2D communication with the second terminal based on the D2D communication link includes:
D2D communication with the second terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
In a second aspect, an embodiment of the present invention further provides a D2D communication method, applied to a second terminal, where the method includes:
under the condition that a broadcast message sent by a first terminal is received, a D2D connection request message is sent to core network equipment, wherein the broadcast message carries a first hash message authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal and the first HMAC;
Under the condition that a D2D connection request acceptance message sent by the core network equipment is received, carrying out key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request acceptance message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, under the condition that the D2D connection request acceptance message sent by the core network device is received, performing key exchange authentication with the second terminal based on the public HMAC key carried in the D2D connection request acceptance message, where the key exchange authentication includes:
under the condition that a D2D connection request acceptance message sent by the core network equipment is received and a key exchange request message sent by the first terminal is received, acquiring a second HMAC carried by the key exchange request message and a second generated HMAC, wherein the second generated HMAC is generated by the second terminal based on the first identification information carried by the key exchange request message and the public HMAC key;
And under the condition that the second HMAC and the second generated HMAC are the same, sending a key exchange response message to the first terminal, wherein the key exchange response message carries second identification information and third HMAC, the second identification information comprises the first terminal identification, the second terminal identification and second authentication information, and the third HMAC is generated by the second terminal based on the second identification information and the public HMAC key.
Optionally, before the sending of the key exchange response message to the first terminal, the method further includes:
generating a second random number;
wherein the second authentication information further includes the second random number.
Optionally, before the sending of the key exchange response message to the first terminal, the method further includes:
performing elliptic curve key exchange operation (ECDH) based on a second private key of the second terminal to generate a second derivative key;
wherein the second authentication information further includes the second derivative key.
Optionally, the D2D connection request accept message further carries a target token, and the key exchange response message further carries the target token;
the target token is used for verifying the validity of mutual authentication between the first terminal and the second terminal.
Optionally, before the D2D communication with the first terminal based on the D2D communication link, the method further includes:
acquiring a public symmetric session key;
the D2D communication with the first terminal based on the D2D communication link includes:
D2D communication with the first terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
In a third aspect, an embodiment of the present invention further provides a first terminal, where the first terminal includes:
a first sending module, configured to send a broadcast message, where the broadcast message carries a first terminal identifier of the first terminal and a first hashed message authentication code HMAC, where the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from a core network device;
the first authentication module is used for carrying out key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message when the discoverer discovery message sent by the core network equipment is received and the discoverer discovery message carries a second terminal identifier of the second terminal;
The first establishing module is used for establishing a D2D communication link with the second terminal under the condition that the mutual authentication of the first terminal and the second terminal is successful;
and the first communication module is used for communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, the first authentication module includes:
a first sending unit, configured to send a key exchange request message to a second terminal when a discoverer discovery message sent by the core network device is received and the discoverer discovery message carries a second terminal identifier of the second terminal, where the key exchange request message carries first identifier information and second HMAC, the first identifier information includes the first terminal identifier, the second terminal identifier and first authentication information, and the second HMAC is generated by the first terminal based on the first identifier information and the public HMAC key;
a first obtaining unit, configured to obtain, when receiving a key exchange response message sent by the second terminal, a third HMAC and a first generated HMAC carried by the key exchange response message, where the first generated HMAC is generated by the first terminal based on second identification information carried by the key exchange response message and the public HMAC key;
A first determining unit, configured to determine that mutual authentication between the first terminal and the second terminal is successful when the third HMAC and the first generated HMAC are the same.
Optionally, the first terminal further includes:
the first generation module is used for generating a first random number;
wherein the first authentication information further includes the first random number.
Optionally, the first terminal further includes:
the second generation module is used for carrying out elliptic curve key exchange operation (ECDH) based on the first private key of the first terminal to generate a first derivative key;
wherein the first authentication information further includes the first derivative key.
Optionally, the key exchange response message further carries a target token, where the target token is acquired from the core network device by the second terminal;
the first determining unit is configured to:
transmitting first indication information to the core network device when the third HMAC and the first generated HMAC are the same, wherein the first indication information comprises the target token, and the first indication information is used for verifying the validity of mutual authentication between the first terminal and the second terminal by the core network device based on the target token;
And under the condition that second indication information sent by the core network equipment is received, determining that the mutual authentication between the first terminal and the second terminal is successful.
Optionally, the first terminal further includes:
the first acquisition module is used for acquiring a public symmetric session key;
the first communication module is used for:
D2D communication with the second terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
In a fourth aspect, an embodiment of the present invention further provides a second terminal, where the second terminal includes:
the second sending module is configured to send a D2D connection request message to a core network device when receiving a broadcast message sent by a first terminal, where the broadcast message carries a first hash authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal, and the first HMAC;
the second authentication module is used for carrying out key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request accepting message under the condition that the D2D connection request accepting message sent by the core network equipment is received;
The second establishing module is used for establishing a D2D communication link with the second terminal under the condition that the mutual authentication of the first terminal and the second terminal is successful;
and the second communication module is used for communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, the second authentication module includes:
a second obtaining unit, configured to obtain, when a D2D connection request accept message sent by the core network device is received and a key exchange request message sent by the first terminal is received, a second HMAC carried by the key exchange request message and a second generated HMAC, where the second generated HMAC is generated by the second terminal based on the first identification information carried by the key exchange request message and the public HMAC key;
a second sending unit, configured to send a key exchange response message to the first terminal when the second HMAC and the second generated HMAC are the same, where the key exchange response message carries second identification information and third HMAC, the second identification information includes the first terminal identification, the second terminal identification, and second authentication information, and the third HMAC is generated by the second terminal based on the second identification information and the public HMAC key.
Optionally, the second terminal further includes:
the third generation module is used for generating a second random number;
wherein the second authentication information further includes the second random number.
Optionally, the second terminal further includes:
a fourth generation module, configured to perform elliptic curve key exchange operation ECDH based on a second private key of the second terminal, and generate a second derivative key;
wherein the second authentication information further includes the second derivative key.
Optionally, the D2D connection request accept message further carries a target token, and the key exchange response message further carries the target token;
the target token is used for verifying the validity of mutual authentication between the first terminal and the second terminal.
Optionally, the second terminal further includes:
the second acquisition module is used for acquiring the public symmetric session key;
the D2D communication with the first terminal based on the D2D communication link includes:
D2D communication with the first terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
In a fifth aspect, embodiments of the present invention also provide a first terminal, comprising a transceiver and a processor,
the transceiver is used for:
transmitting a broadcast message, wherein the broadcast message carries a first terminal identifier and a first Hash Message Authentication Code (HMAC) of the first terminal, the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from core network equipment;
receiving a discoverer discovery message sent by the core network equipment;
the processor is configured to:
under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, carrying out key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, the transceiver is configured to:
under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, sending a key exchange request message to the second terminal, wherein the key exchange request message carries first identifier information and second HMAC, the first identifier information comprises the first terminal identifier, the second terminal identifier and first authentication information, and the second HMAC is generated by the first terminal based on the first identifier information and the public HMAC key;
Receiving a key exchange response message sent by the second terminal;
the processor is configured to:
under the condition that a key exchange response message sent by the second terminal is received, acquiring a third HMAC and a first generated HMAC carried by the key exchange response message, wherein the first generated HMAC is generated by the first terminal based on second identification information carried by the key exchange response message and the public HMAC key;
and under the condition that the third HMAC and the first generated HMAC are the same, determining that the first terminal and the second terminal are mutually authenticated successfully.
Optionally, the processor is further configured to:
generating a first random number;
wherein the first authentication information further includes the first random number.
Optionally, the processor is further configured to:
performing elliptic curve key exchange operation (ECDH) based on a first private key of the first terminal to generate a first derivative key;
wherein the first authentication information further includes the first derivative key.
Optionally, the key exchange response message further carries a target token, where the target token is acquired from the core network device by the second terminal;
the transceiver is also for:
Transmitting first indication information to the core network device when the third HMAC and the first generated HMAC are the same, wherein the first indication information comprises the target token, and the first indication information is used for verifying the validity of mutual authentication between the first terminal and the second terminal by the core network device based on the target token;
receiving second indication information sent by the core network equipment;
the processor is configured to:
and under the condition that second indication information sent by the core network equipment is received, determining that the mutual authentication between the first terminal and the second terminal is successful.
Optionally, the processor is further configured to:
acquiring a public symmetric session key;
D2D communication with the second terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
In a sixth aspect, embodiments of the present invention also provide a second terminal, comprising a transceiver and a processor,
the transceiver is used for:
under the condition that a broadcast message sent by a first terminal is received, a D2D connection request message is sent to core network equipment, wherein the broadcast message carries a first hash message authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal and the first HMAC;
Receiving a D2D connection request acceptance message sent by the core network equipment;
the processor is configured to:
under the condition that a D2D connection request acceptance message sent by the core network equipment is received, carrying out key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request acceptance message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, the transceiver is configured to:
receiving a D2D connection request acceptance message sent by the core network equipment, and receiving a key exchange request message sent by the first terminal;
the processor is configured to:
under the condition that a D2D connection request acceptance message sent by the core network equipment is received and a key exchange request message sent by the first terminal is received, acquiring a second HMAC carried by the key exchange request message and a second generated HMAC, wherein the second generated HMAC is generated by the second terminal based on the first identification information carried by the key exchange request message and the public HMAC key;
The transceiver is also for:
and under the condition that the second HMAC and the second generated HMAC are the same, sending a key exchange response message to the first terminal, wherein the key exchange response message carries second identification information and third HMAC, the second identification information comprises the first terminal identification, the second terminal identification and second authentication information, and the third HMAC is generated by the second terminal based on the second identification information and the public HMAC key.
Optionally, the processor is further configured to:
generating a second random number;
wherein the second authentication information further includes the second random number.
Optionally, the processor is further configured to:
performing elliptic curve key exchange operation (ECDH) based on a second private key of the second terminal to generate a second derivative key;
wherein the second authentication information further includes the second derivative key.
Optionally, the D2D connection request accept message further carries a target token, and the key exchange response message further carries the target token;
the target token is used for verifying the validity of mutual authentication between the first terminal and the second terminal.
Optionally, the processor is further configured to:
acquiring a public symmetric session key;
D2D communication with the first terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
In a seventh aspect, an embodiment of the present invention further provides a terminal, including: a processor, a memory and a program stored on the memory and executable on the processor, the program implementing the steps of the D2D communication method according to the first aspect when being executed by the processor or the program implementing the steps of the D2D communication method according to the second aspect when being executed by the processor.
In an eighth aspect, embodiments of the present invention further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the D2D communication method according to the first aspect, or which, when executed by a processor, implements the steps of the D2D communication method according to the second aspect.
In the embodiment of the invention, based on the message authentication code HMAC, the secure mutual authentication and key exchange are provided for the terminals on two sides of the D2D communication, so that the security of a D2D communication link is ensured, the time for establishing the link can be reduced, and the data transmission load is lightened.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort to a person of ordinary skill in the art.
Fig. 1 is a schematic flow chart of a D2D communication method according to an embodiment of the present invention;
fig. 2 is a second flowchart of a D2D communication method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a D2D communication system according to an embodiment of the present invention;
fig. 4 is an interaction schematic diagram of a D2D communication method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a first terminal according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a second terminal according to an embodiment of the present invention;
FIG. 7 is a second schematic diagram of a first terminal according to an embodiment of the present invention;
fig. 8 is a second schematic structural diagram of a second terminal according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The embodiment of the invention provides a D2D communication method which is applied to a first terminal, wherein the first terminal can be understood as a terminal for initiating D2D communication by a network system.
Referring to fig. 1, fig. 1 is a schematic flow chart of a D2D communication method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step 101, sending a broadcast message. The broadcast message carries a first terminal identifier of a first terminal and a first Hash message authentication code (Hash-based Message Authentication Code, HMAC), the first HMAC is determined based on the first terminal identifier and a first HMAC key, and the first HMAC key is acquired from the core network device.
In a D2D communication scenario, each terminal may discover any other terminals available nearby by scanning the broadcast message. Correspondingly, each terminal may also be discovered by sending a broadcast message to be found by any other terminal available nearby. The first terminal may share data with other terminals by establishing a D2D connection with the other terminals. In the embodiment of the invention, the broadcast message sent by the first terminal carries the first terminal identifier and the first HMAC of the first terminal.
In particular implementations, the core network device may assign a unique terminal identity to each terminal, e.g., the 5G core network device may assign a 5G globally unique temporary identity (Global Unique Temporary Identifier, 5G-GUTI) to each terminal. The terminal identity is typically a temporary pseudo-identity information that is updated periodically. The broadcast message sent by the first terminal also carries a first HMAC, the first terminal can perform HMAC operation to obtain the first HMAC based on the first terminal identifier and the first HMAC key, and the first HMAC key can be obtained from the core network device by the first terminal.
Step 102, when a discoverer discovery message sent by the core network device is received and the discoverer discovery message carries a second terminal identifier of the second terminal, performing key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message.
In the embodiment of the invention, in order to improve the security and authentication efficiency of communication between terminals in D2D communication, the first terminal carries the first HMAC in the broadcast message.
In particular implementations, optionally, any available terminal, herein denoted as second terminal, in the vicinity of the first terminal may request to establish a D2D connection with the first terminal by sending a D2D connection request message to the core network device after scanning for the broadcast message. The second terminal may carry the first HMAC obtained from the broadcast message of the first terminal, and the first terminal identification of the first terminal and the second terminal identification of the second terminal in the D2D connection request message.
After receiving the D2D connection request message, the core network device may verify the validity of the terminal identifiers of the first terminal and the second terminal, respectively, and in the case that the verification is valid, verify the first HMAC carried by the D2D connection request message by using the first HMAC key of the first terminal, so as to verify the identity of the first terminal. Specifically, the core network device may perform an HMAC operation based on the first HMAC key to obtain a third generated HMAC, and compare the third generated HMAC with the first HMAC. If the third generated HMAC is different from the first HMAC, the core network device may reject the connection request of the second terminal. If the third generated HMAC is the same as the first HMAC, the verification is successful, the core network device may agree with the connection request of the second terminal, and inform the second terminal that the D2D connection can be established with the first terminal by sending a D2D connection request acceptance message to the second terminal. The D2D connection request accept message may carry a public HMAC key allocated by the core network device to the first terminal and the second terminal, and based on the public HMAC key, the first terminal and the second terminal may perform key exchange authentication. And the core network device may inform the first terminal that there is currently a second terminal desiring to establish D2D communication with the first terminal by transmitting a discoverer discovery message to the first terminal. The discovery message of the discovery person can carry the public HMAC key, and the first terminal and the second terminal can perform key exchange authentication based on the public HMAC key.
Optionally, the step 102 includes:
under the condition that a discoverer discovery message sent by core network equipment is received and carries a second terminal identifier of a second terminal, a key exchange request message is sent to the second terminal, the key exchange request message carries first identifier information and second HMAC, the first identifier information comprises a first terminal identifier, the second terminal identifier and first authentication information, and the second HMAC is generated for the first terminal based on the first identifier information and a public HMAC key;
under the condition that a key exchange response message sent by a second terminal is received, acquiring a third HMAC and a first generated HMAC carried by the key exchange response message, wherein the first generated HMAC is generated by the first terminal based on second identification information and a public HMAC key carried by the key exchange response message;
and under the condition that the third HMAC is the same as the first generated HMAC, determining that the first terminal and the second terminal are mutually authenticated successfully.
In this embodiment, the first terminal and the second terminal may interact HMAC information, identification information and authentication information with the key exchange response message through the key exchange request message, so as to improve efficiency and convenience of mutual authentication.
In a specific implementation, the first terminal may carry the first identification information and the second HMAC in a key exchange request message. The first terminal may perform HMAC operation to obtain the second HMAC based on the first terminal identifier, the second terminal identifier, the first authentication information, and the public HMAC key obtained from the finder discovery message. After receiving the key exchange request message, the second terminal may verify the second HMAC using the public HMAC key acquired from the D2D connection request acceptance message. Specifically, the second terminal may perform HMAC operation based on the first identification information and the public HMAC key carried by the key exchange request message to obtain the second generated HMAC. If the calculated second generated HMAC is different from the received and acquired second HMAC, the identity of the first terminal is characterized as being doubtful, the key exchange request message may be tampered in transmission, the authentication of the second terminal to the first terminal fails, and the connection can be refused. If the calculated second generated HMAC is the same as the received and acquired second HMAC, the identity of the first terminal is represented to be real, the key exchange request message is not tampered in transmission, and the second terminal successfully authenticates the first terminal, in which case the second terminal can respond by sending a key exchange response message to the first terminal. The key exchange response message carries second identification information and a third HMAC, and the second terminal may perform HMAC operation to obtain the third HMAC based on the first terminal identification, the second authentication information and the public HMAC key acquired from the D2D connection request acceptance message.
After receiving the key exchange response message, the first terminal may verify the third HMAC using the public HMAC key obtained from the discoverer discovery message. Specifically, the first terminal may perform HMAC operation based on the second identification information and the public HMAC key carried by the key exchange response message to obtain the first generated HMAC. If the calculated first generated HMAC is different from the received and acquired third HMAC, the identity of the second terminal is doubtful, the key exchange request message may be tampered in transmission, the authentication of the first terminal to the second terminal fails, and the connection can be refused. If the calculated first generated HMAC is the same as the third HMAC obtained by receiving, the identity of the second terminal is represented to be real, the key exchange request message is not tampered in transmission, and the first terminal successfully authenticates the second terminal, and in this case, the first terminal and the second terminal successfully mutually authenticate each other.
In an alternative embodiment, before sending the key exchange request message to the second terminal, the D2D communication method further includes: a first random number is generated. Wherein the first authentication information further includes a first random number.
Or, in another alternative embodiment, before sending the key exchange request message to the second terminal, the D2D communication method further includes: an elliptic curve key exchange operation (Elliptic Curve Diffie-Hellman, ECDH) is performed based on the first private key of the first terminal to generate a first derivative key. Wherein the first authentication information further includes a first derivative key.
In the above two embodiments, the first random number and/or the first derivative key based on ECDH operation is added to the first authentication information of the first terminal, so as to further improve the security in the D2D communication link establishment process. In specific implementation, the two embodiments may be combined, for example, after the first random number is generated, the first public key may be generated by using ECDH operation based on the first random number and the first private key of the first terminal, and the first public key may be added to the first authentication information. It should be noted that, correspondingly, a second random number and/or a second derivative key based on ECDH operation may also be added to the second authentication information of the second terminal, so as to further improve security in the D2D communication link establishment process. In a specific implementation, the two embodiments may be combined, for example, after the second random number is generated, the second public key may be generated by using ECDH operation based on the second random number and the second private key of the second terminal, and the second public key may be added to the second authentication information.
In an alternative embodiment, the key exchange response message also carries a target token, and the target token is acquired from the core network device for the second terminal;
And under the condition that the third HMAC and the first generated HMAC are the same, determining that the first terminal and the second terminal are mutually authenticated successfully comprises the following steps:
under the condition that the third HMAC is the same as the first generated HMAC, first indication information is sent to core network equipment, the first indication information comprises a target token, and the first indication information is used for verifying the validity of mutual authentication between the first terminal and the second terminal based on the target token by the core network equipment;
and under the condition that the second indication information sent by the core network equipment is received, determining that the mutual authentication of the first terminal and the second terminal is successful.
In this embodiment, in order to further improve accuracy of mutual authentication between the first terminal and the second terminal, when the core network device issues the D2D connection request accept message to the second device, the core network device may issue the first token to the second terminal through the D2D connection request accept message, where the token may be a random number generated randomly, and this is not limited herein, but the first token is uniquely associated with the second terminal. The second terminal may carry the token in a key exchange response message. After the first terminal and the second terminal are mutually authenticated successfully, the first indication information carrying the token can be sent to the core network so as to inform the core network that the mutual authentication with the second terminal is successful, and the core network equipment can compare the received target token with the first token sent to the second terminal previously. If the target token is different from the first token, the mutual authentication between the first terminal and the second terminal is invalid. If the target token is the same as the first token, the mutual authentication between the first terminal and the second terminal is effective, and the core network equipment can inform the first terminal that the D2D communication link can be established with the second terminal through the second indication information.
Step 103, under the condition that the mutual authentication of the first terminal and the second terminal is successful, a D2D communication link is established with the second terminal.
In an optional embodiment, the first terminal may send third indication information for indicating that the D2D communication is established successfully to the core network device, where the third indication information may carry the first terminal identifier and the second terminal identifier, and the core network device may record D2D connection between the first terminal and the second terminal based on the third indication information, and continuously track all terminals that establish the D2D communication link, so as to avoid a pick-up behavior, and charge communications if necessary.
Step 104, communicating with the second terminal based on the D2D communication link.
In an alternative embodiment, the first terminal may obtain a public symmetric session key and perform D2D communication with the second terminal based on the D2D communication link and the public symmetric session key. In specific implementation, the public symmetric session key is generated by performing ECDH operation based on the first private key of the first terminal and the second private key of the second terminal. For D2D communications based on a common symmetric session key, the sequence number and timestamp may be concatenated with the message prior to encryption to prevent possible replay attacks. Further, in an alternative embodiment, the communication content may be encrypted using an authenticated encryption (Authenticated Encryption with Associated Data, AEAD) password or any other algorithm of associated data common to advanced encryption standard-Galois/Counter Mode (Advanced Encryption Standard-Galois/Counter Mode, AES-CGM) or the like, as desired.
It should be noted that, in the embodiment of the present invention, the core network device may receive the access and mobility management functions (Access and Mobility Management Function, AMF), and the AMF may forward the request messages sent by the terminals respectively to the authentication server function (Authentication Server Function, AUSF), and provide basic access control for the connected terminals, so as to further improve the authentication reliability.
In the embodiment of the invention, based on the message authentication code HMAC, the secure mutual authentication and key exchange are provided for the terminals on two sides of the D2D communication, so that the security of the D2D communication link is ensured, the time for establishing the link can be reduced, and the data transmission load is lightened.
Referring to fig. 2, fig. 2 is a second schematic flow chart of a D2D communication method according to an embodiment of the present invention, which is applied to a second terminal, where the second terminal may be understood as any terminal except a terminal initiating D2D communication in a network system. As shown in fig. 2, the method comprises the steps of:
step 201, under the condition that a broadcast message sent by a first terminal is received, sending a D2D connection request message to core network equipment, wherein the broadcast message carries a first hash message authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal and the first HMAC;
Step 202, under the condition that a D2D connection request acceptance message sent by the core network device is received, performing key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request acceptance message;
step 203, establishing a D2D communication link with the second terminal when the mutual authentication between the first terminal and the second terminal is successful;
and 204, communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, under the condition that the D2D connection request acceptance message sent by the core network device is received, performing key exchange authentication with the second terminal based on the public HMAC key carried in the D2D connection request acceptance message, where the key exchange authentication includes:
under the condition that a D2D connection request acceptance message sent by the core network equipment is received and a key exchange request message sent by the first terminal is received, acquiring a second HMAC carried by the key exchange request message and a second generated HMAC, wherein the second generated HMAC is generated by the second terminal based on the first identification information carried by the key exchange request message and the public HMAC key;
And under the condition that the second HMAC and the second generated HMAC are the same, sending a key exchange response message to the first terminal, wherein the key exchange response message carries second identification information and third HMAC, the second identification information comprises the first terminal identification, the second terminal identification and second authentication information, and the third HMAC is generated by the second terminal based on the second identification information and the public HMAC key.
Optionally, before the sending of the key exchange response message to the first terminal, the method further includes:
generating a second random number;
wherein the second authentication information further includes the second random number.
Optionally, before the sending of the key exchange response message to the first terminal, the method further includes:
performing elliptic curve key exchange operation (ECDH) based on a second private key of the second terminal to generate a second derivative key;
wherein the second authentication information further includes the second derivative key.
Optionally, the D2D connection request accept message further carries a target token, and the key exchange response message further carries the target token;
the target token is used for verifying the validity of mutual authentication between the first terminal and the second terminal.
Optionally, before the D2D communication with the first terminal based on the D2D communication link, the method further includes:
acquiring a public symmetric session key;
the D2D communication with the first terminal based on the D2D communication link includes:
D2D communication with the first terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
It should be noted that, as an implementation manner corresponding to the second terminal in the foregoing method embodiment, a specific implementation manner of the present embodiment may refer to a related description in the foregoing method embodiment, and in order to avoid repeated description, this embodiment is not repeated.
The following describes a specific implementation of this embodiment:
in this embodiment, a system model will be described based on the 3gpp 5g architecture listed in TS 23.501. As shown in fig. 3, the 5G core network (5G Core Network,5GC) is a 3gpp 5G cellular network composed of various elements, and the next generation node B (the next Generation Node B, gNB) is a signal tower providing data transmission between the terminal and the core network. The AMF/security anchor function (Security Anchor Function, SEAF) is a server located in the home or visited network that forwards authentication requests to the AUSF and provides basic access control to the connected UE. The AUSF is an authentication server located in the home network that processes authentication requests and grants permissions to eligible mobile devices. The unified data management (Unified Data Management, UDM)/authentication credentials library and processing function (Authentication Credential Repository and Processing Function, ARPF) is a server in the home network, storing the private keys and other sensitive information of all universal subscriber identity modules (Universal Subscriber Identity Module, USIM) issued by the network operator. The session management function (Session Management Function, SMF) is a server that controls the release of all data sessions for the UE. For terminals in 3GPP access coverage, i.e., in the gNB coverage, 5GC may be accessed through a nearby gNB.
In this embodiment, it is assumed that all user equipments are connected to gNB, and gNBs are connected to 5GC, and the connection between gNB and 5GC is secure. Based on this, the UE and the 5GC can create one secure communication link by mutual authentication under the 5G-AKA protocol. Further, assume that both terminals UE a and UE B successfully complete registration authentication under the coverage of gbbs under the same 5GC.
The security model assumes: all D2D terminals may mutually authenticate UEs, gnbs and 5GC by running 5G-AKA during the registration state, which may connect to a reliable gNB and register with a trusted 5GC. However, in some rare cases, the data stored in the 5GC may be exposed to an attacker due to an incident, a configuration error, or a cause inside the network operator. Thus, the established security model needs to prevent these attackers from recovering the historical communication data in case of any key leakage in the future 5GC. On the other hand, for an attacker outside 5GC, it can be assumed that the D2D communication between two terminals is vulnerable to many security attacks due to the nature of the wireless network. Thus, it is assumed that under the multi-levy model there are many active attackers around that may eavesdrop, intercept, modify and forge any message on the wireless channel. Further, for the pick-up users in all terminals, it is assumed that all broadcast terminals share their data resources, and all discovered terminals are data users.
With all the above assumptions, the protocol involved in this embodiment can implement the following security features:
privacy preserving device discovery: the UE may discover any available D2D UE in the vicinity by scanning the broadcast messages, but the adversary cannot use these broadcast messages for identity tracking or location tracking.
Mutual authentication: the legitimacy and identity of the two UEs should be mutually confirmed so as not to discover man-in-the-middle (Man In The Middle, MTIM) attacks.
Secure data transmission: after the protocol runs successfully, the two parties should obtain the session key. All messages should be encrypted using the AEAD cipher for the session key so that the attacker is not aware of the plaintext.
The session key is completely forward secret: the session key generated in the protocol should be independent of the key known to the 5 GC. Thus, even if the key in the 5GC is exposed in the future, the attacker cannot recover the old message.
Traceability: all D2D connection success events are reported to the 5GC so that the 5GC can keep track of statistics of all D2D UEs. It can prevent the riding of a car and facilitate billing when necessary.
The protocol resists attacks: the protocol should be able to prevent both passive and active attacks. Passive attacks include eavesdropping and location tracking. Active attacks include replay attacks, MITM attacks, and pick-and-place attacks.
In particular, the method can comprise four stages of initialization, device discovery, link establishment and data security transmission. As shown in fig. 4:
step one: initialization stage (Initialzation of UEx): at this stage, the UE and 5GC use 5G-AKA mutual authentication, and after establishing a secure channel according to 3gpp TS 33.501, each UE is assigned a 5G globally unique temporary identity (5G-GUTI). This 5G-GUTI is a temporary pseudo-identity that is updated periodically. For each D2D UE, it first sends a D2D initialization request to the 5GC, indicating that the UE supports D2D functions, then the 5GC will generate and send a unique HMAC key K back to the UE, and assume: elliptic curve parameters required for subsequent elliptic curve cryptography algorithm (Ellipse Curve Cryptography, ECC) based operations are preloaded in the USIM or Mobile Equipment (ME), following similar strategies for 5G subscription hidden identifier (Subscription Concealed Identifier, 5G-sui) operations set forth in 3gpp TS 33501.
Step two: device Discovery phase (device Discovery): in the device discovery phase, it is assumed that UE a has some data to share with other UEs, which can make itself discoverable by broadcasting its own 5G-GUTI with HMAC code over an unsafe idle channel. As the 5G-GUTI changes periodically over time, UE a must also generate a new HMAC code σ locally 1 And updates the broadcast message accordingly. It ensures the legitimacy and freshness of the broadcast information. Thus, UE a issues Wherein sigma 1 =HMAC(GUTI UEA ,K A ),TAG broadcast To discover the message tags of the broadcast.
Step three: link Setup phase (Link Setup): after UE B receives the broadcast message from UE a, they enter a link establishment phase. The following steps are performed:
step 3-1: UE B sends a D2D connection request message to the AMF through the secure channel. It should include a discoverer message tag, UE BUE A +.>And HMAC code sigma received from a broadcast message of UE a 1
Step 3-2: upon receipt of a connection request message from UE B, the AMF checks if the GUTI in the connection request is valid. If they are valid, the AMF further verifies the HMAC code σ with the stored HMAC key for UE A 1 . Otherwise, it will reject the request.
Step 3-3: the AMF allows the UE B to connect to the UE a by sending a connection request accept message. It contains message tag, UE ARandom number TK to be transmitted to UE B during key exchange, and public HMAC key K shared between UE a and UE B AB . UE B may now wait for a key exchange protocol (Diffie-Hellman Key Exchange, DHKE) request message from UE a.
Step 3-4: the AMF informs UE a that there is one UE B found and that it wants to connect with UE a. In the discoverer discovery message, it includes a message tag, UE BAnd a common HMAC key K shared between UE a and UE B AB
Step 3-5: the UE a sends a DHKE request message by performing the following steps:
(1) UE A selects random number aεZn * And a.G is calculated. Where a is the private key of UE a, G is the key generator of ECDH, and a·g represents the public key of ECDH.
(2) UE A sends DHKE to UE B Wherein sigma 2 =HMAC({GUTI UEA ,GUTI UEB ,a·G},K AB )。
Step 3-6: after receiving the DHKE request message sent by the UE a, the UE B performs the following operations:
(1) UE B uses K obtained from AMF AB Calculate HMAC ({ GUTI UEA ,GUTI UEB ,a·G},K AB ). If the calculated HMAC code and sigma carried in the DHKE request message 2 If not, the connection is denied.
(2) UE B selects a random number bεZn * And b.G was calculated. Where B is the private key of UE B, G is the key generator of the ECDH, and b·g represents the public key of the ECDH.
(3) UE B sends DHKE to UE A Wherein sigma 3 =HMAC({GUTI UEA ,GUTI UEB ,b·G,TK},K AB )。
Step 3-7: after receiving the DHKE response message from UE B, UE a uses the K acquired from AMF AB Calculate HMAC ({ GUTI UEA ,GUTI UEB ,b·G,TK},K AB ) If the calculated HMAC code and sigma carried in the DHKE response message 3 If not, the connection is denied.
Step 3-8: after the UE a successfully verifies the DHKE response message, the UE a sends a D2D success indication to the 5GC through the secure channel. The indication message contains a message tag, a GUTI for UE a UEA GUTI of UE B UEB And TK. Finally, the 5GC may check its validity by comparing the received TK value with the TK value previously assigned to UE B.
Step four: data secure communication phase (Secure Data Transmission): the final stage of the scheme is to generate a common symmetric session key and start symmetric key based communication. The ECDH of the formula k=a·b·g can be used for the session key. For subsequent symmetric key based communications, the sequence number and timestamp should be concatenated with the message prior to encryption to prevent possible replay attacks. The string information should then be encrypted using the usual AEAD cipher of AES-GCM or any other algorithm, as required by the different use cases.
Referring to fig. 5, fig. 5 is a first terminal according to an embodiment of the present invention.
As shown in fig. 5, the first terminal 500 includes:
a first sending module 501, configured to send a broadcast message, where the broadcast message carries a first terminal identifier of the first terminal and a first hashed message authentication code HMAC, where the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from a core network device;
A first authentication module 502, configured to, when a discoverer discovery message sent by the core network device is received and the discoverer discovery message carries a second terminal identifier of a second terminal, perform key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message;
a first establishing module 503, configured to establish a D2D communication link with the second terminal when the mutual authentication between the first terminal and the second terminal is successful;
a first communication module 504, configured to communicate with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, the first authentication module 502 includes:
a first sending unit, configured to send a key exchange request message to a second terminal when a discoverer discovery message sent by the core network device is received and the discoverer discovery message carries a second terminal identifier of the second terminal, where the key exchange request message carries first identifier information and second HMAC, the first identifier information includes the first terminal identifier, the second terminal identifier and first authentication information, and the second HMAC is generated by the first terminal based on the first identifier information and the public HMAC key;
A first obtaining unit, configured to obtain, when receiving a key exchange response message sent by the second terminal, a third HMAC and a first generated HMAC carried by the key exchange response message, where the first generated HMAC is generated by the first terminal based on second identification information carried by the key exchange response message and the public HMAC key;
a first determining unit, configured to determine that mutual authentication between the first terminal and the second terminal is successful when the third HMAC and the first generated HMAC are the same.
Optionally, the first terminal 500 further includes:
the first generation module is used for generating a first random number;
wherein the first authentication information further includes the first random number.
Optionally, the first terminal 500 further includes:
the second generation module is used for carrying out elliptic curve key exchange operation (ECDH) based on the first private key of the first terminal to generate a first derivative key;
wherein the first authentication information further includes the first derivative key.
Optionally, the key exchange response message further carries a target token, where the target token is acquired from the core network device by the second terminal;
The first determining unit is configured to:
transmitting first indication information to the core network device when the third HMAC and the first generated HMAC are the same, wherein the first indication information comprises the target token, and the first indication information is used for verifying the validity of mutual authentication between the first terminal and the second terminal by the core network device based on the target token;
and under the condition that second indication information sent by the core network equipment is received, determining that the mutual authentication between the first terminal and the second terminal is successful.
Optionally, the first terminal 500 further includes:
the first acquisition module is used for acquiring a public symmetric session key;
the first communication module is used for:
D2D communication with the second terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
The first terminal 500 can implement the respective processes implemented by the method embodiment shown in fig. 1, and achieve the same beneficial effects, and in order to avoid repetition, a detailed description is omitted here.
Referring to fig. 6, fig. 6 is a second terminal according to an embodiment of the present invention.
As shown in fig. 6, the second terminal 600 includes:
a second sending module 601, configured to send a D2D connection request message to a core network device when receiving a broadcast message sent by a first terminal, where the broadcast message carries a first hash authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal, and the first HMAC;
a second authentication module 602, configured to, when receiving a D2D connection request accept message sent by the core network device, perform key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request accept message;
a second establishing module 603, configured to establish a D2D communication link with the second terminal when the mutual authentication between the first terminal and the second terminal is successful;
a second communication module 604, configured to communicate with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, the second authentication module 602 includes:
a second obtaining unit, configured to obtain, when a D2D connection request accept message sent by the core network device is received and a key exchange request message sent by the first terminal is received, a second HMAC carried by the key exchange request message and a second generated HMAC, where the second generated HMAC is generated by the second terminal based on the first identification information carried by the key exchange request message and the public HMAC key;
A second sending unit, configured to send a key exchange response message to the first terminal when the second HMAC and the second generated HMAC are the same, where the key exchange response message carries second identification information and third HMAC, the second identification information includes the first terminal identification, the second terminal identification, and second authentication information, and the third HMAC is generated by the second terminal based on the second identification information and the public HMAC key.
Optionally, the second terminal 600 further includes:
the third generation module is used for generating a second random number;
wherein the second authentication information further includes the second random number.
Optionally, the second terminal 600 further includes:
a fourth generation module, configured to perform elliptic curve key exchange operation ECDH based on a second private key of the second terminal, and generate a second derivative key;
wherein the second authentication information further includes the second derivative key.
Optionally, the D2D connection request accept message further carries a target token, and the key exchange response message further carries the target token;
the target token is used for verifying the validity of mutual authentication between the first terminal and the second terminal.
Optionally, the second terminal 600 further includes:
the second acquisition module is used for acquiring the public symmetric session key;
the D2D communication with the first terminal based on the D2D communication link includes:
D2D communication with the first terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
The second terminal 600 can implement the respective processes implemented by the method embodiment shown in fig. 2, and achieve the same beneficial effects, and in order to avoid repetition, a detailed description is omitted here.
The embodiment of the invention also provides a first terminal, which comprises: the program is executed by the processor to realize each process of the D2D communication method embodiment applied to the first terminal, and the same technical effects can be achieved, so that repetition is avoided, and detailed description is omitted.
Specifically, referring to fig. 7, the embodiment of the present invention further provides a first terminal, which includes a bus 701, a transceiver 702, an antenna 703, a bus interface 704, a processor 705, and a memory 706.
The transceiver 702 is configured to:
transmitting a broadcast message, wherein the broadcast message carries a first terminal identifier and a first Hash Message Authentication Code (HMAC) of the first terminal, the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from core network equipment;
receiving a discoverer discovery message sent by the core network equipment;
the processor 705 is configured to:
under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, carrying out key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, the transceiver 702 is configured to:
under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, sending a key exchange request message to the second terminal, wherein the key exchange request message carries first identifier information and second HMAC, the first identifier information comprises the first terminal identifier, the second terminal identifier and first authentication information, and the second HMAC is generated by the first terminal based on the first identifier information and the public HMAC key;
Receiving a key exchange response message sent by the second terminal;
the processor 705 is configured to:
under the condition that a key exchange response message sent by the second terminal is received, acquiring a third HMAC and a first generated HMAC carried by the key exchange response message, wherein the first generated HMAC is generated by the first terminal based on second identification information carried by the key exchange response message and the public HMAC key;
and under the condition that the third HMAC and the first generated HMAC are the same, determining that the first terminal and the second terminal are mutually authenticated successfully.
Optionally, the processor 705 is further configured to:
generating a first random number;
wherein the first authentication information further includes the first random number.
Optionally, the processor 705 is further configured to:
performing elliptic curve key exchange operation (ECDH) based on a first private key of the first terminal to generate a first derivative key;
wherein the first authentication information further includes the first derivative key.
Optionally, the key exchange response message further carries a target token, where the target token is acquired from the core network device by the second terminal;
the transceiver 702 is also configured to:
Transmitting first indication information to the core network device when the third HMAC and the first generated HMAC are the same, wherein the first indication information comprises the target token, and the first indication information is used for verifying the validity of mutual authentication between the first terminal and the second terminal by the core network device based on the target token;
receiving second indication information sent by the core network equipment;
the processor 705 is configured to:
and under the condition that second indication information sent by the core network equipment is received, determining that the mutual authentication between the first terminal and the second terminal is successful.
Optionally, the processor 705 is further configured to:
acquiring a public symmetric session key;
D2D communication with the second terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
In FIG. 7, a bus architecture (represented by bus 701), the bus 701 may include any number of interconnected buses and bridges, with the bus 701 linking together various circuits, including one or more processors 705, as represented by the processor 705, and memory, as represented by the memory 706. The bus 701 may also link together various other circuits such as peripheral devices, voltage regulators, power management circuits, etc., which are well known in the art and, therefore, will not be described further herein. Bus interface 704 provides an interface between bus 701 and transceiver 702. The transceiver 702 may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 705 is transmitted over a wireless medium via the antenna 703, and further, the antenna 703 receives and transmits data to the processor 705.
The processor 705 is responsible for managing the bus 701 and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 706 may be used to store data used by processor 705 in performing operations.
Alternatively, the processor 705 may be a CPU, ASIC, FPGA or CPLD.
The embodiment of the invention also provides a second terminal, which comprises: the program is executed by the processor to realize each process of the D2D communication method embodiment applied to the second terminal, and the same technical effects can be achieved, so that repetition is avoided, and detailed description is omitted.
Specifically, referring to fig. 8, the embodiment of the present invention further provides a second terminal, which includes a bus 801, a transceiver 802, an antenna 803, a bus interface 804, a processor 805, and a memory 806.
The transceiver 802 is configured to:
under the condition that a broadcast message sent by a first terminal is received, a D2D connection request message is sent to core network equipment, wherein the broadcast message carries a first hash message authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal and the first HMAC;
Receiving a D2D connection request acceptance message sent by the core network equipment;
the processor 805 is configured to:
under the condition that a D2D connection request acceptance message sent by the core network equipment is received, carrying out key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request acceptance message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
Optionally, the core network device includes an AMF.
Optionally, the transceiver 802 is configured to:
receiving a D2D connection request acceptance message sent by the core network equipment, and receiving a key exchange request message sent by the first terminal;
the processor 805 is configured to:
under the condition that a D2D connection request acceptance message sent by the core network equipment is received and a key exchange request message sent by the first terminal is received, acquiring a second HMAC carried by the key exchange request message and a second generated HMAC, wherein the second generated HMAC is generated by the second terminal based on the first identification information carried by the key exchange request message and the public HMAC key;
The transceiver 802 is also configured to:
and under the condition that the second HMAC and the second generated HMAC are the same, sending a key exchange response message to the first terminal, wherein the key exchange response message carries second identification information and third HMAC, the second identification information comprises the first terminal identification, the second terminal identification and second authentication information, and the third HMAC is generated by the second terminal based on the second identification information and the public HMAC key.
Optionally, the processor 805 is further configured to:
generating a second random number;
wherein the second authentication information further includes the second random number.
Optionally, the processor 805 is further configured to:
performing elliptic curve key exchange operation (ECDH) based on a second private key of the second terminal to generate a second derivative key;
wherein the second authentication information further includes the second derivative key.
Optionally, the D2D connection request accept message further carries a target token, and the key exchange response message further carries the target token;
the target token is used for verifying the validity of mutual authentication between the first terminal and the second terminal.
Optionally, the processor 805 is further configured to:
acquiring a public symmetric session key;
D2D communication with the first terminal based on the D2D communication link and the common symmetric session key.
Optionally, the public symmetric session key performs ECDH generation based on the first private key of the first terminal and the second private key of the second terminal.
In fig. 8, a bus architecture (represented by bus 801), the bus 801 may include any number of interconnected buses and bridges, with the bus 801 linking together various circuits, including one or more processors 805, as represented by the processor 805, and memory, as represented by the memory 806. The bus 801 may also link together various other circuits such as peripheral devices, voltage regulators, power management circuits, etc., which are well known in the art and, therefore, will not be described further herein. Bus interface 804 provides an interface between bus 801 and transceiver 802. The transceiver 802 may be one element or may be multiple elements, such as multiple receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 805 is transmitted over a wireless medium via the antenna 803, and further, the antenna 803 also receives data and transmits the data to the processor 805.
The processor 805 is responsible for managing the bus 801 and general processing, and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 806 may be used to store data used by the processor 805 in performing operations.
Alternatively, the processor 805 may be CPU, ASIC, FPGA or a CPLD.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the processes of the above D2D communication method embodiment, and can achieve the same technical effects, so that repetition is avoided, and no further description is given here. Wherein the computer readable storage medium is such as ROM, RAM, magnetic or optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.

Claims (22)

1. A D2D communication method, applied to a first terminal, the method comprising:
transmitting a broadcast message, wherein the broadcast message carries a first terminal identifier and a first Hash Message Authentication Code (HMAC) of the first terminal, the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from core network equipment;
under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, carrying out key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
2. The method of claim 1, wherein the core network device comprises an AMF.
3. The method according to claim 1 or 2, wherein, in the case that a discoverer discovery message sent by the core network device is received and the discoverer discovery message carries a second terminal identifier of a second terminal, performing key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message, includes:
Under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, sending a key exchange request message to the second terminal, wherein the key exchange request message carries first identifier information and second HMAC, the first identifier information comprises the first terminal identifier, the second terminal identifier and first authentication information, and the second HMAC is generated by the first terminal based on the first identifier information and the public HMAC key;
under the condition that a key exchange response message sent by the second terminal is received, acquiring a third HMAC and a first generated HMAC carried by the key exchange response message, wherein the first generated HMAC is generated by the first terminal based on second identification information carried by the key exchange response message and the public HMAC key;
and under the condition that the third HMAC and the first generated HMAC are the same, determining that the first terminal and the second terminal are mutually authenticated successfully.
4. A method according to claim 3, wherein before said sending a key exchange request message to said second terminal, the method further comprises:
Generating a first random number;
wherein the first authentication information further includes the first random number.
5. A method according to claim 3, wherein before said sending a key exchange request message to said second terminal, the method further comprises:
performing elliptic curve key exchange operation (ECDH) based on a first private key of the first terminal to generate a first derivative key;
wherein the first authentication information further includes the first derivative key.
6. A method according to claim 3, wherein the key exchange response message also carries a target token, the target token being obtained from the core network device for the second terminal;
the determining that the first terminal and the second terminal mutually authenticate successfully when the third HMAC and the first generated HMAC are the same comprises:
transmitting first indication information to the core network device when the third HMAC and the first generated HMAC are the same, wherein the first indication information comprises the target token, and the first indication information is used for verifying the validity of mutual authentication between the first terminal and the second terminal by the core network device based on the target token;
And under the condition that second indication information sent by the core network equipment is received, determining that the mutual authentication between the first terminal and the second terminal is successful.
7. The method of claim 1, wherein the D2D communication link is based on the D2D communication link, the method further comprising, prior to D2D communication with the second terminal:
acquiring a public symmetric session key;
the D2D communication with the second terminal based on the D2D communication link includes:
D2D communication with the second terminal based on the D2D communication link and the common symmetric session key.
8. The method of claim 7, wherein the public symmetric session key is ECDH generated based on a first private key of the first terminal and a second private key of the second terminal.
9. A D2D communication method, applied to a second terminal, the method comprising:
under the condition that a broadcast message sent by a first terminal is received, a D2D connection request message is sent to core network equipment, wherein the broadcast message carries a first hash message authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal and the first HMAC;
Under the condition that a D2D connection request acceptance message sent by the core network equipment is received, carrying out key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request acceptance message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
10. The method of claim 9, wherein the core network device comprises an AMF.
11. The method according to claim 9 or 10, wherein, in the case of receiving the D2D connection request accept message sent by the core network device, performing key exchange authentication with the second terminal based on the public HMAC key carried in the D2D connection request accept message, including:
under the condition that a D2D connection request acceptance message sent by the core network equipment is received and a key exchange request message sent by the first terminal is received, acquiring a second HMAC carried by the key exchange request message and a second generated HMAC, wherein the second generated HMAC is generated by the second terminal based on the first identification information carried by the key exchange request message and the public HMAC key;
And under the condition that the second HMAC and the second generated HMAC are the same, sending a key exchange response message to the first terminal, wherein the key exchange response message carries second identification information and third HMAC, the second identification information comprises the first terminal identification, the second terminal identification and second authentication information, and the third HMAC is generated by the second terminal based on the second identification information and the public HMAC key.
12. The method of claim 11, wherein prior to the sending the key exchange response message to the first terminal, the method further comprises:
generating a second random number;
wherein the second authentication information further includes the second random number.
13. The method of claim 11, wherein prior to the sending the key exchange response message to the first terminal, the method further comprises:
performing elliptic curve key exchange operation (ECDH) based on a second private key of the second terminal to generate a second derivative key;
wherein the second authentication information further includes the second derivative key.
14. The method of claim 11, wherein the D2D connection request accept message further carries a target token, and wherein the key exchange response message further carries the target token;
The target token is used for verifying the validity of mutual authentication between the first terminal and the second terminal.
15. The method of claim 9, wherein the D2D communication link is based on the D2D communication link, the method further comprising, prior to D2D communication with the first terminal:
acquiring a public symmetric session key;
the D2D communication with the first terminal based on the D2D communication link includes:
D2D communication with the first terminal based on the D2D communication link and the common symmetric session key.
16. The method of claim 15, wherein the public symmetric session key is ECDH generated based on a first private key of the first terminal and a second private key of the second terminal.
17. A first terminal, the first terminal comprising:
a first sending module, configured to send a broadcast message, where the broadcast message carries a first terminal identifier of the first terminal and a first hashed message authentication code HMAC, where the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from a core network device;
The first authentication module is used for carrying out key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message when the discoverer discovery message sent by the core network equipment is received and the discoverer discovery message carries a second terminal identifier of the second terminal;
the first establishing module is used for establishing a D2D communication link with the second terminal under the condition that the mutual authentication of the first terminal and the second terminal is successful;
and the first communication module is used for communicating with the second terminal based on the D2D communication link.
18. A second terminal, the second terminal comprising:
the second sending module is configured to send a D2D connection request message to a core network device when receiving a broadcast message sent by a first terminal, where the broadcast message carries a first hash authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal, and the first HMAC;
the second authentication module is used for carrying out key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request accepting message under the condition that the D2D connection request accepting message sent by the core network equipment is received;
The second establishing module is used for establishing a D2D communication link with the second terminal under the condition that the mutual authentication of the first terminal and the second terminal is successful;
and the second communication module is used for communicating with the second terminal based on the D2D communication link.
19. A first terminal comprising a transceiver and a processor,
the transceiver is used for:
transmitting a broadcast message, wherein the broadcast message carries a first terminal identifier and a first Hash Message Authentication Code (HMAC) of the first terminal, the first HMAC is generated based on the first terminal identifier and a first HMAC key of the first terminal, and the first HMAC key is acquired from core network equipment;
receiving a discoverer discovery message sent by the core network equipment;
the processor is configured to:
under the condition that a discoverer discovery message sent by the core network equipment is received and carries a second terminal identifier of a second terminal, carrying out key exchange authentication with the second terminal based on a public HMAC key carried in the discoverer discovery message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
And communicating with the second terminal based on the D2D communication link.
20. A second terminal comprising a transceiver and a processor,
the transceiver is used for:
under the condition that a broadcast message sent by a first terminal is received, a D2D connection request message is sent to core network equipment, wherein the broadcast message carries a first hash message authentication code HMAC, and the D2D connection request message carries a first terminal identifier of the first terminal, a second terminal identifier of the second terminal and the first HMAC;
receiving a D2D connection request acceptance message sent by the core network equipment;
the processor is configured to:
under the condition that a D2D connection request acceptance message sent by the core network equipment is received, carrying out key exchange authentication with the first terminal based on a public HMAC key carried in the D2D connection request acceptance message;
establishing a D2D communication link with the second terminal under the condition that the first terminal and the second terminal are mutually authenticated;
and communicating with the second terminal based on the D2D communication link.
21. A terminal, comprising: a processor, a memory and a program stored on the memory and executable on the processor, the program implementing the steps of the D2D communication method according to any of claims 1-8 when executed by the processor or the steps of the D2D communication method according to any of claims 9-16 when executed by the processor.
22. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the D2D communication method according to any of claims 1-8 or which, when executed by a processor, implements the steps of the D2D communication method according to any of claims 9-16.
CN202310957331.3A 2023-08-01 2023-08-01 D2D communication method, terminal and medium Pending CN116847350A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310957331.3A CN116847350A (en) 2023-08-01 2023-08-01 D2D communication method, terminal and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310957331.3A CN116847350A (en) 2023-08-01 2023-08-01 D2D communication method, terminal and medium

Publications (1)

Publication Number Publication Date
CN116847350A true CN116847350A (en) 2023-10-03

Family

ID=88174418

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310957331.3A Pending CN116847350A (en) 2023-08-01 2023-08-01 D2D communication method, terminal and medium

Country Status (1)

Country Link
CN (1) CN116847350A (en)

Similar Documents

Publication Publication Date Title
US11496320B2 (en) Registration method and apparatus based on service-based architecture
EP4089977B1 (en) Key acquisition method and device
US8559633B2 (en) Method and device for generating local interface key
US10841784B2 (en) Authentication and key agreement in communication network
US20190156019A1 (en) Secure authentication of devices for internet of things
CN102215474B (en) Method and device for carrying out authentication on communication equipment
JP6632713B2 (en) Method and apparatus for establishing a direct communication key
CN104145465B (en) The method and apparatus of bootstrapping based on group in machine type communication
CN114268943B (en) Authorization method and device
CN102111766B (en) Network accessing method, device and system
US11778458B2 (en) Network access authentication method and device
US11997078B2 (en) Secured authenticated communication between an initiator and a responder
CN102934470A (en) Method and apparatus for binding subscriber authentication and device authentication in communication systems
CN101946536A (en) Application specific master key selection in evolved networks
WO2012174959A1 (en) Group authentication method, system and gateway in machine-to-machine communication
US9807088B2 (en) Method and network node for obtaining a permanent identity of an authenticating wireless device
KR102119586B1 (en) Systems and methods for relaying data over communication networks
Pratas et al. Massive machine-type communication (mMTC) access with integrated authentication
JP2016519873A (en) Establishing secure voice communication using a generic bootstrapping architecture
US20230396602A1 (en) Service authorization method and system, and communication apparatus
Lee et al. An efficient authentication protocol for mobile communications
TWI685267B (en) Method and equipment for access control
KR101431214B1 (en) Mutual authentication method and system with network in machine type communication, key distribution method and system, and uicc and device pair authentication method and system in machine type communication
Lee et al. Physical layer aided authentication and key agreement for the Internet of Things
CN116847350A (en) D2D communication method, terminal and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination