Security mode establishment method, equipment and medium

By determining the cryptographic algorithm suite between the target AMF and the terminal of the 5G communication network, deriving the NAS key, and encrypting the NAS security mode establishment message, the problem of high authentication difficulty in the 5G communication network is solved, and multi-protocol implementation is achieved. compatibility and security.

CN118803744APending Publication Date: 2024-10-18CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311099073.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-29
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

During the establishment of the non-access layer (NAS) security model of the existing 5G communication network, the key compatibility is low, which makes authentication and authentication under different network protocols more difficult, and commercial cryptographic algorithms and algorithm negotiation are not supported.

Method used

By determining the cipher algorithm suite between the target AMF and the endpoint, derive the NAS encryption key (KNASenc) and integrity protection key (KNASint), and use these keys to encrypt and protect the NAS security mode establishment message, supporting multiple Algorithm negotiation for algorithm and key derivation improves NAS key compatibility.

Benefits of technology

It achieves adaptive compatibility of authentication and authentication under different network protocols, improves the compatibility of NAS keys, supports commercial passwords and international cryptographic algorithms, and adapts to more protocols.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118803744A_ABST
    Figure CN118803744A_ABST
Patent Text Reader

Abstract

The invention discloses a security mode establishment method, equipment and a medium, and relates to the technical field of communication. The method applied to a target AMF comprises the steps of determining a first cryptographic algorithm suite according to an algorithm support state of the target AMF when authentication of a terminal succeeds; a first cryptographic algorithm suite is used, and KNASenc and KNASint are derived through the first KAMF; an NAS security mode establishment message is sent to the terminal, and encryption and integrity protection are performed on the NAS security mode establishment message by using KNASenc and KNASint, the NAS security mode establishment message carries a first identifier, and the first identifier is used for indicating the first cryptographic algorithm suite; under the condition that an NAS security mode establishment completion message sent by the terminal is received, the NAS security mode establishment completion message is decrypted, and NAS integrity verification is carried out; and under the condition that the integrity verification of the NAS security mode establishment completion message is successful, establishing a security mode with the terminal. According to the invention, the compatibility of the NAS authentication key can be improved, and the method can adapt to more different network protocols.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a method, device and medium for establishing a security mode. Background Art

[0002] With the rapid development of Internet technology, the network security risks of information systems continue to increase, and the threat challenges are becoming increasingly severe. Cryptographic security is an important foundation for information security and can be used to effectively protect the data security of network information systems. Commercial encryption is the core technology and important means to protect network information systems.

[0003] At present, the security mode of the non-access stratum (NAS) in the 5G communication network authentication protocol is established using an international cryptographic algorithm, which is usually incompatible with commercial encryption, does not support other algorithms, and does not support algorithm negotiation. In the case of low compatibility, it is difficult to complete authentication under different network protocols. Summary of the invention

[0004] The embodiments of the present invention provide a method, device and medium for establishing a security mode, which can solve the problem in the related art that the key compatibility is low during the security mode establishment process, resulting in high difficulty in authentication under different network protocols.

[0005] In a first aspect, an embodiment of the present invention provides a security mode establishment method, which is applied to a target AMF, and the method includes:

[0006] In the case where the terminal authentication is successful, determining the first cryptographic algorithm suite according to the algorithm support status of the target AMF;

[0007] Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0008] Send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASint Encrypting and integrity protecting the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate the first cryptographic algorithm suite;

[0009] Upon receiving a NAS security mode establishment completion message sent by the terminal, decrypting the NAS security mode establishment completion message and performing NAS integrity verification;

[0010] In case that the NAS integrity verification of the NAS security mode establishment completion message is successful, a security mode is established with the terminal.

[0011] Optionally, determining the first cryptographic algorithm suite according to the algorithm support status of the target AMF includes any one of the following:

[0012] If the target AMF supports multiple cryptographic algorithm suites and is configured with a first algorithm identifier corresponding to NAS layer key derivation, determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0013] If the target AMF supports multiple cryptographic algorithm suites but is not configured with a first algorithm identifier corresponding to NAS layer key derivation, generate a first algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0014] If the target AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the target AMF is determined as the first cryptographic algorithm suite.

[0015] Optionally, generating a first algorithm identifier corresponding to NAS layer key derivation according to a preset strategy includes:

[0016] In a case where the target AMF is configured with a second algorithm identifier corresponding to AKA authentication and key derivation, the first algorithm identifier is generated according to the second algorithm identifier.

[0017] Optionally, before generating the first algorithm identifier corresponding to the NAS layer key derivation according to the preset strategy, the method further includes:

[0018] Receive the second algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

[0019] Optionally, after sending the NAS security mode establishment message to the terminal, the method further includes:

[0020] Decrypts NAS uplink transmissions.

[0021] Optionally, after receiving the NAS security mode establishment completion message sent by the terminal, the method further includes:

[0022] Encrypt NAS downlink transmission.

[0023] Optionally, the method further comprises:

[0024] Receiving an initial NAS message sent by a terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal;

[0025] When the initial NAS message carries a NAS container and the integrity check of the initial message succeeds, obtaining a security context of the terminal, wherein the encrypted complete initial NAS message is stored in the NAS container;

[0026] Use Target K AMF Decoding the NAS container to obtain the initial NAS message;

[0027] Sending a first response message of the initial NAS message to the terminal;

[0028] Among them, the target K AMF For the first K AMF or the second K AMF , the second K AMF For the first K AMF The derived K AMF .

[0029] Optionally, the obtaining the security context of the terminal includes any one of the following:

[0030] In a case where the security context of the terminal is locally queried according to the GUTI, locally querying and acquiring the security context of the terminal;

[0031] When the security context of the terminal is not locally queried according to the GUTI, a first request message is sent to the source AMF, and when a second response message sent by the source AMF is received, and the second response message carries the permanent identifier SPUI of the terminal, the security context of the terminal sent by the source AMF is received, and the first request message carries the GUTI.

[0032] Optionally, the use target K AMF Decoding the NAS container to obtain the initial NAS message includes any one of the following:

[0033] The second response message also carries a second K AMF In this case, use the second K AMF The NAS container is decoded to obtain the initial NAS message.

[0034] The second response message does not carry the second KAMF In the case of using the first K AMF The NAS container is decoded to obtain the initial NAS message.

[0035] In a second aspect, an embodiment of the present invention provides a full-mode establishment method, which is applied to a terminal, and the method includes:

[0036] receiving a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite;

[0037] Decrypt the NAS security mode establishment message and perform NAS integrity verification;

[0038] Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0039] If the NAS integrity verification of the NAS security mode establishment message is successful, a NAS security mode establishment complete message is sent to the target AMF, and the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

[0040] Optionally, the method further comprises:

[0041] In case the NAS integrity verification of the NAS security mode setup message is successful, the NAS uplink transmission is encrypted and the NAS downlink transmission is decrypted.

[0042] In a third aspect, an embodiment of the present invention provides a method for establishing a security mode, which is applied to a source AMF, and the method includes:

[0043] Upon receiving the first request message sent by the target AMF, query whether there is a security context of the terminal locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message, and the first request message also carries an initial NAS message;

[0044] When it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

[0045] Optionally, the method further comprises:

[0046] Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF;

[0047] Change the first K in the source AMF AMF In the case of using the second cryptographic algorithm suite, from the first K AMF The second K is derived from AMF ;

[0048] The second response message also carries the second K AMF , the second K AMF Used to decode the complete initial NAS message in a NAS container.

[0049] Optionally, determining the second cryptographic algorithm suite according to the algorithm support status of the source AMF includes any one of the following:

[0050] If the source AMF supports multiple cryptographic algorithm suites and is configured with a third algorithm identifier corresponding to NAS layer key derivation, the cryptographic algorithm suite identified by the third algorithm identifier is used to determine the second cryptographic algorithm suite, and the second response message also carries the third algorithm identifier;

[0051] If the source AMF supports multiple cryptographic algorithm suites but is not configured with a third algorithm identifier corresponding to NAS layer key derivation, generate a third algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and use the cryptographic algorithm suite identified by the third algorithm identifier as the target algorithm suite, and the second response message also carries the third algorithm identifier;

[0052] If the source AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the source AMF is determined as the second cryptographic algorithm suite.

[0053] Optionally, generating a third algorithm identifier corresponding to NAS layer key derivation according to a preset strategy includes:

[0054] In a case where the source AMF is configured with a fourth algorithm identifier corresponding to AKA authentication and key derivation, the third algorithm identifier is generated according to the fourth algorithm identifier.

[0055] Optionally, before generating, according to a preset strategy, a third algorithm identifier corresponding to NAS layer key derivation, the method further includes:

[0056] Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

[0057] Optionally, the method further includes any one of the following:

[0058] After the query finds that the security context of the terminal exists locally, and the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first K AMF In the case of a fault, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first K AMF , the SPUI is used to instruct the target AMF to receive the security context of the terminal, the first K AMF Used to decode the complete initial NAS message in the NAS container;

[0059] When it is found that the security context of the terminal does not exist locally, and / or the NAS integrity verification of the initial NAS message fails, a second response message is sent to the target AMF, and the second response message carries first indication information, and the first indication information is used to indicate that the security context of the terminal has not been queried.

[0060] In a fourth aspect, an embodiment of the present invention provides a target AMF, wherein the target AMF includes:

[0061] A first determination module is used to determine a first cryptographic algorithm suite according to the algorithm support status of the target AMF when the terminal authentication is successful;

[0062] A first derivation module is used to use the first cryptographic algorithm suite to obtain a first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0063] The first sending module is used to send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASintEncrypting and integrity protecting the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate the first cryptographic algorithm suite;

[0064] A first verification module is used to decrypt the NAS security mode establishment completion message sent by the terminal and perform NAS integrity verification;

[0065] The first establishing module is used to establish a security mode with the terminal when the NAS integrity verification of the NAS security mode establishment completion message is successful.

[0066] Optionally, the first determining module is used for any of the following:

[0067] If the target AMF supports multiple cryptographic algorithm suites and is configured with a first algorithm identifier corresponding to NAS layer key derivation, determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0068] If the target AMF supports multiple cryptographic algorithm suites but is not configured with a first algorithm identifier corresponding to NAS layer key derivation, generate a first algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0069] If the target AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the target AMF is determined as the first cryptographic algorithm suite.

[0070] Optionally, the first determining module is used to:

[0071] In a case where the target AMF is configured with a second algorithm identifier corresponding to AKA authentication and key derivation, the first algorithm identifier is generated according to the second algorithm identifier.

[0072] Optionally, the target AMF further includes:

[0073] The first receiving module is used to receive a second algorithm identifier corresponding to AKA authentication and key derivation sent by a user data manager UDM.

[0074] Optionally, the target AMF further includes:

[0075] The first decryption module is used to decrypt the transmission of the NAS uplink.

[0076] Optionally, the target AMF further includes:

[0077] The first encryption module is used to encrypt the transmission of the NAS downlink.

[0078] Optionally, the target AMF further includes:

[0079] A second receiving module is used to receive an initial NAS message sent by a terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal;

[0080] A first acquisition module is configured to acquire a security context of the terminal if the initial NAS message carries a NAS container and the initial message integrity check succeeds, wherein the NAS container stores an encrypted complete initial NAS message;

[0081] The first decoding module is used to use the target K AMF Decoding the NAS container to obtain the initial NAS message;

[0082] A second sending module, configured to send a first response message of the initial NAS message to the terminal;

[0083] Among them, the target K AMF For the first K AMF or the second K AMF , the second K AMF For the first K AMF The derived K AMF .

[0084] Optionally, the first acquisition module is used for any of the following:

[0085] In a case where the security context of the terminal is locally queried according to the GUTI, locally querying and acquiring the security context of the terminal;

[0086] When the security context of the terminal is not locally queried according to the GUTI, a first request message is sent to the source AMF, and when a second response message sent by the source AMF is received, and the second response message carries the permanent identifier SPUI of the terminal, the security context of the terminal sent by the source AMF is received, and the first request message carries the GUTI.

[0087] Optionally, the first decoding module is used for any of the following:

[0088] The second response message also carries a second K AMF In this case, use the second K AMF The NAS container is decoded to obtain the initial NAS message.

[0089] The second response message does not carry the second K AMF In the case of using the first K AMF The NAS container is decoded to obtain the initial NAS message.

[0090] In a fifth aspect, an embodiment of the present invention provides a terminal, the terminal comprising:

[0091] A third receiving module is configured to receive a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite;

[0092] A second decryption module, used to decrypt the NAS security mode establishment message and perform NAS integrity verification;

[0093] The second derivation module is used to use the first cryptographic algorithm suite to obtain the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0094] The third sending module is used to send a NAS security mode establishment completion message to the target AMF when the NAS integrity verification of the NAS security mode establishment message is successful, and use the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

[0095] Optionally, the terminal further includes:

[0096] The first processing module is used to encrypt the NAS uplink transmission and decrypt the NAS downlink transmission when the NAS integrity verification of the NAS security mode establishment message is successful.

[0097] In a sixth aspect, an embodiment of the present invention provides a source AMF, wherein the source AMF includes:

[0098] A first query module is configured to query whether there is a security context of the terminal locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message when a first request message sent by the target AMF is received, and the first request message also carries an initial NAS message;

[0099] The fourth sending module is used to send the second response message to the target AMF when it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, wherein the second response message carries the SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

[0100] Optionally, the source AMF further includes:

[0101] A second determination module, configured to determine a second cryptographic algorithm suite according to the algorithm support status of the source AMF;

[0102] The third derivation module is used to change the first K in the source AMF AMF In the case of using the second cryptographic algorithm suite, from the first K AMF The second K is derived from AMF ;

[0103] The second response message also carries the second K AMF , the second K AMF Used to decode the complete initial NAS message in a NAS container.

[0104] Optionally, the second determining module is used for any of the following:

[0105] If the source AMF supports multiple cryptographic algorithm suites and is configured with a third algorithm identifier corresponding to NAS layer key derivation, the cryptographic algorithm suite identified by the third algorithm identifier is used to determine the second cryptographic algorithm suite, and the second response message also carries the third algorithm identifier;

[0106] If the source AMF supports multiple cryptographic algorithm suites but is not configured with a third algorithm identifier corresponding to NAS layer key derivation, generate a third algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and use the cryptographic algorithm suite identified by the third algorithm identifier as the target algorithm suite, and the second response message also carries the third algorithm identifier;

[0107] If the source AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the source AMF is determined as the second cryptographic algorithm suite.

[0108] Optionally, the second determining module is used to:

[0109] In a case where the source AMF is configured with a fourth algorithm identifier corresponding to AKA authentication and key derivation, the third algorithm identifier is generated according to the fourth algorithm identifier.

[0110] Optionally, the source AMF further includes:

[0111] The fourth receiving module is used to receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

[0112] Optionally, the source AMF further includes any one of the following:

[0113] The second verification module is used to query the local security context of the terminal, and the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first K AMF In the case of a fault, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first K AMF , the SPUI is used to instruct the target AMF to receive the security context of the terminal, the first K AMF Used to decode the complete initial NAS message in the NAS container;

[0114] The fifth sending module is used to send a second response message to the target AMF when it is found that the security context of the terminal does not exist locally and / or the NAS integrity verification of the initial NAS message fails, wherein the second response message carries first indication information, and the first indication information is used to indicate that the security context of the terminal has not been queried.

[0115] In a seventh aspect, an embodiment of the present invention provides a target AMF, including a transceiver and a processor,

[0116] The processor is used to:

[0117] In the case where the terminal authentication is successful, determining the first cryptographic algorithm suite according to the algorithm support status of the target AMF;

[0118] Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0119] The transceiver is used for:

[0120] Send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASintEncrypting and integrity protecting the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate the first cryptographic algorithm suite;

[0121] The processor is used to:

[0122] Upon receiving a NAS security mode establishment completion message sent by the terminal, decrypting the NAS security mode establishment completion message and performing NAS integrity verification;

[0123] In case that the NAS integrity verification of the NAS security mode establishment completion message is successful, a security mode is established with the terminal.

[0124] Optionally, the processor is used for any of the following:

[0125] If the target AMF supports multiple cryptographic algorithm suites and is configured with a first algorithm identifier corresponding to NAS layer key derivation, determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0126] If the target AMF supports multiple cryptographic algorithm suites but is not configured with a first algorithm identifier corresponding to NAS layer key derivation, generate a first algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0127] If the target AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the target AMF is determined as the first cryptographic algorithm suite.

[0128] Optionally, the processor is configured to:

[0129] In a case where the target AMF is configured with a second algorithm identifier corresponding to AKA authentication and key derivation, the first algorithm identifier is generated according to the second algorithm identifier.

[0130] Optionally, the transceiver is further used for:

[0131] Receive the second algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

[0132] Optionally, the processor is further configured to:

[0133] Decrypts NAS uplink transmissions.

[0134] Optionally, the processor is further configured to:

[0135] Encrypt NAS downlink transmission.

[0136] Optionally, the transceiver is further used for:

[0137] Receiving an initial NAS message sent by a terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal;

[0138] The processor is further configured to:

[0139] When the initial NAS message carries a NAS container and the integrity check of the initial message succeeds, obtaining a security context of the terminal, wherein the encrypted complete initial NAS message is stored in the NAS container;

[0140] Use Target K AMF Decoding the NAS container to obtain the initial NAS message;

[0141] The transceiver is also used for:

[0142] Sending a first response message of the initial NAS message to the terminal;

[0143] Among them, the target K AMF For the first K AMF or the second K AMF , the second K AMF For the first K AMF The derived K AMF .

[0144] Optionally, the processor is configured to:

[0145] In the case where the security context of the terminal is locally queried according to the GUTI, the security context of the terminal is locally queried and acquired; or,

[0146] The transceiver is used for:

[0147] When the security context of the terminal is not locally queried according to the GUTI, a first request message is sent to the source AMF, and when a second response message sent by the source AMF is received, and the second response message carries the permanent identifier SPUI of the terminal, the security context of the terminal sent by the source AMF is received, and the first request message carries the GUTI.

[0148] Optionally, the processor is used for any of the following:

[0149] The second response message also carries a second K AMF In this case, use the second K AMFThe NAS container is decoded to obtain the initial NAS message.

[0150] The second response message does not carry the second K AMF In the case of using the first K AMF The NAS container is decoded to obtain the initial NAS message.

[0151] In an eighth aspect, an embodiment of the present invention provides a terminal, including a transceiver and a processor.

[0152] The transceiver is used for:

[0153] receiving a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite;

[0154] The processor is used to:

[0155] Decrypt the NAS security mode establishment message and perform NAS integrity verification;

[0156] Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0157] The transceiver is used for:

[0158] If the NAS integrity verification of the NAS security mode establishment message is successful, a NAS security mode establishment complete message is sent to the target AMF, and the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

[0159] Optionally, the processor is configured to:

[0160] In case the NAS integrity verification of the NAS security mode setup message is successful, the NAS uplink transmission is encrypted and the NAS downlink transmission is decrypted.

[0161] In a ninth aspect, an embodiment of the present invention provides a source AMF, including a transceiver and a processor,

[0162] The processor is used to:

[0163] Upon receiving the first request message sent by the target AMF, query whether there is a security context of the terminal locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message, and the first request message also carries an initial NAS message;

[0164] The transceiver is used for:

[0165] When it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

[0166] Optionally, the processor is further configured to:

[0167] Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF;

[0168] Change the first K in the source AMF AMF In the case of using the second cryptographic algorithm suite, from the first K AMF The second K is derived from AMF ;

[0169] The second response message also carries the second K AMF , the second K AMF Used to decode the complete initial NAS message in a NAS container.

[0170] Optionally, the processor is used for any of the following:

[0171] If the source AMF supports multiple cryptographic algorithm suites and is configured with a third algorithm identifier corresponding to NAS layer key derivation, the cryptographic algorithm suite identified by the third algorithm identifier is used to determine the second cryptographic algorithm suite, and the second response message also carries the third algorithm identifier;

[0172] If the source AMF supports multiple cryptographic algorithm suites but is not configured with a third algorithm identifier corresponding to NAS layer key derivation, generate a third algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and use the cryptographic algorithm suite identified by the third algorithm identifier as the target algorithm suite, and the second response message also carries the third algorithm identifier;

[0173] If the source AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the source AMF is determined as the second cryptographic algorithm suite.

[0174] Optionally, the processor is configured to:

[0175] In a case where the source AMF is configured with a fourth algorithm identifier corresponding to AKA authentication and key derivation, the third algorithm identifier is generated according to the fourth algorithm identifier.

[0176] Optionally, the transceiver is further used for:

[0177] Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

[0178] Optionally, the transceiver is further used for any of the following:

[0179] After the query finds that the security context of the terminal exists locally, and the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first K AMF In the case of a fault, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first K AMF , the SPUI is used to instruct the target AMF to receive the security context of the terminal, the first K AMF Used to decode the complete initial NAS message in the NAS container;

[0180] When it is found that the security context of the terminal does not exist locally, and / or the NAS integrity verification of the initial NAS message fails, a second response message is sent to the target AMF, and the second response message carries first indication information, and the first indication information is used to indicate that the security context of the terminal has not been queried.

[0181] In the tenth aspect, an embodiment of the present invention provides a target AMF, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the security mode establishment method described in the first aspect are implemented.

[0182] In the eleventh aspect, an embodiment of the present invention provides a terminal, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the security mode establishment method as described in the second aspect.

[0183] In the twelfth aspect, an embodiment of the present invention provides a source AMF, comprising: a processor, a memory, and a program stored on the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the security mode establishment method described in the third aspect are implemented.

[0184] In the thirteenth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the security mode establishment method as described in the first aspect are implemented, or when the computer program is executed by a processor, the steps of the security mode establishment method as described in the second aspect are implemented, or when the computer program is executed by a processor, the steps of the security mode establishment method as described in the third aspect are implemented.

[0185] In the embodiment of the present invention, based on the original 3GPP 5G NAS security mode establishment protocol, multiple algorithms can be supported according to the algorithm support status of the network and the terminal, algorithm negotiation for key derivation can be supported, and commercial and international cryptographic algorithms can be adaptively compatible. The compatibility of NAS keys is improved, and it can adapt to authentication under more different network protocols. BRIEF DESCRIPTION OF THE DRAWINGS

[0186] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0187] Figure 1 This is one of the flow charts of a method for establishing a security mode provided by an embodiment of the present invention;

[0188] Figure 2 This is a second flow chart of a method for establishing a security mode provided by an embodiment of the present invention;

[0189] Figure 3 This is a flowchart of a method for establishing a security mode provided by an embodiment of the present invention;

[0190] Figure 4 It is a structural diagram of an algorithm identifier XX_AS provided in an embodiment of the present invention;

[0191] Figure 5 This is one of the interactive schematic diagrams for establishing a NAS security mode provided by an embodiment of the present invention;

[0192] Figure 6 This is the second interactive schematic diagram of establishing a NAS security mode provided by an embodiment of the present invention;

[0193] Figure 7 This is one of the structural diagrams of a target AMF provided by an embodiment of the present invention;

[0194] Figure 8This is one of the structural schematic diagrams of a terminal provided by an embodiment of the present invention;

[0195] Fig. 9 This is one of the structural diagrams of a source AMF provided by an embodiment of the present invention;

[0196] Fig.10 This is a second structural diagram of a target AMF provided by an embodiment of the present invention;

[0197] Fig.11 This is a second schematic diagram of the structure of a terminal provided by an embodiment of the present invention;

[0198] Fig.12 This is the second structural diagram of a source AMF provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0199] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0200] The embodiment of the present invention proposes a method for establishing a security mode, which can solve the problem that the cryptographic algorithm in the related art has low compatibility and is difficult to complete authentication under different network protocols.

[0201] See also Figure 1 , Figure 1 It is one of the flow diagrams of a method for establishing a security mode provided by an embodiment of the present invention, and is applied to a target authentication management function (Authentication Management Function, AMF). The above-mentioned target AMF can be understood as the AMF currently interacting with the terminal in the authentication and key agreement protocol (Authentication and KeyAgreement, AKA) of the third-generation mobile communication network.

[0202] like Figure 1 As shown, the safety mode establishment method includes the following steps:

[0203] Step 101: When the UE is authenticated successfully, determine the first cryptographic algorithm suite according to the algorithm support status of the target AMF.

[0204] In an embodiment of the present invention, after the 5G AKA protocol is completed, a NAS security mode establishment (Security Mode Command, SMC) process needs to be performed between the UE and the target AMF. NAS SMC is used to establish a NAS security context between the UE and the AMF. This process includes round-trip messages between the target AMF and the UE. Based on the original 3GPP 5G NAS security mode establishment protocol, the target AMF can determine the corresponding first cryptographic algorithm suite based on its own algorithm support status to support algorithm negotiation for key derivation.

[0205] In specific implementation, the target AMF can be modified and upgraded, and the upgraded device can generate the corresponding algorithm identifier, which is used to identify the supported algorithm suite. The upgraded device can also recognize the algorithm identifiers of other devices. The implementation form of the algorithm identifier is not limited here, and can be specifically expressed as XX_AS. For example, AKA_AS can be used to identify the cryptographic algorithm suite used for AKA authentication and key derivation; or, NAS_AS can be used to identify the cryptographic algorithm suite used for NAS layer key derivation. The implementation form of the above algorithm identifier can usually be a string, which is generally an index value used to query the corresponding cryptographic algorithm suite in the database.

[0206] Step 102: Use the first cryptographic algorithm suite to AMF Derived K NASenc and K NASint , K NASenc is the key used for NAS encryption, K NASint is the key used for NAS integrity protection. The first K AMF K is shared between the target AMF and the terminal AMF .

[0207] In specific implementation, step 102 includes any one of the following implementation modes:

[0208] Implementation method 1: When the target AMF supports multiple cryptographic algorithm suites and is configured with a first algorithm identifier corresponding to NAS layer key derivation, the cryptographic algorithm suite identified by the first algorithm identifier is determined as the first cryptographic algorithm suite.

[0209] In this implementation, the first algorithm identifier corresponding to the NAS layer key derivation can be understood as the NAS_AS identifier generated corresponding to the target AMF. If the target AMF supports multiple cryptographic algorithm suites and a NAS_AS identifier is generated, the first cryptographic algorithm suite can be determined according to the cryptographic algorithm suite specified by the NAS_AS identifier.

[0210] Implementation method 2: When the target AMF supports multiple cryptographic algorithm suites but is not configured with a first algorithm identifier corresponding to NAS layer key derivation, a first algorithm identifier corresponding to NAS layer key derivation is generated according to a preset strategy, and the cryptographic algorithm suite identified by the first algorithm identifier is determined as the first cryptographic algorithm suite.

[0211] In this implementation, the first algorithm identifier corresponding to the NAS layer key derivation can be understood as the NAS_AS identifier generated corresponding to the target AMF. If the target AMF supports multiple cryptographic algorithm suites but no NAS_AS identifier is generated, the NAS_AS identifier can be generated according to a preset strategy, and the first cryptographic algorithm suite can be determined according to the cryptographic algorithm suite specified by the NAS_AS identifier.

[0212] In specific implementation, the above-mentioned preset strategy may include: when the target AMF is configured with a second algorithm identifier corresponding to AKA authentication and key derivation, that is, when the AKA_AS identifier is generated, the first cryptographic algorithm suite is determined according to the cryptographic algorithm suite specified by the AKA_AS identifier. In this embodiment, during the 5G AKA authentication process, the user data management (Unified Data Management, UDM) will determine the cryptographic algorithm suite supported by the network side devices and terminals, such as mobile equipment (Mobile Equipment, ME), security anchor function (Security Anchor Function, SEAF), authentication service function (Authentication Server Function, AUSF) and other devices according to the algorithm support status of the network side devices and terminals, according to the policy selection or negotiation, and generate the corresponding AKA_AS. UDM can send AKA_AS to the above-mentioned network side devices and terminals.

[0213] Implementation method three: when the target AMF does not support multiple cryptographic algorithm suites, the basic cryptographic algorithm suite supported by the target AMF is determined as the first cryptographic algorithm suite.

[0214] In this implementation, if the target AMF does not support multiple cryptographic algorithm suites and no NAS_AS identifier or AKA_AS identifier is generated, it means that the target AMF has not performed the upgrade involved in the embodiment of the present invention, and the target AMF can use the default basic cryptographic algorithm suite as the first cryptographic algorithm suite.

[0215] Referring to the above description, if the target AMF has a NAS_AS identifier, the cryptographic algorithm suite specified by NAS_AS is used, and the first K AMF Derived K NASenc and K NASintIf the target AMF does not have a NAS_AS identifier, the cryptographic algorithm suite used by the NAS layer is selected according to the policy to generate NAS_AS. An optional method is: if the target AMF has an AKA_AS identifier, NAS_AS is set to AKA_AS, otherwise NAS_AS is set to the default basic cryptographic algorithm suite 1, and then the cryptographic algorithm suite specified by NAS_AS is used. AMF Derived K NASenc and K NASint .

[0216] Step 103: Send a NAS security mode establishment message to the UE and use K NASenc and K NASint The NAS security mode establishment message is encrypted and integrity protected, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite.

[0217] In specific implementation, after the target AMF successfully authenticates the UE, the target AMF shall send a NAS security mode establishment message and use K NASenc and K NASint The NAS security mode establishment message is encrypted and integrity protected. The NAS security mode establishment message may carry the following information: the replayed UE security function, the selected NAS algorithm, and the K AMF The NASSMC message may also include: K_AMF_change_flag (carried in the additional 5G security parameters IE specified in 3GPP TS24.501) to indicate the newly calculated K AMF , a flag to request a complete initial NAS message, and the inter-architecture anti-downgrade attack parameter (ABBA). K is derived horizontally during the mobility registration update process or during multiple registrations in the same PLMN. AMF When K_AMF_change_flag is included in the NAS security mode establishment message, AMF The key identifier K indicated by AMF , should use the K AMF The NAS integrity key K NASintThe message shall be integrity protected (but not encrypted). If the network supports interworking using the N26 interface between the network node (Mobility Management Entity, MME) and the AMF, the target AMF shall also include the selected EPS NAS algorithm used after moving to the Evolved Packet System (EPS) in the NAS Security Mode Establishment message. The UE shall save the algorithm used after moving to EPS. The AMF shall save the selected EPS algorithm in the UE security context.

[0218] In an embodiment of the present invention, the NAS security mode establishment message sent by the target AMF to the UE may carry the NAS_AS identifier of the target AMF. In specific implementation, the NAS_AS identifier may be used as a new parameter, or a reserved field in the message may be used. The NAS uplink decryption of the AMF may be enabled after sending the NAS security mode establishment message.

[0219] After receiving the NAS security mode establishment message, the UE can decrypt the NAS security mode establishment message and perform integrity verification. Specifically, it may include: checking whether the security capabilities sent by the target AMF match the security capabilities stored in the UE to ensure that the attacker does not modify these security capabilities, and using the NAS integrity algorithm indicated in the NAS security mode establishment message and the K-based integrity algorithm indicated by ngKSI. AMF The NAS integrity key is used to verify integrity.

[0220] It should be noted that if the NAS security mode establishment message includes K_AMF_change_flag, the UE shall generate a new K AMF And set NAS COUNT to zero. If the integrity verification of the NAS security mode establishment message succeeds, the UE shall use the security context indicated by ngKSI for NAS integrity protection and encryption / decryption. In the embodiment of the present invention, if the UE is an upgraded device, it can identify and save the cryptographic algorithm suite specified by NAS_AS from the NAS security mode establishment message, and use the first KSI to identify and save the cryptographic algorithm suite specified by NAS_AS. AMF Derived K NASenc and K NASint If the UE is a non-upgraded device, the default basic cryptographic algorithm suite is used. AMF Derived K NASenc and K NASint .

[0221] If the UE successfully verifies the integrity of the NAS security mode establishment message, the UE can send an encrypted, integrity-protected NAS security mode establishment complete message to the target AMF. Specifically, K NASenc and the KNASint The NAS Security Mode Setup Complete message is encrypted and integrity protected. After that, the UE starts the NAS uplink transmission encryption and NAS downlink transmission decryption. If the target AMF requests a permanent equipment identifier (PEI) in the NAS SMC message, the NAS Security Mode Setup Complete message sent by the UE can also carry the PEI. AMF Horizontally derived, the AMF shall set the NAS COUNT to zero. The UE may include a complete Initial NAS message.

[0222] If the UE fails to verify the integrity of the NAS security mode establishment message, the UE may return a NAS security mode reject message. The NAS security mode reject message and all subsequent NAS messages shall be protected using the previous (if any) 5G NAS security context. If no 5G NAS security context exists before the NAS security mode reject message, the NAS security mode reject message will not be protected. It should be noted that if the uplink NAS COUNT is reset by sending a NAS security mode reject message, the UE releases the NAS connection without sending a NAS security mode reject message.

[0223] Step 104: When receiving the NAS security mode establishment completion message sent by the UE, decrypt the NAS security mode establishment completion message and perform NAS integrity verification.

[0224] In specific implementation, after receiving the NAS security mode setup complete message sent by the UE, the target AMF can decrypt the NAS security mode setup complete message and verify its integrity. The NAS downlink encryption of the AMF should be enabled through this security context after receiving the NAS security mode setup complete message.

[0225] Step 105: When the NAS integrity verification of the NAS security mode establishment completion message is successful, a security mode is established with the terminal.

[0226] In specific implementation, the NAS downlink encryption of the target AMF shall be enabled through the security context after receiving the NAS security mode setup complete message. It should be noted that if the target AMF successfully verifies the NAS security mode setup complete message, it can be indicated that the target AMF has successfully confirmed that the SUPI from the home network matches the SUPI used by the UE.

[0227] It should be noted that before the UE and the target AMF establish a security mode, a protection mechanism for the initial NAS message can also be established between the UE and the target AMF. The specific instructions are as follows:

[0228] In an optional embodiment, the method further comprises the following steps:

[0229] An initial NAS message sent by a receiving terminal carries a globally unique temporary identifier GUTI of the terminal;

[0230] When the initial NAS message carries a NAS container and the initial message integrity check succeeds, the security context of the terminal is obtained, and the encrypted complete initial NAS message is stored in the NAS container;

[0231] Use Target K AMF Decode the NAS container to obtain the initial NAS message;

[0232] Sending a first response message of an initial NAS message to the terminal;

[0233] Among them, the target K AMF For the first K AMF or the second K AMF , the second K AMF From the first K AMF The derived K AMF .

[0234] In specific implementation, the UE can send the initial NAS message to the target AMF.

[0235] Case 1: If the UE does not have a NAS security context, the initial NAS message may carry only plain text information elements (IE), which may include but are not limited to: user identifier (such as SUCI or GUTI), UE security capabilities, S-NSSAI, ngKSI, an indication that the UE is moving from EPC to 5G, additional GUTI, and an IE containing a Tracking Area Identity (TAU) request from Long Term Evolution (LTE) to 5G New Radio (NR).

[0236] Case 2: If the UE has a NAS security context, the initial NAS message can carry not only the above-mentioned IEs sent in plain text, but also the complete initial NAS message. The above-mentioned initial NAS message can be encrypted in the NAS container, and the sent message should be integrity protected. After receiving the initial NAS message, the target AMF will confirm whether the UE has a security context based on the user identifier GUTI carried in the initial NAS message. In other words, if the initial NAS message carries a NAS container, it indicates that the current UE has a security context.

[0237] The target AMF can first query locally whether there is a security context for the UE. If the initial NAS message is protected and the target AMF queries locally for the same security context, the target AMF can directly return a response message to the initial NAS message to the UE. If the UE's security context does not exist locally, the historical AMF, here referred to as the source AMF, can be used to query whether there is a security context for the UE. The specific implementation is as follows:

[0238] The target AMF can identify the source AMF based on the UE's 5G-GUTI and obtain the security context from the source AMF. Specifically, the target AMF can send a first request message to the source AMF, and the first request message can carry the 5G-GUTI and the initial NAS message received from the UE. Upon receiving the first request message, the source AMF can search for the UE's data in the database and check the integrity protection of the registration request message.

[0239] (1) If the UE is found and the integrity protection check is successful, that is, when the UE's security context is found locally and the NAS integrity verification of the initial NAS message is successful, a second response message can be sent to the target AMF. The second response message carries the UE's SPUI to instruct the target AMF to receive the UE's security context. In addition, when the source AMF finds that the UE's security context is found locally and the NAS integrity verification of the initial NAS message is successful, it can be divided into the following two cases and handled separately:

[0240] Case 1: When the source AMF does not change K according to its local policy AMF The source AMF will send a second response message back to the target AMF, which may carry the SUPI and possibly any current 5G security context it has.

[0241] Case 2: When the source AMF changes K according to its local policy AMF , the source AMF will send a second response message back to the target AMF. The second response message may carry SUPI, keyAmfHDerivationInd, and may carry a new 5G security context derived from the current 5G security context it has, that is, based on the current K AMF A new K is derived AMF It should be noted that the source AMF can determine the second cryptographic algorithm suite to complete the above steps based on its own algorithm support status. Specifically, if the source AMF has a NAS_AS identifier, the cryptographic algorithm suite specified by NAS_AS is used, starting from the first K AMF Derived a new K AMFIf the source AMF does not have the NAS_AS identifier, the cryptographic algorithm suite used by the NAS layer is selected according to the policy to generate NAS_AS. An optional method is: if the source AMF has the AKA_AS identifier, NAS_AS is set to AKA_AS, otherwise NAS_AS is set to the default basic cryptographic algorithm suite, and then the cryptographic algorithm suite specified by NAS_AS is used, starting from the first K AMF Derived a new K AMF In this case, the second response message sent by the source AMF to the target AMF carries the NAS_AS identifier and the new K AMF , here recorded as the second K AMF The source AMF may then delete the 5G security context it owns.

[0242] (2) If the source AMF cannot identify the UE and / or the integrity protection check fails, the source AMF shall send a first indication message indicating that the temporary identifier 5G-GUTI cannot be retrieved, and the first indication information may be carried in the second response message.

[0243] If the target AMF receives a response message carrying SUPI, it indicates that the source AMF has queried the UE's security context, and the target AMF can create an entry and store the 5G security context that may have been received or may be received later. AMF , the target AMF can store NAS_AS and the second K AMF .

[0244] If neither the target AMF nor the source AMF can query the UE's security context, and / or the integrity check of the initial NAS message fails, the target AMF shall initiate the authentication process with the UE. After the 5G AKA protocol is completed, the authentication is completed between the UE and the access network AMF / SEAF, and K is shared. SEAF , and through K SEAF Deducing K AMF Used for secure interaction between UE and AMF.

[0245] When the target AMF successfully authenticates the UE, the above-mentioned steps 101 to 105 can be executed, which will not be repeated here. At this point, the NAS message encryption and integrity protection function activation is completed between the UE and the target AMF.

[0246] In the embodiments of the present invention, based on the original 3GPP 5G NAS security mode establishment protocol, multiple algorithms can be supported according to the algorithm support status of the network and the terminal, algorithm negotiation for key derivation can be supported, and commercial and international cryptographic algorithms can be adaptively compatible. The compatibility of NAS keys is improved, and it can adapt to authentication under more different network protocols.

[0247] See also Figure 2 , Figure 2 FIG. 2 is a flow chart of a method for establishing a security mode provided by an embodiment of the present invention, which is applied to a terminal (UE). Figure 4 As shown, the safety mode establishment method includes the following steps:

[0248] Step 201: Receive a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite;

[0249] Step 202: decrypt the NAS security mode establishment message and perform NAS integrity verification;

[0250] Step 203: Use the first cryptographic algorithm suite to AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0251] Step 204: If the NAS integrity verification of the NAS security mode establishment message is successful, send a NAS security mode establishment completion message to the target AMF and use the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

[0252] Optionally, the method further comprises:

[0253] In case the NAS integrity verification of the NAS security mode setup message is successful, the NAS uplink transmission is encrypted and the NAS downlink transmission is decrypted.

[0254] It should be noted that this embodiment is an implementation method corresponding to the terminal in the above method embodiment. Its specific implementation method can refer to the relevant description in the above method embodiment. To avoid repeated description, this embodiment will not be repeated.

[0255] See also Figure 3 , Figure 3 This is a flowchart of a method for establishing a security mode provided by an embodiment of the present invention, which is applied to a source AMF. The above-mentioned source AMF can be understood as a historical AMF interacting with a UE.

[0256] like Figure 3 As shown, the safety mode establishment method includes the following steps:

[0257] Step 301: upon receiving a first request message sent by a target AMF, query whether a security context of the terminal exists locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message, and the first request message also carries an initial NAS message;

[0258] Step 302: When it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

[0259] Optionally, the method further comprises:

[0260] Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF;

[0261] Change the first K in the source AMF AMF In the case of using the second cryptographic algorithm suite, from the first K AMF The second K is derived from AMF ;

[0262] The second response message also carries the second K AMF , the second K AMF Used to decode the complete initial NAS message in a NAS container.

[0263] Optionally, determining the second cryptographic algorithm suite according to the algorithm support status of the source AMF includes any one of the following:

[0264] If the source AMF supports multiple cryptographic algorithm suites and is configured with a third algorithm identifier corresponding to NAS layer key derivation, the cryptographic algorithm suite identified by the third algorithm identifier is used to determine the second cryptographic algorithm suite, and the second response message also carries the third algorithm identifier;

[0265] If the source AMF supports multiple cryptographic algorithm suites but is not configured with a third algorithm identifier corresponding to NAS layer key derivation, generate a third algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and use the cryptographic algorithm suite identified by the third algorithm identifier as the target algorithm suite, and the second response message also carries the third algorithm identifier;

[0266] If the source AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the source AMF is determined as the second cryptographic algorithm suite.

[0267] Optionally, generating a third algorithm identifier corresponding to NAS layer key derivation according to a preset strategy includes:

[0268] In a case where the source AMF is configured with a fourth algorithm identifier corresponding to AKA authentication and key derivation, the third algorithm identifier is generated according to the fourth algorithm identifier.

[0269] Optionally, before generating, according to a preset strategy, a third algorithm identifier corresponding to NAS layer key derivation, the method further includes:

[0270] Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

[0271] Optionally, the method further includes any one of the following:

[0272] After the query finds that the security context of the terminal exists locally, and the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first K AMF In the case of a fault, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first K AMF , the SPUI is used to instruct the target AMF to receive the security context of the terminal, the first K AMF Used to decode the complete initial NAS message in the NAS container;

[0273] When it is found that the security context of the terminal does not exist locally, and / or the NAS integrity verification of the initial NAS message fails, a second response message is sent to the target AMF, and the second response message carries first indication information, and the first indication information is used to indicate that the security context of the terminal has not been queried.

[0274] It should be noted that this embodiment is an implementation method corresponding to the source AMF in the above method embodiment. Its specific implementation method can refer to the relevant description in the above method embodiment. To avoid repeated description, this embodiment will not be repeated.

[0275] A specific implementation of an embodiment of the present invention is described below:

[0276] It should be noted that in this implementation, the upgraded device refers to the device that has been implemented according to the solution involved in the embodiment of the present invention, including but not limited to UE, SEAF, AMF, and can support multiple cryptographic algorithm suites, for example, including cryptographic algorithm suite 1, cryptographic algorithm suite 2, cryptographic algorithm suite 3, etc. Generally speaking, all devices support a basic cryptographic algorithm suite, which is defined as cryptographic algorithm suite 1 here. For example, in 5G, the international cryptographic algorithms AES-128 and SHA-256 are used. Non-upgraded devices refer to devices implemented according to existing 3GPP standards and support a basic cryptographic algorithm suite.

[0277] In this implementation manner, the cryptographic algorithm support status of the relevant network elements and devices indicates the algorithms supported by the network elements and devices in authentication and key derivation. Upgraded devices can generate the corresponding algorithm identifier XX_AS, and can also recognize the algorithm identifier XX_AS of other devices. Non-upgraded devices may not be able to generate XX_AS, and may not be able to recognize XX_AS of other devices. If XX_AS does not exist, it means that the device XX is a non-upgraded device and only supports cryptographic algorithm suite 1. AKA_AS represents the cryptographic algorithm suite used for AKA authentication and key derivation, generally as an index value. NAS_AS represents the cryptographic algorithm suite used for NAS layer key derivation, generally as an index value.

[0278] The implementation methods of XX_AS include but are not limited to the following two:

[0279] The first is the algorithm list format. Specifically, XX_AS consists of two parts, one is the supported encryption algorithm list (EAS), and the other is the supported hash algorithm list (IAS). Among them, the supported encryption algorithm list (EAS), for example, can use a bit array to mark all available encryption algorithms. For example, the 0th bit indicates whether encryption algorithm 1 (such as Advanced Encryption Standard (AES)), etc.) is supported, and the 1st bit indicates whether encryption algorithm 2 (such as SM4, etc.) is supported. If a certain bit is 1, it means that the corresponding algorithm is supported, and if it is 0, it means that the corresponding algorithm is not supported. The supported hash algorithm list (IAS), for example, can use a bit array to mark all available hash algorithms (including HASH algorithms and corresponding HMAC algorithms). For example, the 0th bit indicates whether hash algorithm 1 (such as SHA256 and HMAC_SHA256, etc.) is supported, and the 1st bit indicates whether hash algorithm 2 (such as SM3 and HMAC_SM3, etc.) is supported. If a certain bit is 1, it means that the corresponding algorithm is supported, and if it is 0, it means that the corresponding algorithm is not supported. Exemplarily, such as Figure 4 shown.

[0280] The second is the single-bit format. XX_AS can be represented by one bit: 1 means support for commercial encryption, and 0 means no support for commercial encryption. This method can only support two encryption algorithm negotiations, which can reduce the difficulty of upgrading and transformation.

[0281] This implementation is specifically implemented as follows:

[0282] 1. Protection mechanism of initial NAS message

[0283] The initial NAS message is the first NAS message sent after the UE transitions from the idle state. The specific process is as follows: Figure 5 shown.

[0284] Step 1: The UE shall send an initial message to the target AMF. If the UE does not have a NAS security context, the initial NAS message shall contain only plain text IEs, namely the user identifier (such as SUCI or GUTI), UE security capabilities, S-NSSAI, ngKSI, an indication that the UE is moving from EPC to 5G, additional GUTI, and an IE containing a TAU request for moving from LTE to NR.

[0285] If the UE has a NAS security context, the message sent shall contain the above information sent in plain text and the complete initial NAS message, the initial NAS message is encrypted in the NAS container, and the message sent shall be integrity protected. In the case where the initial message is protected and the target AMF has the same security context, the following steps 2 to 4 can be omitted. In this case, the target AMF shall respond with the complete initial NAS message in the NAS container.

[0286] The target AMF identifies whether it needs to obtain the security context from the source AMF based on the UE's 5G-GUTI. If not, step 2a is ignored.

[0287] Step 2a: The target AMF identifies the source AMF based on the UE's 5G-GUTI and obtains the security context from the source AMF:

[0288] (1) The target AMF sends a message to the source AMF, which contains the 5G-GUTI and the received registration request message.

[0289] (2) The source AMF searches the UE’s data in the database and checks the integrity protection of the Registration Request message.

[0290] a. If the UE is found and the integrity protection check succeeds, the source AMF shall send back a response message, which shall include the SUPI and possibly any current 5G security context it has, provided that the source AMF does not change the KAMF according to its local policy.

[0291] b. If the UE is found and the integrity protection check succeeds, the source AMF shall send a response message when the source AMF changes the KAMF according to its local policy: it shall include SUPI, keyAmfHDerivationInd and may include a new 5G security context derived from the current 5G security context it has.

[0292] It should be noted that in step b, if the source AMF is a non-upgraded device, the cryptographic algorithm suite 1 is used for execution; if the source AMF is an upgraded device, the following processing is performed: if NAS_AS exists, the cryptographic algorithm suite specified by NAS_AS is used from K AMF Derived a new K AMF If NAS_AS does not exist, the cryptographic algorithm suite used by the NAS layer is selected according to the policy to generate NAS_AS. For example: if AKA_AS exists, NAS_AS is set to AKA_AS and the cryptographic algorithm suite specified by AKA_AS is used to generate NAS_AS. AMF Derived a new K AMF Otherwise, NAS_AS is set to cipher suite 1 and cipher suite 1 is used from K AMF Derived a new K AMF Afterwards, the source AMF can send NAS_AS and the new K AMF etc. is sent to the target AMF and deletes the 5G security context it owns.

[0293] c. If the source AMF cannot identify the UE or the integrity protection check fails, the source AMF shall send a response indicating that the temporary identity 5G-GUTI could not be retrieved.

[0294] (3) If the target AMF receives a response message with SUPI, it shall create an entry and store the 5G security context that may have been received.

[0295] It should be noted that in step (3), if the target AMF is a non-upgraded device, the above steps are executed. If the target AMF is an upgraded device, NAS_AS and the new KAMF are obtained and saved.)

[0296] Step 2: If neither the target AMF nor the source AMF has a security context or the integrity check fails, the target AMF shall initiate the authentication process with the UE.

[0297] After the 5G AKA protocol is completed, the UE and the access network AMF / SEAF complete the authentication and share the K SEAF , and through K SEAF Deducing K AMFUsed for secure interaction between UE and AMF. The target AMF can also obtain the UE's security status (Security Capability) through the Registration Request message during the AKA protocol process.

[0298] It should be noted that in this implementation, during the 5G AKA authentication process, UDM will select or negotiate the appropriate cryptographic algorithm suite AKA_AS based on the cryptographic algorithm suite support status of ME, AMF / SEAF, AUSF, etc., and according to the policy, for example, cryptographic algorithm suite 1 or cryptographic algorithm suite 2 supported by each device, etc. AKA_AS is used to indicate the cryptographic algorithm suite that ME, SEAF, AUSF and other devices should use in authentication and key derivation. UDM sends AKA_AS to network elements such as ME, gNB, AMF / SEAF, AUSF, and AMF deletes the old NAS_AS. ME, gNB, AMF / SEAF, AUSF and other network elements will calculate authentication parameters and key derivation based on the cryptographic algorithm suite specified by AKA_AS.

[0299] Step 3: After successfully authenticating the UE, the target AMF shall send a NAS Security Mode Command (NAS SMC) message. If the initial NAS message sent is integrity protected but fails the integrity check, other AMFs will not be able to decrypt the complete initial NAS message in the NAS container. The target AMF shall include a flag in the NAS Security Mode Setup message to request the UE to send the complete initial NAS message in the NAS Security Mode Setup Complete message.

[0300] Step 4: The UE shall send a NAS Security Mode Complete message to the network in response to the NAS Security Mode Setup message. The NAS Security Mode Setup Complete message shall be encrypted and integrity protected. In addition, if the target AMF requests or the UE does not protect the initial NAS message sent, the complete initial NAS message shall be included in the NAS Security Mode Setup Complete message. At this time, the AMF shall respond with the complete initial NAS message in the NAS container.

[0301] Step 5: The AMF shall send a response to the initial NAS message. This message shall be encrypted and integrity protected.

[0302] 2. NAS Security Mode Establishment (Security Mode Command, SMC) Process:

[0303] After the 5G AKA protocol is completed, the NAS SMC process needs to be performed between the UE and AMF. NAS SMC is used to establish a NAS security context between the UE and AMF. This process includes round-trip messages between the AMF and the UE. The AMF sends a NAS SMC message to the UE, and the UE returns a NAS SMC message, such as Figure 6 shown.

[0304] Step 1a: The target AMF activates NAS integrity protection before sending the NAS Security Mode Establishment message, using K AMF Derived K NASenc and K NASint .

[0305] It should be noted that if the target AMF is a non-upgraded device, the above steps are performed using cryptographic algorithm suite 1. If the target AMF is an upgraded device, the following processing is performed: If NAS_AS exists, the cryptographic algorithm suite specified by NAS_AS is used from K AMF Derived K NASenc and K NASint If NAS_AS does not exist, the cryptographic algorithm suite used by the NAS layer is selected according to the policy to generate NAS_AS. For example, if AKA_AS exists, NAS_AS is set to AKA_AS and the cryptographic algorithm suite specified by AKA_AS is used to generate the K AMF Derived K NASenc and K NASint Otherwise, NAS_AS is set to cipher suite 1 and cipher suite 1 is used from K AMF Derived K NASenc and K NASint .

[0306] Step 1b: The target AMF sends a NAS security mode setup message to the UE. The NAS security mode setup message shall contain: the replayed UE security functions, the selected NAS algorithm, and the ngKSI used to identify the KAMF. The NAS security mode setup message may also contain: K_AMF_change_flag (carried in the additional 5G security parameters IE specified in 3GPP TS 24.501) to indicate the newly calculated K AMF , requesting a complete initial NAS message flag, ABBA. Horizontally derived K during mobility registration update or multiple registrations in the same PLMN AMF When K_AMF_change_flag is included in the NAS security mode establishment message.

[0307] According to the K indicated by ngKSI in the NAS security mode establishment message AMF , should use the K AMFThe message shall be integrity protected (but not encrypted) with the NAS integrity key of the MME. If the network supports interworking using the N26 interface between the MME and the AMF, the AMF shall also include the selected EPS NAS algorithm to be used after moving to EPS in the NAS SMC message. The UE shall save the algorithm to be used after moving to EPS. The AMF shall save the selected EPS algorithm in the UE security context.

[0308] When an AMF change occurs during N2 handover or idle mode mobility, the selected EPS NAS algorithm shall be included in the 5GUE security context and sent to the target AMF.

[0309] It should be noted that if the AMF is a non-upgraded device, the above steps are performed using cryptographic algorithm suite 1. If the AMF is an upgraded device, the following processing is performed: The NASSMC sent by the AMF to the ME should contain NAS_AS, where NAS_AS can be used as a new parameter or as a reserved field in the message.

[0310] Step 1c: AMF activates NAS uplink decryption after sending the NAS Security Mode Establishment message.

[0311] Step 2a: The UE shall validate the NAS Security Mode Establishment message, including checking that the security capabilities sent by the UE AMF match the security capabilities stored in the UE to ensure that these security capabilities have not been modified by an attacker, and verifying the integrity using the indicated NAS integrity algorithm and the KAMF-based NAS integrity keys indicated by ngKSI.

[0312] If the NAS security mode establishment message includes K_AMF_change_flag, the UE shall generate a new KAMF and set NAS COUNT to zero. If the integrity verification of the NAS security mode establishment message succeeds, the UE shall use the security context indicated by ngKSI for NAS integrity protection and encryption / decryption.

[0313] It should be noted that if the ME is not an upgraded device, the above steps are performed using cryptographic algorithm suite 1. If the ME is an upgraded device, the following processing is performed: Identify and save NAS_AS from the NAS security mode establishment message. Use the cryptographic algorithm suite specified by NAS_AS to calculate the NAS encryption key K NASenc and the integrity key K NASint , otherwise the cryptographic algorithm suite 1 is used for calculation.

[0314] Step 2b: The UE sends an encrypted and integrity protected NAS Security Mode Setup Complete message to the AMF. If the AMF requested PEI in the NAS Security Mode Setup message, the NAS Security Mode Setup Complete message shall include the PEI. If KAMF level derivation is performed, the AMF shall set the NAS COUNT to zero. The UE may include the complete initial NAS message.

[0315] If the UE's NAS security mode setup message verification fails, the UE shall return a NAS security mode setup reject message. The NAS security mode setup reject message and all subsequent NAS messages shall be protected using the previous (if any) 5G NAS security context, in other words, the 5G NAS security context before the NAS security mode setup message. If no 5G NAS security context exists before the NAS security mode setup message, the NAS security mode setup reject message shall not be protected.

[0316] The AMF shall decrypt the NAS Security Mode Setup Complete message and verify its integrity using the key and algorithm indicated in the NAS Security Mode Setup Complete message. The AMF's NAS downlink cipher shall be turned on through this security context after receiving the NAS Security Mode Setup Complete message.

[0317] Step 1d: AMF activates NAS downlink encryption.

[0318] It should be noted that if the uplink NAS COUNT is reset by sending a NAS security mode setup reject message, the UE releases the NAS connection without sending a NAS security mode setup reject message. If the AMF successfully verifies the NAS security mode setup complete message, it means that the AMF has successfully confirmed that the SUPI from the home network matches the SUPI used by the UE. However, SUPI mismatch is not the only reason for the failure of the integrity verification of the NAS security mode setup complete message on the AMF.

[0319] At this point, the UE and AMF have completed the activation of NAS message encryption and integrity protection functions.

[0320] See also Figure 7 , Figure 7 It is a target AMF provided by an embodiment of the present invention.

[0321] like Figure 7 As shown, the target AMF700 includes:

[0322] A first determination module 701 is used to determine a first cryptographic algorithm suite according to the algorithm support status of the target AMF when the terminal authentication is successful;

[0323] The first derivation module 702 is used to use the first cryptographic algorithm suite to obtain a first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0324] The first sending module 703 is used to send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASint Encrypting and integrity protecting the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate the first cryptographic algorithm suite;

[0325] A first verification module 704 is configured to, upon receiving a NAS security mode establishment completion message sent by the terminal, decrypt the NAS security mode establishment completion message and perform NAS integrity verification;

[0326] The first establishing module 705 is configured to establish a security mode with the terminal if the NAS integrity verification of the NAS security mode establishment completion message is successful.

[0327] Optionally, the first determining module 701 is used for any of the following:

[0328] If the target AMF supports multiple cryptographic algorithm suites and is configured with a first algorithm identifier corresponding to NAS layer key derivation, determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0329] If the target AMF supports multiple cryptographic algorithm suites but is not configured with a first algorithm identifier corresponding to NAS layer key derivation, generate a first algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0330] If the target AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the target AMF is determined as the first cryptographic algorithm suite.

[0331] Optionally, the first determining module 701 is used to:

[0332] In a case where the target AMF is configured with a second algorithm identifier corresponding to AKA authentication and key derivation, the first algorithm identifier is generated according to the second algorithm identifier.

[0333] Optionally, the target AMF700 further includes:

[0334] The first receiving module is used to receive a second algorithm identifier corresponding to AKA authentication and key derivation sent by a user data manager UDM.

[0335] Optionally, the target AMF700 further includes:

[0336] The first decryption module is used to decrypt the transmission of the NAS uplink.

[0337] Optionally, the target AMF700 further includes:

[0338] The first encryption module is used to encrypt the transmission of the NAS downlink.

[0339] Optionally, the target AMF700 further includes:

[0340] A second receiving module is used to receive an initial NAS message sent by a terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal;

[0341] A first acquisition module is configured to acquire a security context of the terminal if the initial NAS message carries a NAS container and the initial message integrity check succeeds, wherein the NAS container stores an encrypted complete initial NAS message;

[0342] The first decoding module is used to use the target K AMF Decoding the NAS container to obtain the initial NAS message;

[0343] A second sending module, configured to send a first response message of the initial NAS message to the terminal;

[0344] Among them, the target K AMF For the first K AMF or the second K AMF , the second K AMF For the first K AMF The derived K AMF .

[0345] Optionally, the first acquisition module is used for any of the following:

[0346] In a case where the security context of the terminal is locally queried according to the GUTI, locally querying and acquiring the security context of the terminal;

[0347] When the security context of the terminal is not locally queried according to the GUTI, a first request message is sent to the source AMF, and when a second response message sent by the source AMF is received, and the second response message carries the permanent identifier SPUI of the terminal, the security context of the terminal sent by the source AMF is received, and the first request message carries the GUTI.

[0348] Optionally, the first decoding module is used for any of the following:

[0349] The second response message also carries a second K AMF In this case, use the second K AMF The NAS container is decoded to obtain the initial NAS message.

[0350] The second response message does not carry the second K AMF In the case of using the first K AMF The NAS container is decoded to obtain the initial NAS message.

[0351] Target AMF700 can achieve Figure 1 The various processes implemented by the method embodiment shown can achieve the same beneficial effects, and will not be described again here to avoid repetition.

[0352] See also Figure 8 , Figure 8 A terminal is provided by an embodiment of the present invention.

[0353] like Figure 8 As shown, the terminal 800 includes:

[0354] The third receiving module 801 is used to receive a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite;

[0355] A second decryption module 802 is used to decrypt the NAS security mode establishment message and perform NAS integrity verification;

[0356] The second derivation module 803 is used to use the first cryptographic algorithm suite to obtain the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF;

[0357] The third sending module 804 is used to send a NAS security mode establishment completion message to the target AMF when the NAS integrity verification of the NAS security mode establishment message is successful, and use the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

[0358] Optionally, the terminal 800 further includes:

[0359] The first processing module is used to encrypt the NAS uplink transmission and decrypt the NAS downlink transmission when the NAS integrity verification of the NAS security mode establishment message is successful.

[0360] Terminal 800 can achieve Figure 2 The various processes implemented by the method embodiment shown can achieve the same beneficial effects, and will not be described again here to avoid repetition.

[0361] See also Fig. 9 , Fig. 9 It is a source AMF provided by an embodiment of the present invention.

[0362] like Fig. 9 As shown, the source AMF900 includes:

[0363] The first query module 901 is used to query whether there is a security context of the terminal locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message when receiving the first request message sent by the target AMF, and the first request message also carries an initial NAS message;

[0364] The fourth sending module 902 is used to send the second response message to the target AMF when it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, wherein the second response message carries the SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

[0365] Optionally, the source AMF 900 further includes:

[0366] A second determination module, configured to determine a second cryptographic algorithm suite according to the algorithm support status of the source AMF;

[0367] The third derivation module is used to change the first K in the source AMF AMF In the case of using the second cryptographic algorithm suite, from the first K AMFThe second K is derived from AMF ;

[0368] The second response message also carries the second K AMF , the second K AMF Used to decode the complete initial NAS message in a NAS container.

[0369] Optionally, the second determining module is used for any of the following:

[0370] If the source AMF supports multiple cryptographic algorithm suites and is configured with a third algorithm identifier corresponding to NAS layer key derivation, the cryptographic algorithm suite identified by the third algorithm identifier is used to determine the second cryptographic algorithm suite, and the second response message also carries the third algorithm identifier;

[0371] If the source AMF supports multiple cryptographic algorithm suites but is not configured with a third algorithm identifier corresponding to NAS layer key derivation, generate a third algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and use the cryptographic algorithm suite identified by the third algorithm identifier as the target algorithm suite, and the second response message also carries the third algorithm identifier;

[0372] If the source AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the source AMF is determined as the second cryptographic algorithm suite.

[0373] Optionally, the second determining module is used to:

[0374] In a case where the source AMF is configured with a fourth algorithm identifier corresponding to AKA authentication and key derivation, the third algorithm identifier is generated according to the fourth algorithm identifier.

[0375] Optionally, the source AMF 900 further includes:

[0376] The fourth receiving module is used to receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data management UDM.

[0377] Optionally, the source AMF 900 further includes any one of the following:

[0378] The second verification module is used to query the local security context of the terminal, and the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first K AMF In the case of a fault, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first K AMF, the SPUI is used to instruct the target AMF to receive the security context of the terminal, the first K AMF Used to decode the complete initial NAS message in the NAS container;

[0379] The fifth sending module is used to send a second response message to the target AMF when it is found that the security context of the terminal does not exist locally and / or the NAS integrity verification of the initial NAS message fails, wherein the second response message carries first indication information, and the first indication information is used to indicate that the security context of the terminal has not been queried.

[0380] Source AMF900 can achieve Figure 3 The various processes implemented by the method embodiment shown can achieve the same beneficial effects, and will not be described again here to avoid repetition.

[0381] An embodiment of the present invention also provides a target AMF, including: a processor, a memory, and a program stored on the memory and executable on the processor. When the program is executed by the processor, each process of the above-mentioned security mode establishment method embodiment applied to the target AMF is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0382] For details, see Fig.10 As shown, an embodiment of the present invention further provides a target AMF, including a bus 1001, a transceiver 1002, an antenna 1003, a bus interface 1004, a processor 1005 and a memory 1006.

[0383] The processor 1005 is used for:

[0384] In the case where the terminal authentication is successful, determining the first cryptographic algorithm suite according to the algorithm support status of the target AMF;

[0385] Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0386] The transceiver 10002 is used for:

[0387] Send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASintEncrypting and integrity protecting the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate the first cryptographic algorithm suite;

[0388] The processor 1005 is used for:

[0389] When receiving a NAS security mode establishment completion message sent by the terminal, decrypt the NAS security mode establishment completion message and perform NAS integrity verification;

[0390] In case that the NAS integrity verification of the NAS security mode establishment completion message is successful, a security mode is established with the terminal.

[0391] Optionally, the processor 1005 is used for any of the following:

[0392] If the target AMF supports multiple cryptographic algorithm suites and is configured with a first algorithm identifier corresponding to NAS layer key derivation, determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0393] If the target AMF supports multiple cryptographic algorithm suites but is not configured with a first algorithm identifier corresponding to NAS layer key derivation, generate a first algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite;

[0394] If the target AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the target AMF is determined as the first cryptographic algorithm suite.

[0395] Optionally, the processor 1005 is configured to:

[0396] In a case where the target AMF is configured with a second algorithm identifier corresponding to AKA authentication and key derivation, the first algorithm identifier is generated according to the second algorithm identifier.

[0397] Optionally, the transceiver 1002 is further configured to:

[0398] Receive the second algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

[0399] Optionally, the processor 1005 is further configured to:

[0400] Decrypts NAS uplink transmissions.

[0401] Optionally, the processor 1005 is further configured to:

[0402] Encrypt NAS downlink transmission.

[0403] Optionally, the transceiver 1002 is further configured to:

[0404] Receiving an initial NAS message sent by a terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal;

[0405] The processor 1005 is further configured to:

[0406] When the initial NAS message carries a NAS container and the integrity check of the initial message succeeds, obtaining a security context of the terminal, wherein the encrypted complete initial NAS message is stored in the NAS container;

[0407] Use Target K AMF Decoding the NAS container to obtain the initial NAS message;

[0408] The transceiver 1002 is also used for:

[0409] Sending a first response message of the initial NAS message to the terminal;

[0410] Among them, the target K AMF For the first K AMF or the second K AMF , the second K AMF For the first K AMF The derived K AMF .

[0411] Optionally, the processor 1005 is configured to:

[0412] In the case where the security context of the terminal is locally queried according to the GUTI, the security context of the terminal is locally queried and acquired; or,

[0413] The transceiver 1002 is used for:

[0414] When the security context of the terminal is not locally queried according to the GUTI, a first request message is sent to the source AMF, and when a second response message sent by the source AMF is received, and the second response message carries the permanent identifier SPUI of the terminal, the security context of the terminal sent by the source AMF is received, and the first request message carries the GUTI.

[0415] Optionally, the processor 1005 is used for any of the following:

[0416] The second response message also carries a second K AMFIn this case, use the second K AMF The NAS container is decoded to obtain the initial NAS message.

[0417] The second response message does not carry the second K AMF In the case of using the first K AMF The NAS container is decoded to obtain the initial NAS message.

[0418] exist Fig.10 In the embodiment, the bus architecture (represented by bus 1001) is shown, and bus 1001 may include any number of interconnected buses and bridges, and bus 1001 links various circuits including one or more processors 1005 represented by processor 1005 and memory represented by memory 1006. Bus 1001 may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. Bus interface 1004 provides an interface between bus 1001 and transceiver 1002. Transceiver 1002 may be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. Data processed by processor 1005 is transmitted on a wireless medium via antenna 1003, and further, antenna 1003 also receives data and transmits the data to processor 1005.

[0419] The processor 1005 is responsible for managing the bus 1001 and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory 1006 can be used to store data used by the processor 1005 when performing operations.

[0420] Optionally, the processor 1005 may be a CPU, an ASIC, an FPGA or a CPLD.

[0421] An embodiment of the present invention also provides a terminal, comprising: a processor, a memory, and a program stored in the memory and executable on the processor. When the program is executed by the processor, the various processes of the above-mentioned security mode establishment method embodiment applied to the terminal are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0422] For details, see Fig.11 As shown, an embodiment of the present invention further provides a terminal, including a bus 1101 , a transceiver 1102 , an antenna 1103 , a bus interface 1104 , a processor 1105 and a memory 1106 .

[0423] The transceiver 1102 is used for:

[0424] receiving a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite;

[0425] The processor 1105 is used for:

[0426] Decrypt the NAS security mode establishment message and perform NAS integrity verification;

[0427] Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ;

[0428] The transceiver 1102 is used for:

[0429] If the NAS integrity verification of the NAS security mode establishment message is successful, a NAS security mode establishment complete message is sent to the target AMF, and the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

[0430] Optionally, the processor 1105 is configured to:

[0431] In case the NAS integrity verification of the NAS security mode setup message is successful, the NAS uplink transmission is encrypted and the NAS downlink transmission is decrypted.

[0432] exist Fig.11In the embodiment, the bus architecture (represented by bus 1101) may include any number of interconnected buses and bridges, and bus 1101 links various circuits including one or more processors 1105 represented by processor 1105 and memory represented by memory 1106. Bus 1101 may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. Bus interface 1104 provides an interface between bus 1101 and transceiver 1102. Transceiver 1102 may be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. Data processed by processor 1105 is transmitted on a wireless medium via antenna 1103, and further, antenna 1103 also receives data and transmits the data to processor 1105.

[0433] The processor 1105 is responsible for managing the bus 1101 and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory 1106 can be used to store data used by the processor 1105 when performing operations.

[0434] Optionally, the processor 1105 may be a CPU, an ASIC, an FPGA or a CPLD.

[0435] An embodiment of the present invention also provides a source AMF, including: a processor, a memory, and a program stored on the memory and executable on the processor. When the program is executed by the processor, the various processes of the above-mentioned security mode establishment method embodiment applied to the source AMF are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0436] For details, see Fig.12 As shown, an embodiment of the present invention further provides a source AMF, including a bus 1201, a transceiver 1202, an antenna 1203, a bus interface 1204, a processor 1205 and a memory 1206.

[0437] The processor 1205 is used for:

[0438] Upon receiving the first request message sent by the target AMF, query whether there is a security context of the terminal locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message, and the first request message also carries an initial NAS message;

[0439] The transceiver 1202 is used for:

[0440] When it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

[0441] Optionally, the processor 1205 is further configured to:

[0442] Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF;

[0443] Change the first K in the source AMF AMF In the case of using the second cryptographic algorithm suite, from the first K AMF The second K is derived from AMF ;

[0444] The second response message also carries the second K AMF , the second K AMF Used to decode the complete initial NAS message in a NAS container.

[0445] Optionally, the processor 1205 is used for any of the following:

[0446] If the source AMF supports multiple cryptographic algorithm suites and is configured with a third algorithm identifier corresponding to NAS layer key derivation, the cryptographic algorithm suite identified by the third algorithm identifier is used to determine the second cryptographic algorithm suite, and the second response message also carries the third algorithm identifier;

[0447] If the source AMF supports multiple cryptographic algorithm suites but is not configured with a third algorithm identifier corresponding to NAS layer key derivation, generate a third algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and use the cryptographic algorithm suite identified by the third algorithm identifier as the target algorithm suite, and the second response message also carries the third algorithm identifier;

[0448] If the source AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the source AMF is determined as the second cryptographic algorithm suite.

[0449] Optionally, the processor 1205 is configured to:

[0450] In a case where the source AMF is configured with a fourth algorithm identifier corresponding to AKA authentication and key derivation, the third algorithm identifier is generated according to the fourth algorithm identifier.

[0451] Optionally, the transceiver 1202 is further configured to:

[0452] Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

[0453] Optionally, the transceiver 1202 is further used for any of the following:

[0454] After the query finds that the security context of the terminal exists locally, and the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first K AMF In the case of a fault, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first K AMF , the SPUI is used to instruct the target AMF to receive the security context of the terminal, the first K AMF Used to decode the complete initial NAS message in the NAS container;

[0455] When it is found that the security context of the terminal does not exist locally, and / or the NAS integrity verification of the initial NAS message fails, a second response message is sent to the target AMF, and the second response message carries first indication information, and the first indication information is used to indicate that the security context of the terminal has not been queried.

[0456] exist Fig.12 In the embodiment, the bus architecture (represented by bus 1201) may include any number of interconnected buses and bridges, and bus 1201 links various circuits including one or more processors 1205 represented by processor 1205 and memory represented by memory 1206. Bus 1201 may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. Bus interface 1204 provides an interface between bus 1201 and transceiver 1202. Transceiver 1202 may be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. Data processed by processor 1205 is transmitted on a wireless medium via antenna 1203, and further, antenna 1203 also receives data and transmits the data to processor 1205.

[0457] The processor 1205 is responsible for managing the bus 1201 and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory 1206 can be used to store data used by the processor 1205 when performing operations.

[0458] Optionally, the processor 1205 may be a CPU, an ASIC, an FPGA or a CPLD.

[0459] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned security mode establishment method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a ROM, RAM, a magnetic disk or an optical disk.

[0460] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0461] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0462] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.

Claims

1. A method for establishing a security mode, characterized in that: Applied to the target AMF, the method comprises: In the case where the terminal authentication is successful, determining the first cryptographic algorithm suite according to the algorithm support status of the target AMF; Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ; Send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASint Encrypting and integrity protecting the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate the first cryptographic algorithm suite; Upon receiving a NAS security mode establishment completion message sent by the terminal, decrypting the NAS security mode establishment completion message and performing NAS integrity verification; In case that the NAS integrity verification of the NAS security mode establishment completion message is successful, a security mode is established with the terminal.

2. The method according to claim 1, characterized in that The determining, according to the algorithm support status of the target AMF, the first cryptographic algorithm suite comprises any one of the following: If the target AMF supports multiple cryptographic algorithm suites and is configured with a first algorithm identifier corresponding to NAS layer key derivation, determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite; If the target AMF supports multiple cryptographic algorithm suites but is not configured with a first algorithm identifier corresponding to NAS layer key derivation, generate a first algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and determine the cryptographic algorithm suite identified by the first algorithm identifier as the first cryptographic algorithm suite; If the target AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the target AMF is determined as the first cryptographic algorithm suite.

3. The method according to claim 2, characterized in that The step of generating a first algorithm identifier corresponding to NAS layer key derivation according to a preset strategy includes: In a case where the target AMF is configured with a second algorithm identifier corresponding to AKA authentication and key derivation, the first algorithm identifier is generated according to the second algorithm identifier.

4. The method according to claim 3, characterized in that: Before generating the first algorithm identifier corresponding to the NAS layer key derivation according to the preset strategy, the method further includes: Receive the second algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

5. The method according to claim 1, characterized in that: After sending the NAS security mode establishment message to the terminal, the method further includes: Decrypts NAS uplink transmissions.

6. The method according to claim 1, characterized in that After receiving the NAS security mode establishment completion message sent by the terminal, the method further includes: Encrypt NAS downlink transmission.

7. The method according to claim 1, characterized in that The method further comprises: Receiving an initial NAS message sent by the terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal; When the initial NAS message carries a NAS container and the integrity check of the initial message succeeds, obtaining a security context of the terminal, wherein the encrypted complete initial NAS message is stored in the NAS container; Use Target K AMF Decoding the NAS container to obtain the initial NAS message; Sending a first response message of the initial NAS message to the terminal; Among them, the target K AMF For the first K AMF or the second K AMF , the second K AMF For the first K AMF The derived K AMF .

8. The method according to claim 7, characterized in that The obtaining of the security context of the terminal includes any one of the following: In a case where the security context of the terminal is locally queried according to the GUTI, locally querying and acquiring the security context of the terminal; When the security context of the terminal is not locally queried according to the GUTI, a first request message is sent to the source AMF, and when a second response message sent by the source AMF is received, and the second response message carries the permanent identifier SPUI of the terminal, the security context of the terminal sent by the source AMF is received, and the first request message carries the GUTI.

9. The method according to claim 8, characterized in that The target K AMF Decoding the NAS container to obtain the initial NAS message includes any one of the following: The second response message also carries a second K AMF In this case, use the second K AMF Decoding the NAS container to obtain the initial NAS message; The second response message does not carry the second K AMF In the case of using the first K AMF The NAS container is decoded to obtain the initial NAS message.

10. A method for establishing a security mode, characterized in that: Applied to a terminal, the method comprises: receiving a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite; Decrypt the NAS security mode establishment message and perform NAS integrity verification; Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ; If the NAS integrity verification of the NAS security mode establishment message is successful, a NAS security mode establishment complete message is sent to the target AMF, and the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

11. The method according to claim 10, characterized in that The method further comprises: In case the NAS integrity verification of the NAS security mode setup message is successful, the NAS uplink transmission is encrypted and the NAS downlink transmission is decrypted.

12. A method for establishing a security mode, characterized in that: Applied to the source AMF, the method comprises: Upon receiving the first request message sent by the target AMF, query whether there is a security context of the terminal locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message, and the first request message also carries an initial NAS message; When it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, a second response message is sent to the target AMF, where the second response message carries the permanent identifier SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

13. The method according to claim 12, characterized in that The method further comprises: Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF; Change the first K in the source AMF AMF In the case of using the second cryptographic algorithm suite, from the first K AMF The second K is derived from AMF ; The second response message also carries the second K AMF , the second K AMF Used to decode the complete initial NAS message in a NAS container.

14. The method according to claim 13, characterized in that The determining, according to the algorithm support status of the source AMF, a second cryptographic algorithm suite includes any one of the following: If the source AMF supports multiple cryptographic algorithm suites and is configured with a third algorithm identifier corresponding to NAS layer key derivation, the cryptographic algorithm suite identified by the third algorithm identifier is used to determine the second cryptographic algorithm suite, and the second response message also carries the third algorithm identifier; If the source AMF supports multiple cryptographic algorithm suites but is not configured with a third algorithm identifier corresponding to NAS layer key derivation, generate a third algorithm identifier corresponding to NAS layer key derivation according to a preset policy, and use the cryptographic algorithm suite identified by the third algorithm identifier as the target algorithm suite, and the second response message also carries the third algorithm identifier; If the source AMF does not support multiple cryptographic algorithm suites, a basic cryptographic algorithm suite supported by the source AMF is determined as the second cryptographic algorithm suite.

15. The method according to claim 14, characterized in that The generating, according to the preset strategy, a third algorithm identifier corresponding to the derivation of the NAS layer key includes: In a case where the source AMF is configured with a fourth algorithm identifier corresponding to AKA authentication and key derivation, the third algorithm identifier is generated according to the fourth algorithm identifier.

16. The method according to claim 15, characterized in that Before generating the third algorithm identifier corresponding to the NAS layer key derivation according to the preset strategy, the method further includes: Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.

17. The method according to claim 12, characterized in that The method further includes any of the following: After the query finds that the security context of the terminal exists locally, and the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first K AMF In the case of a fault, the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first K AMF , the SPUI is used to instruct the target AMF to receive the security context of the terminal, the first K AMF Used to decode the complete initial NAS message in the NAS container; When it is found that the security context of the terminal does not exist locally, and / or the NAS integrity verification of the initial NAS message fails, a second response message is sent to the target AMF, and the second response message carries first indication information, and the first indication information is used to indicate that the security context of the terminal has not been queried.

18. A target AMF, characterized in that: The target AMF includes: A first determination module is used to determine a first cryptographic algorithm suite according to the algorithm support status of the target AMF when the terminal authentication is successful; A first derivation module is used to use the first cryptographic algorithm suite to obtain a first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ; The first sending module is used to send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASint Encrypting and integrity protecting the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate the first cryptographic algorithm suite; A first verification module is used to decrypt the NAS security mode establishment completion message sent by the terminal and perform NAS integrity verification; The first establishing module is used to establish a security mode with the terminal when the NAS integrity verification of the NAS security mode establishment completion message is successful.

19. A terminal, characterized in that: The terminal comprises: A third receiving module is configured to receive a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite; A second decryption module, used to decrypt the NAS security mode establishment message and perform NAS integrity verification; The second derivation module is used to use the first cryptographic algorithm suite to obtain the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ; The third sending module is used to send a NAS security mode establishment completion message to the target AMF when the NAS integrity verification of the NAS security mode establishment message is successful, and use the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

20. A source AMF, characterized in that: The source AMF includes: A first query module is configured to query whether there is a security context of the terminal locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message when a first request message sent by the target AMF is received, and the first request message also carries an initial NAS message; The fourth sending module is used to send a second response message to the target AMF when it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, wherein the second response message carries the permanent identifier SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

21. A target AMF, characterized in that: Including transceiver and processor, The processor is used to: In the case where the terminal authentication is successful, determining the first cryptographic algorithm suite according to the algorithm support status of the target AMF; Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ; The transceiver is used for: Send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASint Encrypting and integrity protecting the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate the first cryptographic algorithm suite; The processor is used to: When receiving a NAS security mode establishment completion message sent by the terminal, decrypt the NAS security mode establishment completion message and perform NAS integrity verification; In case that the NAS integrity verification of the NAS security mode establishment completion message is successful, a security mode is established with the terminal.

22. A terminal, characterized in that: Including transceiver and processor, The transceiver is used for: receiving a NAS security mode establishment message sent by a target AMF, where the NAS security mode establishment message carries a first identifier, where the first identifier is used to indicate a first cryptographic algorithm suite; The processor is used to: Decrypt the NAS security mode establishment message and perform NAS integrity verification; Using the first cryptographic algorithm suite, the first K AMF Derived K NASenc and K NASint , the K NASenc is the key used for NAS encryption, the K NASint is a key used for NAS integrity protection, the first K AMF K is shared between the target AMF and the terminal AMF ; The transceiver is used for: If the NAS integrity verification of the NAS security mode establishment message is successful, a NAS security mode establishment complete message is sent to the target AMF, and the K NASenc and the K NASint The NAS security mode establishment completion message is encrypted and integrity protected.

23. A source AMF, characterized in that: Including transceiver and processor, The processor is used to: Upon receiving the first request message sent by the target AMF, query whether there is a security context of the terminal locally according to the global unique temporary identifier GUTI of the terminal carried in the first request message, and the first request message also carries an initial NAS message; The transceiver is used for: When it is found that the security context of the terminal exists locally and the NAS integrity verification of the initial NAS message is successful, a second response message is sent to the target AMF, where the second response message carries the permanent identifier SPUI of the terminal, and the SPUI is used to indicate that the target AMF receives the security context of the terminal.

24. A target AMF, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the security mode establishment method according to any one of claims 1 to 9 are implemented.

25. A terminal, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the security mode establishment method according to claim 10 or 11 are implemented.

26. A source AMF, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the security mode establishment method as described in any one of claims 12 to 17 are implemented.

27. A computer-readable storage medium, characterized in that: A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the security mode establishment method as described in any one of claims 1 to 9 are implemented, or when the computer program is executed by the processor, the steps of the security mode establishment method as described in claim 10 or 11 are implemented, or when the computer program is executed by the processor, the steps of the security mode establishment method as described in any one of claims 12 to 17 are implemented.