Key management method and device, medium and product
The session key is encrypted and stored through multi-level key derivation and randomly generated session encryption keys, which solves the problem of key leakage in the key management system and improves key security and information security.
Patent Information
- Application Number
- CN202510990645.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-17
- Publication Date
- 2025-09-16
AI Technical Summary
In the prior art, key management systems are prone to key leakage when key storage is insecure or access rules are flawed, thus endangering data security.
Multi-level key derivation and randomly generated session encryption keys are used to encrypt and store session keys, combined with identity authentication to ensure key security.
Multi-level key derivation and randomly generated session encryption keys improve key security, prevent unauthorized access and leakage, and enhance information security.
Smart Images

Figure CN120658499A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information security technology, and in particular to a key management method, electronic device, computer-readable medium, and computer program product. Background Art
[0002] Key security is the foundation of information security. If a key is leaked, it may lead to the leakage of ciphertext, which in turn may expose the corresponding firmware and application software to illegal attacks. Key Management Service (KMS) is a system specifically used to create, manage, and protect keys, and can centrally manage keys. KMS can be used to manage various types of keys, including symmetric keys and asymmetric keys. In related technologies, when key storage is insecure or there are defects in key access rules and authentication rules, key leakage may occur, thereby endangering data security. Summary of the Invention
[0003] The present disclosure provides a key management method, an electronic device, a computer-readable medium, and a computer program product.
[0004] In a first aspect, an embodiment of the present disclosure provides a key management method, comprising: in response to a key storage request sent by a key management unit, obtaining a session key to be stored and user information corresponding to the session key; performing multi-level key derivation based on the user information and initial derivation information to obtain a key storage key; generating a session encryption key based on a random manner; encrypting the session key based on the key storage key and the session encryption key to obtain and store a session key ciphertext.
[0005] In a second aspect, an embodiment of the present disclosure provides a key management method, comprising: authenticating the user terminal in response to a first session request sent by the user terminal; and when the user terminal passes the authentication, sending a key storage request to a target device, so that the target device performs key storage based on the key storage request through a multi-level key derivation method.
[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a memory on which one or more programs are stored, and when the one or more programs are executed by one or more processors, the one or more processors implement any one of the key management methods in the embodiments of the present disclosure.
[0007] In a fourth aspect, an embodiment of the present disclosure provides a readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements any one of the key management methods in the embodiments of the present disclosure.
[0008] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements any one of the key management methods in the embodiments of the present disclosure.
[0009] The key management method of the disclosed embodiment, in response to a key storage request sent by a key management unit, obtains a session key to be stored and user information corresponding to the session key; performs multi-level key derivation based on the user information and initial derivative information to obtain a key storage key; generates a session encryption key based on a random method; encrypts the session key based on the key storage key and the session encryption key to obtain and store the session key ciphertext. It can be seen that when storing the session key, the key storage key and the session encryption key are used. The key storage key is not a pre-stored key, but is obtained through multi-level key derivation based on initial derivative information when needed. Therefore, the possibility of stealing the key storage key by illegally accessing the storage space can be fundamentally avoided, thereby improving key security. In addition, the session encryption key is a randomly generated key. This randomness can increase key security. Based on this, the session key ciphertext obtained by encrypting the session key using the key storage key and the session encryption key is highly secure. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In the accompanying drawings of the embodiments of the present disclosure:
[0011] Figure 1 A flowchart of a key management method provided in an embodiment of the present disclosure.
[0012] Figure 2 A schematic diagram of a key hierarchy provided in an embodiment of the present disclosure.
[0013] Figure 3 A schematic diagram of a key management method provided in an embodiment of the present disclosure.
[0014] Figure 4 A flowchart of a key management method provided in an embodiment of the present disclosure.
[0015] Figure 5 A flowchart of a key management method provided in an embodiment of the present disclosure.
[0016] Figure 6 A flowchart of a key management method provided in an embodiment of the present disclosure.
[0017] Figure 7 A block diagram of a key management device provided in an embodiment of the present disclosure.
[0018] Figure 8 A block diagram of a key management device provided in an embodiment of the present disclosure.
[0019] Figure 9 A block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0021] The present disclosure will be described more fully hereinafter with reference to the accompanying drawings, but the illustrated embodiments may be embodied in different forms, and the present disclosure should not be construed as limited to the embodiments set forth below. Rather, these embodiments are provided so that the present disclosure will be thorough and complete and will fully understand the scope of the present disclosure to those skilled in the art.
[0022] The accompanying drawings of the embodiments of the present disclosure are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the detailed embodiments, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing the detailed embodiments with reference to the accompanying drawings.
[0023] The present disclosure may be described with reference to plan views and / or cross-sectional views by way of ideal schematic views of the present disclosure. Therefore, the exemplary illustrations may be modified according to manufacturing techniques and / or tolerances.
[0024] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0025] The terms used in this disclosure are only used to describe specific embodiments and are not intended to limit the disclosure. As used in this disclosure, the term "and / or" includes any and all combinations of one or more related enumerated items. As used in this disclosure, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. As used in this disclosure, the terms "comprising" and "made of" specify the presence of the features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof.
[0026] Unless otherwise defined, all terms (including technical and scientific terms) used in this disclosure have the same meanings as those commonly understood by those skilled in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning unless expressly defined in this disclosure.
[0027] The present disclosure is not limited to the embodiments shown in the drawings, but includes modifications of the configurations formed based on the manufacturing process. Therefore, the regions illustrated in the drawings have schematic properties, and the shapes of the regions shown in the drawings illustrate the specific shapes of the regions of the elements, but are not intended to be limiting.
[0028] Key security is the foundation of information security. If the key is leaked, the cryptographic algorithm may be broken, leading to the leakage of sensitive information and exposing firmware and application software to illegal attacks.
[0029] In related technologies, key management services can be used to implement centralized key management, manage a large number of keys, and improve key security. Key management services can be used to manage various types of keys, such as symmetric keys, asymmetric keys, public keys, and private keys. However, managing a large number of different keys can lead to key leaks. Alternatively, when keys are stored insecurely and without reasonable access rules to enforce authorization and authentication, users without proper access rights can arbitrarily access keys, compromising user data security and failing to guarantee key security.
[0030] In order to solve the above problems, the present disclosure provides a key management method, an electronic device, a computer-readable medium, and a computer program product.
[0031] In a first aspect, an embodiment of the present disclosure provides a key management method.
[0032] Figure 1 This is a flowchart of a key management method provided by an embodiment of the present disclosure. The key management method can be applied to a target device, including a security chip, etc.
[0033] like Figure 1 As shown, the key management method includes but is not limited to the following steps:
[0034] Step S101: In response to a key storage request sent by a key management unit, a session key to be stored and user information corresponding to the session key are obtained.
[0035] Step S102: Based on the user information and the initial derivation information, multi-level key derivation is performed to obtain a key storage key.
[0036] Step S103: Generate a session encryption key based on a random method.
[0037] Step S104: encrypt the session key based on the key storage key and the session encryption key to obtain and store the session key ciphertext.
[0038] In some optional embodiments, the key management unit is a functional unit that can provide key management services. If a user needs to store a key, they can initiate a key storage request to the key management unit through their user terminal. The key management unit then forwards the key storage request to the target device. After receiving the key storage request, the target device can analyze the key storage request and other operations to determine the relevant content for key storage.
[0039] It should be noted that when the key management unit receives a request from the user terminal that requires encrypted storage keys or decryption keys in the target device, which involves key management, the key management unit can first authenticate the user terminal. Only after the identity authentication is passed will the corresponding operation be performed. If the identity authentication is not passed, the subsequent operation cannot be performed. It can be seen that the authenticity and legality of the user terminal can be ensured through identity authentication, and the security of key management can be guaranteed. In other words, the key management unit can serve as a medium connecting the user terminal and the target device, transmitting data between the two, and ensuring smooth data interaction. In addition, the key management unit can also serve as a security subject to isolate the user terminal and the target device, isolating the data interaction between the two when necessary, thereby protecting the leakage of keys and other information and improving information security.
[0040] Exemplarily, the target device obtains the session key to be stored and the user information corresponding to the session key (i.e., the information of the user for whom the session key is to be stored) through a key storage request. Based on this, the target device first performs a multi-level key derivation operation using the user information and the initial derived information to obtain the key storage key. Furthermore, a random session encryption key is generated based on a random method. The session key is then encrypted using the key storage key and the session encryption key to obtain a session key ciphertext, which is then stored. In this process, the key storage key used to encrypt the session key is derived, not a pre-stored key, and therefore has a lower risk of being leaked. Furthermore, the session encryption key is a random key with unpredictability, and therefore has a higher security. Therefore, the session key encrypted using the key storage key and the session encryption key is more secure, effectively ensuring the security of the session key.
[0041] It can be seen from this that the key management method provided in the embodiment of the present disclosure can provide users with multi-level key management, and combined with identity authentication, multi-level key derivation, multi-level encrypted storage and other methods, it ensures key security and data security and improves information security.
[0042] In summary, in the disclosed embodiment, in response to a key storage request sent by a key management unit, the session key to be stored and the user information corresponding to the session key are obtained; based on the user information and the initial derived information, multi-level key derivation is performed to obtain a key storage key; a session encryption key is generated based on a random method; the session key is encrypted based on the key storage key and the session encryption key to obtain and store the session key ciphertext. It can be seen that when storing the session key, the key storage key and the session encryption key are used. The key storage key is not a pre-stored key, but is obtained through multi-level key derivation based on the initial derived information when needed. Therefore, the possibility of stealing the key storage key by illegally accessing the storage space can be fundamentally avoided, thereby improving key security. In addition, the session encryption key is a randomly generated key. This randomness can increase key security. Based on this, the session key ciphertext obtained by encrypting the session key using the key storage key and the session encryption key is highly secure.
[0043] The key management method of the embodiment of the present disclosure is described in detail below.
[0044] In some optional embodiments, the session key is a key to be stored. The session key can be imported by the user terminal or generated locally on the target device, which is not limited in the embodiments of the present disclosure.
[0045] In some optional embodiments, in response to a key storage request sent by a key management unit, obtaining a session key to be stored and user information corresponding to the session key includes: in response to a key storage request sent by the key management unit, obtaining from the key storage request the session key (Conversation Key, CSK) and user information sent by the user terminal and forwarded by the key management unit; or, in response to a key storage request sent by the key management unit, obtaining from the key storage request the user information sent by the user terminal and forwarded by the key management unit, and generating a session key.
[0046] In some optional embodiments, the user information includes a user identity (UID), which is an identifier that can uniquely identify a user.
[0047] In some optional embodiments, the key storage request is sent when the user terminal has passed identity authentication by the key management unit. In other words, the key management unit must first authenticate the user terminal to ensure that the user's identity is authentic and valid, and that the user has permission to store session keys, before sending the key storage request to the target device. Conversely, if the user terminal fails identity authentication, the key management unit will not send the key storage request to the target device. Instead, it may reject the target device's key storage request or perform other forms of identity authentication on the user terminal to ensure the security of key management.
[0048] In some optional embodiments, after obtaining the user information, multi-level key derivation can be performed based on the user information and the initial derived information to obtain a key storage key (KSK). The initial derived information is a number of initial information required to perform multi-level key derivation, which may include passwords, random seeds, etc. Key derivation refers to the process of generating one or more encryption keys from one or more initial key materials (such as initial derived information), which can convert "original materials" into keys that meet cryptographic standards, and at the same time enhance security and resist threats such as brute force cracking and dictionary attacks. In the embodiment of the present disclosure, key derivation is a multi-level key derivation process, that is, after deriving a first-level key based on the initial derived information, this first-level key is used to derive again. After repeating the derivation operation multiple times, the key storage key can be obtained.
[0049] It should be noted that since the key storage key is generated by key derivation rather than pre-generated and stored, the key storage key is more secure and has a lower risk of being stolen.
[0050] In some optional embodiments, the initial derived information includes a device unique key (Hardware UniqueKey, HUK) and device information; accordingly, based on the user information and the initial derived information, multi-level key derivation is performed to obtain a key storage key, including: deriving a device storage key (HardwareStorage Key, HSK) based on the device unique key HUK and device information; deriving a user storage key (UserStorageKey, USK) based on the device storage key and user information; assigning a key identity (Key Identity, KID) to the session key CSK; and deriving a key storage key KSK based on the user storage key USK and the key identity.
[0051] In some optional embodiments, the target device is pre-integrated with the encryption algorithm required for multi-level key derivation. When performing multi-level key derivation, the pre-integrated encryption algorithm can be directly used to perform corresponding data processing to obtain derived keys at each level.
[0052] In some optional embodiments, the encryption algorithm required for multi-level key derivation can be pre-integrated in the key management unit. When performing multi-level key derivation, the target device can call the encryption algorithm pre-integrated in the key management unit to perform corresponding data processing, thereby obtaining derived keys at each level.
[0053] It should be noted that the derived device storage key (HSK), user storage key (USK), and key storage key (KSK) are deleted after use and are not stored on the target device. In other words, these keys are only dynamically generated when needed and are not stored.
[0054] In some optional embodiments, the device unique key HUK and the target device are in one-to-one correspondence, that is, one target device corresponds to a unique device unique key HUK.
[0055] In some optional embodiments, the target device may include multiple sub-devices. Accordingly, the device information may include a hardware identity (HID) and / or a sub-hardware identity (SHID). The device identity is used to identify the target device, and the sub-device identity is used to identify each sub-device in the target device, with different sub-devices having different sub-device identities. When performing multi-level key derivation, the device storage key (HSK) can be derived from either the device identity or the sub-device identity as required.
[0056] For example, if the target device is a many-core processing device that includes multiple processing cores, the device identifier is used to identify the many-core processing device to distinguish it from other devices, and the sub-device identifier is used to identify a processing core within the many-core processing device to distinguish it from other processing cores within the many-core processing device. When generating a device storage key for isolating the many-core processing device, the device identifier is used for key derivation. When generating a device storage key for isolating a processing core, the sub-device identifier is used for key derivation.
[0057] In some optional embodiments, the device unique key is a key burned into a preset read-only storage area at the factory, and the device identification is also stored in the preset read-only storage area. The preset read-only storage area may be a read-only memory in the target device.
[0058] In some optional embodiments, when deriving the device storage key based on the device unique key and device information, a message authentication code (MAC) algorithm can be used, and the derivation process can be implemented inside the target device, thereby effectively ensuring the security of the key.
[0059] In some optional embodiments, when deriving the user storage key based on the device storage key and user information, a message authentication code algorithm can also be used, and the derivation process can be implemented inside the target device, thereby effectively ensuring key security.
[0060] The message authentication code algorithm includes a Hash-based MAC (HMAC) algorithm, and its working mode may be a Secure Hash Algorithm 256-bit (SHA256), that is, the HMAC algorithm uses SHA256 as the underlying hash function.
[0061] In summary, the multi-level key derivation process involves four levels of keys: device-level keys, storage system-level keys, user-level keys, and application-level keys. Device-level keys include device-unique keys, which are typically burned into the device at the factory and cannot be changed. The device-unique key can be used to distinguish and isolate target devices. Storage system-level keys include device storage keys, which can be derived from the device-unique key and a device identifier or sub-device identifier. These keys provide root key protection for the key storage of the target device or each sub-device within the target device, thereby achieving key isolation between the target device and other devices, or between sub-devices within the target device. User-level keys include user storage keys, which are derived from the device storage key and the user identifier. The user identifier provides a unique identification value for the user, allowing different users to have different user storage keys, thus achieving key isolation between users. Application-level keys include key storage keys, which are derived from the user storage key and the key identifier. Since different users have different user storage keys, each user has their own set of key storage keys, thereby achieving session key isolation between different users.
[0062] Figure 2 A schematic diagram of a key hierarchy provided in an embodiment of the present disclosure. Figure 2As shown, the target device has a unique device key, HUK, burned into ROM at the factory. Through a single key derivation, multiple device storage keys can be obtained: device storage key HSK-1, device storage key HSK-2, device storage key HSK-3, and so on. Furthermore, from device storage key HSK-1, user storage keys USK-1, user storage key USK-2, user storage key USK-3, and so on can be derived for different users. Device storage keys HSK-2 and HSK-3 are similar to device storage key HSK-1 and will not be described in detail here.
[0063] For the user storage key USK-1, multiple key storage keys corresponding to multiple session keys can be generated, namely key storage key KSK-1, key storage key KSK-2, key storage key KSK-3,...; user storage key USK-2, user storage key USK-3, etc. are similar to user storage key USK-1, and will not be described in detail here.
[0064] In some optional embodiments, the session encryption key (Key Encrypted Key, KEK) may be generated in a random manner, for example, by using a random number generator to randomly generate the session encryption key KEK.
[0065] After obtaining the key storage key and the session encryption key, you can perform encryption operations on the session key to obtain the session key ciphertext.
[0066] In some optional embodiments, the session key is encrypted based on the key storage key and the session encryption key to obtain and store the session key ciphertext, including: encrypting the session encryption key based on the key storage key to obtain a first sub-ciphertext; generating an initialization vector based on a random method; encrypting the session key based on the session encryption key and the initialization vector to obtain an encryption result and verification information corresponding to the encryption result; obtaining a second sub-ciphertext based on the encryption result and the initialization vector; obtaining a third sub-ciphertext based on the verification information; obtaining a session key ciphertext based on the first sub-ciphertext, the second sub-ciphertext and the third sub-ciphertext; and storing the session key ciphertext in a preset non-volatile storage area.
[0067] In some optional embodiments, an initialization vector (IV) is a random or pseudo-random data block used to enhance security in a symmetric encryption algorithm, which can ensure that the same plaintext generates different ciphertexts under the same key encryption, thereby resisting attacks such as repetitive pattern analysis.
[0068] In some optional embodiments, the verification information (Tag) is a short encrypted data block used to verify the integrity and authenticity of the data. It can be generated by an authenticated encryption algorithm or a message authentication code. Its core function is to ensure that the data has not been tampered with during transmission or storage and comes from a legitimate sender.
[0069] Exemplarily, the session key ciphertext is essentially a key storage data structure, wherein the first sub-ciphertext corresponds to the head of the data structure, the second sub-ciphertext corresponds to the middle of the data structure, and the third sub-ciphertext corresponds to the tail of the data structure. First, the session encryption key KEK is encrypted based on the key storage key KSK using a symmetric encryption algorithm to obtain the first sub-ciphertext, which is then placed in the head of the key storage data structure. Then, an initialization vector IV is randomly generated using a random number generator, and the session key CSK is encrypted using the session encryption key KEK using a symmetric encryption algorithm to obtain the encryption result and verification information TAG. The encryption result and initialization vector IV are used as the middle of the key storage data structure, and the verification information TAG is used as the tail of the key storage data structure, thereby obtaining a complete key storage data structure. The key storage data structure can then be stored in a preset non-volatile memory (NVM).
[0070] Among them, the symmetric cryptographic algorithm (Symmetric Cryptographic Algorithm) includes the Advanced Encryption Standard (AES) algorithm, and the working modes include the Electronic Codebook (ECB) mode and the Galois / Counter Mode (GCM).
[0071] In some optional embodiments, the key management method may further include: establishing a correspondence between the storage location of the session key ciphertext and the key identifier corresponding to the session key; sending the key identifier to the key management unit so that the key management unit sends the key identifier to the user terminal.
[0072] In this way, when the user needs to use the session key, the corresponding session key ciphertext can be found accurately and quickly based on the key identifier and the above-mentioned corresponding relationship, and corresponding decryption operations can be performed.
[0073] Table 1 is a schematic table of key information shown in an embodiment of the present disclosure, which shows the source of each key and its storage location or derivation method.
[0074] Table 1 Schematic diagram of key information
[0075]
[0076] Figure 3 A schematic diagram of a key management method provided by an embodiment of the present disclosure. Figure 3 When the target device performs key storage in response to the key storage request, it first derives the device storage key HSK based on the device unique key HUK and the device identifier HID, then derives the user storage key USK based on the device storage key HSK and the user identifier UID, and then derives the key storage key KSK based on the user storage key USK and the key identifier KID. The randomly generated session encryption key KEK is encrypted using the AES-ECB algorithm based on the key storage key KSK to obtain the encrypted session encryption key KEK, and the encrypted session encryption key KEK is stored in the header of the key storage data structure.
[0077] Furthermore, a random number generator is used to generate an initialization vector (IV), and the session encryption key KEK, the IV, the session key CSK, and the encrypted session encryption key KEK are used as input data for the AES-GCM algorithm. After calculation, the output result includes the encrypted session key CSK and verification information. The IV and the encrypted session key CSK are stored as the middle part of the key storage data structure, and the verification information is stored as the tail part of the key storage data structure. Among the input data of the AES-GCM algorithm, the encrypted session encryption key KEK is the header data. Its essence is Additional Authenticated Data (AAD), a special data type that does not participate in the encryption process but is included in the authentication scope and undergoes integrity and authenticity verification along with the ciphertext. Its core function is to provide security for data that "does not require encryption but requires trustworthiness."
[0078] In some optional embodiments, after the session key is encrypted and stored, the session key can also be used to perform some tasks. Wherein, since the session key is encrypted and stored, it is necessary to first perform a decryption operation to obtain the session key before using the session key.
[0079] In some optional embodiments, after encrypting the session key based on the key storage key and the session encryption key to obtain and store the session key ciphertext, the key management method may also include: in response to a key service request sent by the user terminal through the key management unit, obtaining the user information of the stored session key and the key identifier of the session key corresponding to the key service request; performing multi-level key derivation based on the user information, the key identifier and the initial derivation information to obtain the key storage key; decrypting the session key ciphertext based on the key storage key to obtain the session key; performing a preset task based on the session key to obtain a task result; and sending the task result to the key management unit so that the key management unit forwards the task result to the user terminal.
[0080] Exemplarily, the preset task includes an encryption task and / or a decryption task based on a session key.
[0081] In some optional embodiments, obtaining user information and a key identifier of a stored session key corresponding to a key service request includes: receiving user information sent by a user terminal and forwarded by a key management unit; sending a session handle corresponding to the key service request to the user terminal via the key management unit; and receiving the key identifier of the session key returned by the user terminal via the key management unit. The user information includes the user identifier, and the session handle is an identifier used to uniquely identify a session. It is essentially a reference or pointer to a session resource used to track and manage session status in network communications, process interactions, or software applications, thereby minimizing data confusion between different sessions. The session handle is used here primarily to obtain the correct key identifier.
[0082] In some optional embodiments, the initial derived information includes a device-unique key and device information; accordingly, based on the user information, the key identifier, and the initial derived information, a multi-level key derivation is performed to obtain a key storage key, including: deriving a device storage key based on the device-unique key and the device information; deriving a user storage key based on the device storage key and the user information; and deriving a key storage key based on the user storage key and the key identifier. The device information includes a device identifier and / or a sub-device identifier, and the user information includes a user identifier.
[0083] Exemplarily, based on the device unique key HUK and the device identifier, the device storage key HSK is derived; based on the device storage key and the user identifier, the user storage key USK is derived; based on the user storage key USK and the key identifier, the key storage key KSK is derived.
[0084] Further, as mentioned above, the session key ciphertext includes a first sub-ciphertext, a second sub-ciphertext and a third sub-ciphertext; accordingly, in some optional embodiments, decrypting the session key ciphertext based on the key storage key to obtain the session key includes: decrypting the first sub-ciphertext based on the key storage key to obtain the session encryption key; obtaining verification information to be verified based on the session encryption key, the first sub-ciphertext and the initialization vector in the second sub-ciphertext; and when the verification information to be verified is consistent with the verification information in the third sub-ciphertext, decrypting the encryption result in the second sub-ciphertext based on the session encryption key, the first sub-ciphertext and the initialization vector to obtain the session key.
[0085] In other words, the non-volatile storage area stores session key ciphertext, which is essentially a key storage data structure. The header of this data structure corresponds to the first sub-ciphertext, the middle portion corresponds to the second sub-ciphertext, and the tail portion corresponds to the third sub-ciphertext. During decryption, the header data is first decrypted using the key storage key KSK derived from multi-level keys to obtain the session encryption key KEK. Then, based on the session encryption key KEK, the header data, and the initialization vector IV of the middle portion, a calculation is performed to obtain the verification information TAG'. This TAG' is compared with the TAG stored at the tail portion. If the two match, verification is considered successful, and the encrypted result of the middle portion can be decrypted using the session encryption key KEK to obtain the session key CSK. Otherwise, if the two do not match, subsequent decryption operations are terminated.
[0086] In some optional embodiments, after completing decryption to obtain the session key, the target device can use the session key to perform some preset tasks, such as performing some encryption tasks or decryption tasks based on the session key, and obtain corresponding task results, and the task results can be forwarded to the user terminal through the key management unit, so that the user terminal can perform subsequent data processing based on these task results.
[0087] In a second aspect, an embodiment of the present disclosure provides a key management method.
[0088] Figure 4 This is a flowchart of a key management method provided by an embodiment of the present disclosure. The key management method can be applied to a key management unit.
[0089] like Figure 4 As shown, the key management method includes but is not limited to the following steps:
[0090] Step S401, in response to a first session request sent by a user terminal, performing identity authentication on the user terminal;
[0091] Step S402: When the user terminal passes the identity authentication, a key storage request is sent to the target device, so that the target device performs key storage in a multi-level key derivation manner based on the key storage request.
[0092] In some optional embodiments, when a user needs to store a session key, the user can send a first session request to the key management unit through the user terminal. The key management unit receives and responds to the first session request and needs to authenticate the user terminal to ensure the user's legal identity through authentication.
[0093] In some optional embodiments, when the user terminal passes the identity authentication, the key management unit can send a key storage request to the target device, so that after receiving the key storage request, the target device performs key storage based on the key storage request through multi-level key derivation.
[0094] In some optional embodiments, the key management unit, in response to a first session request sent by a user terminal, obtains user information from the first session request and uses the user information, among other things, to authenticate the user terminal. After the user terminal passes authentication, the key management unit may import the session key to be stored sent by the user terminal, generate a key storage request based on the user information and the session key, and send the key storage request to the target device. The target device then parses the key storage request to obtain the user information and the session key. Alternatively, after the user terminal passes authentication, the key management unit may generate a key storage request based on the user information and send the key storage request to the target device. The target device then parses the key storage request to obtain the user information and locally generate the session key to be stored. Furthermore, the target device may perform multi-level key derivation based on the user information and initial derived information of the target device to obtain a key storage key. The session key is then encrypted using the key storage key and a randomly generated session encryption key to obtain and store the session key ciphertext, thereby completing the encrypted storage of the session key. The implementation of key storage by the target device can be found in the relevant embodiments of this disclosure and will not be further described here.
[0095] In some optional embodiments, the key management unit can also use the encrypted and stored session key to execute some preset tasks through the target device. The preset tasks include encryption tasks and / or decryption tasks based on the session key, which are not limited in the embodiment of the present disclosure.
[0096] In some optional embodiments, the key management method may also include: authenticating the user terminal in response to a second session request sent by the user terminal; if the user terminal passes the authentication, sending a key service request to the target device, so that the target device can perform key decryption based on the key service request through a multi-level key derivation method, and use the decrypted session key to perform a preset task, obtain and return the task result; and send the task result to the user terminal.
[0097] As can be seen from this, in addition to encrypting and storing session keys according to user terminal requirements or requests to the target device, the key management unit can also set decryption session keys according to new user terminal requirements or requests, perform certain preset tasks based on the session keys, and forward the obtained task results to the user terminal. The implementation of decrypting the session keys by the target device can be found in the relevant content of the embodiments of this disclosure and will not be described in detail here.
[0098] In summary, the target device can use a variety of cryptographic algorithms in the process of deriving multi-level keys for encryption and decryption, and their contents can be shown in Table 2.
[0099] Table 2 Cryptographic Algorithms
[0100]
[0101] In some optional embodiments, whether the session key is encrypted and stored, or the encrypted and stored session key is decrypted to perform a preset task, the user terminal may be authenticated using a verification code.
[0102] In some optional embodiments, authenticating a user terminal includes: generating a verification random number and sending the verification random number to the user terminal; generating a first verification code based on user information and the verification random number, where the user information is information obtained from the first session request or the second session request; receiving a second verification code sent by the user terminal, where the second verification code is a verification code generated by the user terminal based on the user information and the verification random number; determining an authentication result of the user terminal based on the first verification code and the second verification code; wherein, if the first verification code and the second verification code are consistent, an authentication result of authentication passing is obtained, and if the first verification code and the second verification code are inconsistent, an authentication result of authentication failing is obtained.
[0103] Exemplarily, the identity authentication mode is first adjusted to the challenge / response authentication mode. After entering the identity authentication, the user terminal sends the user identification, and the key management unit generates a verification random number A and returns it to the user terminal. The key management unit then locally uses the verification random number A and the user identification to use the HMAC-SHA256 algorithm to generate a MAC value M, and M will be used as the first verification code. After the user terminal receives the verification random number A, it uses the HMAC-SHA256 algorithm to generate a MAC value M' based on the user identification and the verification random number A, and sends M' as the second verification code to the key management unit. The key management unit compares the first verification code M with the second verification code M' to see if they are consistent. If the two are consistent, it is considered that the user terminal has passed the identity authentication and authorization is enabled. If the two are inconsistent, it is considered that the user terminal has not passed the identity authentication and authorization will not be enabled.
[0104] In summary, in the disclosed embodiments, in response to a first session request sent by a user terminal, the user terminal is authenticated. If the user terminal passes authentication, a key storage request is sent to the target device, allowing the target device to perform key storage based on the key storage request through a multi-level key derivation method. Thus, it can be seen that the key management unit can uniformly manage the keys of the target device. Regardless of the user terminal, the target device must pass through the key management unit in order to perform key storage and use. Furthermore, before performing key storage and use, the key management unit first authenticates the user terminal. Only after the user terminal passes authentication will subsequent operations such as key storage be performed, thereby ensuring key security and improving the information security of the target device. In other words, the key management unit can serve as a medium connecting the user terminal and the target device, transmitting data between the two and ensuring smooth data exchange. Furthermore, the key management unit can also serve as a security entity that isolates the user terminal from the target device, isolating data exchange between the two when necessary, thereby preventing the leakage of keys and other information and improving information security.
[0105] The following combination Figure 5 and Figure 6 The interaction process between various execution entities in the key management method of the embodiment of the present disclosure is exemplarily described.
[0106] Figure 5 A flowchart of a key management method provided by an embodiment of the present disclosure. Figure 5 The execution entities mainly include user terminals, key management units and security chips.
[0107] like Figure 5 As shown, a user terminal initiates a session request, establishes a session with the key management unit, and, based on the established session, sends a user identifier and a second verification code to the key management unit. The key management unit receives the user identifier and second verification code and performs identity authentication based on the locally generated first and second verification codes. After the user terminal passes identity authentication, the user terminal sends the encrypted session key CSK to the key management unit, which then sends the user identifier and session key CSK to the security chip. The key management unit can encapsulate the user identifier and session key CSK into a key storage request and send it to the security chip, although this is not a limitation in the present embodiment.
[0108] After receiving the user identifier and session key CSK sent by the key management unit, the security chip derives the device storage key HSK based on the device unique key HUK and device information; derives the user storage key USK based on the device storage key and user identifier; assigns a key identifier to the session key CSK; derives the key storage key KSK based on the user storage key USK and the key identifier; randomly generates a session encryption key KEK; encrypts the session encryption key KEK based on the key storage key KSK to obtain a first sub-ciphertext, and stores the first sub-ciphertext in the header of the key storage data structure; randomly generates an initialization vector and encrypts the session key CSK using the session encryption key KEK to obtain an encryption result and verification information; stores the encryption result and the initialization vector as the second sub-ciphertext in the middle of the key storage data structure, and stores the verification information in the tail of the key storage data structure; stores the key storage data structure in a non-volatile storage area, and establishes a correspondence between the key identifier and the storage location; and returns the key identifier to the user terminal. The user terminal receives the key identifier.
[0109] The operation of assigning a key to the session key CSK can be completed at any time before the derivation of the key storage key KSK is performed. Figure 5 The above is merely an exemplary description; similarly, the operation of randomly generating the session encryption key KEK can be completed at any time before encrypting the session encryption key KEK based on the session encryption key KEK. Figure 5 The following are only exemplary descriptions.
[0110] Figure 6 A flowchart of a key management method provided by an embodiment of the present disclosure. Figure 6 The execution entities mainly include user terminals, key management units and security chips.
[0111] like Figure 6 As shown, the user terminal initiates a session request, establishes a session with the key management unit, and, based on the established session, sends a user identifier and a second verification code to the key management unit. The key management unit receives the user identifier and the second verification code and performs identity authentication based on the locally generated first and second verification codes. After the user terminal passes identity authentication, the key management unit sends the user identifier to the security chip. The key management unit can encapsulate the user identifier into a key service request and send it to the security chip, although this is not a limitation in the present embodiment.
[0112] After the security chip receives the user identifier sent by the key management unit, it derives the device storage key HSK based on the device unique key HUK and device information, and derives the user storage key USK based on the device storage key and user identifier, and returns the session handle to the user terminal through the key management unit. The user terminal feeds back the key identifier of the session key CSK to the security chip through the key management unit based on the session handle. The security chip receives the key identifier and derives the key storage key KSK based on the user storage key USK and the key identifier. The security chip locates the storage location of the session key CSK based on the key identifier and decrypts the header of the key storage data structure using the key storage key KSK to obtain the session encryption key KEK. The security chip calculates verification information to be verified based on the session encryption key KEK, the header data, and the initialization vector. The security chip compares the verification information to be verified with the verification information at the end of the key storage data structure to obtain a verification result. If the verification result shows that the verification information to be verified is consistent with the verification information, the security chip decrypts the encrypted result in the middle of the key storage data structure based on the session encryption key KEK, the header data, and the initialization vector to obtain the session key CSK. The security chip then executes a preset encryption and / or decryption task based on the session key CSK, obtains a task result, and returns the task result to the user terminal via the key management unit. The user terminal receives the task result.
[0113] In a third aspect, an embodiment of the present disclosure provides a key management device.
[0114] Figure 7 A block diagram of a key management device provided in an embodiment of the present disclosure. The key management device can be set in a target device and is used to execute the key management method as described in any one of the embodiments of the present disclosure.
[0115] like Figure 7 As shown, the key management device 700 includes but is not limited to the following modules:
[0116] An acquisition module 701 is configured to acquire a session key to be stored and user information corresponding to the session key in response to a key storage request sent by the key management unit;
[0117] A derivation module 702 is configured to perform multi-level key derivation based on user information and initial derivation information to obtain a key storage key;
[0118] A generating module 703 is used to generate a session encryption key based on a random method;
[0119] The encryption module 704 is configured to encrypt the session key based on the key storage key and the session encryption key, and obtain and store the session key ciphertext.
[0120] In the disclosed embodiment, an acquisition module, in response to a key storage request sent by a key management unit, obtains a session key to be stored and user information corresponding to the session key. A derivation module, based on user information and initial derived information, performs multi-level key derivation to obtain a key storage key. A generation module generates a session encryption key in a random manner. An encryption module encrypts the session key based on the key storage key and the session encryption key to obtain and store a session key ciphertext. Thus, when storing the session key, both the key storage key and the session encryption key are used. The key storage key is not a pre-stored key, but is obtained when needed through multi-level key derivation based on initial derived information. This fundamentally prevents the possibility of the key storage key being stolen through unauthorized access to the storage space, thereby improving key security. Furthermore, the session encryption key is a randomly generated key, and this randomness can enhance key security. Therefore, the session key ciphertext obtained by encrypting the session key using both the key storage key and the session encryption key is highly secure.
[0121] In a fourth aspect, an embodiment of the present disclosure provides a key management device.
[0122] Figure 8 A block diagram of a key management device provided in an embodiment of the present disclosure. The key management device can be provided in a key management unit and is used to execute the key management method as described in any one of the embodiments of the present disclosure.
[0123] like Figure 8 As shown, the key management device 800 includes but is not limited to the following modules:
[0124] The verification module 801 is configured to authenticate the user terminal in response to a first session request sent by the user terminal;
[0125] The sending module 802 is configured to send a key storage request to a target device when the user terminal passes identity authentication, so that the target device performs key storage in a multi-level key derivation manner based on the key storage request.
[0126] In the disclosed embodiment, the verification module authenticates the user terminal in response to a first session request sent by the user terminal. The sending module, upon successful authentication of the user terminal, sends a key storage request to the target device, enabling the target device to perform key storage based on the key storage request through a multi-level key derivation method. Thus, the key management unit can uniformly manage the keys of the target device. Regardless of the user terminal, all key storage and use operations on the target device must be performed through the key management unit. Furthermore, before performing key storage and use, the key management unit authenticates the user terminal. Only after the user terminal passes authentication will subsequent operations such as key storage be performed, ensuring key security and enhancing the information security of the target device. In other words, the key management unit serves as a medium connecting the user terminal and the target device, transmitting data between them and ensuring smooth data exchange. Furthermore, the key management unit can also serve as a security entity that isolates the user terminal from the target device, isolating data exchange between them when necessary, thereby preventing the leakage of keys and other security information and enhancing information security.
[0127] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, a computer-readable medium, and a computer program product.
[0128] Figure 9 A block diagram of an electronic device provided in an embodiment of the present disclosure.
[0129] like Figure 9 As shown, the electronic device includes: at least one processor 901, at least one memory 902, and one or more I / O interfaces 903. The processor 901, memory 902, and I / O interface 903 are interconnected via a bus 904. The memory 902 stores one or more computer programs, which are executed by the at least one processor 901 to enable the at least one processor 901 to implement any of the key management methods described in the above embodiments.
[0130] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the key management methods described in the above embodiments. The computer-readable storage medium may be a volatile or non-volatile computer-readable storage medium.
[0131] An embodiment of the present disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of a terminal, the processor in the terminal executes the above-mentioned key management method.
[0132] Among them, the processor is a device with data processing capabilities, including but not limited to the central processing unit (CPU); the memory is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically such as SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read-write interface) is connected between the processor and the memory, which can realize information exchange between the memory and the processor, including but not limited to the data bus (Bus), etc.
[0133] Those skilled in the art will appreciate that all or some of the steps, systems, and functional modules / units in the apparatus disclosed above may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0134] In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation.
[0135] Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit (CPU), a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH) or other disk storage; compact disc (CD-ROM), digital versatile disc (DVD) or other optical disc storage; magnetic cassettes, tapes, disk storage or other magnetic storage; any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, as is well known to those skilled in the art, communication media typically embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0136] The present disclosure has disclosed example embodiments, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly indicated, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, it will be understood by those skilled in the art that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. A key management method, comprising: In response to a key storage request sent by the key management unit, obtaining a session key to be stored and user information corresponding to the session key; performing multi-level key derivation based on the user information and the initial derived information to obtain a key storage key; Generate session encryption keys based on randomness; The session key is encrypted based on the key storage key and the session encryption key to obtain and store a session key ciphertext.
2. The method according to claim 1, wherein The initial derived information includes a device unique key and device information; The performing multi-level key derivation based on the user information and the initial derivation information to obtain a key storage key includes: deriving a device storage key based on the device unique key and the device information; deriving a user storage key based on the device storage key and the user information; assigning a key identifier to the session key; The key storage key is derived based on the user storage key and the key identifier.
3. The method according to claim 2, wherein: The device unique key is a key burned into a preset read-only storage area when leaving the factory. The device information includes a device identifier and / or a sub-device identifier, and the device identifier is also stored in the preset read-only storage area.
4. The method according to claim 2, wherein: The encrypting the session key based on the key storage key and the session encryption key to obtain and store the session key ciphertext includes: encrypting the session encryption key based on the key storage key to obtain a first sub-ciphertext; Generate an initialization vector based on a random method; Encrypting the session key based on the session encryption key and the initialization vector to obtain an encryption result and verification information corresponding to the encryption result; Obtaining a second sub-ciphertext based on the encryption result and the initialization vector; Based on the verification information, obtaining a third sub-ciphertext; Obtaining the session key ciphertext based on the first sub-ciphertext, the second sub-ciphertext, and the third sub-ciphertext; The session key ciphertext is stored in a preset non-volatile storage area.
5. The method according to claim 1, wherein The step of obtaining, in response to a key storage request sent by the key management unit, a session key to be stored and user information corresponding to the session key, includes: In response to the key storage request sent by the key management unit, obtaining the session key and the user information sent by the user terminal and forwarded by the key management unit from the key storage request; or In response to the key storage request sent by the key management unit, obtaining the user information sent by the user terminal and forwarded by the key management unit from the key storage request, and generating the session key; The key storage request is sent when the user terminal passes the identity authentication of the key management unit.
6. The method according to claim 1, wherein The method further comprises: Establishing a correspondence between the storage location of the session key ciphertext and the key identifier corresponding to the session key; The key identifier is sent to the key management unit, so that the key management unit sends the key identifier to the user terminal.
7. The method according to any one of claims 1 to 6, wherein: After encrypting the session key based on the key storage key and the session encryption key to obtain and store the session key ciphertext, the method further includes: In response to a key service request sent by the user terminal through the key management unit, obtaining user information of a stored session key and a key identifier of the session key corresponding to the key service request; performing multi-level key derivation based on the user information, the key identifier, and the initial derivation information to obtain the key storage key; decrypting the session key ciphertext based on the key storage key to obtain the session key; Execute a preset task based on the session key to obtain a task result; The task result is sent to the key management unit, so that the key management unit forwards the task result to the user terminal.
8. The method according to claim 7, wherein: The initial derived information includes a device unique key and device information; The performing multi-level key derivation based on the user information, the key identifier, and the initial derivation information to obtain a key storage key includes: deriving a device storage key based on the device unique key and the device information; deriving a user storage key based on the device storage key and the user information; The key storage key is derived based on the user storage key and the key identifier.
9. The method according to claim 8, wherein The session key ciphertext includes a first sub-ciphertext, a second sub-ciphertext and a third sub-ciphertext; The decrypting the session key ciphertext based on the key storage key to obtain the session key includes: decrypting the first sub-ciphertext based on the key storage key to obtain a session encryption key; Obtaining verification information to be verified based on the session encryption key, the first sub-ciphertext, and the initialization vector in the second sub-ciphertext; When the verification information to be verified is consistent with the verification information in the third sub-ciphertext, the encryption result in the second sub-ciphertext is decrypted based on the session encryption key, the first sub-ciphertext and the initialization vector to obtain the session key.
10. The method according to claim 7, wherein: The acquiring of user information of a stored session key corresponding to the key service request and a key identifier of the session key includes: receiving the user information sent by the user terminal and forwarded by the key management unit; Sending a session handle corresponding to the key service request to the user terminal through the key management unit; Receive the key identifier of the session key returned by the user terminal through the key management unit.
11. A key management method, comprising: In response to a first session request sent by a user terminal, performing identity authentication on the user terminal; In a case where the user terminal passes the identity authentication, a key storage request is sent to the target device, so that the target device performs key storage in a multi-level key derivation manner based on the key storage request.
12. The method according to claim 11, wherein The method further comprises: In response to the second session request sent by the user terminal, performing identity authentication on the user terminal; When the user terminal passes the identity authentication, a key service request is sent to the target device, so that the target device performs key decryption based on the key service request through a multi-level key derivation method, and uses the decrypted session key to perform a preset task, and obtain and return a task result; The task result is sent to the user terminal.
13. The method according to claim 11 or 12, wherein: The performing identity authentication on the user terminal includes: Generate a verification random number and send the verification random number to the user terminal; generating a first verification code based on user information and the verification random number, wherein the user information is information obtained from the first session request or the second session request; receiving a second verification code sent by the user terminal, where the second verification code is generated by the user terminal according to the user information and the verification random number; determining an identity authentication result of the user terminal according to the first verification code and the second verification code; When the first verification code and the second verification code are consistent, an authentication result indicating that the identity is passed is obtained; when the first verification code and the second verification code are inconsistent, an authentication result indicating that the identity is failed is obtained.
14. An electronic device comprising a memory and a processor; the memory stores a computer program that can be executed by the processor, and when the computer program is executed by the processor, it implements the key management method described in any one of claims 1 to 10, or the key management method described in any one of claims 11 to 13.
15. A computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the computer program implements the key management method according to any one of claims 1 to 10, or the key management method according to any one of claims 11 to 13.
16. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the key management method according to any one of claims 1 to 10, or the key management method according to any one of claims 11 to 13.
Citation Information
Patent Citations
Key storage method and device and equipment identity authentication method and device
CN107317677A
Key management method and device, computing equipment and computer readable storage medium
CN117375832A