CN118803744A - A method, device and medium for establishing a safe mode - Google Patents
A method, device and medium for establishing a safe mode Download PDFInfo
- Publication number
- CN118803744A CN118803744A CN202311099073.6A CN202311099073A CN118803744A CN 118803744 A CN118803744 A CN 118803744A CN 202311099073 A CN202311099073 A CN 202311099073A CN 118803744 A CN118803744 A CN 118803744A
- Authority
- CN
- China
- Prior art keywords
- nas
- amf
- message
- terminal
- security mode
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 123
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 481
- 238000012795 verification Methods 0.000 claims abstract description 75
- 230000004044 response Effects 0.000 claims description 114
- 238000009795 derivation Methods 0.000 claims description 99
- 230000005540 biological transmission Effects 0.000 claims description 31
- 230000008859 change Effects 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 10
- 238000013523 data management Methods 0.000 claims description 4
- 238000004891 communication Methods 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 24
- 230000006870 function Effects 0.000 description 16
- 238000010586 diagram Methods 0.000 description 10
- 238000007726 management method Methods 0.000 description 9
- 238000012545 processing Methods 0.000 description 9
- 230000002093 peripheral effect Effects 0.000 description 6
- 230000000694 effects Effects 0.000 description 4
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 3
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 2
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 2
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 2
- 230000004913 activation Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/04—Key management, e.g. using generic bootstrapping architecture [GBA]
- H04W12/041—Key generation or derivation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/20—Network architectures or network communication protocols for network security for managing network security; network security policies in general
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/03—Protecting confidentiality, e.g. by encryption
- H04W12/033—Protecting confidentiality, e.g. by encryption of the user plane, e.g. user's traffic
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/04—Key management, e.g. using generic bootstrapping architecture [GBA]
- H04W12/043—Key management, e.g. using generic bootstrapping architecture [GBA] using a trusted network node as an anchor
- H04W12/0431—Key distribution or pre-distribution; Key agreement
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/10—Integrity
- H04W12/106—Packet or message integrity
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及通信技术领域,尤其涉及一种安全模式建立方法、设备及介质。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
随着互联网技术快速发展,信息系统的网络安全风险持续增加,威胁挑战日益严峻,密码安全是信息安全的重要基础,可以用于有效保障网络信息系统的数据安全,商用密码是保障网络信息系统的核心技术和重要手段。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.
目前5G通信网络鉴权协议中非接入层(Non-Access Stratum,NAS)的安全模式建立采用的是国际密码算法,通常不兼容商用密码,也不支持其他算法,也不支持算法协商,在兼容度较低的情况下,很难完成不同网络协议下的鉴权认证。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
本发明实施例提供一种安全模式建立方法、设备及介质,能够解决相关技术中安全模式建立过程中密钥兼容度低,而导致不同网络协议下的鉴权认证难度较高的问题。The embodiments of the present invention provide a security mode establishment method, device and medium, which can solve the problem in the related art that the key compatibility is low during the security mode establishment process, resulting in high authentication difficulty under different network protocols.
第一方面,本发明实施例提供了一种安全模式建立方法,应用于目标AMF,所述方法包括: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:
在对终端鉴权认证成功的情况下,根据所述目标AMF的算法支持状态,确定第一密码算法套件;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;
使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;Using the first cryptographic algorithm suite, deriving K NASenc and K NASint through the first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
向所述终端发送NAS安全模式建立消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立消息进行加密和完整性保护,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示所述第一密码算法套件;Sending a NAS security mode establishment message to the terminal, and using the K NASenc and the K NASint to encrypt and integrity protect 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;
在接收所述终端发送的NAS安全模式建立完成消息的情况下,对所述NAS安全模式建立完成消息进行解密,并进行NAS完整性验证;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;
在对所述NAS安全模式建立完成消息的NAS完整性验证成功的情况下,与所述终端建立安全模式。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.
可选地,所述根据所述目标AMF的算法支持状态,确定第一密码算法套件,包括以下任意一项:Optionally, determining the first cryptographic algorithm suite according to the algorithm support status of the target AMF includes any one of the following:
在所述目标AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第一算法标识的情况下,将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第一算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第一算法标识,并将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF不支持多个密码算法套件,将所述目标AMF支持的基础密码算法套件确定为所述第一密码算法套件。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.
可选地,所述根据预设策略,生成NAS层密钥推衍对应的第一算法标识,包括:Optionally, generating a first algorithm identifier corresponding to NAS layer key derivation according to a preset strategy includes:
在所述目标AMF配置有AKA鉴权认证和密钥推衍对应的第二算法标识的情况下,根据所述第二算法标识,生成所述第一算法标识。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.
可选地,所述根据预设策略,生成NAS层密钥推衍对应的第一算法标识之前,所述方法还包括:Optionally, before generating the first algorithm identifier corresponding to the NAS layer key derivation according to the preset strategy, the method further includes:
接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第二算法标识。Receive the second algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.
可选地,所述向所述终端发送NAS安全模式建立消息之后,所述方法还包括:Optionally, after sending the NAS security mode establishment message to the terminal, the method further includes:
对NAS上行链路的传输进行解密。Decrypts NAS uplink transmissions.
可选地,在接收到所述终端发送的NAS安全模式建立完成消息之后,所述方法还包括:Optionally, after receiving the NAS security mode establishment completion message sent by the terminal, the method further includes:
对NAS下行链路的传输进行加密。Encrypt NAS downlink transmission.
可选地,所述方法还包括:Optionally, the method further comprises:
接收终端发送的初始NAS消息,所述初始NAS消息携带所述终端的全球唯一临时标识符GUTI;Receiving an initial NAS message sent by a terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal;
在所述初始NAS消息携带NAS容器,且所述初始消息完整性检验成功的情况下,获取所述终端的安全上下文,所述NAS容器中存储有加密的完整初始NAS消息;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;
使用目标KAMF对所述NAS容器解码,得到所述初始NAS消息;Decoding the NAS container using the target KAMF to obtain the initial NAS message;
向所述终端发送所述初始NAS消息的第一响应消息;Sending a first response message of the initial NAS message to the terminal;
其中,所述目标KAMF为所述第一KAMF或第二KAMF,所述第二KAMF为从所述第一KAMF推衍得到的KAMF。The target KAMF is the first KAMF or the second KAMF , and the second KAMF is a KAMF derived from the first KAMF .
可选地,所述获取所述终端的安全上下文,包括以下任意一项:Optionally, the obtaining the security context of the terminal includes any one of the following:
在根据所述GUTI在本地查询到所述终端的安全上下文的情况下,在本地查询获取所述终端的安全上下文;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;
在根据所述GUTI未在本地查询到所述终端的安全上下文的情况下,向源AMF发送第一请求消息,并在接收到所述源AMF发送的第二响应消息,且所述第二响应消息携带所述终端的永久标识符SPUI的情况下,接收所述源AMF发送的所述终端的安全上下文,所述第一请求消息携带所述GUTI。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.
可选地,所述使用目标KAMF对所述NAS容器解码,得到所述初始NAS消息,包括以下任意一项:Optionally, the using the target KAMF to decode the NAS container to obtain the initial NAS message includes any one of the following:
在所述第二响应消息还携带第二KAMF的情况下,使用所述第二KAMF对所述NAS容器解码,得到所述初始NAS消息。In the case where the second response message also carries the second KAMF , the second KAMF is used to decode the NAS container to obtain the initial NAS message.
在所述第二响应消息未携带第二KAMF的情况下,使用所述第一KAMF对所述NAS容器解码,得到所述初始NAS消息。In a case where the second response message does not carry the second KAMF , the NAS container is decoded using the first KAMF to obtain the initial NAS message.
第二方面,本发明实施例提供了一种全模式建立方法,应用于终端,所述方法包括:In a second aspect, an embodiment of the present invention provides a full-mode establishment method, applied to a terminal, the method comprising:
接收目标AMF发送的NAS安全模式建立消息,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示第一密码算法套件;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;
对所述NAS安全模式建立消息进行解密,并进行NAS完整性验证;Decrypt the NAS security mode establishment message and perform NAS integrity verification;
使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;Using the first cryptographic algorithm suite, deriving K NASenc and K NASint through the first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,向所述目标AMF发送NAS安全模式建立完成消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立完成消息进行加密和完整性保护。If the NAS integrity verification of the NAS security mode establishment message is successful, a NAS security mode establishment completion message is sent to the target AMF, and the NAS security mode establishment completion message is encrypted and integrity protected using the K NASenc and the K NASint .
可选地,所述方法还包括:Optionally, the method further comprises:
在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,对NAS上行链路的传输进行加密,以及对NAS下行链路的传输进行解密。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.
第三方面,本发明实施例提供了一种安全模式建立方法,应用于源AMF,所述方法包括: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:
在接收到目标AMF发送的第一请求消息的情况下,根据所述第一请求消息携带的终端的全球唯一临时标识符GUTI查询到本地是否存在所述终端的安全上下文,所述第一请求消息还携带初始NAS消息;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;
在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI,所述SPUI用于指示所述目标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, 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.
可选地,所述方法还包括:Optionally, the method further comprises:
根据所述源AMF的算法支持状态,确定第二密码算法套件;Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF;
在所述源AMF更改第一KAMF的情况下,使用所述第二密码算法套件,从所述第一KAMF中推衍出第二KAMF;In the case where the source AMF changes the first KAMF , deriving the second KAMF from the first KAMF using the second cryptographic algorithm suite;
其中,所述第二响应消息还携带所述第二KAMF,所述第二KAMF用于对NAS容器中的完整初始NAS消息进行解码。The second response message also carries the second KAMF , and the second KAMF is used to decode the complete initial NAS message in the NAS container.
可选地,所述根据所述源AMF的算法支持状态,确定第二密码算法套件,包括以下任意一项:Optionally, determining the second cryptographic algorithm suite according to the algorithm support status of the source AMF includes any one of the following:
在所述源AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第三算法标识的情况下,将所述第三算法标识所标识的密码算法套件为确定所述第二密码算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第三算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第三算法标识,将所述第三算法标识所标识的密码算法套件为确定所述目标算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF不支持多个密码算法套件,将所述源AMF支持的基础密码算法套件确定为所述第二密码算法套件。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.
可选地,所述根据预设策略,生成NAS层密钥推衍对应的第三算法标识,包括:Optionally, generating a third algorithm identifier corresponding to NAS layer key derivation according to a preset strategy includes:
在所述源AMF配置有AKA鉴权认证和密钥推衍对应的第四算法标识的情况下,根据所述第四算法标识,生成所述第三算法标识。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.
可选地,所述根据预设策略,生成NAS层密钥推衍对应的第三算法标识之前,所述方法还包括:Optionally, before generating, according to a preset strategy, a third algorithm identifier corresponding to NAS layer key derivation, the method further includes:
接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第四算法标识。Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.
可选地,所述方法还包括以下任意一项:Optionally, the method further includes any one of the following:
在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功,且所述源AMF不更改第一KAMF的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI和所述第一KAMF,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文,所述第一KAMF用于对NAS容器中的完整初始NAS消息进行解码;When it is found that the security context of the terminal exists locally, the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first KAMF , the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first KAMF , and the SPUI is used to instruct the target AMF to receive the security context of the terminal, and the first KAMF is used to decode the complete initial NAS message in the NAS container;
在查询到本地不存在所述终端的安全上下文,和/或,对所述初始NAS消息的NAS完整性验证失败的情况下,向所述目标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, 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.
第四方面,本发明实施例提供了一种目标AMF,所述目标AMF包括:In a fourth aspect, an embodiment of the present invention provides a target AMF, wherein the target AMF includes:
第一确定模块,用于在对终端鉴权认证成功的情况下,根据所述目标AMF的算法支持状态,确定第一密码算法套件;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;
第一推衍模块,用于使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;a first derivation module, configured to derive K NASenc and K NASint by using the first cryptographic algorithm suite through a first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
第一发送模块,用于向所述终端发送NAS安全模式建立消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立消息进行加密和完整性保护,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示所述第一密码算法套件;a first sending module, configured to send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASint to encrypt and integrity protect the NAS security mode establishment message, wherein the NAS security mode establishment message carries a first identifier, and the first identifier is used to indicate the first cryptographic algorithm suite;
第一验证模块,用于在接收所述终端发送的NAS安全模式建立完成消息的情况下,对所述NAS安全模式建立完成消息进行解密,并进行NAS完整性验证;A first verification module is used to decrypt the NAS security mode establishment completion message sent by the terminal and perform NAS integrity verification;
第一建立模块,用于在对所述NAS安全模式建立完成消息的NAS完整性验证成功的情况下,与所述终端建立安全模式。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.
可选地,所述第一确定模块用于以下任意一项:Optionally, the first determining module is used for any of the following:
在所述目标AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第一算法标识的情况下,将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第一算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第一算法标识,并将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF不支持多个密码算法套件,将所述目标AMF支持的基础密码算法套件确定为所述第一密码算法套件。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.
可选地,所述第一确定模块用于:Optionally, the first determining module is used to:
在所述目标AMF配置有AKA鉴权认证和密钥推衍对应的第二算法标识的情况下,根据所述第二算法标识,生成所述第一算法标识。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.
可选地,所述目标AMF还包括:Optionally, the target AMF further includes:
第一接收模块,用于接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第二算法标识。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.
可选地,所述目标AMF还包括:Optionally, the target AMF further includes:
第一解密模块,用于对NAS上行链路的传输进行解密。The first decryption module is used to decrypt the transmission of the NAS uplink.
可选地,所述目标AMF还包括:Optionally, the target AMF further includes:
第一加密模块,用于对NAS下行链路的传输进行加密。The first encryption module is used to encrypt the transmission of the NAS downlink.
可选地,所述目标AMF还包括:Optionally, the target AMF further includes:
第二接收模块,用于接收终端发送的初始NAS消息,所述初始NAS消息携带所述终端的全球唯一临时标识符GUTI;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;
第一获取模块,用于在所述初始NAS消息携带NAS容器,且所述初始消息完整性检验成功的情况下,获取所述终端的安全上下文,所述NAS容器中存储有加密的完整初始NAS消息;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;
第一解码模块,用于使用目标KAMF对所述NAS容器解码,得到所述初始NAS消息;A first decoding module, configured to decode the NAS container using a target KAMF to obtain the initial NAS message;
第二发送模块,用于向所述终端发送所述初始NAS消息的第一响应消息;A second sending module, configured to send a first response message of the initial NAS message to the terminal;
其中,所述目标KAMF为所述第一KAMF或第二KAMF,所述第二KAMF为从所述第一KAMF推衍得到的KAMF。The target KAMF is the first KAMF or the second KAMF , and the second KAMF is a KAMF derived from the first KAMF .
可选地,所述第一获取模块用于以下任意一项:Optionally, the first acquisition module is used for any of the following:
在根据所述GUTI在本地查询到所述终端的安全上下文的情况下,在本地查询获取所述终端的安全上下文;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;
在根据所述GUTI未在本地查询到所述终端的安全上下文的情况下,向源AMF发送第一请求消息,并在接收到所述源AMF发送的第二响应消息,且所述第二响应消息携带所述终端的永久标识符SPUI的情况下,接收所述源AMF发送的所述终端的安全上下文,所述第一请求消息携带所述GUTI。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.
可选地,所述第一解码模块用于以下任意一项:Optionally, the first decoding module is used for any of the following:
在所述第二响应消息还携带第二KAMF的情况下,使用所述第二KAMF对所述NAS容器解码,得到所述初始NAS消息。In the case where the second response message also carries the second KAMF , the second KAMF is used to decode the NAS container to obtain the initial NAS message.
在所述第二响应消息未携带第二KAMF的情况下,使用所述第一KAMF对所述NAS容器解码,得到所述初始NAS消息。In a case where the second response message does not carry the second KAMF , the NAS container is decoded using the first KAMF to obtain the initial NAS message.
第五方面,本发明实施例提供了一种终端,所述终端包括:In a fifth aspect, an embodiment of the present invention provides a terminal, the terminal comprising:
第三接收模块,用于接收目标AMF发送的NAS安全模式建立消息,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示第一密码算法套件;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;
第二解密模块,用于对所述NAS安全模式建立消息进行解密,并进行NAS完整性验证;A second decryption module, used to decrypt the NAS security mode establishment message and perform NAS integrity verification;
第二推衍模块,用于使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;a second derivation module, configured to derive K NASenc and K NASint by using the first cryptographic algorithm suite through a first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
第三发送模块,用于在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,向所述目标AMF发送NAS安全模式建立完成消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立完成消息进行加密和完整性保护。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 to encrypt and integrity protect the NAS security mode establishment completion message.
可选地,所述终端还包括:Optionally, the terminal further includes:
第一处理模块,用于在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,对NAS上行链路的传输进行加密,以及对NAS下行链路的传输进行解密。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.
第六方面,本发明实施例提供了一种源AMF,所述源AMF包括:In a sixth aspect, an embodiment of the present invention provides a source AMF, wherein the source AMF includes:
第一查询模块,用于在接收到目标AMF发送的第一请求消息的情况下,根据所述第一请求消息携带的终端的全球唯一临时标识符GUTI查询到本地是否存在所述终端的安全上下文,所述第一请求消息还携带初始NAS消息;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;
第四发送模块,用于在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文。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.
可选地,所述源AMF还包括:Optionally, the source AMF further includes:
第二确定模块,用于根据所述源AMF的算法支持状态,确定第二密码算法套件;A second determination module, configured to determine a second cryptographic algorithm suite according to the algorithm support status of the source AMF;
第三推衍模块,用于在所述源AMF更改第一KAMF的情况下,使用所述第二密码算法套件,从所述第一KAMF中推衍出第二KAMF;a third derivation module, configured to derive a second KAMF from the first KAMF by using the second cryptographic algorithm suite when the source AMF changes the first KAMF ;
其中,所述第二响应消息还携带所述第二KAMF,所述第二KAMF用于对NAS容器中的完整初始NAS消息进行解码。The second response message also carries the second KAMF , and the second KAMF is used to decode the complete initial NAS message in the NAS container.
可选地,所述第二确定模块用于以下任意一项:Optionally, the second determining module is used for any of the following:
在所述源AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第三算法标识的情况下,将所述第三算法标识所标识的密码算法套件为确定所述第二密码算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第三算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第三算法标识,将所述第三算法标识所标识的密码算法套件为确定所述目标算法套件,所述第二响应消息还携带所述第三算法标识;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 to determine the target algorithm suite. The second response message also carries the third algorithm identifier.
在所述源AMF不支持多个密码算法套件,将所述源AMF支持的基础密码算法套件确定为所述第二密码算法套件。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.
可选地,所述第二确定模块用于:Optionally, the second determining module is used to:
在所述源AMF配置有AKA鉴权认证和密钥推衍对应的第四算法标识的情况下,根据所述第四算法标识,生成所述第三算法标识。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.
可选地,所述源AMF还包括:Optionally, the source AMF further includes:
第四接收模块,用于接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第四算法标识。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.
可选地,所述源AMF还包括以下任意一项:Optionally, the source AMF further includes any one of the following:
第二验证模块,用于在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功,且所述源AMF不更改第一KAMF的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI和所述第一KAMF,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文,所述第一KAMF用于对NAS容器中的完整初始NAS消息进行解码;a second verification module, configured to send the second response message to the target AMF when it is found that the security context of the terminal exists locally, the NAS integrity verification of the initial NAS message succeeds, and the source AMF does not change the first KAMF , wherein the second response message carries the SPUI of the terminal and the first KAMF , the SPUI is used to instruct the target AMF to receive the security context of the terminal, and the first KAMF is used to decode the complete initial NAS message in the NAS container;
第五发送模块,用于在查询到本地不存在所述终端的安全上下文,和/或,对所述初始NAS消息的NAS完整性验证失败的情况下,向所述目标AMF发送第二响应消息,所述第二响应消息携带第一指示信息,所述第一指示信息用于指示未查询到终端的安全上下文。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.
第七方面,本发明实施例提供了一种目标AMF,包括收发机和处理器,In a seventh aspect, an embodiment of the present invention provides a target AMF, including a transceiver and a processor,
所述处理器用于:The processor is used to:
在对终端鉴权认证成功的情况下,根据所述目标AMF的算法支持状态,确定第一密码算法套件;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;
使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;Using the first cryptographic algorithm suite, deriving K NASenc and K NASint through the first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
所述收发机用于:The transceiver is used for:
向所述终端发送NAS安全模式建立消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立消息进行加密和完整性保护,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示所述第一密码算法套件;Sending a NAS security mode establishment message to the terminal, and using the K NASenc and the K NASint to encrypt and integrity protect 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:
在接收所述终端发送的NAS安全模式建立完成消息的情况下,对所述NAS安全模式建立完成消息进行解密,并进行NAS完整性验证;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;
在对所述NAS安全模式建立完成消息的NAS完整性验证成功的情况下,与所述终端建立安全模式。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.
可选地,所述处理器用于以下任意一项:Optionally, the processor is used for any of the following:
在所述目标AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第一算法标识的情况下,将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第一算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第一算法标识,并将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF不支持多个密码算法套件,将所述目标AMF支持的基础密码算法套件确定为所述第一密码算法套件。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.
可选地,所述处理器用于:Optionally, the processor is configured to:
在所述目标AMF配置有AKA鉴权认证和密钥推衍对应的第二算法标识的情况下,根据所述第二算法标识,生成所述第一算法标识。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.
可选地,所述收发机还用于:Optionally, the transceiver is further used for:
接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第二算法标识。Receive the second algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.
可选地,所述处理器还用于:Optionally, the processor is further configured to:
对NAS上行链路的传输进行解密。Decrypts NAS uplink transmissions.
可选地,所述处理器还用于:Optionally, the processor is further configured to:
对NAS下行链路的传输进行加密。Encrypt NAS downlink transmission.
可选地,所述收发机还用于:Optionally, the transceiver is further used for:
接收终端发送的初始NAS消息,所述初始NAS消息携带所述终端的全球唯一临时标识符GUTI;Receiving an initial NAS message sent by a terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal;
所述处理器还用于:The processor is further configured to:
在所述初始NAS消息携带NAS容器,且所述初始消息完整性检验成功的情况下,获取所述终端的安全上下文,所述NAS容器中存储有加密的完整初始NAS消息;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;
使用目标KAMF对所述NAS容器解码,得到所述初始NAS消息;Decoding the NAS container using the target KAMF to obtain the initial NAS message;
所述收发机还用于:The transceiver is also used for:
向所述终端发送所述初始NAS消息的第一响应消息;Sending a first response message of the initial NAS message to the terminal;
其中,所述目标KAMF为所述第一KAMF或第二KAMF,所述第二KAMF为从所述第一KAMF推衍得到的KAMF。The target KAMF is the first KAMF or the second KAMF , and the second KAMF is a KAMF derived from the first KAMF .
可选地,所述处理器用于:Optionally, the processor is configured to:
在根据所述GUTI在本地查询到所述终端的安全上下文的情况下,在本地查询获取所述终端的安全上下文;或者,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,
所述收发机用于:The transceiver is used for:
在根据所述GUTI未在本地查询到所述终端的安全上下文的情况下,向源AMF发送第一请求消息,并在接收到所述源AMF发送的第二响应消息,且所述第二响应消息携带所述终端的永久标识符SPUI的情况下,接收所述源AMF发送的所述终端的安全上下文,所述第一请求消息携带所述GUTI。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.
可选地,所述处理器用于以下任意一项:Optionally, the processor is used for any of the following:
在所述第二响应消息还携带第二KAMF的情况下,使用所述第二KAMF对所述NAS容器解码,得到所述初始NAS消息。In the case where the second response message also carries the second KAMF , the second KAMF is used to decode the NAS container to obtain the initial NAS message.
在所述第二响应消息未携带第二KAMF的情况下,使用所述第一KAMF对所述NAS容器解码,得到所述初始NAS消息。In a case where the second response message does not carry the second KAMF , the NAS container is decoded using the first KAMF to obtain the initial NAS message.
第八方面,本发明实施例提供了一种终端,包括收发机和处理器,In an eighth aspect, an embodiment of the present invention provides a terminal, including a transceiver and a processor.
所述收发机用于:The transceiver is used for:
接收目标AMF发送的NAS安全模式建立消息,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示第一密码算法套件;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:
对所述NAS安全模式建立消息进行解密,并进行NAS完整性验证;Decrypt the NAS security mode establishment message and perform NAS integrity verification;
使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;Using the first cryptographic algorithm suite, deriving K NASenc and K NASint through the first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
所述收发机用于:The transceiver is used for:
在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,向所述目标AMF发送NAS安全模式建立完成消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立完成消息进行加密和完整性保护。If the NAS integrity verification of the NAS security mode establishment message is successful, a NAS security mode establishment completion message is sent to the target AMF, and the NAS security mode establishment completion message is encrypted and integrity protected using the K NASenc and the K NASint .
可选地,所述处理器用于:Optionally, the processor is configured to:
在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,对NAS上行链路的传输进行加密,以及对NAS下行链路的传输进行解密。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.
第九方面,本发明实施例提供了一种源AMF,包括收发机和处理器,In a ninth aspect, an embodiment of the present invention provides a source AMF, including a transceiver and a processor,
所述处理器用于:The processor is used to:
在接收到目标AMF发送的第一请求消息的情况下,根据所述第一请求消息携带的终端的全球唯一临时标识符GUTI查询到本地是否存在所述终端的安全上下文,所述第一请求消息还携带初始NAS消息;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:
在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI,所述SPUI用于指示所述目标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, 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.
可选地,所述处理器还用于:Optionally, the processor is further configured to:
根据所述源AMF的算法支持状态,确定第二密码算法套件;Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF;
在所述源AMF更改第一KAMF的情况下,使用所述第二密码算法套件,从所述第一KAMF中推衍出第二KAMF;In the case where the source AMF changes the first KAMF , deriving the second KAMF from the first KAMF using the second cryptographic algorithm suite;
其中,所述第二响应消息还携带所述第二KAMF,所述第二KAMF用于对NAS容器中的完整初始NAS消息进行解码。The second response message also carries the second KAMF , and the second KAMF is used to decode the complete initial NAS message in the NAS container.
可选地,所述处理器用于以下任意一项:Optionally, the processor is used for any of the following:
在所述源AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第三算法标识的情况下,将所述第三算法标识所标识的密码算法套件为确定所述第二密码算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第三算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第三算法标识,将所述第三算法标识所标识的密码算法套件为确定所述目标算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF不支持多个密码算法套件,将所述源AMF支持的基础密码算法套件确定为所述第二密码算法套件。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.
可选地,所述处理器用于:Optionally, the processor is configured to:
在所述源AMF配置有AKA鉴权认证和密钥推衍对应的第四算法标识的情况下,根据所述第四算法标识,生成所述第三算法标识。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.
可选地,所述收发机还用于:Optionally, the transceiver is further used for:
接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第四算法标识。Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.
可选地,所述收发机还用于以下任意一项:Optionally, the transceiver is further used for any of the following:
在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功,且所述源AMF不更改第一KAMF的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI和所述第一KAMF,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文,所述第一KAMF用于对NAS容器中的完整初始NAS消息进行解码;When it is found that the security context of the terminal exists locally, the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first KAMF , the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first KAMF , and the SPUI is used to instruct the target AMF to receive the security context of the terminal, and the first KAMF is used to decode the complete initial NAS message in the NAS container;
在查询到本地不存在所述终端的安全上下文,和/或,对所述初始NAS消息的NAS完整性验证失败的情况下,向所述目标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, 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.
第十方面,本发明实施例提供了一种目标AMF,包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序,所述程序被所述处理器执行时实现如第一方面所述的安全模式建立方法的步骤。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.
第十一方面,本发明实施例提供了一种终端,包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序,所述程序被所述处理器执行时实现如第二方面所述的安全模式建立方法的步骤。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.
第十二方面,本发明实施例提供了一种源AMF,包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序,所述程序被所述处理器执行时实现如第三方面所述的安全模式建立方法的步骤。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.
第十三方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如第一方面所述的安全模式建立方法的步骤,或所述计算机程序被处理器执行时实现如第二方面所述的安全模式建立方法的步骤,或所述计算机程序被处理器执行时实现如第三方面所述的安全模式建立方法的步骤。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.
在本发明实施例中,在原有3GPP 5G NAS安全模式建立协议的基础上,可以根据网络和终端的算法支持状态,支持多种算法,支持密钥推衍的算法协商,自适应兼容商密和国际密码算法,提高了NAS密钥的兼容度,能够适配更多不同网络协议下的鉴权认证。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
为了更清楚地说明本发明实施例的技术方案,下面将对本发明实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。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.
图1是本发明实施例提供的一种安全模式建立方法的流程示意图之一;FIG1 is a flow chart of a method for establishing a security mode according to an embodiment of the present invention;
图2是本发明实施例提供的一种安全模式建立方法的流程示意图之二;FIG2 is a second flow chart of a method for establishing a security mode provided in an embodiment of the present invention;
图3是本发明实施例提供的一种安全模式建立方法的流程示意图之三;FIG3 is a third flow chart of a method for establishing a security mode provided in an embodiment of the present invention;
图4是本发明实施例提供的一种算法标识XX_AS的结构示意图;FIG4 is a schematic diagram of the structure of an algorithm identifier XX_AS provided in an embodiment of the present invention;
图5是本发明实施例提供的一种NAS安全模式建立的交互示意图之一;FIG5 is one of interactive schematic diagrams of establishing a NAS security mode provided by an embodiment of the present invention;
图6是本发明实施例提供的一种NAS安全模式建立的交互示意图之二;FIG6 is a second interactive schematic diagram of establishing a NAS security mode provided by an embodiment of the present invention;
图7是本发明实施例提供的一种目标AMF的结构示意图之一;FIG7 is a schematic diagram of a structure of a target AMF provided by an embodiment of the present invention;
图8是本发明实施例提供的一种终端的结构示意图之一;FIG8 is one of the structural schematic diagrams of a terminal provided by an embodiment of the present invention;
图9是本发明实施例提供的一种源AMF的结构示意图之一;FIG9 is a schematic diagram of a structure of a source AMF provided by an embodiment of the present invention;
图10是本发明实施例提供的一种目标AMF的结构示意图之二;FIG10 is a second schematic diagram of the structure of a target AMF provided in an embodiment of the present invention;
图11是本发明实施例提供的一种终端的结构示意图之二;11 is a second schematic diagram of the structure of a terminal provided in an embodiment of the present invention;
图12是本发明实施例提供的一种源AMF的结构示意图之二。FIG. 12 is a second schematic diagram of the structure of a source AMF provided in an embodiment of the present invention.
具体实施方式DETAILED DESCRIPTION
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。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.
本发明实施例提出一种安全模式建立方法,能够解决相关技术中密码算法,兼容度较低,较难完成不同网络协议下的鉴权认证的问题。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.
请参见图1,图1是本发明实施例提供的一种安全模式建立方法的流程示意图之一,应用于目标认证管理功能(Authentication Management Function,AMF)。上述目标AMF可以理解为第三代移动通讯网络的认证与密钥协商协议(Authentication and KeyAgreement,AKA)中当前与终端交互的AMF。Please refer to Figure 1, which is one of the flow diagrams of a method for establishing a security mode provided by an embodiment of the present invention, which 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.
如图1所示,安全模式建立方法包括以下步骤:As shown in FIG1 , the security mode establishment method includes the following steps:
步骤101、在对UE鉴权认证成功的情况下,根据目标AMF的算法支持状态,确定第一密码算法套件。Step 101: When the UE is authenticated successfully, determine the first cryptographic algorithm suite according to the algorithm support status of the target AMF.
本发明实施例中,5G AKA协议完成后,UE和目标AMF之间需要进行NAS安全模式建立(Security Mode Command,SMC)过程。NAS SMC用于建立UE和AMF之间的NAS安全上下文。此过程包括目标AMF和UE之间的往返消息。在原有3GPP 5G NAS安全模式建立协议的基础上,目标AMF可以根据自身的算法支持状态,确定对应的第一密码算法套件,来支持密钥推衍的算法协商。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.
具体实现时,可以对目标AMF进行改造升级,已升级设备可生成对应的算法标识,算法标识用于标识所支持的算法套件,已升级设备也可识别其他设备的算法标识。算法标识的实现形式在此不作限定,具体可以表示为XX_AS,例如,AKA_AS可以用于标识AKA鉴权认证和密钥推衍采用的密码算法套件;或者,NAS_AS可以用于标识NAS层密钥推衍采用的密码算法套件。上述算法标识的实现形式通常可以为字符串,该字符串一般为索引值,用于在数据库中查询对应的密码算法套件。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.
步骤102、使用第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,KNASenc为用于NAS加密的密钥,KNASint为用于NAS完整性保护的密钥,第一KAMF为目标AMF与终端之间共享的KAMF。Step 102: Use the first cryptographic algorithm suite to derive K NASenc and K NASint through the first KAMF , where K NASenc is a key for NAS encryption, K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal.
具体实现时,步骤102包括以下任意一项实施方式:In specific implementation, step 102 includes any one of the following implementation modes:
实施方式一、在目标AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第一算法标识的情况下,将第一算法标识所标识的密码算法套件确定为第一密码算法套件。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.
本实施方式中,NAS层密钥推衍对应的第一算法标识可以理解为目标AMF对应生成的NAS_AS标识,若目标AMF支持多个密码算法套件,且生成了NAS_AS标识,则可以根据NAS_AS标识指定的密码算法套件,确定第一密码算法套件。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.
实施方式二、在目标AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第一算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第一算法标识,并将第一算法标识所标识的密码算法套件确定为第一密码算法套件。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.
本实施方式中,NAS层密钥推衍对应的第一算法标识可以理解为目标AMF对应生成的NAS_AS标识,若目标AMF支持多个密码算法套件,但未生成NAS_AS标识,则可以根据预设策略,生成NAS_AS标识,并根据NAS_AS标识指定的密码算法套件,确定第一密码算法套件。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.
具体实现时,上述预设策略可以包括:在目标AMF配置有AKA鉴权认证和密钥推衍对应的第二算法标识,即生成了AKA_AS标识的情况下,根据AKA_AS标识指定的密码算法套件,确定第一密码算法套件。本实施方式中,在5G AKA鉴权过程中,用户数据管理(UnifiedData Management,UDM)会根据网络侧设备和终端,例如移动设备(Mobile Equipment,ME)、安全锚点功能(Security Anchor Function,SEAF)、鉴权服务功能(AuthenticationServer Function,AUSF)等设备的算法支持状态,根据策略选择或者协商确定网络侧设备和终端所支持的密码算法套件,并生成对应的AKA_AS。UDM可以将AKA_AS下发到上述网络侧设备和终端。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.
实施方式三、在目标AMF不支持多个密码算法套件,将目标AMF支持的基础密码算法套件确定为第一密码算法套件。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.
本实施方式中,若目标AMF不支持多个密码算法套件,且未生成有NAS_AS标识或AKA_AS标识,则表示目标AMF未进行本发明实施例所涉及的升级改造,则目标AMF可以使用默认的基础密码算法套件作为第一密码算法套件。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.
参照上述说明,如果目标AMF存在NAS_AS标识,则使用NAS_AS指定的密码算法套件,通过第一KAMF推衍出KNASenc和KNASint。如果目标AMF不存在NAS_AS标识,则根据策略选择NAS层使用的密码算法套件,生成NAS_AS,一种可选的方式为:如果目标AMF存在AKA_AS标识,则将NAS_AS设置为AKA_AS,否则将NAS_AS设置为默认的基础密码算法套件1,再使用NAS_AS指定的密码算法套件,通过第一KAMF推衍出KNASenc和KNASint。Referring to the above description, if the target AMF has a NAS_AS identifier, the cryptographic algorithm suite specified by NAS_AS is used to derive K NASenc and K NASint through the first K AMF . If 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 to derive K NASenc and K NASint through the first K AMF .
步骤103、向UE发送NAS安全模式建立消息,并使用KNASenc和KNASint对NAS安全模式建立消息进行加密和完整性保护,NAS安全模式建立消息携带第一标识,第一标识用于指示第一密码算法套件。Step 103: Send a NAS security mode establishment message to the UE, and use K NASenc and K NASint to encrypt and integrity protect the NAS security mode establishment message, where the NAS security mode establishment message carries a first identifier, and the first identifier is used to indicate a first cryptographic algorithm suite.
具体实现时,目标AMF成功验证UE后,目标AMF应发送NAS安全模式建立消息,并使用KNASenc和KNASint对NAS安全模式建立消息进行加密和完整性保护。NAS安全模式建立消息可以携带以下信息:重放的UE安全功能、选定的NAS算法、以及用于识别KAMF的密钥标识,例如ngKSI。NASSMC消息还可包含:K_AMF_change_flag(在3GPP TS24.501中规定的附加5G安全参数IE中携带)以指示新计算的KAMF、请求完整初始NAS消息的flag、架构间反降级攻击参数(ABBA)。在移动性注册更新过程中或在同一PLMN中多次注册过程中水平推衍KAMF时,应在NAS安全模式建立消息中包含K_AMF_change_flag。根据NAS安全模式建立消息中用于识别KAMF的密钥标识所指示的KAMF,应使用基于该KAMF的NAS完整性密钥KNASint对该消息进行完整性保护(但不加密)。若网络支持使用网络节点(Mobility Management Entity,MME)和AMF之间的N26接口进行互通,目标AMF还应在NAS安全模式建立消息中包含移动到演进的分组系统(Evolved Packet System,EPS)之后使用的所选EPS NAS算法。UE应保存移动到EPS后使用的算法。AMF应在UE安全上下文中保存选定的EPS算法。In specific implementation, after the target AMF successfully authenticates the UE, the target AMF shall send a NAS security mode establishment message and encrypt and integrity protect the NAS security mode establishment message using K NASenc and K NASint . The NAS security mode establishment message may carry the following information: the replayed UE security functions, the selected NAS algorithm, and the key identifier used to identify the KAMF , such as ngKSI. 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 KAMF , the flag requesting a complete initial NAS message, and the inter-architecture anti-downgrade attack parameter (ABBA). When the KAMF is horizontally derived during the mobility registration update process or during multiple registrations in the same PLMN, the K_AMF_change_flag shall be included in the NAS security mode establishment message. According to the KAMF indicated by the key identifier used to identify the KAMF in the NAS security mode establishment message, the message shall be integrity protected (but not encrypted) using the NAS integrity key K NASint based on the KAMF . 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.
本发明实施例中,目标AMF向UE发送的NAS安全模式建立消息可以携带目标AMF的NAS_AS标识。具体实现时,NAS_AS标识可作为新增参数,也可以使用消息中的预留字段等。AMF的NAS上行链路解密可以在发送NAS安全模式建立消息后开启。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.
UE在接收到NAS安全模式建立消息后,可以对NAS安全模式建立消息解密并进行完整性验证。具体可以包括:检查目标AMF发送的安全能力是否与存储在UE中的安全能力相匹配,以确保攻击者不会修改这些安全能力,并使用NAS安全模式建立消息中指示的NAS完整性算法和由ngKSI指示的基于KAMF的NAS完整性密钥来验证完整性。After receiving the NAS security mode establishment message, the UE can decrypt the NAS security mode establishment message and perform integrity verification. Specifically, it can include: checking whether the security capabilities sent by the target AMF match the security capabilities stored in the UE to ensure that attackers do not modify these security capabilities, and using the NAS integrity algorithm indicated in the NAS security mode establishment message and the NAS integrity key based on K AMF indicated by ngKSI to verify the integrity.
需要说明的是,若NAS安全模式建立消息包括K_AMF_change_flag,UE应生成一个新的KAMF并将NAS COUNT设为零。若NAS安全模式建立消息的完整性验证成功,UE应使用ngKSI指示的安全上下文进行NAS完整性保护和加/解密。本发明实施例中,如果UE为升级改造的设备,则可以从NAS安全模式建立消息中识别并保存使用NAS_AS指定的密码算法套件,通过第一KAMF推衍出KNASenc和KNASint。如果UE为未升级改造的设备,则使用默认的基础密码算法套件,通过第一KAMF推衍出KNASenc和KNASint。It should be noted that if the NAS security mode establishment message includes K_AMF_change_flag, the UE should generate a new KAMF and set NAS COUNT to zero. If the integrity verification of the NAS security mode establishment message is successful, the UE should use the security context indicated by ngKSI for NAS integrity protection and encryption/decryption. In an embodiment of the present invention, if the UE is an upgraded device, the cryptographic algorithm suite specified by NAS_AS can be identified and saved from the NAS security mode establishment message, and KNASenc and KNASint are derived through the first KAMF . If the UE is a non-upgraded device, the default basic cryptographic algorithm suite is used, and KNASenc and KNASint are derived through the first KAMF .
在UE对NAS安全模式建立消息的完整性验证成功的情况下,UE可以向目标AMF发送加密的、受完整性保护的NAS安全模式建立完成消息,具体可以使用KNASenc和所述KNASint对NAS安全模式建立完成消息进行加密和完整性保护,此后,UE开启NAS上行链路的传输加密和NAS下行链路的传输解密。若目标AMF在NAS SMC消息中请求永久设备标识符(PermanentEquipment Identifier,PEI),那么UE发送的NAS安全模式建立完成消息也可以携带PEI。若执行KAMF水平推衍,AMF应将NAS COUNT设置为零。UE可包含完整初始NAS消息。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 completion message to the target AMF. Specifically, the NAS security mode establishment completion message can be encrypted and integrity-protected using K NASenc and the K NASint . Thereafter, the UE turns on the transmission encryption of the NAS uplink and the transmission decryption of the NAS downlink. If the target AMF requests a permanent equipment identifier (PEI) in the NAS SMC message, the NAS security mode establishment completion message sent by the UE can also carry the PEI. If K AMF horizontal derivation is performed, the AMF shall set NAS COUNT to zero. The UE may include a complete initial NAS message.
若UE对NAS安全模式建立消息的完整性验证失败的情况下,UE可以返回NAS安全模式拒绝消息。NAS安全模式拒绝消息和所有后续NAS消息应使用先前(如果有)的5G NAS安全上下文进行保护。若NAS安全模式拒绝消息之前不存在5G NAS安全上下文,NAS安全模式拒绝消息将不受保护。需要说明的是,若上行链路NAS COUNT通过发送NAS安全模式拒绝消息重置,UE释放NAS连接,而不发送NAS安全模式拒绝消息。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.
步骤104、在接收UE发送的NAS安全模式建立完成消息的情况下,对NAS安全模式建立完成消息进行解密,并进行NAS完整性验证。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.
具体实现时,目标AMF在接收到UE发送的NAS安全模式建立完成消息后,可以对NAS安全模式建立完成消息进行解密并验证其完整性。AMF的NAS下行链路加密应在接收到NAS安全模式建立完成消息后通过此安全上下文开启。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.
步骤105、在对NAS安全模式建立完成消息的NAS完整性验证成功的情况下,与终端建立安全模式。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.
具体实现时,目标AMF的NAS下行链路加密应在接收到NAS安全模式建立完成消息后通过安全上下文开启。需要说明的是,目标AMF若成功验证NAS安全模式建立完成消息,可以表征目标AMF已成功确认来自归属网的SUPI与UE使用的SUPI相匹配。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.
需要说明的是,在UE与目标AMF进行安全模式建立之前,UE与目标AMF之间还可以建立初始NAS消息的保护机制。具体说明如下: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:
在一可选实施方式中,方法还包括以下步骤:In an optional embodiment, the method further comprises the following steps:
接收终端发送的初始NAS消息,初始NAS消息携带终端的全球唯一临时标识符GUTI;An initial NAS message sent by a receiving terminal carries a globally unique temporary identifier GUTI of the terminal;
在初始NAS消息携带NAS容器,且初始消息完整性检验成功的情况下,获取终端的安全上下文,NAS容器中存储有加密的完整初始NAS消息;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;
使用目标KAMF对NAS容器解码,得到初始NAS消息;Use the target K AMF to decode the NAS container and obtain the initial NAS message;
向终端发送初始NAS消息的第一响应消息;Sending a first response message of an initial NAS message to the terminal;
其中,目标KAMF为第一KAMF或第二KAMF,第二KAMF为从第一KAMF推衍得到的KAMF。The target KAMF is the first KAMF or the second KAMF , and the second KAMF is the KAMF derived from the first KAMF .
具体实现时,UE可以将初始NAS消息发送给目标AMF。In specific implementation, the UE can send the initial NAS message to the target AMF.
情况一、若UE没有NAS安全上下文,则初始NAS消息可以仅携带明文信息元素(Information Element,IE),具体可以包括但不限于:用户标识符(如SUCI或GUTI)、UE安全能力、S-NSSAI、ngKSI、UE从EPC移动到5G的指示,额外GUTI、包含从长期演进(Long TermEvolution,LTE)移动至5G新空口(New Radio,NR)的跟踪区更新(Tracking AreaIdentity,TAU)请求的IE。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).
情况二、若UE有NAS安全上下文,则初始NAS消息不仅可以携带上述明文发送的IEs,还可以携带完整的初始NAS消息,上述初始NAS消息可以在NAS容器中进行加密,且发送的消息应受到完整性保护。目标AMF在接收到初始NAS消息,将根据初始NAS消息中携带的用户标识符GUTI确认UE是否存在安全上下文。换言之,若初始NAS消息携带NAS容器,则表征当前UE存在安全上下文。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.
目标AMF可以先在本地查询是否存在UE的安全上下文,若初始NAS消息受到保护且目标AMF在本地查询到具有相同的安全上下文的情况下,目标AMF可以直接向UE返回初始NAS消息的响应消息。若本地不存在UE的安全上下文,可在历史AMF,在此记为源AMF处查询是否存在UE的安全上下文。具体实现如下: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:
目标AMF可以根据UE的5G-GUTI来识别源AMF,从源AMF获取安全上下文。具体的,目标AMF可以向源AMF发送第一请求消息,第一请求消息可以携带5G-GUTI和从UE接收到的初始NAS消息。源AMF在接收到第一请求消息的情况下,可以搜索数据库中UE的数据,并检查注册请求消息的完整性保护。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.
(1)如果找到UE并且完整性保护检查成功,即在查询到本地存在UE的安全上下文,且对初始NAS消息的NAS完整性验证成功的情况下,可以向目标AMF发送第二响应消息,第二响应消息携带UE的SPUI,用于指示目标AMF接收UE的安全上下文。此外,源AMF在查询到本地存在UE的安全上下文,且对初始NAS消息的NAS完整性验证成功的情况下,还可以分为以下两种情况进行分别处理:(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:
情况一,当源AMF根据其本地策略不更改KAMF时,源AMF将向目标AMF发回第二响应消息,第二响应消息可以携带SUPI,以及可能携带其拥有的任何当前5G安全上下文。In case 1, when the source AMF does not change the KAMF according to its local policy, the source AMF will send a second response message back to the target AMF. The second response message may carry the SUPI and possibly any current 5G security context it has.
情况二,当源AMF根据其本地策略更改KAMF时,源AMF将向目标AMF发回第二响应消息,第二响应消息可以携带SUPI,keyAmfHDerivationInd,以及可能携带其拥有的当前5G安全上下文推衍出的一个新的5G安全上下文,即基于当前KAMF推衍出的一个新的KAMF。需要说明的是,源AMF可以根据自身的算法支持状态,确定第二密码算法套件来完成上述步骤。具体的,如果源AMF存在NAS_AS标识,则使用NAS_AS指定的密码算法套件,从第一KAMF推衍出新的KAMF。如果源AMF不存在NAS_AS标识,则根据策略选择NAS层使用的密码算法套件,生成NAS_AS,一种可选的方式为:如果源AMF存在AKA_AS标识,则将NAS_AS设置为AKA_AS,否则将NAS_AS设置为默认的基础密码算法套件,再使用NAS_AS指定的密码算法套件,从第一KAMF推衍出新的KAMF。此情况下,源AMF发送给目标AMF的第二响应消息中携带NAS_AS标识和新的KAMF,在此记为第二KAMF。源AMF随后可以删除它所拥有的5G安全上下文。Case 2: When the source AMF changes the KAMF according to its local policy , 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, a new KAMF derived based on the current KAMF . 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 to derive a new KAMF from the first KAMF . If the source 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 source 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, and then the cryptographic algorithm suite specified by NAS_AS is used to derive a new KAMF from the first KAMF . In this case, the second response message sent by the source AMF to the target AMF carries the NAS_AS identifier and the new KAMF , which is referred to as the second KAMF . The source AMF can then delete the 5G security context it owns.
(2)如果源AMF无法识别UE,和/或,完整性保护检查失败,则源AMF应发送指示无法检索到临时标识为5G-GUTI的第一指示信息,第一指示信息可以携带在第二响应消息中。(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.
如果目标AMF收到携带有SUPI的响应消息,则表征源AMF查询到了UE的安全上下文,目标AMF可以将创建一个条目并存储可能已接收到的、后续可能接收到的5G安全上下文。若收到的响应消息还携带第二KAMF,目标AMF可以存储NAS_AS和第二KAMF。If the target AMF receives a response message carrying SUPI, it indicates that the source AMF has queried the security context of the UE, and the target AMF can create an entry and store the 5G security context that may have been received and may be received later. If the received response message also carries the second KAMF , the target AMF can store NAS_AS and the second KAMF .
如果目标AMF和源AMF均未查询到UE的安全上下文,和/或,对初始NAS消息的完整性检验失败,目标AMF应启动与UE的认证过程。5G AKA协议完成后,UE和访问网络AMF/SEAF之间完成了鉴权认证,并共享了KSEAF,并通过KSEAF推演出KAMF用于UE和AMF之间安全交互。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 and authorization are completed between the UE and the access network AMF/SEAF, and K SEAF is shared. K AMF is derived from K SEAF for secure interaction between the UE and AMF.
在目标AMF对UE鉴权认证成功的情况下,可以执行上述步骤101至步骤105的实施例,在此不再赘述。至此,UE和目标AMF之间完成了NAS消息加密和完整性保护功能激活。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.
本发明实施例中,在原有3GPP 5G NAS安全模式建立协议的基础上,可以根据网络和终端的算法支持状态,支持多种算法,支持密钥推衍的算法协商,自适应兼容商密和国际密码算法,提高了NAS密钥的兼容度,能够适配更多不同网络协议下的鉴权认证。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.
请参见图2,图2是本发明实施例提供的一种安全模式建立方法的流程示意图之二,应用于终端(UE)。如图4所示,安全模式建立方法包括以下步骤:Please refer to Figure 2, which is a flow chart of a second method for establishing a security mode provided by an embodiment of the present invention, which is applied to a terminal (UE). As shown in Figure 4, the method for establishing a security mode includes the following steps:
步骤201、接收目标AMF发送的NAS安全模式建立消息,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示第一密码算法套件;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;
步骤202、对所述NAS安全模式建立消息进行解密,并进行NAS完整性验证;Step 202: decrypt the NAS security mode establishment message and perform NAS integrity verification;
步骤203、使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;Step 203: Use the first cryptographic algorithm suite to derive K NASenc and K NASint through the first KAMF , where K NASenc is a key for NAS encryption, K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
步骤204、在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,向所述目标AMF发送NAS安全模式建立完成消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立完成消息进行加密和完整性保护。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 to encrypt and integrity protect the NAS security mode establishment completion message.
可选地,所述方法还包括:Optionally, the method further comprises:
在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,对NAS上行链路的传输进行加密,以及对NAS下行链路的传输进行解密。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.
需要说明的是,本实施例作为与上述方法实施例中终端对应的实施方式,其具体的实施方式可以参见上述方法实施例中的相关说明,为避免重复说明,本实施例不再赘述。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.
请参见图3,图3是本发明实施例提供的一种安全模式建立方法的流程示意图之三,应用于源AMF。上述源AMF可以理解为与UE交互的历史AMF。Please refer to Figure 3, which is a flowchart of a method for establishing a security mode provided by an embodiment of the present invention, which is applied to the source AMF. The above-mentioned source AMF can be understood as a historical AMF interacting with the UE.
如图3所示,安全模式建立方法包括以下步骤:As shown in FIG3 , the security mode establishment method includes the following steps:
步骤301、在接收到目标AMF发送的第一请求消息的情况下,根据所述第一请求消息携带的终端的全球唯一临时标识符GUTI查询到本地是否存在所述终端的安全上下文,所述第一请求消息还携带初始NAS消息;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;
步骤302、在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文。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.
可选地,所述方法还包括:Optionally, the method further comprises:
根据所述源AMF的算法支持状态,确定第二密码算法套件;Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF;
在所述源AMF更改第一KAMF的情况下,使用所述第二密码算法套件,从所述第一KAMF中推衍出第二KAMF;In the case where the source AMF changes the first KAMF , deriving the second KAMF from the first KAMF using the second cryptographic algorithm suite;
其中,所述第二响应消息还携带所述第二KAMF,所述第二KAMF用于对NAS容器中的完整初始NAS消息进行解码。The second response message also carries the second KAMF , and the second KAMF is used to decode the complete initial NAS message in the NAS container.
可选地,所述根据所述源AMF的算法支持状态,确定第二密码算法套件,包括以下任意一项:Optionally, determining the second cryptographic algorithm suite according to the algorithm support status of the source AMF includes any one of the following:
在所述源AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第三算法标识的情况下,将所述第三算法标识所标识的密码算法套件为确定所述第二密码算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第三算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第三算法标识,将所述第三算法标识所标识的密码算法套件为确定所述目标算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF不支持多个密码算法套件,将所述源AMF支持的基础密码算法套件确定为所述第二密码算法套件。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.
可选地,所述根据预设策略,生成NAS层密钥推衍对应的第三算法标识,包括:Optionally, generating a third algorithm identifier corresponding to NAS layer key derivation according to a preset strategy includes:
在所述源AMF配置有AKA鉴权认证和密钥推衍对应的第四算法标识的情况下,根据所述第四算法标识,生成所述第三算法标识。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.
可选地,所述根据预设策略,生成NAS层密钥推衍对应的第三算法标识之前,所述方法还包括:Optionally, before generating, according to a preset strategy, a third algorithm identifier corresponding to NAS layer key derivation, the method further includes:
接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第四算法标识。Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.
可选地,所述方法还包括以下任意一项:Optionally, the method further includes any one of the following:
在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功,且所述源AMF不更改第一KAMF的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI和所述第一KAMF,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文,所述第一KAMF用于对NAS容器中的完整初始NAS消息进行解码;When it is found that the security context of the terminal exists locally, the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first KAMF , the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first KAMF , and the SPUI is used to instruct the target AMF to receive the security context of the terminal, and the first KAMF is used to decode the complete initial NAS message in the NAS container;
在查询到本地不存在所述终端的安全上下文,和/或,对所述初始NAS消息的NAS完整性验证失败的情况下,向所述目标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, 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.
需要说明的是,本实施例作为与上述方法实施例中源AMF对应的实施方式,其具体的实施方式可以参见上述方法实施例中的相关说明,为避免重复说明,本实施例不再赘述。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.
下面对本发明实施例的一种具体实施方式进行说明:A specific implementation of an embodiment of the present invention is described below:
需要说明的是,本实施方式中,已升级设备是指已经按照本发明实施例所涉及的方案实现的设备,包括但不限于UE、SEAF、AMF,可以支持多个密码算法套件,例如,包括密码算法套件1,密码算法套件2,密码算法套件3等。一般来说,所有设备都支持一个基础密码算法套件,这里定义为密码算法套件1,例如在5G中是采用国际密码算法AES-128和SHA-256。未升级设备是指按照已有3GPP标准实现的设备,支持一个基础密码算法套件。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.
本实施方式中,相关网元和设备的密码算法支持状态,表示该网元和设备在鉴权认证和密钥推衍中所支持的算法。已升级设备可生成对应的算法标识XX_AS,也可识别其他设备的算法标识XX_AS。未升级设备可能无法生成XX_AS,也可能无法识别其他设备的XX_AS。如果XX_AS不存在表示该设备XX是未升级设备,只支持密码算法套件1。AKA_AS表示AKA鉴权认证和密钥推衍采用的密码算法套件,一般为索引值。NAS_AS表示NAS层密钥推衍采用的密码算法套件,一般为索引值。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.
XX_AS的实现方式包括但不限于以下两种:The implementation methods of XX_AS include but are not limited to the following two:
第一种,算法列表形式。具体的,XX_AS由两部分组成,一部分是支持的加密算法列表(EAS),另一部分是支持的哈希算法列表(IAS)。其中,支持的加密算法列表(EAS),示例性地,可以用bit位数组标记所有可使用的加密密码算法,例如,第0位表示是否支持加密算法1(比如高级加密标准(Advanced Encryption Standard,AES)等),第1位表示是否支持加密算法2(比如SM4等)等。若某bit位为1表示支持对应的算法,为0表示不支持对应的算法。支持的哈希算法列表(IAS),示例性地,可以用bit位数组标记所有可使用的哈希密码算法(包括HASH算法和对应的HMAC算法),比如第0位表示是否支持哈希算法1(比如SHA256和HMAC_SHA256等),第1位表示是否支持哈希算法2(比如SM3和HMAC_SM3等)。若某bit位为1表示支持对应的算法,为0表示不支持对应的算法。示例性的,如图4所示。The first is the algorithm list form. 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 0 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 0 means that the corresponding algorithm is not supported. For example, see FIG4 .
第二种,单bit形式。XX_AS可以使用1个bit位来表示:1表示支持商密,0表示不支持商密。采用该方式只可以支持2种密码算法协商,该方式可以降低升级改造难度。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.
本实施方式具体实现如下:This implementation is specifically implemented as follows:
一、初始NAS消息的保护机制1. Protection mechanism of initial NAS message
初始NAS消息是在UE从空闲状态转换之后发送的第一个NAS消息,其具体流程如图5所示。The initial NAS message is the first NAS message sent after the UE transitions from the idle state, and its specific process is shown in FIG5 .
步骤1:UE应将初始消息发送给目标AMF。若UE没有NAS安全上下文,则初始NAS消息应仅包含明文IE,即用户标识符(如SUCI或GUTI)、UE安全能力、S-NSSAI、ngKSI、UE从EPC移动到5G的指示,额外GUTI、包含从LTE移动至NR的TAU请求的IE。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.
若UE有NAS安全上下文,发送的消息应包含其中上述明文发送的信息和完整的初始NAS消息,初始NAS消息在NAS容器中进行加密,且发送的消息应受到完整性保护。在初始消息受到保护且目标AMF具有相同的安全上下文的情况下,可省略下述步骤2到4。此时目标AMF应对NAS容器中的完整初始NAS消息进行响应。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.
目标AMF根据UE的5G-GUTI来识别是否需要从源AMF获取安全上下文,如果不需要则忽略步骤2a。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.
步骤2a:目标AMF从根据UE的5G-GUTI来识别源AMF,从源AMF获取安全上下文: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:
(1)目标AMF向源AMF发送消息,该消息包含5G-GUTI和接收到的注册请求消息。(1) The target AMF sends a message to the source AMF, which contains the 5G-GUTI and the received registration request message.
(2)源AMF搜索数据库中UE的数据,并检查注册请求消息的完整性保护。(2) The source AMF searches the UE’s data in the database and checks the integrity protection of the Registration Request message.
a.如果找到UE并且完整性保护检查成功,当源AMF根据其本地策略不更改KAMF时,源AMF将发回响应消息:应包括SUPI,可能包括它拥有的任何当前5G安全上下文。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.
b.如果找到UE并且完整性保护检查成功,当源AMF根据其本地策略更改KAMF时,源AMF将发送响应消息:应包括SUPI,keyAmfHDerivationInd,可能包括由它所拥有的当前5G安全上下文推衍出的一个新的5G安全上下文。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.
需要说明的是,步骤b中,如果源AMF为未升级设备,则使用密码算法套件1执行;如果源AMF为已升级设备,则进行以下处理:如果NAS_AS存在,则使用NAS_AS指定的密码算法套件从KAMF推衍出新的KAMF。如果NAS_AS不存在,则根据策略选择NAS层使用的密码算法套件,生成NAS_AS。例如:判断如果AKA_AS存在,则将NAS_AS设置为AKA_AS,使用AKA_AS指定的密码算法套件从KAMF推衍出新的KAMF。否则将NAS_AS设置为密码算法套件1,使用密码算法套件1从KAMF推衍出新的KAMF。之后,源AMF可以将NAS_AS以及新的KAMF等发送给目标AMF,并删除它所拥有的5G安全上下文。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 to derive a new KAMF from KAMF . 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 a new KAMF is derived from KAMF using the cryptographic algorithm suite specified by AKA_AS. Otherwise, NAS_AS is set to cryptographic algorithm suite 1, and a new KAMF is derived from KAMF using cryptographic algorithm suite 1. Afterwards, the source AMF can send NAS_AS and the new KAMF to the target AMF, and delete the 5G security context it owns.
c.如果源AMF无法识别UE或完整性保护检查失败,则源AMF应发送指示无法检索到临时标识为5G-GUTI的响应。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.
(3)目标AMF如果收到带有SUPI的响应消息,它将创建一个条目并存储可能已接收到的5G安全上下文。(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.
需要说明的是,步骤(3)中,如果目标AMF为未升级设备,则执行上述步骤。如果目标AMF为已升级设备,则获取并保存NAS_AS和新的KAMF。)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.)
步骤2:若目标AMF或源AMF均没有安全上下文或完整性检验失败,目标AMF应启动与UE的认证过程。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.
5G AKA协议完成后,UE和访问网络AMF/SEAF之间完成了鉴权认证,并共享了KSEAF,并通过KSEAF推演出KAMF用于UE和AMF之间安全交互。目标AMF在AKA协议过程中也可以通过注册请求(Registration Request)消息获取UE的安全状态(Security Capability)。After the 5G AKA protocol is completed, the authentication is completed between the UE and the access network AMF/SEAF, and K SEAF is shared. K AMF is derived from K SEAF for secure interaction between the 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.
需要说明的是,本实施方式中,在5G AKA鉴权过程中,UDM会根据ME、AMF/SEAF、AUSF等的密码算法套件支持状态,并根据策略选择或者协商合适的密码算法套件AKA_AS,例如,各设备都支持的密码算法套件1或者密码算法套件2等,AKA_AS用于指示ME、SEAF、AUSF等设备在鉴权认证和密钥推衍中应该使用的密码算法套件。UDM将AKA_AS下发到ME、gNB、AMF/SEAF、AUSF等网元,AMF删除旧的NAS_AS。ME、gNB、AMF/SEAF、AUSF等网元会根据AKA_AS指定的密码算法套件计算鉴权参数和密钥推衍。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.
步骤3:成功验证UE后,目标AMF应发送NAS安全模式建立(NAS Security ModeCommand,NAS SMC)消息。若发送的初始NAS消息被完整性保护但未通过完整性检验,其他AMF将无法解密NAS容器中的完整初始NAS消息,则目标AMF应在NAS安全模式建立消息中包含一个flag,请求UE在NAS安全模式建立完成消息中发送完整初始NAS消息。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.
步骤4:UE应响应NAS安全模式建立消息向网络发送NAS安全模式建立完成(NASSecurity Mode Complete)消息。NAS安全模式建立完成消息应进行加密和保护完整性。另外,若目标AMF请求、或UE未保护发送的初始NAS消息,则应在NAS安全模式建立完成消息中包含完整的初始NAS消息。此时AMF应对NAS容器中的完整初始NAS消息进行响应。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.
步骤5:AMF应对初始NAS消息发送响应。此消息应进行加密和完整性保护。Step 5: The AMF shall send a response to the initial NAS message. This message shall be encrypted and integrity protected.
二、NAS安全模式建立(Security Mode Command,SMC)过程:2. NAS Security Mode Establishment (Security Mode Command, SMC) Process:
5G AKA协议完成后,UE和AMF之间需要进行NAS SMC过程。NAS SMC用于建立UE和AMF之间的NAS安全上下文。此过程包括AMF和UE之间的往返消息。AMF向UE发送NAS SMC消息,UE返回NAS SMC消息,如图6所示。After the 5G AKA protocol is completed, the NAS SMC process needs to be performed between the UE and the AMF. The NAS SMC is used to establish a NAS security context between the UE and the 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, as shown in Figure 6.
步骤1a:目标AMF在发送NAS安全模式建立消息之前激活NAS完整性保护,通过KAMF推衍KNASenc和KNASint。Step 1a: The target AMF activates NAS integrity protection before sending the NAS Security Mode Setup message and derives K NASenc and K NASint through KAMF .
需要说明的是,如果目标AMF为未升级设备,则使用密码算法套件1执行上述步骤。如果目标AMF为已升级设备,则进行以下处理:如果NAS_AS存在,则使用NAS_AS指定的密码算法套件从KAMF推衍KNASenc和KNASint。如果NAS_AS不存在,则根据策略选择NAS层使用的密码算法套件,生成NAS_AS例如,如果AKA_AS存在,则将NAS_AS设置为AKA_AS,使用AKA_AS指定的密码算法套件从KAMF推衍KNASenc和KNASint,否则将NAS_AS设置为密码算法套件1,使用密码算法套件1从KAMF推衍KNASenc和KNASint。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 to derive K NASenc and K NASint from KAMF . 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 derive K NASenc and K NASint from KAMF . Otherwise, NAS_AS is set to cryptographic algorithm suite 1, and cryptographic algorithm suite 1 is used to derive K NASenc and K NASint from KAMF .
步骤1b:目标AMF向UE发送NAS安全模式建立消息。NAS安全模式建立消息应包含:重放的UE安全功能、选定的NAS算法、以及用于识别KAMF的ngKSI。NAS安全模式建立消息还可包含:K_AMF_change_flag(在3GPP TS 24.501中规定的附加5G安全参数IE中携带)以指示新计算的KAMF、请求完整初始NAS消息的flag、ABBA。在移动性注册更新过程中或在同一PLMN中多次注册过程中水平推衍KAMF时,应在NAS安全模式建立消息中包含K_AMF_change_flag。Step 1b: The target AMF sends a NAS security mode establishment message to the UE. The NAS security mode establishment message shall include: the replayed UE security functions, the selected NAS algorithms, and the ngKSI used to identify the KAMF. The NAS security mode establishment message may also include: K_AMF_change_flag (carried in the additional 5G security parameters IE specified in 3GPP TS 24.501) to indicate the newly calculated KAMF , a flag requesting a complete initial NAS message, and ABBA. When KAMF is horizontally derived during the mobility registration update process or during multiple registrations in the same PLMN, the K_AMF_change_flag shall be included in the NAS security mode establishment message.
根据NAS安全模式建立消息中ngKSI指示的KAMF,应使用基于该KAMF的NAS完整性密钥对该消息进行完整性保护(但不加密)。若网络支持使用MME和AMF之间的N26接口进行互通,AMF还应在NAS SMC消息中包含移动到EPS之后使用的所选EPS NAS算法。UE应保存移动到EPS后使用的算法。AMF应在UE安全上下文中保存选定的EPS算法。The message shall be integrity protected (but not encrypted) using the NAS integrity key based on the K AMF indicated by ngKSI in the NAS Security Mode Establishment message. If the network supports interworking using the N26 interface between the MME and the AMF , the AMF shall also include in the NAS SMC message the selected EPS NAS algorithm to be used after moving to EPS. 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.
当N2切换或空闲模式移动过程中发生AMF变更时,所选的EPS NAS算法应包含在5GUE安全上下文中并发送至目标AMF。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.
需要说明的是,如果AMF为未升级设备,则使用密码算法套件1执行上述步骤。如果AMF为已升级设备,则进行以下处理:AMF向ME发送的NASSMC应包含NAS_AS,其中NAS_AS可作为新增参数,也可以使用消息中的预留字段等。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.
步骤1c:AMF在发送NAS安全模式建立消息后激活NAS上行链路解密。Step 1c: AMF activates NAS uplink decryption after sending the NAS Security Mode Establishment message.
步骤2a:UE应验证NAS安全模式建立消息,包括检查UE AMF发送的安全能力是否与存储在UE中的安全能力相匹配,以确保攻击者不会修改这些安全能力,并使用指示的NAS完整性算法和由ngKSI指示的基于KAMF的NAS完整性密钥来验证完整性。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.
若NAS安全模式建立消息包括K_AMF_change_flag,UE应生成一个新的KAMF并将NAS COUNT设为零。若NAS安全模式建立消息的完整性验证成功,UE应使用ngKSI指示的安全上下文进行NAS完整性保护和加/解密。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.
需要说明的是,如果ME为未升级设备,则使用密码算法套件1执行上述步骤。如果ME为已升级设备,则进行以下处理:从NAS安全模式建立消息中识别并保存NAS_AS。使用NAS_AS指定的密码算法套件计算NAS加密密钥KNASenc和完整性密钥KNASint,否则使用密码算法套件1计算。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: NAS_AS is identified and saved from the NAS security mode establishment message. The NAS encryption key K NASenc and integrity key K NASint are calculated using the cryptographic algorithm suite specified by NAS_AS, otherwise cryptographic algorithm suite 1 is used for calculation.
步骤2b:UE向AMF发送加密的和受完整性保护NAS安全模式建立完成消息。若AMF在NAS安全模式建立消息中请求PEI,NAS安全模式建立完成消息应包含PEI。若执行KAMF水平推衍,AMF应将NAS COUNT设置为零。UE可包含完整初始NAS消息。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.
若UE的NAS安全模式建立消息验证不成功,UE应返回NAS安全模式建立拒绝消息。NAS安全模式建立拒绝消息和所有后续NAS消息应使用先前(如果有)的5G NAS安全上下文,换言之,使用在NAS安全模式建立消息之前的5G NAS安全上下文进行保护。若在NAS安全模式建立消息之前不存在5G NAS安全上下文,NAS安全模式建立拒绝消息将不受保护。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.
AMF应使用NAS安全模式建立消息中指示的密钥和算法对NAS安全模式建立完成消息进行解密并验证其完整性。AMF的NAS下行链路加密应在接收到NAS安全模式建立完成消息后通过此安全上下文开启。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.
步骤1d:AMF激活NAS下行链路加密。Step 1d: AMF activates NAS downlink encryption.
需要说明的是,若上行链路NAS COUNT通过发送NAS安全模式建立拒绝消息重置,UE释放NAS连接,而不发送NAS安全模式建立拒绝消息。AMF若成功验证NAS安全模式建立完成消息,即说明AMF已成功确认来自归属网的SUPI与UE使用的SUPI相匹配。然而,SUPI不匹配并非AMF上NAS安NAS安全模式建立完成消息完整性验证失败的唯一原因。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.
至此,UE和AMF完成了NAS消息加密和完整性保护功能激活。At this point, the UE and AMF have completed the activation of NAS message encryption and integrity protection functions.
请参见图7,图7是本发明实施例提供的一种目标AMF。Please refer to Figure 7, which is a target AMF provided by an embodiment of the present invention.
如图7所示,目标AMF700包括:As shown in FIG7 , the target AMF 700 includes:
第一确定模块701,用于在对终端鉴权认证成功的情况下,根据所述目标AMF的算法支持状态,确定第一密码算法套件;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;
第一推衍模块702,用于使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;A first derivation module 702 is configured to derive K NASenc and K NASint by using the first cryptographic algorithm suite through a first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
第一发送模块703,用于向所述终端发送NAS安全模式建立消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立消息进行加密和完整性保护,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示所述第一密码算法套件;A first sending module 703 is configured to send a NAS security mode establishment message to the terminal, and use the K NASenc and the K NASint to encrypt and integrity protect 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;
第一验证模块704,用于在接收所述终端发送的NAS安全模式建立完成消息的情况下,对所述NAS安全模式建立完成消息进行解密,并进行NAS完整性验证;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;
第一建立模块705,用于在对所述NAS安全模式建立完成消息的NAS完整性验证成功的情况下,与所述终端建立安全模式。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.
可选地,所述第一确定模块701用于以下任意一项:Optionally, the first determining module 701 is used for any of the following:
在所述目标AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第一算法标识的情况下,将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第一算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第一算法标识,并将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF不支持多个密码算法套件,将所述目标AMF支持的基础密码算法套件确定为所述第一密码算法套件。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.
可选地,所述第一确定模块701用于:Optionally, the first determining module 701 is used to:
在所述目标AMF配置有AKA鉴权认证和密钥推衍对应的第二算法标识的情况下,根据所述第二算法标识,生成所述第一算法标识。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.
可选地,所述目标AMF700还包括:Optionally, the target AMF700 further includes:
第一接收模块,用于接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第二算法标识。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.
可选地,所述目标AMF700还包括:Optionally, the target AMF700 further includes:
第一解密模块,用于对NAS上行链路的传输进行解密。The first decryption module is used to decrypt the transmission of the NAS uplink.
可选地,所述目标AMF700还包括:Optionally, the target AMF700 further includes:
第一加密模块,用于对NAS下行链路的传输进行加密。The first encryption module is used to encrypt the transmission of the NAS downlink.
可选地,所述目标AMF700还包括:Optionally, the target AMF700 further includes:
第二接收模块,用于接收终端发送的初始NAS消息,所述初始NAS消息携带所述终端的全球唯一临时标识符GUTI;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;
第一获取模块,用于在所述初始NAS消息携带NAS容器,且所述初始消息完整性检验成功的情况下,获取所述终端的安全上下文,所述NAS容器中存储有加密的完整初始NAS消息;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;
第一解码模块,用于使用目标KAMF对所述NAS容器解码,得到所述初始NAS消息;A first decoding module, configured to decode the NAS container using a target KAMF to obtain the initial NAS message;
第二发送模块,用于向所述终端发送所述初始NAS消息的第一响应消息;A second sending module, configured to send a first response message of the initial NAS message to the terminal;
其中,所述目标KAMF为所述第一KAMF或第二KAMF,所述第二KAMF为从所述第一KAMF推衍得到的KAMF。The target KAMF is the first KAMF or the second KAMF , and the second KAMF is a KAMF derived from the first KAMF .
可选地,所述第一获取模块用于以下任意一项:Optionally, the first acquisition module is used for any of the following:
在根据所述GUTI在本地查询到所述终端的安全上下文的情况下,在本地查询获取所述终端的安全上下文;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;
在根据所述GUTI未在本地查询到所述终端的安全上下文的情况下,向源AMF发送第一请求消息,并在接收到所述源AMF发送的第二响应消息,且所述第二响应消息携带所述终端的永久标识符SPUI的情况下,接收所述源AMF发送的所述终端的安全上下文,所述第一请求消息携带所述GUTI。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.
可选地,所述第一解码模块用于以下任意一项:Optionally, the first decoding module is used for any of the following:
在所述第二响应消息还携带第二KAMF的情况下,使用所述第二KAMF对所述NAS容器解码,得到所述初始NAS消息。In the case where the second response message also carries the second KAMF , the second KAMF is used to decode the NAS container to obtain the initial NAS message.
在所述第二响应消息未携带第二KAMF的情况下,使用所述第一KAMF对所述NAS容器解码,得到所述初始NAS消息。In a case where the second response message does not carry the second KAMF , the NAS container is decoded using the first KAMF to obtain the initial NAS message.
目标AMF700能够实现图1所示的方法实施例实现的各个过程,且能达到相同的有益效果,为避免重复,这里不再赘述。The target AMF700 can implement each process implemented by the method embodiment shown in FIG1 , and can achieve the same beneficial effects. To avoid repetition, it will not be described here.
请参见图8,图8是本发明实施例提供的一种终端。Please refer to FIG. 8 , which is a terminal provided by an embodiment of the present invention.
如图8所示,终端800包括:As shown in FIG8 , the terminal 800 includes:
第三接收模块801,用于接收目标AMF发送的NAS安全模式建立消息,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示第一密码算法套件;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;
第二解密模块802,用于对所述NAS安全模式建立消息进行解密,并进行NAS完整性验证;A second decryption module 802 is used to decrypt the NAS security mode establishment message and perform NAS integrity verification;
第二推衍模块803,用于使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;a second derivation module 803, configured to use the first cryptographic algorithm suite to derive K NASenc and K NASint through a first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
第三发送模块804,用于在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,向所述目标AMF发送NAS安全模式建立完成消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立完成消息进行加密和完整性保护。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 to encrypt and integrity protect the NAS security mode establishment completion message.
可选地,所述终端800还包括:Optionally, the terminal 800 further includes:
第一处理模块,用于在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,对NAS上行链路的传输进行加密,以及对NAS下行链路的传输进行解密。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.
终端800能够实现图2所示的方法实施例实现的各个过程,且能达到相同的有益效果,为避免重复,这里不再赘述。The terminal 800 can implement each process implemented by the method embodiment shown in FIG. 2 and can achieve the same beneficial effects. To avoid repetition, they will not be described again here.
请参见图9,图9是本发明实施例提供的一种源AMF。Please refer to Figure 9, which is a source AMF provided by an embodiment of the present invention.
如图9所示,源AMF900包括:As shown in FIG9 , the source AMF 900 includes:
第一查询模块901,用于在接收到目标AMF发送的第一请求消息的情况下,根据所述第一请求消息携带的终端的全球唯一临时标识符GUTI查询到本地是否存在所述终端的安全上下文,所述第一请求消息还携带初始NAS消息;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;
第四发送模块902,用于在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文。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.
可选地,所述源AMF900还包括:Optionally, the source AMF 900 further includes:
第二确定模块,用于根据所述源AMF的算法支持状态,确定第二密码算法套件;A second determination module, configured to determine a second cryptographic algorithm suite according to the algorithm support status of the source AMF;
第三推衍模块,用于在所述源AMF更改第一KAMF的情况下,使用所述第二密码算法套件,从所述第一KAMF中推衍出第二KAMF;a third derivation module, configured to derive a second KAMF from the first KAMF by using the second cryptographic algorithm suite when the source AMF changes the first KAMF ;
其中,所述第二响应消息还携带所述第二KAMF,所述第二KAMF用于对NAS容器中的完整初始NAS消息进行解码。The second response message also carries the second KAMF , and the second KAMF is used to decode the complete initial NAS message in the NAS container.
可选地,所述第二确定模块用于以下任意一项:Optionally, the second determining module is used for any of the following:
在所述源AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第三算法标识的情况下,将所述第三算法标识所标识的密码算法套件为确定所述第二密码算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第三算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第三算法标识,将所述第三算法标识所标识的密码算法套件为确定所述目标算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF不支持多个密码算法套件,将所述源AMF支持的基础密码算法套件确定为所述第二密码算法套件。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.
可选地,所述第二确定模块用于:Optionally, the second determining module is used to:
在所述源AMF配置有AKA鉴权认证和密钥推衍对应的第四算法标识的情况下,根据所述第四算法标识,生成所述第三算法标识。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.
可选地,所述源AMF900还包括:Optionally, the source AMF 900 further includes:
第四接收模块,用于接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第四算法标识。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.
可选地,所述源AMF900还包括以下任意一项:Optionally, the source AMF 900 further includes any one of the following:
第二验证模块,用于在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功,且所述源AMF不更改第一KAMF的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI和所述第一KAMF,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文,所述第一KAMF用于对NAS容器中的完整初始NAS消息进行解码;a second verification module, configured to send the second response message to the target AMF when it is found that the security context of the terminal exists locally, the NAS integrity verification of the initial NAS message succeeds, and the source AMF does not change the first KAMF , wherein the second response message carries the SPUI of the terminal and the first KAMF , the SPUI is used to instruct the target AMF to receive the security context of the terminal, and the first KAMF is used to decode the complete initial NAS message in the NAS container;
第五发送模块,用于在查询到本地不存在所述终端的安全上下文,和/或,对所述初始NAS消息的NAS完整性验证失败的情况下,向所述目标AMF发送第二响应消息,所述第二响应消息携带第一指示信息,所述第一指示信息用于指示未查询到终端的安全上下文。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.
源AMF900能够实现图3所示的方法实施例实现的各个过程,且能达到相同的有益效果,为避免重复,这里不再赘述。The source AMF 900 can implement each process implemented by the method embodiment shown in FIG. 3 and can achieve the same beneficial effects, which will not be described again here to avoid repetition.
本发明实施例还提供了一种目标AMF,包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序,所述程序被所述处理器执行时实现上述应用于目标AMF的安全模式建立方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。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.
具体的,参见图10所示,本发明实施例还提供了一种目标AMF,包括总线1001、收发机1002、天线1003、总线接口1004、处理器1005和存储器1006。Specifically, as shown in Figure 10, an embodiment of the present invention also 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.
所述处理器1005用于:The processor 1005 is used for:
在对终端鉴权认证成功的情况下,根据所述目标AMF的算法支持状态,确定第一密码算法套件;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;
使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;Using the first cryptographic algorithm suite, deriving K NASenc and K NASint through the first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
所述收发机10002用于:The transceiver 10002 is used for:
向所述终端发送NAS安全模式建立消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立消息进行加密和完整性保护,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示所述第一密码算法套件;Sending a NAS security mode establishment message to the terminal, and using the K NASenc and the K NASint to encrypt and integrity protect 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;
所述处理器1005用于:The processor 1005 is used for:
在接收所述终端发送的NAS安全模式建立完成消息的情况下,对所述NAS安全模式建立完成消息进行解密,并进行NAS完整性验证;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;
在对所述NAS安全模式建立完成消息的NAS完整性验证成功的情况下,与所述终端建立安全模式。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.
可选地,所述处理器1005用于以下任意一项:Optionally, the processor 1005 is used for any of the following:
在所述目标AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第一算法标识的情况下,将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第一算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第一算法标识,并将所述第一算法标识所标识的密码算法套件确定为所述第一密码算法套件;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;
在所述目标AMF不支持多个密码算法套件,将所述目标AMF支持的基础密码算法套件确定为所述第一密码算法套件。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.
可选地,所述处理器1005用于:Optionally, the processor 1005 is configured to:
在所述目标AMF配置有AKA鉴权认证和密钥推衍对应的第二算法标识的情况下,根据所述第二算法标识,生成所述第一算法标识。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.
可选地,所述收发机1002还用于:Optionally, the transceiver 1002 is further configured to:
接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第二算法标识。Receive the second algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.
可选地,所述处理器1005还用于:Optionally, the processor 1005 is further configured to:
对NAS上行链路的传输进行解密。Decrypts NAS uplink transmissions.
可选地,所述处理器1005还用于:Optionally, the processor 1005 is further configured to:
对NAS下行链路的传输进行加密。Encrypt NAS downlink transmission.
可选地,所述收发机1002还用于:Optionally, the transceiver 1002 is further configured to:
接收终端发送的初始NAS消息,所述初始NAS消息携带所述终端的全球唯一临时标识符GUTI;Receiving an initial NAS message sent by a terminal, where the initial NAS message carries a global unique temporary identifier GUTI of the terminal;
所述处理器1005还用于:The processor 1005 is further configured to:
在所述初始NAS消息携带NAS容器,且所述初始消息完整性检验成功的情况下,获取所述终端的安全上下文,所述NAS容器中存储有加密的完整初始NAS消息;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;
使用目标KAMF对所述NAS容器解码,得到所述初始NAS消息;Decoding the NAS container using the target KAMF to obtain the initial NAS message;
所述收发机1002还用于:The transceiver 1002 is also used for:
向所述终端发送所述初始NAS消息的第一响应消息;Sending a first response message of the initial NAS message to the terminal;
其中,所述目标KAMF为所述第一KAMF或第二KAMF,所述第二KAMF为从所述第一KAMF推衍得到的KAMF。The target KAMF is the first KAMF or the second KAMF , and the second KAMF is a KAMF derived from the first KAMF .
可选地,所述处理器1005用于:Optionally, the processor 1005 is configured to:
在根据所述GUTI在本地查询到所述终端的安全上下文的情况下,在本地查询获取所述终端的安全上下文;或者,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,
所述收发机1002用于:The transceiver 1002 is used for:
在根据所述GUTI未在本地查询到所述终端的安全上下文的情况下,向源AMF发送第一请求消息,并在接收到所述源AMF发送的第二响应消息,且所述第二响应消息携带所述终端的永久标识符SPUI的情况下,接收所述源AMF发送的所述终端的安全上下文,所述第一请求消息携带所述GUTI。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.
可选地,所述处理器1005用于以下任意一项:Optionally, the processor 1005 is used for any of the following:
在所述第二响应消息还携带第二KAMF的情况下,使用所述第二KAMF对所述NAS容器解码,得到所述初始NAS消息。In the case where the second response message also carries the second KAMF , the second KAMF is used to decode the NAS container to obtain the initial NAS message.
在所述第二响应消息未携带第二KAMF的情况下,使用所述第一KAMF对所述NAS容器解码,得到所述初始NAS消息。In a case where the second response message does not carry the second KAMF , the NAS container is decoded using the first KAMF to obtain the initial NAS message.
在图10中,总线架构(用总线1001来代表),总线1001可以包括任意数量的互联的总线和桥,总线1001将包括由处理器1005代表的一个或多个处理器1005和存储器1006代表的存储器的各种电路链接在一起。总线1001还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口1004在总线1001和收发机1002之间提供接口。收发机1002可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器1005处理的数据通过天线1003在无线介质上进行传输,进一步,天线1003还接收数据并将数据传送给处理器1005。In FIG. 10 , a bus architecture (represented by bus 1001) is shown. Bus 1001 may include any number of interconnected buses and bridges. 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. Further, antenna 1003 also receives data and transmits the data to processor 1005.
处理器1005负责管理总线1001和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器1006可以被用于存储处理器1005在执行操作时所使用的数据。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.
可选的,处理器1005可以是CPU、ASIC、FPGA或CPLD。Optionally, the processor 1005 may be a CPU, an ASIC, an FPGA or a CPLD.
本发明实施例还提供了一种终端,包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序,所述程序被所述处理器执行时实现上述应用于终端的安全模式建立方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。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.
具体的,参见图11所示,本发明实施例还提供了一种终端,包括总线1101、收发机1102、天线1103、总线接口1104、处理器1105和存储器1106。Specifically, as shown in FIG. 11 , 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 .
所述收发机1102用于:The transceiver 1102 is used for:
接收目标AMF发送的NAS安全模式建立消息,所述NAS安全模式建立消息携带第一标识,所述第一标识用于指示第一密码算法套件;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;
所述处理器1105用于:The processor 1105 is used for:
对所述NAS安全模式建立消息进行解密,并进行NAS完整性验证;Decrypt the NAS security mode establishment message and perform NAS integrity verification;
使用所述第一密码算法套件,通过第一KAMF推衍出KNASenc和KNASint,所述KNASenc为用于NAS加密的密钥,所述KNASint为用于NAS完整性保护的密钥,所述第一KAMF为所述目标AMF与所述终端之间共享的KAMF;Using the first cryptographic algorithm suite, deriving K NASenc and K NASint through the first KAMF , wherein the K NASenc is a key for NAS encryption, the K NASint is a key for NAS integrity protection, and the first KAMF is a KAMF shared between the target AMF and the terminal;
所述收发机1102用于:The transceiver 1102 is used for:
在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,向所述目标AMF发送NAS安全模式建立完成消息,并使用所述KNASenc和所述KNASint对所述NAS安全模式建立完成消息进行加密和完整性保护。If the NAS integrity verification of the NAS security mode establishment message is successful, a NAS security mode establishment completion message is sent to the target AMF, and the NAS security mode establishment completion message is encrypted and integrity protected using the K NASenc and the K NASint .
可选地,所述处理器1105用于:Optionally, the processor 1105 is configured to:
在对所述NAS安全模式建立消息的NAS完整性验证成功的情况下,对NAS上行链路的传输进行加密,以及对NAS下行链路的传输进行解密。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.
在图11中,总线架构(用总线1101来代表),总线1101可以包括任意数量的互联的总线和桥,总线1101将包括由处理器1105代表的一个或多个处理器1105和存储器1106代表的存储器的各种电路链接在一起。总线1101还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口1104在总线1101和收发机1102之间提供接口。收发机1102可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器1105处理的数据通过天线1103在无线介质上进行传输,进一步,天线1103还接收数据并将数据传送给处理器1105。In FIG. 11 , a bus architecture (represented by bus 1101) is shown. Bus 1101 may include any number of interconnected buses and bridges. 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. Further, antenna 1103 also receives data and transmits the data to processor 1105.
处理器1105负责管理总线1101和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器1106可以被用于存储处理器1105在执行操作时所使用的数据。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.
可选的,处理器1105可以是CPU、ASIC、FPGA或CPLD。Optionally, the processor 1105 may be a CPU, an ASIC, an FPGA or a CPLD.
本发明实施例还提供了一种源AMF,包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序,所述程序被所述处理器执行时实现上述应用于源AMF的安全模式建立方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。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.
具体的,参见图12所示,本发明实施例还提供了一种源AMF,包括总线1201、收发机1202、天线1203、总线接口1204、处理器1205和存储器1206。Specifically, as shown in Figure 12, an embodiment of the present invention also 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.
所述处理器1205用于:The processor 1205 is used for:
在接收到目标AMF发送的第一请求消息的情况下,根据所述第一请求消息携带的终端的全球唯一临时标识符GUTI查询到本地是否存在所述终端的安全上下文,所述第一请求消息还携带初始NAS消息;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;
所述收发机1202用于:The transceiver 1202 is used for:
在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI,所述SPUI用于指示所述目标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, 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.
可选地,所述处理器1205还用于:Optionally, the processor 1205 is further configured to:
根据所述源AMF的算法支持状态,确定第二密码算法套件;Determining a second cryptographic algorithm suite according to the algorithm support status of the source AMF;
在所述源AMF更改第一KAMF的情况下,使用所述第二密码算法套件,从所述第一KAMF中推衍出第二KAMF;In the case where the source AMF changes the first KAMF , deriving the second KAMF from the first KAMF using the second cryptographic algorithm suite;
其中,所述第二响应消息还携带所述第二KAMF,所述第二KAMF用于对NAS容器中的完整初始NAS消息进行解码。The second response message also carries the second KAMF , and the second KAMF is used to decode the complete initial NAS message in the NAS container.
可选地,所述处理器1205用于以下任意一项:Optionally, the processor 1205 is used for any of the following:
在所述源AMF支持多个密码算法套件,且配置有NAS层密钥推衍对应的第三算法标识的情况下,将所述第三算法标识所标识的密码算法套件为确定所述第二密码算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF支持多个密码算法套件,但未配置有NAS层密钥推衍对应的第三算法标识的情况下,根据预设策略,生成NAS层密钥推衍对应的第三算法标识,将所述第三算法标识所标识的密码算法套件为确定所述目标算法套件,所述第二响应消息还携带所述第三算法标识;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;
在所述源AMF不支持多个密码算法套件,将所述源AMF支持的基础密码算法套件确定为所述第二密码算法套件。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.
可选地,所述处理器1205用于:Optionally, the processor 1205 is configured to:
在所述源AMF配置有AKA鉴权认证和密钥推衍对应的第四算法标识的情况下,根据所述第四算法标识,生成所述第三算法标识。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.
可选地,所述收发机1202还用于:Optionally, the transceiver 1202 is further configured to:
接收用户数据管理UDM发送的AKA鉴权认证和密钥推衍对应的第四算法标识。Receive a fourth algorithm identifier corresponding to the AKA authentication and key derivation sent by the user data manager UDM.
可选地,所述收发机1202还用于以下任意一项:Optionally, the transceiver 1202 is further used for any of the following:
在查询到本地存在所述终端的安全上下文,且对所述初始NAS消息的NAS完整性验证成功,且所述源AMF不更改第一KAMF的情况下,向所述目标AMF发送所述第二响应消息,所述第二响应消息携带所述终端的SPUI和所述第一KAMF,所述SPUI用于指示所述目标AMF接收所述终端的安全上下文,所述第一KAMF用于对NAS容器中的完整初始NAS消息进行解码;When it is found that the security context of the terminal exists locally, the NAS integrity verification of the initial NAS message is successful, and the source AMF does not change the first KAMF , the second response message is sent to the target AMF, where the second response message carries the SPUI of the terminal and the first KAMF , and the SPUI is used to instruct the target AMF to receive the security context of the terminal, and the first KAMF is used to decode the complete initial NAS message in the NAS container;
在查询到本地不存在所述终端的安全上下文,和/或,对所述初始NAS消息的NAS完整性验证失败的情况下,向所述目标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, 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.
在图12中,总线架构(用总线1201来代表),总线1201可以包括任意数量的互联的总线和桥,总线1201将包括由处理器1205代表的一个或多个处理器1205和存储器1206代表的存储器的各种电路链接在一起。总线1201还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口1204在总线1201和收发机1202之间提供接口。收发机1202可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器1205处理的数据通过天线1203在无线介质上进行传输,进一步,天线1203还接收数据并将数据传送给处理器1205。In FIG. 12 , a bus architecture (represented by bus 1201) is shown. Bus 1201 may include any number of interconnected buses and bridges. 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. Further, antenna 1203 also receives data and transmits the data to processor 1205.
处理器1205负责管理总线1201和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器1206可以被用于存储处理器1205在执行操作时所使用的数据。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.
可选的,处理器1205可以是CPU、ASIC、FPGA或CPLD。Optionally, the processor 1205 may be a CPU, an ASIC, an FPGA or a CPLD.
本发明实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述安全模式建立方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。其中,所述的计算机可读存储介质,如ROM、RAM、磁碟或者光盘等。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.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。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.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。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.
上面结合附图对本发明的实施例进行了描述,但是本发明并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本发明的启示下,在不脱离本发明宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本发明的保护之内。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 (27)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311099073.6A CN118803744A (en) | 2023-08-29 | 2023-08-29 | A method, device and medium for establishing a safe mode |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311099073.6A CN118803744A (en) | 2023-08-29 | 2023-08-29 | A method, device and medium for establishing a safe mode |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN118803744A true CN118803744A (en) | 2024-10-18 |
Family
ID=93024231
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202311099073.6A Pending CN118803744A (en) | 2023-08-29 | 2023-08-29 | A method, device and medium for establishing a safe mode |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118803744A (en) |
-
2023
- 2023-08-29 CN CN202311099073.6A patent/CN118803744A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11824981B2 (en) | Discovery method and apparatus based on service-based architecture | |
| US11825303B2 (en) | Method for performing verification by using shared key, method for performing verification by using public key and private key, and apparatus | |
| US11405780B2 (en) | Method for performing verification by using shared key, method for performing verification by using public key and private key, and apparatus | |
| US11496320B2 (en) | Registration method and apparatus based on service-based architecture | |
| US10849191B2 (en) | Unified authentication for heterogeneous networks | |
| CN113676901B (en) | Key management method, device and system | |
| TWI388180B (en) | Key generation in a communication system | |
| US8559633B2 (en) | Method and device for generating local interface key | |
| EP1811744B1 (en) | Method, system and centre for authenticating in End-to-End communications based on a mobile network | |
| CN102656841B (en) | Credential transfer | |
| US9015819B2 (en) | Method and system for single sign-on | |
| CN109922474B (en) | Method for triggering network authentication and related equipment | |
| EP1891789B1 (en) | Apparatus, method and computer program product providing mobile node identities in conjunction with authentication preferences in generic bootstrapping architecture (gba) | |
| WO2008006312A1 (en) | A realizing method for push service of gaa and a device | |
| EP4187952B1 (en) | Method, system and apparatus for determining user plane security algorithm | |
| CN104754575A (en) | Method, device and system for terminal certification | |
| US12413963B2 (en) | Communication method and apparatus | |
| WO2018120217A1 (en) | Verification method and apparatus for key requester | |
| US8726023B2 (en) | Authentication using GAA functionality for unidirectional network connections | |
| WO2022245687A1 (en) | Accelerated reconnection in authenticated networks | |
| CN115037504B (en) | Communication method and device | |
| CN117915322A (en) | A slice secondary authentication method and system based on key integrity detection | |
| WO2018126791A1 (en) | Authentication method and device, and computer storage medium | |
| WO2024021580A1 (en) | Security authentication method for user terminal to access network, apparatus, and electronic device | |
| WO2018076298A1 (en) | Security capability negotiation method and related device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |