WO2017157006A1 - 一种密钥处理方法及装置 - Google Patents

一种密钥处理方法及装置 Download PDF

Info

Publication number
WO2017157006A1
WO2017157006A1 PCT/CN2016/101582 CN2016101582W WO2017157006A1 WO 2017157006 A1 WO2017157006 A1 WO 2017157006A1 CN 2016101582 W CN2016101582 W CN 2016101582W WO 2017157006 A1 WO2017157006 A1 WO 2017157006A1
Authority
WO
WIPO (PCT)
Prior art keywords
key
command
module
slot
slots
Prior art date
Application number
PCT/CN2016/101582
Other languages
English (en)
French (fr)
Inventor
施迅
余发江
赵波
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2017157006A1 publication Critical patent/WO2017157006A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0877Generation of secret information including derivation or calculation of cryptographic keys or passwords using additional device, e.g. trusted platform module [TPM], smartcard, USB or hardware security module [HSM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/121Restricting unauthorised execution of programs
    • G06F21/123Restricting unauthorised execution of programs by using dedicated hardware, e.g. dongles, smart cards, cryptographic processors, global positioning systems [GPS] devices
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0894Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage
    • H04L9/0897Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage involving additional devices, e.g. trusted platform module [TPM], smartcard or USB

Definitions

  • the present invention relates to the field of communications, and in particular, to a key processing method and apparatus.
  • TPM Trusted Platform Module
  • TCG Trusted Computing Group
  • the embodiment of the invention provides a key processing method and device, which can avoid returning an error code whose space is full when the key is loaded, and ensure the smooth loading of the key.
  • an embodiment of the present invention provides a key processing method, including:
  • a key load command is obtained.
  • the key load command indicates that the first key is loaded on the trusted platform module TPM chip.
  • a key processing device capable of releasing a first key slot of all key slots in the TPM chip and loading the first key on the first key slot according to a key loading command . Therefore, it is possible to avoid returning an error code that the space is full when the key is loaded, to ensure the smooth loading of the key, and to reasonably use the memory space resource of the TPM chip.
  • the method further includes:
  • the first key slot in all the key slots in the TPM chip is released, including:
  • the key occupying the first key slot is the key that is used the least in the key occupying all the key slots, or the first key slot is occupied
  • the key is the earliest loaded key among the keys occupying all the key slots; and the TPM chip is instructed to release the first key slot according to the identifier of the first key slot.
  • the key occupying the first key slot is the key that uses the least number of keys in all the key slots, or the first secret is occupied.
  • the key of the key slot is the earliest loaded key among the keys occupying all key slots.
  • the first key slot is selected in a reasonable manner, as much as possible to ensure that the other key slots are not affected when the first key is loaded.
  • the method further includes:
  • a live record of the key occupying the first key slot is saved before the first key slot is released.
  • the live record of the key occupying the first key slot is saved, so that the next time the key is reloaded, the direct Restore the live record of the key to achieve fast loading of the key.
  • the method further includes:
  • the live record of the first key is stored in the memory, and the live record of the first key is acquired and restored.
  • the live record of the first key may be directly restored. Achieve fast loading of keys.
  • the method further includes:
  • the mapping relationship between the first key slot and the first key is recorded, so that the first key is acquired from the first key slot according to the mapping relationship.
  • the method further includes:
  • the key release command is used to trigger the TPM chip to release the second key occupying the second key slot in the TPM chip;
  • the method before acquiring the key load command, the method further includes:
  • the first command is obtained from at least one command, and the first command is any one of the at least one command, and the first command includes a key load command.
  • the method before acquiring the key load command, the method further includes:
  • the key processing method it is determined whether the number of key slots in the idle state in the chip is greater than or equal to a preset threshold, and is in an idle state key slot in the chip.
  • the first command is obtained from the received at least one command, the first command being any one of the at least one command; and the secret in the idle state in the chip
  • the first command is obtained from the received at least one command, and the first command is the command with the highest priority among the at least one command, so as to ensure reasonable use of the TPM chip. Key slot.
  • an embodiment of the present invention provides a key processing apparatus, where the key processing apparatus includes an obtaining module, a confirming module, a releasing module, and a loading module;
  • An obtaining module configured to obtain a key loading command, where the key loading command indicates that the first key is loaded on the trusted platform module TPM chip;
  • the confirmation module is configured to confirm the inside of the TPM chip after the acquisition module acquires the key loading command All key slots are in a non-idle state;
  • a release module configured to release a first key slot of all key slots in the TPM chip if all key slots in the TPM chip are in a non-idle state
  • a loading module configured to load the first key on the first key slot according to the key loading command after the releasing module releases the first key slot in all the key slots in the TPM chip.
  • the technical effects of the key processing apparatus provided by the embodiment of the present invention can be referred to the technical effects of the key processing apparatus described in the key processing method performed by the key processing apparatus of the first aspect, and details are not described herein again.
  • the confirmation module is further configured to confirm a mapping relationship between all key slots and keys in the TPM chip before the release module releases the first key slot.
  • the release module is configured to obtain an identifier of the first key slot, where the key occupying the first key slot is a key that is used the least in the key occupying all the key slots. Or the key occupying the first key slot is the earliest loaded key among the keys occupying all the key slots; and the TPM chip is instructed to release the first key slot according to the identifier of the first key slot. .
  • the key processing device further includes a saving module
  • the save module is configured to save the live record of the key occupying the first key slot before the release module releases the first key slot.
  • the loading module is configured to: when the loading module loads the first key on the first slot, confirm that the first record of the first key is stored in the memory, and obtain and restore the live record of the first key.
  • the key processing device further includes a recording module
  • a recording module configured to record a mapping relationship between the first key slot and the first key when the loading module loads the first key on the first key slot, so as to be from the first key slot according to the mapping relationship Get the first key.
  • the obtaining module is further configured to obtain a key release command, where the key release command is used to trigger the TPM chip to release the second key occupying the second key slot in the TPM chip;
  • the releasing module is further configured to release the second key on the second key slot according to the key release command after the obtaining module acquires the key release command;
  • the recording module is further configured to delete a mapping relationship between the second key slot and the second key when the release module releases the second key on the second key slot.
  • the confirmation module is further configured to: before the obtaining module obtains the key loading command, confirm that the number of key slots in the idle state in the TPM chip is greater than or equal to a preset threshold;
  • the obtaining module is further configured to: after the confirmation module confirms that the number of the key slots in the idle state of the TPM chip is greater than or equal to the preset threshold, obtain the first command from the received at least one command, where the first command is at least Any of a command, the first command includes a key load command.
  • the confirmation module is further configured to: before the obtaining module obtains the key loading command, confirm that the number of key slots in the idle state of the TPM chip is less than a preset threshold;
  • the obtaining module is further configured to: after the confirmation module confirms that the number of key slots in the idle state of the TPM chip is less than a preset threshold, obtain the first command from the received at least one command, where the first command is at least one command The highest priority command, the first command includes a key load command.
  • an embodiment of the present invention further provides a terminal device, where the terminal device includes a memory, a processor, a communication interface, and a system bus.
  • the memory, the processor, and the communication interface are connected by the system bus, the memory is for storing computer instructions, and the processor is configured to execute computer instructions stored by the memory to cause the terminal device to execute A key processing method as described in the first aspect above.
  • the technical effects of the terminal device provided by the embodiment of the present invention can be referred to the technical effects of the key processing device described in the key processing method performed by the key processing device in the first aspect, and details are not described herein again.
  • an embodiment of the present invention further provides a software product, where the software product includes computer instructions for implementing a key processing method.
  • the computer instructions can be stored on a readable storage medium; the processor can read and execute the computer instructions from the readable storage medium such that the processor implements a key processing method.
  • the embodiment of the invention provides a key processing method and device.
  • the key loading command indicates that the first key is loaded on the trusted platform module TPM chip by acquiring a key loading command; if all key slots in the TPM chip are In the non-idle state, the first key slot in all the key slots in the TPM chip is released; according to the key loading command, the first key is loaded on the first key slot.
  • the key processing apparatus since the key loading command indicating that the first key is loaded on the trusted platform module TPM chip is acquired, and all key slots in the TPM chip are in a non-idle state, the key processing apparatus The first key slot of all key slots in the TPM chip can be released, and the first key is loaded on the first key slot according to a key loading command. Therefore, it is possible to avoid returning an error code that the space is full when the key is loaded, to ensure the smooth loading of the key, and to reasonably use the memory space resource of the TPM chip.
  • FIG. 1 is a system architecture diagram 1 of a chip based on a TSS 1.2 version according to an embodiment of the present invention
  • FIG. 2 is a system architecture diagram 1 of a chip based on the TSS 2.0 version according to an embodiment of the present invention
  • FIG. 3 is a schematic flowchart 1 of a key processing method according to an embodiment of the present disclosure
  • FIG. 4 is a schematic flowchart 2 of a key processing method according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic flowchart 3 of a key processing method according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic flowchart 4 of a key processing method according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic flowchart 5 of a key processing method according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram 1 of a key processing apparatus according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram 2 of a key processing apparatus according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram 3 of a key processing apparatus according to an embodiment of the present disclosure.
  • FIG. 11 is a second structural diagram of a system based on a TSS 1.2 version of the chip according to an embodiment of the present invention.
  • FIG. 12 is a second structural diagram of a system based on a TSS 2.0 version of the chip according to an embodiment of the present invention.
  • FIG. 13 is a schematic diagram of hardware of a terminal device according to an embodiment of the present invention.
  • TCG TCG also defines TSS (TPM Software Stack), which is a software system that provides access to the TPM interface for upper-layer trusted computing applications.
  • TSS TPM Software Stack
  • FIG. 1 is a system architecture of a chip based on a TSS 1.2 version according to an embodiment of the present invention, Including: Reduced API (Application Program Interface), TDDL (TPM Device Driver Library), TCS (TCG Core Service), TSP (TCG Service Provider) and TSP (TCG Service Provider).
  • the streamlined API provides compatibility services for various applications;
  • TDDL provides a unified driver library function interface for different TPM devices;
  • TCS is responsible for sending TPM commands and receiving TPM command responses in the form of byte streams, and The concurrent queuing of the TPM command invokes basic queuing processing;
  • the TSP is responsible for key management and provides an API interface for the application.
  • TSS 2.0-based chip is a system architecture of a TSS 2.0-based chip according to an embodiment of the present invention, including: a reduced API, a feature API, an enhanced system API, a system API, a TCTI (TPM Command Transmission Interface), and a TAB. (TPM Access Broker, TPM Access Broker) and Resource Manager.
  • the streamlined API provides compatibility services for various applications; the resource manager mainly provides TPM objects (such as keys) and context management; the TAB is used to handle multi-process synchronization of TPM accesses, ensuring that a process invokes a TPM command.
  • TCTI is used to handle all TPM communication modes, such as local TPM, TPM simulator, virtual TPM, remote TPM, etc.
  • system API is used to send TPM commands and receive TPM commands in the form of byte streams.
  • Enhanced system APIs, feature APIs provide a better underlying abstraction for applications.
  • the key processing method provided by the embodiment of the present invention can be applied to the TSS 1.2 shown in FIG. 1 or to the TSS 2.0 shown in FIG. 2.
  • the applicable TSS of the present invention is not limited, and the TSS 1.2 and TSS 2.0 are only limited. Is an example.
  • the TSS can be deployed to the TPM chip or deployed to the terminal device.
  • the deployment form can be in the form of a middleware. If the TSS is deployed to the TPM chip, the processor of the TPM chip performs a key processing method based on the TSS. If the TSS is deployed to the terminal device, the processor of the terminal device performs a key processing method based on the TSS.
  • the terminal device described in this embodiment of the present invention may be a wireless terminal or a wired terminal, and the wireless terminal may be a device that provides voice and/or data connectivity to the user, a handheld device with wireless connection function, or a connection. Other processing devices to the wireless modem.
  • the wireless terminal can communicate with one or more core networks via a radio access network (eg, RAN, radio access network), which can be a mobile terminal, such as a mobile phone (or "cellular" phone) and with a mobile terminal
  • RAN radio access network
  • the computers for example, can be portable, pocket-sized, handheld, computer-integrated or in-vehicle mobile devices that exchange language and/or data with the wireless access network.
  • a wireless terminal may also be referred to as a system, a subscriber unit, a subscriber station, a mobile station, a mobile, a remote station, an access point, A remote terminal, an access terminal, a user terminal, a user agent, a user device, or a user equipment.
  • the embodiment of the invention provides a key processing method, as shown in FIG. 3 .
  • the method includes:
  • the TSS acquires a key load command.
  • the key load command indicates that the first key is loaded on the trusted platform module TPM chip.
  • the key processing method provided by the embodiment of the present invention is implemented on the TSS software layer.
  • the TSS is deployed in a key processing device, where the key processing device may be a TPM chip. It may be in a terminal device, and the present invention is not limited thereto.
  • the commands that the TPM chip mentioned in the embodiment of the present invention can process are generally classified into four categories: a key load command, a key release command, a long job command, and a short job command.
  • the key load command refers to a command to load a key in a key slot in an idle state;
  • the key release command refers to a command to release a key in which a key slot is loaded;
  • a long job command and a short job command are both Refers to the command that the application calls the key loaded in the key slot.
  • the case where the TPM chip acquires other types of commands, such as a key release command, a long job command, or a short job command will be described in detail in the following embodiments, and details are not described herein again.
  • the TSS releases the first key slot in all the key slots in the TPM chip.
  • the TSS releases the first key slot in the TPM chip.
  • the specific implementation may be: the TSS instructs the TPM chip to release the first key slot.
  • the method for the TSS to confirm whether all the key slots in the TPM chip are in the non-idle state may be: the TSS confirms the mapping relationship between all the key slots and the keys in the TPM chip. If all the key slots in the TPM chip respectively map different keys, all the key slots in the TPM chip are in a non-idle state; if at least one key slot in the TPM chip does not have any key If there is a mapping relationship, it indicates that the key slot in the TPM chip that is not mapped to any one of the keys is in an idle state.
  • At least one of the key slots in the TPM chip is in an idle state, it indicates that the at least one key slot is an idle key slot, and at this time, any idle key is directly inserted.
  • the first key can be loaded on the slot; if all the key slots in the TPM chip are in a non-idle state, it indicates that all the key slots in the TPM chip are occupied. At this time, the TSS needs to release the TPM chip. The first key slot inside.
  • the first key slot may be any one of all key slots in the TPM chip.
  • the key occupying the first key slot is the key that is used the least in the key occupying all the key slots, or the key occupying the first key slot is occupied by all the keys. The earliest key loaded in the slot's key.
  • the TSS loads the first key on the first key slot according to the key loading command.
  • the TSS loads the first key on the first key slot.
  • the specific implementation may be: the TSS instructs the TPM chip to load the first key on the first key slot.
  • the process of loading the first key on the first key slot by the TSS according to the key loading command may include: the TSS acquiring the parent key of the first key according to the first key, where the first key is The parent key of the key refers to the parent key of the first key; if the parent key of the first key is SRK (Storage Root Key), the TSS decrypts the key data using SRK. Decrypting the plaintext of the first key, and loading the first key on the first key slot to generate a first key handle. It should be noted that if the parent key of the first key is not SRK, the TSS continues to acquire the grandparent key of the first key, where the grandparent key of the first key refers to the parent key of the first key.
  • SRK Storage Root Key
  • the key of the key is up to the SRK; if the parent key of the first key is SRK, this embodiment first uses SRK to obtain the plaintext of the parent key of the first key, and inserts the key in the idle key. Loading the parent key of the first key on the slot, decrypting the key data using the parent key of the first key, decrypting the plaintext of the first key, and loading the first key in the first key On the slot, a first key handle is generated. So that the application can accept the execution of encryption, signature, and verification according to the first key handle. Or HMAC (Hash Message Authentication Code) calculation and other operations.
  • HMAC Hash Message Authentication Code
  • the complete process of the key processing method provided by the embodiment of the present invention includes:
  • the TSS determines whether the number of key slots in the idle state in the TPM chip is greater than or equal to a preset threshold.
  • the TSS may first accept at least one command issued by at least one application at the same time, then the execution order of the at least one command needs to be defined.
  • an application can issue a command and can issue multiple commands, and the present invention is not limited.
  • the TSS can classify the received at least one command according to the type of the command. That is, the TSS classifies the key loading commands into one class, divides the key release commands into one class, divides the long job commands into one class, and divides the short job commands into one class, and the execution of the same type of commands is based on TSS. The timing of receiving commands is determined in succession.
  • the TSS determines whether the number of key slots in the idle state in the TPM chip is greater than or equal to a preset threshold.
  • the preset threshold may be less than or equal to the total number of key slots in the chip. Generally, the preset threshold is smaller than the total number of key slots in the chip. Assuming that there are six key slots in the TPM chip, the preset threshold can be set to 2.
  • the TSS obtains the first command from the received at least one command, where the first command is any one of the at least one command. command.
  • the TSS receives at least one command from the command.
  • the first command is obtained, and the first command is any one of the at least one command.
  • the TSS obtains the first command from the received at least one command, where the first command is the command with the highest priority among the at least one command. .
  • the TSS obtains the first command from the received at least one command, the first command is The command with the highest priority among one less command can ensure that the command with higher priority can be executed first.
  • the priority of the four types of commands that the TSS can handle from high to low are: key release command, short job command, long job command, and key load command.
  • the TSS is executed sequentially when processing the command. Therefore, the first command obtained by the TSS from at least one received command is a separate command. After executing the first command, the TSS may return to perform step S202 or step S203 until all the received commands are executed.
  • the TSS determines whether the first command is a key load command.
  • the key loading command indicates that the first key is loaded on the TPM chip.
  • the TSS determines whether the first key is already loaded.
  • the TSS acquires the status of all key slots in the TPM chip.
  • the TSS needs to obtain the status of all the key slots in the TPM chip, and determine whether all the key slots in the TPM chip are in a non-idle state.
  • the method for the TSS to confirm whether all the key slots in the TPM chip are in the non-idle state may be: the TSS confirms the mapping relationship between all the key slots and the keys in the TPM chip. If at least one key slot in the TPM chip is in an idle state, it indicates that there is at least one free key slot in the TPM chip, and the first key can be directly loaded on any of the free key slots. .
  • the TSS releases the first key slot in all the key slots in the chip.
  • step S207 may include S207a and S207b:
  • the TSS acquires the first key slot.
  • the obtaining, by the TSS, the first key slot is that the TSS obtains the first key slot that meets the preset condition, where the first key slot that meets the preset condition is: occupying the first key slot.
  • the key is the key that is the least used of the keys occupying all the key slots, or the key occupying the first key slot is the earliest loaded key among the keys occupying all the key slots.
  • TSS is indicating the TPM chip. Release the first key slot.
  • step S207c the method further includes step S207c:
  • TSS saves the live record of the key occupying the first key slot.
  • the memory connected to the TPM chip or the internal memory of the TPM chip can save the live record of the key, wherein the live record of the key refers to the key loading.
  • the required file, status and other information to ensure that the key record of the key can be quickly read from the memory when the key is loaded next time, and the key is restored.
  • the TSS needs to save a live record of the key occupying the first key slot.
  • the TSS loads the first key on the first key slot. Specifically, the TSS is to instruct the TPM chip to load the first key on the first key slot.
  • step S208 may include S208a and S208b:
  • S208a and TSS determine whether the live record of the first key is stored in the memory.
  • the TSS When loading the first key on the first key slot, the TSS first determines whether the live record of the first key is stored in the memory. If the live record of the first key is not stored in the memory, the TSS is first. The first key is loaded on the key slot.
  • the TSS acquires and restores the live record of the first key.
  • the TSS acquires and restores the live record of the first key to implement a fast load key.
  • the TSS records the first information in the key loading record.
  • the first information includes at least a mapping relationship between the first key slot and the first key.
  • the state of all key slots in the TPM chip at the current time is recorded in the key loading record in real time.
  • the TSS After the TSS loads the first key on the first key slot, the TSS records the first information in the key loading record, and the first information includes at least a mapping relationship between the first key slot and the first key.
  • the TSS determines whether the first command is a key release command.
  • Step S210 is a step parallel to step S205.
  • the key release command is used to trigger the chip to release the second key, and the second key is a key that occupies the second key slot in the chip.
  • the TSS releases the second key on the second key slot.
  • the TSS deletes the second information in the key loading record.
  • the second information includes at least a mapping relationship between the second key slot and the second key.
  • the state of all key slots in the TPM chip at the current time is recorded in the key loading record in real time.
  • the TSS deletes the second information in the key loading record, and the second information includes at least a mapping relationship between the second key slot and the second key.
  • the first command is neither a key load command nor a key release command
  • the first command is a long job command or a short job command, which is used due to a long job command or a short job command request. It must be the key already loaded in the key slot, so it is only necessary to record the number of times the key used for the long job command or the short job command request is used in the key load record.
  • the embodiment of the present invention provides a key processing method.
  • the key loading command indicates that the first key is loaded on the trusted platform module TPM chip by acquiring a key loading command; if all the key slots in the TPM chip are in a non- In the idle state, the first key slot in all the key slots in the TPM chip is released; according to the key loading command, the first key is loaded on the first key slot.
  • the key processing apparatus since the key loading command indicating that the first key is loaded on the trusted platform module TPM chip is acquired, and all key slots in the TPM chip are in a non-idle state, the key processing apparatus The first key slot of all key slots in the TPM chip can be released, and the first key is loaded on the first key slot according to a key loading command. Therefore, it is possible to avoid returning an error code that the space is full when the key is loaded, to ensure the smooth loading of the key, and to reasonably use the memory space resource of the TPM chip.
  • the embodiment of the present invention provides a key processing apparatus.
  • the key processing apparatus is configured to execute the steps performed by the key processing apparatus in the above method.
  • the key processing means may comprise modules corresponding to the respective steps.
  • the key processing apparatus may include an acquisition module 10, a confirmation module 11, a release module 12, and a load module 13.
  • the obtaining module 10 is configured to obtain a key loading command, and the key loading command indicates the trusted platform module
  • the block TPM chip loads the first key.
  • the confirmation module 11 is configured to confirm that all the key slots in the TPM chip are in a non-idle state after the obtaining module 10 obtains the key loading command.
  • the release module 12 is configured to release the first key slot in the TPM chip that meets the preset condition after the confirmation module 11 confirms that all the key slots in the TPM chip are in a non-idle state.
  • the loading module 13 is configured to load the first key on the first key slot according to the key loading command after the release module 12 releases the first key slot in all the key slots in the TPM chip. .
  • the confirmation module 11 is further configured to confirm a mapping relationship between all key slots and keys in the TPM chip before the release module 12 releases the first key slot.
  • the releasing module 12 is configured to obtain an identifier of the first key slot, where the key occupying the first key slot is the key that is used the least in the key occupying all the key slots. Or, the key occupying the first key slot is the earliest loaded key among the keys occupying all the key slots; and the TPM chip is instructed to release the first key insertion according to the identifier of the first key slot. groove.
  • the key processing apparatus further includes a saving module 14.
  • the saving module 14 is configured to save the live record of the key occupying the first key slot before the release module 12 releases the first key slot.
  • the loading module 13 is configured to: when the loading module 13 loads the first key on the first slot, confirm that the first record of the first key is stored in the memory, and obtain and restore the first key. On-site record.
  • the key processing apparatus further includes a recording module 15.
  • the recording module 15 is configured to: when the loading module 13 loads the first key on the first key slot, record a mapping relationship between the first key slot and the first key, so as to be from the first key according to the mapping relationship The slot gets the first key.
  • the obtaining module 10 is further configured to obtain a key release command, where the key release command is used to trigger the key processing device to release the second key occupying the second key slot in the TPM chip.
  • the release module 12 is further configured to release the second key on the second key slot after the obtaining module 10 obtains the key release command.
  • the recording module 15 is further configured to: after the release module 12 releases the second key on the second key slot, delete the second information in the key loading record, where the second information includes at least the second key slot and the second The mapping relationship between the two keys.
  • the confirmation module 11 is further configured to: before the obtaining module 10 obtains the key loading command or Before obtaining the key release command, confirm that the number of key slots in the idle state of the TPM chip is greater than or equal to a preset threshold.
  • the obtaining module 10 is further configured to: after the confirmation module 11 confirms that the number of key slots in the idle state in the TPM chip is greater than or equal to a preset threshold, acquiring the first command from the received at least one command, the first command For any one of the at least one command, the first command includes a key load command or a key release command.
  • the confirmation module 11 is further configured to confirm that the number of key slots in the idle state of the TPM chip is less than a preset threshold before the obtaining module 10 obtains the key loading command or before obtaining the key release command.
  • the obtaining module 10 is further configured to: after the confirmation module 11 confirms that the number of key slots in the idle state in the TPM chip is less than a preset threshold, obtain the first command from the received at least one command, where the first command is at least The highest priority command in a command.
  • the first command includes a key load command or a key release command.
  • the key processing apparatus of the present embodiment may correspond to the key processing apparatus in the key processing method of the embodiment of any of the above-described ones of FIG. 3 to FIG. 7, and the key processing apparatus of the present embodiment
  • the division and/or function of each module in the process is to implement the method flow shown in any one of FIG. 3 to FIG. 7.
  • no further details are provided herein.
  • the TSS is deployed in the key processing apparatus.
  • the system architecture of the chip based on the TSS 1.2 version may specifically include: four layers of the reduced API, TDDL, TCS, and TSP.
  • the TSP layer may include a parent key load release module and a parent key storage module, and the parent key load release module and the parent key storage module correspond to the load module 13 in the key processing device; the TCS layer may include multiple levels.
  • the queue scheduling module, the key loading release module, the field record storage module, the key loading record module, the field record storage module stores the live record
  • the key load record module stores the key load record
  • the multi-level queue scheduling module corresponds
  • the key load release module corresponds to the load module 13 in the key processing device
  • the live record storage module corresponds to the save module 14 in the key processing device
  • the key is loaded.
  • the recording module corresponds to the recording module 15 in the above key processing apparatus.
  • the system architecture of the TSS 2.0-based chip may specifically include: a reduced API, a feature API, an enhanced system API, a system API, a TCTI, a TAB, and a resource manager.
  • the feature API may include a parent key load release module and a parent key storage module, and the parent key load release module and the parent key storage module correspond to the device in the key processing device.
  • the resource manager may include a multi-level queue scheduling module, a key loading release module, a field record storage module, and a key loading record module.
  • the live record storage module stores the live record, and the key load record module stores the same.
  • the multi-level queue scheduling module corresponds to the acquisition module 10 in the key processing device
  • the key load release module corresponds to the load module 13 in the key processing device
  • the live record storage module corresponds to the key
  • the key load record module corresponds to the record module 15 in the above key processing device.
  • An embodiment of the present invention provides a key processing apparatus, including an obtaining module, a confirming module, a releasing module, and a loading module.
  • the acquiring module is configured to acquire a key loading command, and the key loading command indicates that the trusted platform module TPM chip is loaded.
  • a key a confirmation module, configured to confirm that all key slots in the TPM chip are in a non-idle state after the obtaining module obtains a key loading command; and release the module for all key slots in the TPM chip The first key slot in all the key slots in the TPM chip is released in the non-idle state; the loading module is configured to release the first key slot in all the key slots in the TPM chip in the release module.
  • the first key is loaded on the first key slot according to the key load command.
  • the key processing apparatus since the key loading command indicating that the first key is loaded on the trusted platform module TPM chip is acquired, and all key slots in the TPM chip are in a non-idle state, the key processing apparatus The first key slot of all key slots in the TPM chip can be released, and the first key is loaded on the first key slot according to a key loading command. Therefore, it is possible to avoid returning an error code that the space is full when the key is loaded, to ensure the smooth loading of the key, and to reasonably use the memory space resource of the TPM chip.
  • the embodiment of the present invention further provides a terminal device.
  • the terminal device includes: a memory 20, a processor 21, a communication interface 22, and a system bus 23.
  • the memory 20, the processor 21 and the communication interface 22 are connected by a system bus 23 for storing some computer instructions, and the processor 21 is configured to execute computer instructions to enable the terminal device to perform the compactness of any one of FIGS. Key processing method.
  • a specific key processing method refer to the related description in the foregoing embodiment shown in any one of FIG. 3 to FIG. 7, and details are not described herein again.
  • the processor 21 may be the key processing apparatus described in the embodiment shown in any one of FIG. 8 to FIG. 10, or may be described in the embodiment including any one of FIG. 8 to FIG. Other hardware structures of the key processing apparatus that are capable of implementing processor functions.
  • the processor 21 can be a central processing unit (CPU).
  • the processor 21 can also be other general purpose processors, digital signal processors (digital signal Processing, DSP), application specific integrated circuit (ASIC), field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, and the like.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field-programmable gate array
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the processor 21 may be a dedicated processor, which may include at least one of a baseband processing chip, a radio frequency processing chip, and the like. Further, the dedicated processor may also include a chip having other dedicated processing functions of the terminal device.
  • the memory 20 may include a volatile memory such as a random-access memory (RAM); the memory 20 may also include a non-volatile memory such as a read-only memory (read) -only memory, ROM), flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 20 may also include a combination of the above types of memories.
  • RAM random-access memory
  • ROM read-only memory
  • HDD hard disk drive
  • SSD solid-state drive
  • the system bus 23 can include a data bus, a power bus, a control bus, and a signal status bus. For the sake of clarity in the present embodiment, various buses are illustrated as the system bus 23 in FIG.
  • Communication interface 22 may include a receiver and a transmitter. And in a specific implementation of the terminal device, the receiver and the transmitter may specifically be transceivers on the terminal device.
  • the transceiver can be a wireless transceiver.
  • each step in the method flow shown in any one of the foregoing FIG. 3 to FIG. 7 can be implemented by hardware execution of a computer-executed instruction in a software form. To avoid repetition, we will not repeat them here.
  • the embodiment of the invention provides a terminal device. Based on the description of the above embodiment, since the key loading command indicating that the first key is loaded on the trusted platform module TPM chip is acquired, and all key slots in the TPM chip are in a non-idle state, the key processing apparatus The first key slot of all key slots in the TPM chip can be released, and the first key is loaded on the first key slot according to a key loading command. Therefore, it is possible to avoid returning an error code that the space is full when the key is loaded, to ensure the smooth loading of the key, and to reasonably use the memory space resource of the TPM chip.
  • the embodiment of the invention further provides a software product, which may include implementing key processing Method of computer instructions.
  • the computer instructions can be stored on a readable storage medium; the processor can read and execute the computer instructions from the readable storage medium such that the processor implements the key processing method.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of modules or units is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • An integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, can be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program codes. quality.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Technology Law (AREA)
  • Multimedia (AREA)
  • Remote Sensing (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Storage Device Security (AREA)
  • Telephone Function (AREA)

Abstract

本发明实施例提供一种密钥处理方法及装置,涉及通信领域,能够避免在密钥装载时返回空间已满的错误码,保证密钥装载的顺利进行。该密钥处理方法包括:获取密钥装载命令,密钥装载命令指示在可信平台模块TPM芯片装载第一密钥;若TPM芯片内的所有密钥插槽均处于非空闲状态,则释放TPM芯片内所有密钥插槽中的第一密钥插槽;根据密钥装载命令,在第一密钥插槽上装载第一密钥。

Description

一种密钥处理方法及装置 技术领域
本发明涉及通信领域,尤其涉及一种密钥处理方法及装置。
背景技术
在通信系统中,为了保证数据的安全,终端设备(Terminal Device)通常需要使用密钥对数据进行加密,这些密钥一旦泄露,与其相关的被加密数据的机密性将受到严重影响。因此必须提供安全保护机制,防止密钥以明文的形式保存在系统或代码中。TPM(Trusted Platform Module,可信平台模块)是常用的一种密钥保护方案,通过集成密钥和加解密运算引擎,能够提供基于硬件的敏感信息安全存储功能。TPM芯片是一种符合TPM标准的芯片,其中,TPM标准是由TCG(Trusted Computing Group,可信计算组织)提出的,该标准通过在计算机系统中嵌入一个包含密钥生成、加解密计算、安全存储和防篡改功能的芯片,使非法用户无法对其内部的数据进行访问更改,从而确保了数据加密的安全性。
现有技术中,通常一个TPM芯片内具有5至10个密钥插槽,密钥只有装载在密钥插槽内,才能被应用程序调用。若TPM芯片的密钥插槽已被占满,且仍有应用程序试图进行密钥装载时,TPM芯片就会返回空间已满的错误码。
发明内容
本发明实施例提供一种密钥处理方法及装置,能够避免在密钥装载时返回空间已满的错误码,保证密钥装载的顺利进行。
为达到上述目的,本发明的实施例采用如下技术方案:
第一方面,本发明实施例提供一种密钥处理方法,包括:
首先,获取密钥装载命令,密钥装载命令指示在可信平台模块TPM芯片装载第一密钥;其次,判断TPM芯片内的所有密钥插槽是否均处于非空闲状态,若TPM芯片内的所有密钥插槽均处于非空闲状态,则释放TPM芯 片内所有密钥插槽中的第一密钥插槽;最后,根据密钥装载命令,在第一密钥插槽上装载第一密钥。
本发明实施例提供的密钥处理方法中,由于在获取指示在可信平台模块TPM芯片装载第一密钥的密钥装载命令,且TPM芯片内的所有密钥插槽均处于非空闲状态时,密钥处理装置能够释放所述TPM芯片内所有密钥插槽中的第一密钥插槽,并根据密钥装载命令,在所述第一密钥插槽上装载所述第一密钥。因此,能够避免在密钥装载时返回空间已满的错误码,保证密钥装载的顺利进行,合理地使用TPM芯片内存空间资源。
可选的,所述方法还包括:
在释放所述第一密钥插槽前,确认TPM芯片内的所有密钥插槽与密钥的映射关系。
可选的,释放TPM芯片内所有密钥插槽中的第一密钥插槽,具体包括:
获取第一密钥插槽的标识,其中,占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中使用次数最少的密钥,或者,占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中最早装载的密钥;以及根据第一密钥插槽的标识,指示TPM芯片释放第一密钥插槽。
本发明实施例提供的密钥处理方法中,占用所述第一密钥插槽的密钥为占用所有密钥插槽的密钥中使用次数最少的密钥,或者,占用所述第一密钥插槽的密钥为占用所有密钥插槽的密钥中最早装载的密钥。通过合理的方式选择第一密钥插槽,尽可能地保证在装载第一密钥时其他密钥插槽不受影响。
可选的,所述方法还包括:
在释放第一密钥插槽前,保存占用第一密钥插槽的密钥的现场记录。
本发明实施例提供的密钥处理方法中,在释放第一密钥插槽前,保存占用第一密钥插槽的密钥的现场记录,以使得下次再装载该密钥时,能够直接恢复该密钥的现场记录,实现密钥的快速装载。
可选的,所述方法还包括:
在第一插槽上装载第一密钥时,确认存储器中存储有第一密钥的现场记录,获取并恢复第一密钥的现场记录。
本发明实施例提供的密钥处理方法中,在第一插槽上装载第一密钥时,若存储器中存储有第一密钥的现场记录,也可以直接恢复第一密钥的现场记录,实现密钥的快速装载。
可选的,所述方法还包括:
在第一密钥插槽上装载第一密钥时,记录第一密钥插槽与第一密钥的映射关系,以便根据映射关系从第一密钥插槽获取到第一密钥。
可选的,所述方法还包括:
获取密钥释放命令,密钥释放命令用于触发TPM芯片释放占用TPM芯片内的第二密钥插槽的第二密钥;
根据密钥释放命令,在第二密钥插槽上释放第二密钥;
在第二密钥插槽上释放第二密钥时,删除第二密钥插槽与第二密钥的映射关系。
在第一种可能的实现方式中,在获取密钥装载命令前,所述方法还包括:
判断TPM芯片内处于空闲状态的密钥插槽的个数是否大于或等于预设门限;若TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限,则从接收到的至少一个命令中获取第一命令,第一命令为至少一个命令中的任意一个命令,第一命令包括密钥装载命令。
在第二种可能的实现方式中,在获取密钥装载命令前,所述方法还包括:
判断TPM芯片内处于空闲状态的密钥插槽的个数是否小于预设门限;若TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限,则从接收到的至少一个命令中获取第一命令,第一命令为所述至少一个命令中优先级最高的命令,第一命令包括密钥装载命令。
本发明实施例提供的密钥处理方法中,通过判断芯片内处于空闲状态的密钥插槽的个数是否大于或者等于预设门限,并在所述芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限时,从接收到的至少一个命令中获取第一命令,所述第一命令为所述至少一个命令中的任意一个命令;在所述芯片内处于空闲状态的密钥插槽的个数小于预设门限时,从接收到的至少一个命令中获取第一命令,所述第一命令为所述至少一个命令中优先级最高的命令,保证合理地利用TPM芯片内的密钥插槽。
第二方面,本发明实施例提供一种密钥处理装置,密钥处理装置包括获取模块、确认模块、释放模块和装载模块;
获取模块,用于获取密钥装载命令,密钥装载命令指示在可信平台模块TPM芯片装载第一密钥;
确认模块,用于在获取模块获取密钥装载命令后,确认TPM芯片内的 所有密钥插槽均处于非空闲状态;
释放模块,用于若TPM芯片内的所有密钥插槽均处于非空闲状态,则释放TPM芯片内所有密钥插槽中的第一密钥插槽;
装载模块,用于在释放模块释放TPM芯片内所有密钥插槽中的第一密钥插槽后,根据密钥装载命令,在第一密钥插槽上装载第一密钥。
本发明实施例提供的密钥处理装置的技术效果可以参见上述第一方面密钥处理装置执行的密钥处理方法中描述的密钥处理装置的技术效果,此处不再赘述。
可选的,确认模块,还用于在释放模块释放第一密钥插槽前,确认TPM芯片内的所有密钥插槽与密钥的映射关系。
可选的,释放模块,具体用于获取第一密钥插槽的标识,其中,占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中使用次数最少的密钥,或者,占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中最早装载的密钥;以及根据第一密钥插槽的标识,指示TPM芯片释放第一密钥插槽。
可选的,密钥处理装置还包括保存模块;
保存模块,用于在释放模块释放第一密钥插槽前,保存占用第一密钥插槽的密钥的现场记录。
可选的,装载模块,具体用于在装载模块在第一插槽上装载第一密钥时,确认存储器中存储有第一密钥的现场记录,获取并恢复第一密钥的现场记录。
可选的,密钥处理装置还包括记录模块;
记录模块,用于在装载模块在第一密钥插槽上装载第一密钥时,记录第一密钥插槽与第一密钥的映射关系,以便根据映射关系从第一密钥插槽获取到第一密钥。
可选的,获取模块,还用于获取密钥释放命令,密钥释放命令用于触发TPM芯片释放占用TPM芯片内的第二密钥插槽的第二密钥;
所述释放模块,还用于在所述获取模块获取密钥释放命令后,根据密钥释放命令,在第二密钥插槽上释放第二密钥;
所述记录模块,还用于在所述释放模块在第二密钥插槽上释放第二密钥时,删除第二密钥插槽与第二密钥的映射关系。
可选的,确认模块,还用于在获取模块获取密钥装载命令前,确认TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限;
获取模块,还用于在确认模块确认TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限后,从接收到的至少一个命令中获取第一命令,第一命令为至少一个命令中的任意一个命令,第一命令包括密钥装载命令。
可选的,确认模块,还用于在获取模块获取密钥装载命令前,确认TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限;
获取模块,还用于在确认模块确认TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限后,从接收到的至少一个命令中获取第一命令,第一命令为至少一个命令中优先级最高的命令,第一命令包括密钥装载命令。
第三方面,本发明实施例还提供一种终端设备,所述终端设备包括存储器、处理器、通信接口和系统总线;
所述存储器、所述处理器和所述通信接口通过所述系统总线连接,所述存储器用于存储计算机指令,所述处理器用于执行所述存储器存储的计算机指令,以使所述终端设备执行如上述第一方面所述的密钥处理方法。
本发明实施例提供的终端设备的技术效果可以参见上述第一方面密钥处理装置执行的密钥处理方法中描述的密钥处理装置的技术效果,此处不再赘述。
第四方面,本发明实施例还提供一种软件产品,所述软件产品包括实现密钥处理方法的计算机指令。
所述计算机指令可以存储在可读存储介质上;处理器可以从该可读存储介质上读取到计算机指令并执行,使得处理器实现密钥处理方法。
本发明实施例提供一种密钥处理方法及装置,通过获取密钥装载命令,密钥装载命令指示在可信平台模块TPM芯片装载第一密钥;若TPM芯片内的所有密钥插槽均处于非空闲状态,则释放TPM芯片内所有密钥插槽中的第一密钥插槽;根据密钥装载命令,在第一密钥插槽上装载第一密钥。基于上述实施例的描述,由于在获取指示在可信平台模块TPM芯片装载第一密钥的密钥装载命令,且TPM芯片内的所有密钥插槽均处于非空闲状态时,密钥处理装置能够释放所述TPM芯片内所有密钥插槽中的第一密钥插槽,并根据密钥装载命令,在所述第一密钥插槽上装载所述第一密钥。因此,能够避免在密钥装载时返回空间已满的错误码,保证密钥装载的顺利进行,合理地使用TPM芯片内存空间资源。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例。
图1为本发明实施例提供的一种基于TSS 1.2版本的芯片的系统架构图一;
图2为本发明实施例提供的一种基于TSS 2.0版本的芯片的系统架构图一;
图3为本发明实施例提供的一种密钥处理方法的流程示意图一;
图4为本发明实施例提供的一种密钥处理方法的流程示意图二;
图5为本发明实施例提供的一种密钥处理方法的流程示意图三;
图6为本发明实施例提供的一种密钥处理方法的流程示意图四;
图7为本发明实施例提供的一种密钥处理方法的流程示意图五;
图8为本发明实施例提供的一种密钥处理装置的结构示意图一;
图9为本发明实施例提供的一种密钥处理装置的结构示意图二;
图10为本发明实施例提供的一种密钥处理装置的结构示意图三;
图11本发明实施例提供的一种基于TSS 1.2版本的芯片的系统架构图二;
图12为本发明实施例提供的一种基于TSS 2.0版本的芯片的系统架构图二;
图13为本发明实施例提供的一种终端设备的硬件示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行详细地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。
本发明实施例中描述的技术可以用于各种芯片,尤其是TPM芯片。TCG除了提出TPM标准外,还定义了TSS(TPM Software Stack,TPM软件栈),其中,TSS是一种为上层可信计算应用提供访问TPM接口的软件系统。
图1是本发明实施例提供的一种基于TSS 1.2版本的芯片的系统架构, 包括:精简API(Application Program Interface,应用编程接口)、TDDL(TPM Device Driver Library,TPM设备驱动库)、TCS(TCG Core Service,核心服务)和TSP(TCG Service Provider,服务提供者)四层。其中,精简API为各种应用程序提供兼容性服务;TDDL为不同的TPM设备提供一个统一的驱动程序库函数接口;TCS负责将以字节流的形式发送TPM命令和接收TPM命令响应,并为TPM命令的并发调用基本的排队处理;TSP负责密钥管理和为应用程序提供API接口。
图2是本发明实施例提供的一种基于TSS 2.0版本的芯片的系统架构,包括:精简API、特征API、增强系统API、系统API、TCTI(TPM Command Transmission Interface,TPM命令传输接口)、TAB(TPM Access Broker,TPM访问代理)和资源管理器。其中,精简API为各种应用程序提供兼容性服务;资源管理器主要提供TPM对象(例如密钥)、上下文的管理;TAB用于处理多进程对TPM访问的同步,保证一个进程调用一个TPM命令时不被其他进程干扰;TCTI用于处理底层所有TPM的通信方式,如本地TPM、TPM模拟器、虚拟TPM、远程TPM等;系统API用于通过字节流的形式发送TPM命令和接收TPM命令;增强系统API、特征API为应用程序提供更好的底层抽象。
本发明实施例提供的密钥处理方法既可以应用于图1所示的TSS 1.2,也可以应用于图2所示的TSS 2.0,本发明可应用的TSS不做限制,TSS 1.2和TSS 2.0仅是示例。
TSS可以部署到TPM芯片,也可以部署到终端设备中,部署形式可以是中间件形式。TSS如果是部署到TPM芯片,由TPM芯片的处理器基于TSS来执行密钥处理方法。TSS如果是部署到终端设备,由终端设备的处理器基于TSS来执行密钥处理方法。
另外,本发明实施例所描述的终端设备,可以是无线终端也可以是有线终端,无线终端可以是指向用户提供语音和/或数据连通性的设备,具有无线连接功能的手持式设备、或连接到无线调制解调器的其他处理设备。无线终端可以经无线接入网(例如,RAN,radio access network)与一个或多个核心网进行通信,无线终端可以是移动终端,如移动电话(或称为“蜂窝”电话)和具有移动终端的计算机,例如,可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置,它们与无线接入网交换语言和/或数据。例 如,个人通信业务(PCS,personal communication service)电话、无绳电话、会话发起协议(SIP)话机、无线本地环路(WLL,wireless local loop)站、个人数字助理(PDA,personal digital assistant)等设备。无线终端也可以称为系统、订户单元(subscriber unit)、订户站(subscriber station),移动站(mobile station)、移动台(mobile)、远程站(remote station)、接入点(access point)、远程终端(remote terminal)、接入终端(access terminal)、用户终端(user terminal)、用户代理(user agent)、用户设备(user device)、或用户装备(user equipment)。
还需要说明的是,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
本发明实施例提供一种密钥处理方法,如图3所示,具体的,该方法包括:
S101、TSS获取密钥装载命令。
其中,密钥装载命令指示在可信平台模块TPM芯片装载第一密钥。
需要说明的是,本发明实施例所提供的密钥处理方法的是在TSS软件层面上实现的,具体的,TSS部署在密钥处理装置中,其中,密钥处理装置可以是TPM芯片,也可以是终端设备中,本发明对此并不做限制。
本发明实施例所提到的TPM芯片可以处理的命令通常分为四类:密钥装载命令、密钥释放命令、长作业命令和短作业命令。其中,密钥装载命令是指在空闲状态的密钥插槽内装载密钥的命令;密钥释放命令是指释放密钥插槽被装载的密钥的命令;长作业命令和短作业命令均是指应用程序调用密钥插槽内装载的密钥的命令。TPM芯片获取其他类型的命令(如密钥释放命令、长作业命令或者短作业命令)的情况将在下述实施例中进行详细描述,此处不再赘述。
S102、若TPM芯片内的所有密钥插槽均处于非空闲状态,则TSS释放TPM芯片内所有密钥插槽中的第一密钥插槽。
TSS释放TPM芯片内的第一密钥插槽,具体实现可以是:TSS指示所述TPM芯片释放第一密钥插槽。
TSS获取密钥装载命令后,首先需要确认TPM芯片内的所有密钥插槽是否均处于非空闲状态。具体的,TSS确认TPM芯片内的所有密钥插槽是否均处于非空闲状态的方法可以为:TSS确认TPM芯片内的所有密钥插槽与密钥的映射关系。若TPM芯片内的所有密钥插槽各自映射不同密钥,则说明TPM芯片内的所有密钥插槽均处于非空闲状态;若TPM芯片内的至少一个密钥插槽没有与任何一个密钥存在映射关系,则说明TPM芯片内的没有与任何一个密钥存在映射关系的密钥插槽处于空闲状态。
若TPM芯片内的所有密钥插槽中有至少一个密钥插槽处于空闲状态,则表明该至少一个密钥插槽为空闲的密钥插槽,此时直接在任意一个空闲的密钥插槽上装载第一密钥即可;若TPM芯片内的所有密钥插槽均处于非空闲状态,则表明TPM芯片内所有的密钥插槽均被占满,此时,TSS需要释放TPM芯片内的第一密钥插槽。
需要说明的是,第一密钥插槽可以是TPM芯片内所有密钥插槽中的任意一个密钥插槽。优选的,占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中使用次数最少的密钥,或者,占用所述第一密钥插槽的密钥为占用所有密钥插槽的密钥中最早装载的密钥。
S103、TSS根据密钥装载命令,在第一密钥插槽上装载第一密钥。
TSS在所述第一密钥插槽上装载所述第一密钥,具体实现可以是:TSS指示所述TPM芯片在所述第一密钥插槽上装载所述第一密钥。
具体的,TSS根据密钥装载命令,在第一密钥插槽上装载第一密钥的过程可以包括:TSS根据第一密钥,获取第一密钥的父密钥,其中,第一密钥的父密钥是指第一密钥的上一级密钥;若第一密钥的父密钥为SRK(Storage Root Key,存储根密钥),则TSS使用SRK对密钥数据进行解密,解密得到第一密钥的明文,再将第一密钥装载在第一密钥插槽上,生成第一密钥句柄。需要说明的是,若第一密钥的父密钥不为SRK,则TSS继续获取第一密钥的祖父密钥,其中,第一密钥的祖父密钥是指第一密钥的父密钥的上一级密钥,直到获取到SRK为止;假设第一密钥的父密钥为SRK,本实施例首先使用SRK获得第一密钥的父密钥的明文,在空闲的密钥插槽上装载第一密钥的父密钥,并使用第一密钥的父密钥对密钥数据进行解密,解密得到第一密钥的明文,再将第一密钥装载在第一密钥插槽上,生成第一密钥句柄。从而使得应用程序能够根据第一密钥句柄,调用接受执行加密、签名、验证 或者HMAC(Hash Message Authentication Code,哈希消息认证码)计算等操作。
具体的,如图4所示,本发明实施例提供的密钥处理方法的完整流程包括:
S201、TSS判断TPM芯片内处于空闲状态的密钥插槽的个数是否大于或等于预设门限。
可以理解的是,在步骤S201执行之前,TSS首先在同一时间可能会接受到至少一个应用程序发出的至少一个命令,那么,需要对至少一个命令的执行顺序做出定义。其中,一个应用程序能够发出一个命令,也能够发出多个命令,本发明不做限制。
可选的,TSS能够对接收到的至少一条命令按照命令类型进行分类。即TSS将密钥装载命令分为一类,将密钥释放命令分为一类,将长作业命令分为一类,以及将短作业命令分为一类,同一类型的命令的执行先后根据TSS接收命令的时间先后决定。
TSS判断TPM芯片内处于空闲状态的密钥插槽的个数是否大于或等于预设门限。其中,预设门限可以小于或等于芯片内密钥插槽的总个数。通常的,预设门限小于芯片内密钥插槽的总个数,假设TPM芯片内具有6个密钥插槽,可以设置预设门限为2。
S202、若TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限,则TSS从接收到的至少一个命令中获取第一命令,第一命令为至少一个命令中的任意一个命令。
若TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限,则说明TPM芯片内处于空闲状态的密钥插槽还有很多,此时TSS从接收到的至少一个命令中获取第一命令,第一命令为至少一个命令中的任意一个命令。
S203、若TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限,则TSS从接收到的至少一个命令中获取第一命令,第一命令为至少一个命令中优先级最高的命令。
若TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限,则说明TPM芯片内处于空闲状态的密钥插槽很少,甚至可能没有处于空闲状态的密钥插槽,此时TSS从接收到的至少一个命令中获取第一命令,第一命令为至 少一个命令中优先级最高的命令,如此能够保证优先级高的命令能够优先执行。
通常的,TSS可以处理的四类命令的优先级从高到低依次为:密钥释放命令、短作业命令、长作业命令,以及密钥装载命令。
需要说明的是,TSS在处理命令时是依次执行的,因此,TSS每次从接收到的至少一个命令中获取的第一命令都是一个单独的命令。在执行完第一命令后,TSS可以返回执行步骤S202或步骤S203,直至接收到的所有命令执行完毕。
S204、TSS判断第一命令是否为密钥装载命令。
其中,密钥装载命令指示在TPM芯片装载第一密钥。
S205、若第一命令为密钥装载命令,则TSS判断第一密钥是否已经装载。
若第一密钥已经装载,则无需再装载第一密钥,下述步骤无须执行。
S206、若第一密钥未装载,则TSS获取TPM芯片内的所有密钥插槽的状态。
若第一密钥未装载,则TSS需要获取TPM芯片内的所有密钥插槽的状态,判断TPM芯片内的所有密钥插槽是否均处于非空闲状态。具体的,TSS确认TPM芯片内的所有密钥插槽是否均处于非空闲状态的方法可以为:TSS确认TPM芯片内的所有密钥插槽与密钥的映射关系。若TPM芯片内的至少一个密钥插槽处于空闲状态,则表明TPM芯片内至少有一个空闲的密钥插槽,此时直接在任意一个空闲的密钥插槽上装载第一密钥即可。
S207、若TPM芯片内的所有密钥插槽均处于非空闲状态,则TSS释放芯片内所有密钥插槽中的第一密钥插槽。
具体的,如图5所示,步骤S207可以包括S207a和S207b:
S207a、若TPM芯片内的所有密钥插槽均处于非空闲状态,TSS获取第一密钥插槽。
其中,TSS获取第一密钥插槽是指TSS获取满足预设条件的第一密钥插槽,其中,满足预设条件的第一密钥插槽是指:占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中使用次数最少的密钥,或者,占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中最早装载的密钥。
S207b、TSS释放第一密钥插槽。具体实现是,TSS是指示TPM芯片 释放第一密钥插槽。
可选的,如图6所示,在步骤S207a和步骤S207b之间,方法还包括步骤S207c:
S207c、TSS保存占用第一密钥插槽的密钥的现场记录。
需要说明的是,本发明实施例提供的密钥处理方法中,与TPM芯片连接的存储器或者TPM芯片内部的存储器可以保存密钥的现场记录,其中,密钥的现场记录是指密钥装载时所需的文件、状态等信息,以保证下次装载该密钥时能够快速地从存储器中读取到该密钥的现场记录,恢复密钥。
因此,在TSS释放第一密钥插槽之前,TSS需要保存占用第一密钥插槽的密钥的现场记录。
S208、TSS在第一密钥插槽上装载第一密钥。具体实现是,TSS是指示TPM芯片在第一密钥插槽上装载第一密钥。
具体的,如图7所示,步骤S208可以包括S208a和S208b:
S208a、TSS判断存储器中是否存储有第一密钥的现场记录。
TSS在第一密钥插槽上装载第一密钥时,首先判断存储器中是否存储有第一密钥的现场记录,若存储器中未存储有第一密钥的现场记录,则TSS在第一密钥插槽上装载第一密钥。具体的装载过程已经在上述实施例中进行了详细描述,此处不再赘述。
S208b、若存储器中存储有第一密钥的现场记录,则TSS获取并恢复第一密钥的现场记录。
若存储器中存储有第一密钥的现场记录,则TSS获取并恢复第一密钥的现场记录,实现快速装载密钥。
S209、TSS在密钥装载记录中记录第一信息。
其中,第一信息至少包括第一密钥插槽与第一密钥的映射关系。
需要说明的是,在密钥装载记录中实时记录着当前时刻TPM芯片内所有密钥插槽的状态。当TSS在第一密钥插槽上装载第一密钥后,TSS在密钥装载记录中记录第一信息,第一信息至少包括第一密钥插槽与第一密钥的映射关系。
S210、若第一命令不为密钥装载命令,则TSS判断第一命令是否为密钥释放命令。
步骤S210是与步骤S205并列的步骤。
其中,密钥释放命令用于触发芯片释放第二密钥,第二密钥为占用芯片内的第二密钥插槽的密钥。
S211、若第一命令为密钥释放命令,则TSS在第二密钥插槽上释放第二密钥。
S212、TSS在密钥装载记录中删除第二信息。
其中,第二信息至少包括第二密钥插槽与第二密钥的映射关系。
需要说明的是,在密钥装载记录中实时记录着当前时刻TPM芯片内所有密钥插槽的状态。当TSS在第二密钥插槽上释放第二密钥后,TSS在密钥装载记录中删除第二信息,第二信息至少包括第二密钥插槽与第二密钥的映射关系。
需要补充的是,若第一命令既不为密钥装载命令,也不为密钥释放命令,则说明第一命令为长作业命令或者短作业命令,由于长作业命令或者短作业命令请求使用的一定是密钥插槽中已经装载了的密钥,因此只需在密钥装载记录中对长作业命令或者短作业命令请求使用的密钥的使用次数进行记录即可。
本发明实施例提供一种密钥处理方法,通过获取密钥装载命令,密钥装载命令指示在可信平台模块TPM芯片装载第一密钥;若TPM芯片内的所有密钥插槽均处于非空闲状态,则释放TPM芯片内所有密钥插槽中的第一密钥插槽;根据密钥装载命令,在第一密钥插槽上装载第一密钥。基于上述实施例的描述,由于在获取指示在可信平台模块TPM芯片装载第一密钥的密钥装载命令,且TPM芯片内的所有密钥插槽均处于非空闲状态时,密钥处理装置能够释放所述TPM芯片内所有密钥插槽中的第一密钥插槽,并根据密钥装载命令,在所述第一密钥插槽上装载所述第一密钥。因此,能够避免在密钥装载时返回空间已满的错误码,保证密钥装载的顺利进行,合理地使用TPM芯片内存空间资源。
本发明实施例提供一种密钥处理装置,如图8所示,密钥处理装置用于执行以上方法中的密钥处理装置所执行的步骤。密钥处理装置可以包括相应步骤所对应的模块。示例性的,密钥处理装置可以包括获取模块10、确认模块11、释放模块12和装载模块13。
获取模块10,用于获取密钥装载命令,密钥装载命令指示在可信平台模 块TPM芯片装载第一密钥。
确认模块11,用于在获取模块10获取密钥装载命令后,确认TPM芯片内的所有密钥插槽均处于非空闲状态。
释放模块12,用于在确认模块11确认TPM芯片内的所有密钥插槽均处于非空闲状态后,则释放TPM芯片内满足预设条件的第一密钥插槽。
装载模块13,用于在释放模块12释放TPM芯片内所有密钥插槽中的第一密钥插槽后,根据所述密钥装载命令,在第一密钥插槽上装载第一密钥。
可选的,确认模块11,还用于在释放模块12释放所述第一密钥插槽前,确认TPM芯片内的所有密钥插槽与密钥的映射关系。
可选的,释放模块12,具体用于获取第一密钥插槽的标识,其中,占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中使用次数最少的密钥,或者,占用第一密钥插槽的密钥为占用所有密钥插槽的密钥中最早装载的密钥;以及根据第一密钥插槽的标识,指示TPM芯片释放第一密钥插槽。
可选的,如图9所示,密钥处理装置还包括保存模块14。
保存模块14,用于在释放模块12释放第一密钥插槽前,保存占用第一密钥插槽的密钥的现场记录。
可选的,装载模块13,具体用于在装载模块13在第一插槽上装载所述第一密钥时,确认存储器中存储有第一密钥的现场记录,获取并恢复第一密钥的现场记录。
可选的,如图10所示,密钥处理装置还包括记录模块15。
记录模块15,用于在装载模块13在第一密钥插槽上装载第一密钥时,记录第一密钥插槽与第一密钥的映射关系,以便根据映射关系从第一密钥插槽获取到第一密钥。
可选的,获取模块10,还用于获取密钥释放命令,密钥释放命令用于触发密钥处理装置释放占用TPM芯片内的第二密钥插槽的第二密钥。
释放模块12,还用于在获取模块10获取密钥释放命令后,在第二密钥插槽上释放第二密钥。
记录模块15,还用于在释放模块12在第二密钥插槽上释放第二密钥后,在密钥装载记录中删除第二信息,第二信息至少包括第二密钥插槽与第二密钥的映射关系。
可选的,确认模块11,还用于在获取模块10获取密钥装载命令前或者 获取密钥释放命令前,确认TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限。
获取模块10,还用于在确认模块11确认TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限后,从接收到的至少一个命令中获取第一命令,第一命令为至少一个命令中的任意一个命令,第一命令包括密钥装载命令或者密钥释放命令。
可选的,确认模块11,还用于在获取模块10获取密钥装载命令前或者获取密钥释放命令前,确认TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限。
获取模块10,还用于在确认模块11确认TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限后,从接收到的至少一个命令中获取第一命令,第一命令为至少一个命令中优先级最高的命令,第一命令包括密钥装载命令或者密钥释放命令。
可以理解的是,本实施例的密钥处理装置可对应于上述如图3-图7任意之一的实施例的密钥处理方法中的密钥处理装置,并且本实施例的密钥处理装置中的各个模块的划分和/或功能等均是为了实现如图3-图7任意之一所示的方法流程,为了简洁,在此不再赘述。
示例性的,TSS部署在密钥处理装置中,如图11所示,基于TSS 1.2版本的芯片的系统架构具体可以包括:精简API、TDDL、TCS和TSP四层。其中,TSP层可以包括父密钥装载释放模块和父密钥存储模块,父密钥装载释放模块和父密钥存储模块对应于上述密钥处理装置中的装载模块13;TCS层可以包括多级队列调度模块、密钥装载释放模块、现场记录存储模块、密钥装载记录模块,现场记录存储模块内存储着现场记录,密钥装载记录模块内存储着密钥装载记录,多级队列调度模块对应于上述密钥处理装置中的获取模块10,密钥装载释放模块对应于上述密钥处理装置中的装载模块13,现场记录存储模块对应于上述密钥处理装置中的保存模块14,密钥装载记录模块对应于上述密钥处理装置中的记录模块15。
又示例性的,如图12所示,基于TSS 2.0版本的芯片的系统架构具体可以包括:精简API、特征API、增强系统API、系统API、TCTI、TAB和资源管理器。其中,特征API可以包括父密钥装载释放模块和父密钥存储模块,父密钥装载释放模块和父密钥存储模块对应于上述密钥处理装置中的装 载模块13;资源管理器可以包括多级队列调度模块、密钥装载释放模块、现场记录存储模块、密钥装载记录模块,现场记录存储模块内存储着现场记录,密钥装载记录模块内存储着密钥装载记录,多级队列调度模块对应于上述密钥处理装置中的获取模块10,密钥装载释放模块对应于上述密钥处理装置中的装载模块13,现场记录存储模块对应于上述密钥处理装置中的保存模块14,密钥装载记录模块对应于上述密钥处理装置中的记录模块15。
本发明实施例提供一种密钥处理装置,包括获取模块、确认模块、释放模块和装载模块;获取模块,用于获取密钥装载命令,密钥装载命令指示在可信平台模块TPM芯片装载第一密钥;确认模块,用于在获取模块获取密钥装载命令后,确认TPM芯片内的所有密钥插槽均处于非空闲状态;释放模块,用于若TPM芯片内的所有密钥插槽均处于非空闲状态,则释放TPM芯片内所有密钥插槽中的第一密钥插槽;装载模块,用于在释放模块释放TPM芯片内所有密钥插槽中的第一密钥插槽后,根据密钥装载命令,在第一密钥插槽上装载第一密钥。基于上述实施例的描述,由于在获取指示在可信平台模块TPM芯片装载第一密钥的密钥装载命令,且TPM芯片内的所有密钥插槽均处于非空闲状态时,密钥处理装置能够释放所述TPM芯片内所有密钥插槽中的第一密钥插槽,并根据密钥装载命令,在所述第一密钥插槽上装载所述第一密钥。因此,能够避免在密钥装载时返回空间已满的错误码,保证密钥装载的顺利进行,合理地使用TPM芯片内存空间资源。
本发明实施例还提供一种终端设备,如图13所示,该终端设备包括:存储器20、处理器21、通信接口22和系统总线23。
存储器20、处理器21和通信接口22通过系统总线23连接,存储器20用于存储一些计算机指令,处理器21用于执行计算机指令,以使终端设备执行如图3-图7任意之一的密钥处理方法。具体的密钥处理方法可参见上述如图3-图7任意之一所示的实施例中的相关描述,此处不再赘述。
具体的,处理器21可以是如图8-图10任意之一所示的实施例中描述的密钥处理装置,也可以是包括如图8-图10任意之一所示的实施例中描述的密钥处理装置的其他能够实现处理器功能的硬件结构。
处理器21可以为中央处理器(central processing unit,CPU)。处理器21还可以为其他通用处理器、数字信号处理器(digital signal  processing,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
处理器21可以为专用处理器,该专用处理器可以包括基带处理芯片、射频处理芯片等中的至少一个。进一步地,该专用处理器还可以包括具有终端设备其他专用处理功能的芯片。
存储器20可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器20也可以包括非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD);存储器20还可以包括上述种类的存储器的组合。
系统总线23可以包括数据总线、电源总线、控制总线和信号状态总线等。本实施例中为了清楚说明,在图13中将各种总线都示意为系统总线23。
通信接口22可以包括接收器和发送器。并且在终端设备的具体实现中,接收器和发送器具体可以是终端设备上的收发器。该收发器可以为无线收发器。
在具体实现过程中,上述如图3-图7任意之一所示的方法流程中的各步骤均可以通过硬件执行软件形式的计算机执行指令实现。为避免重复,此处不再赘述。
本发明实施例提供一种终端设备。基于上述实施例的描述,由于在获取指示在可信平台模块TPM芯片装载第一密钥的密钥装载命令,且TPM芯片内的所有密钥插槽均处于非空闲状态时,密钥处理装置能够释放所述TPM芯片内所有密钥插槽中的第一密钥插槽,并根据密钥装载命令,在所述第一密钥插槽上装载所述第一密钥。因此,能够避免在密钥装载时返回空间已满的错误码,保证密钥装载的顺利进行,合理地使用TPM芯片内存空间资源。
本发明实施例还提供一种软件产品,该软件产品可以包括实现密钥处理 方法的计算机指令。
计算机指令可以存储在可读存储介质上;处理器可以从该可读存储介质上读取到计算机指令并执行,使得处理器实现密钥处理方法。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本发明各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介 质。
以上,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。

Claims (17)

  1. 一种密钥处理方法,其特征在于,包括:
    获取密钥装载命令,所述密钥装载命令指示在可信平台模块TPM芯片装载第一密钥;
    若所述TPM芯片内的所有密钥插槽均处于非空闲状态,则释放所述TPM芯片内所有密钥插槽中的第一密钥插槽;
    根据所述密钥装载命令,在所述第一密钥插槽上装载所述第一密钥。
  2. 根据权利要求1所述的密钥处理方法,其特征在于,所述方法还包括:
    在所述释放所述第一密钥插槽前,确认所述TPM芯片内的所有密钥插槽与密钥的映射关系。
  3. 根据权利要求1或2所述的密钥处理方法,其特征在于,所述释放所述TPM芯片内所有密钥插槽中的第一密钥插槽,具体包括:
    获取所述第一密钥插槽的标识,其中,占用所述第一密钥插槽的密钥为占用所有密钥插槽的密钥中使用次数最少的密钥,或者,占用所述第一密钥插槽的密钥为占用所有密钥插槽的密钥中最早装载的密钥;
    根据所述第一密钥插槽的标识,指示所述TPM芯片释放所述第一密钥插槽。
  4. 根据权利要求1至3任一项所述的密钥处理方法,其特征在于,所述方法还包括:
    在所述释放所述第一密钥插槽前,保存占用所述第一密钥插槽的密钥的现场记录。
  5. 根据权利要求1至4任一项所述的密钥处理方法,其特征在于,所述方法还包括:
    在所述第一插槽上装载所述第一密钥时,确认存储器中存储有第一密钥的现场记录,获取并恢复所述第一密钥的现场记录。
  6. 根据权利要求1至5任一项所述密钥处理方法,其特征在于,所述方法还包括:
    在所述第一密钥插槽上装载所述第一密钥时,记录所述第一密钥插槽与所述第一密钥的映射关系,以便根据所述映射关系从所述第一密钥插槽获取到所述第一密钥。
  7. 根据权利要求1至6任一项所述的密钥处理方法,其特征在于,在所述获取密钥装载命令前,所述方法还包括:
    确认所述TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限;
    从接收到的至少一个命令中获取第一命令,所述第一命令为所述至少一个命令中的任意一个命令,所述第一命令包括密钥装载命令。
  8. 根据权利要求1至7任一项所述的密钥处理方法,其特征在于,在所述获取密钥装载命令前,所述方法还包括:
    确认所述TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限;
    从接收到的至少一个命令中获取第一命令,所述第一命令为所述至少一个命令中优先级最高的命令,所述第一命令包括密钥装载命令。
  9. 一种密钥处理装置,其特征在于,所述密钥处理装置包括获取模块、确认模块、释放模块和装载模块;
    所述获取模块,用于获取密钥装载命令,所述密钥装载命令指示在可信平台模块TPM芯片装载第一密钥;
    所述确认模块,用于在所述获取模块获取密钥装载命令后,确认所述TPM芯片内的所有密钥插槽均处于非空闲状态;
    所述释放模块,用于若所述TPM芯片内的所有密钥插槽均处于非空闲状态,则释放所述TPM芯片内所有密钥插槽中的第一密钥插槽;
    所述装载模块,用于在所述释放模块释放所述TPM芯片内所有密钥插槽中的第一密钥插槽后,根据所述密钥装载命令,在所述第一密钥插槽上装载所述第一密钥。
  10. 根据权利要求9所述的密钥处理装置,其特征在于,
    所述确认模块,还用于在所述释放模块释放所述第一密钥插槽前,确认所述TPM芯片内的所有密钥插槽与密钥的映射关系。
  11. 根据权利要求9或10所述的密钥处理装置,其特征在于,
    所述释放模块,具体用于获取所述第一密钥插槽的标识,其中,占用所述第一密钥插槽的密钥为占用所有密钥插槽的密钥中使用次数最少的密钥,或者,占用所述第一密钥插槽的密钥为占用所有密钥插槽的密钥中最早装载的密钥;以及根据所述第一密钥插槽的标识,指示所述TPM芯片释放所述第一密钥插槽。
  12. 根据权利要求9至11任一项所述的密钥处理装置,其特征在于,所述密钥处理装置还包括保存模块;
    所述保存模块,用于在所述释放模块释放所述第一密钥插槽前,保存占用所述第一密钥插槽的密钥的现场记录。
  13. 根据权利要求9至12任一项所述的密钥处理装置,其特征在于,
    所述装载模块,具体用于在所述装载模块在第一插槽上装载所述第一密钥时,确认存储器中存储有第一密钥的现场记录,获取并恢复所述第一密钥的现场记录。
  14. 根据权利要求9至13任一项所述的密钥处理装置,其特征在于,所述密钥处理装置还包括记录模块;
    所述记录模块,用于在所述装载模块在所述第一密钥插槽上装载所述第一密钥时,记录所述第一密钥插槽与所述第一密钥的映射关系,以便根据所述映射关系从所述第一密钥插槽获取到所述第一密钥。
  15. 根据权利要求9至14任一项所述的密钥处理装置,其特征在于,
    所述确认模块,还用于在所述获取模块获取密钥装载命令前,确认所述TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限;
    所述获取模块,还用于在所述确认模块确认所述TPM芯片内处于空闲状态的密钥插槽的个数大于或等于预设门限后,从接收到的至少一个命令中获取第一命令,所述第一命令为所述至少一个命令中的任意一个命令,所述第一命令包括密钥装载命令。
  16. 根据权利要求9至15任一项所述的密钥处理装置,其特征在于,
    所述确认模块,还用于在所述获取模块获取密钥装载命令前,确认所述TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限;
    所述获取模块,还用于在所述确认模块确认所述TPM芯片内处于空闲状态的密钥插槽的个数小于预设门限后,从接收到的至少一个命令中获取第一命令,所述第一命令为所述至少一个命令中优先级最高的命令,所述第一命令包括密钥装载命令。
  17. 一种终端设备,其特征在于,所述终端设备包括存储器、处理器、通信接口和系统总线;
    所述存储器、所述处理器和所述通信接口通过所述系统总线连接,所述存储器用于存储计算机指令,所述处理器用于执行所述存储器存储的计算机指令,以使所述终端设备执行权利要求1-8任一项所述的密钥处理方法。
PCT/CN2016/101582 2016-03-18 2016-10-09 一种密钥处理方法及装置 WO2017157006A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610156470.6A CN105871539B (zh) 2016-03-18 2016-03-18 一种密钥处理方法及装置
CN201610156470.6 2016-03-18

Publications (1)

Publication Number Publication Date
WO2017157006A1 true WO2017157006A1 (zh) 2017-09-21

Family

ID=56624643

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/101582 WO2017157006A1 (zh) 2016-03-18 2016-10-09 一种密钥处理方法及装置

Country Status (2)

Country Link
CN (1) CN105871539B (zh)
WO (1) WO2017157006A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110059875A (zh) * 2019-04-12 2019-07-26 湖北工业大学 基于分布式鲸鱼优化算法的公共自行车需求量预测方法
CN115250189A (zh) * 2021-04-27 2022-10-28 西门子(中国)有限公司 一种智能家居设备的密钥管理方法及装置

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105871539B (zh) * 2016-03-18 2020-02-14 华为技术有限公司 一种密钥处理方法及装置
CN107959567B (zh) * 2016-10-14 2021-07-27 阿里巴巴集团控股有限公司 数据存储方法、数据获取方法、装置及系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090089582A1 (en) * 2007-09-27 2009-04-02 Tasneem Brutch Methods and apparatus for providing upgradeable key bindings for trusted platform modules
CN101547198A (zh) * 2009-01-22 2009-09-30 联想网御科技(北京)有限公司 一种网络安全设备的连接控制方法及设备
CN102136044A (zh) * 2010-07-14 2011-07-27 华为技术有限公司 安全启动方法、装置及计算机系统
CN103763315A (zh) * 2014-01-14 2014-04-30 北京航空航天大学 一种应用于移动设备云存储的可信数据存取控制方法
CN105871539A (zh) * 2016-03-18 2016-08-17 华为技术有限公司 一种密钥处理方法及装置

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1291612C (zh) * 2003-10-24 2006-12-20 大唐移动通信设备有限公司 根据无线链路的优先级实现资源抢占的装置和方法
US7369856B2 (en) * 2004-11-24 2008-05-06 Intel Corporation Method and system to support fast hand-over of mobile subscriber stations in broadband wireless networks
CN101465808B (zh) * 2008-12-30 2012-02-22 华为技术有限公司 网络优先级控制方法、装置及系统
JP2010224942A (ja) * 2009-03-24 2010-10-07 Olympus Corp プロセッシング・エレメント及び分散処理ユニット
EP2427995B1 (en) * 2009-05-03 2018-07-11 Kabushiki Kaisha Toshiba Proactive authentication
CN101656630B (zh) * 2009-09-09 2015-09-16 中兴通讯股份有限公司 一种业务保护方法和系统
CN101854353B (zh) * 2010-04-28 2013-01-16 国网电力科学研究院 一种基于fpga的多芯片并行加密方法
CN102842005B (zh) * 2011-06-21 2015-06-10 国民技术股份有限公司 一种基于tsm的tspi接口的csp模块和csp实现方法
CN103138939B (zh) * 2013-03-28 2015-09-16 武汉大学 云存储模式下基于可信平台模块的密钥使用次数管理方法
CN103268258B (zh) * 2013-04-27 2016-08-10 中国空间技术研究院 一种卫星地面遥控发令安全控制方法
CN104331329B (zh) * 2014-09-30 2017-12-01 上海斐讯数据通信技术有限公司 支持域管理的移动办公安全系统及方法
CN105245334B (zh) * 2015-10-28 2018-03-02 武汉大学 一种tpm密钥及其授权数据备份恢复系统及方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090089582A1 (en) * 2007-09-27 2009-04-02 Tasneem Brutch Methods and apparatus for providing upgradeable key bindings for trusted platform modules
CN101547198A (zh) * 2009-01-22 2009-09-30 联想网御科技(北京)有限公司 一种网络安全设备的连接控制方法及设备
CN102136044A (zh) * 2010-07-14 2011-07-27 华为技术有限公司 安全启动方法、装置及计算机系统
CN103763315A (zh) * 2014-01-14 2014-04-30 北京航空航天大学 一种应用于移动设备云存储的可信数据存取控制方法
CN105871539A (zh) * 2016-03-18 2016-08-17 华为技术有限公司 一种密钥处理方法及装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110059875A (zh) * 2019-04-12 2019-07-26 湖北工业大学 基于分布式鲸鱼优化算法的公共自行车需求量预测方法
CN110059875B (zh) * 2019-04-12 2023-02-17 湖北工业大学 基于分布式鲸鱼优化算法的公共自行车需求量预测方法
CN115250189A (zh) * 2021-04-27 2022-10-28 西门子(中国)有限公司 一种智能家居设备的密钥管理方法及装置
CN115250189B (zh) * 2021-04-27 2023-06-02 西门子(中国)有限公司 一种智能家居设备的密钥管理方法及装置

Also Published As

Publication number Publication date
CN105871539A (zh) 2016-08-17
CN105871539B (zh) 2020-02-14

Similar Documents

Publication Publication Date Title
CN106063183B (zh) 用于云辅助密码学的方法和装置
JP6332766B2 (ja) トラステッドサービスマネージャデータの保護および秘密性のためのトラステッドセキュリティゾーンコンテナ
RU2542930C2 (ru) Защищенная загрузка и конфигурирование подсистемы с нелокального запоминающего устройства
US10440111B2 (en) Application execution program, application execution method, and information processing terminal device that executes application
WO2017157006A1 (zh) 一种密钥处理方法及装置
US20090298468A1 (en) System and method for deleting data in a communication device
CN110806919B (zh) 一种云环境下保护虚拟机镜像的方法及系统
JP2020508619A (ja) データバックアップ方法およびデータバックアップ装置、記憶媒体ならびにサーバ
CN104937904A (zh) 针对全异卸载提供器的复制卸载
EP3270322B1 (en) Encrypting system level data structures
US11637704B2 (en) Method and apparatus for determining trust status of TPM, and storage medium
US9137219B1 (en) Methods and systems for securely managing multimedia data captured by mobile computing devices
JP2007249507A (ja) 情報漏洩防止方法、情報漏洩防止システム及び情報端末
US20150312763A1 (en) Security Authentication Method, Device, and System
CN111459673A (zh) 安全内存扩展、释放方法及装置和电子设备
CN111866864B (zh) 基于无线ap实现针对云平台证书的加密存储及安全使用管理的方法、装置及存储介质
WO2020187008A1 (zh) 服务调用控制方法、服务调用方法、装置及终端
CN112328415A (zh) 接口调用方法、装置、计算机设备和可读存储介质
CN104732166A (zh) 一种数据存储、读取方法、装置及设备
CN115834192A (zh) 一种文件摆渡方法、装置及计算机可读存储介质
CN116070239A (zh) 文件加密、解密方法、装置、设备及存储介质
US11283768B1 (en) Systems and methods for managing connections
CN105975624B (zh) 一种数据传输方法、设备和系统
US20140033318A1 (en) Apparatus and method for managing usim data using mobile trusted module
CN110737910B (zh) 一种Android log解密管理方法、装置、设备和介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 16894165

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16894165

Country of ref document: EP

Kind code of ref document: A1