Patent Description:
The secure element (SE) has the functions of symmetric and asymmetric encryption and decryption, secure storage and identity authentication, and the SE further has the characteristics of small size and convenient installation. Therefore, the SE is widely used in various scenarios, for example, the SE can be applied in the scenarios of access control devices, mobile payment devices and financial cards.

When applying the SE in various scenarios, the SE needs to be welded on the corresponding equipment to use SE to store data, keys and other files of the user. In most cases, before a device installed with the SE leaves the factory, the key needs to be written into the SE through a specific card. However, for the user of the device, in order to ensure security, the key stored in the SE may need to be changed when the device is first used, or the key stored in the SE may need to be regularly updated during the use of the device.

Because it is necessary to use a specific card when writing a key into the SE in the device, but for the device, the specific card may not exist in the device. Therefore, when the key stored in the SE needs to be changed, the SE needs to be removed from the device, which undoubtedly increases the operational complexity of changing the key.

It can be seen that when the key stored in SE is changed by using relevant technologies, the device structure needs to be changed, and the operation is relatively complex.

Embodiments of the present application adopts the following technical solutions.

In a first aspect, an embodiment of the present application provides a method for changing a key in a secure element, applied to a smart device installed with the secure element, including:.

Optionally, verifying whether the smart device has the first authority to read the new key from the key changing device including:
performing external authentication on the key changing device; and in response to determining that the external authentication of the key changing device is successful, determining that the smart device has the first authority to read data from the key changing device.

Optionally, performing the external authentication on the key changing device includes:.

Optionally, verifying whether the smart device has the second authority to change the target key in the secure element includes:
performing external authentication on the secure element; and in response to determining that the external authentication of the secure element is successful, determining that the smart device has the second authority to change the key in the secure element.

Optionally, the key changing device includes a central processing unit (CPU) card.

Optionally, the smart device is configured to:
perform external authentication on the key changing device; and in response to determining that the external authentication of the key changing device is successful, determine that the smart device has the first authority to read data from the key changing device.

Optionally, the smart device is configured to:.

Optionally, the smart device is configured to:
perform external authentication on the secure element; and in response to determining that the external authentication of the secure element is successful, determine that the smart device has the second authority to change the key in the secure element.

Optionally, the smart device is further configured to: send a second random number generated by the secure element to the key changing device;.

Optionally, the key changing device includes a CPU card.

In a third aspect, an embodiment of the present application provides an apparatus for changing a key in a secure element, applied to a smart device installed with the secure element, including:.

In a fourth aspect, an embodiment of the present application provides a computer device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory communicate with each other through the communication bus, the memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory to achieve any one of the methods provided in the first aspect.

In a fifth aspect, an embodiment of the present application provides a computer readable storage medium, where the storage medium stores a computer program, and the computer program when executed by a processor achieves any one of the methods provided in the first aspect.

In a sixth aspect, an embodiment of the present application provides a computer program, when the computer program is executed by a processor, achieving any one of the methods provided in the first aspect.

At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
Using the technical solutions provided by the embodiments of the present application, the new key corresponding to the target key to be changed is written in the key changing device in advance, and the connection between the key changing device and the smart device is established. In this way, the smart device can obtain the key changing instruction triggered by the key changing device to change the target key under the designated directory in the secure element. After verifying that the smart device has the first authority to read the new key from the key changing device, and that the smart device has the second authority to change the target key under the designated directory in the secure element, the key in the secure element is changed based on the new key stored in the key changing device.

Through the method provided by the embodiments of the present application, without removing the secure element from the smart device, the change of the key stored in the secure element is realized, thereby greatly simplifying the changing operation of the key in the secure element. In addition, in the method provided by the embodiments of the present application, by verifying whether the smart device has the authority to read the key from the key changing device and whether the smart device has the authority to change the target key in the secure element, the security of the key in the secure element is further ensured.

The accompanying drawings illustrated herein are used to provide further understanding of the present application and form a part of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application, and do not constitute an improper limitation of the present application. In the attached figure:.

In order to make the purposes, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings of the present application. The described embodiments are only a part rather than all of the embodiments of the present application. Other embodiments achieved by those of ordinary skill in the art based on the embodiments in the present application without paying creative work shall all fall within the scope of protection of the present application.

The technical solutions provided by the embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

<FIG> shows an application scenario diagram of a method for changing a key in a secure element according to an embodiment of the present application. As shown in <FIG>, the application scenario includes a key changing device and a smart device installed with a SE. The smart device can be any device that uses a SE such as an access control device or a mobile payment device. The key changing device stores a new key that an original key in the SE needs to be changed to. The new key stored in the key changing device can be written into the key changing device through a card writer. It can also be understood that the card writer writes the new key into the key changing device.

In this way, when a key in the SE installed in the smart device needs to be changed, the connection between the key changing device and the smart device is established. For the scenario shown in <FIG>, taking the key changing device as a central processing unit (CPU) card as an example for illustration, when changing a key in the SE, a user can attach the CPU card in a card identification area of the smart device to establish the connection between the CPU card and the smart device. After the connection between the CPU card and the smart device is established, the smart device verifies whether the smart device has an authority to read a new key from the CPU card, and whether the smart device has an authority to change the key in the secure element. If the verification result indicates that the smart device has the above two authorities, the smart device reads the new key stored in the CPU card and changes the key in the SE to the new key.

In addition, <FIG> is only a schematic diagram of a possible application scenario of a method according to an embodiment of the present application, which does not constitute a limitation of the embodiment of the present application.

Optionally, multiple keys may be stored in the SE, such as an internal authentication key, an external authentication key, a master key, an encryption key, a decryption key, and an application maintenance key. In the specific implementation, one or more keys stored in the SE can be changed according to actual needs by using a method according to an embodiment of the present application.

Optionally, in an alternative implementation, a method for changing a key in a secure element according to an embodiment of the present application can be designed to use a key changing device to change one or more keys in the same sub-directory in the secure element.

In an embodiment of the present application, when multiple keys in the secure element need to be changed, multiple key changing devices can be used to change the keys, or one key changing device can be used to change the keys, which is not limited.

The secure element mentioned in the embodiments of the present application can be a security element (SE) chip.

An embodiment of the present application provides a method for changing a key in a secure element. The method is applied to a smart device installed with a secure element, that is, the execution subject of the method is the smart device installed with the secure element. Optionally, the execution subject of the method can be an apparatus for changing a key in a secure element installed in the smart device. The smart device mentioned in the embodiments of the present application can be an access control device, or a mobile payment device, etc..

<FIG> is a first flow diagram of a method for changing a key in a secure element according to an embodiment of the present application. As shown in <FIG>, the method includes at least step <NUM>, step <NUM>, step <NUM> and step <NUM>.

In step <NUM>, after a connection between a key changing device and a smart device is established, a key changing instruction sent by the key changing device to change a target key under a designated directory in a secure element is obtained.

In step <NUM>, after the connection between the key changing device and the smart device is established, the key changing device may send the key changing instruction to the smart device, where the key changing instruction is used to change the target key under the designated directory in the secure element; and the smart device may receive the key changing instruction sent by the key changing device.

The key changing device can include a CPU card. The CPU card is equivalent to a microcomputer. An integrated circuit in the CPU card contains a microprocessor CPU, a memory unit and a chip operating system. The key changing device has functions of data storage, command processing and data security protection.

The key changing device can be understood as an independent device. The card writer writes a new key corresponding to the key to be changed into a directory of the key changing device in advance. In this way, the smart device can change the target key in the secure element of the smart device based on the key changing device.

Optionally, in an embodiment, when the key changing device is a CPU card, the user can attach the CPU card in a card identification area of the smart device to establish the radio frequency (RF) connection between the key changing device and the smart device.

In step <NUM>, the smart device can read the key changing instruction triggered by the key changing device through an RF module in the smart device.

In step <NUM>, whether the smart device has a first authority to read a new key from the key changing device and whether the smart device has a second authority to change the target key in the secure element are verified; if so, step <NUM> is performed; otherwise, the process is ended.

Optionally, in an embodiment, the smart device can verify whether the smart device has the first authority by performing external authentication on the key changing device.

Optionally, in an embodiment, the smart device can verify whether the smart device has the second authority by performing external authentication on the secure element.

The smart device needs to have both the first and second authorities to perform the operation of changing the key in the secure element. In other cases, if the smart device has only the first authority, or only the second authority, or neither the first authority nor the second authority, the smart device cannot perform the operation of changing the key in the secure element.

In step <NUM>, the new key stored in the key changing device is read.

The new key is written into the key changing device through the card writer in advance.

In step <NUM>, the target key under the designated directory in the secure element is changed to the new key.

In the method for changing the key in the secure element provided by the embodiments of the present application, the new key corresponding to the target key to be changed is written in the key changing device in advance, and the connection between the key changing device and the smart device is established. In this way, the smart device can obtain the key changing instruction triggered by the key changing device to change the target key under the designated directory in the secure element. After verifying that the smart device has the first authority to read the new key from the key changing device, and that the smart device has the second authority to change the target key under the designated directory in the secure element, the key in the secure element is changed based on the new key stored in the key changing device.

In order to understand the method provided by the embodiments of the present application, detailed implementation processes of the above steps are introduced below.

Optionally, in an embodiment, in step <NUM>, verifying whether the smart device has the first authority to read data from the key changing device can include the following process:
performing external authentication on the key changing device; and if the external authentication for the key changing device is successful, determining that the smart device has the first authority.

Optionally, the external authentication for the key changing device can be achieved through the following process:.

Optionally, in an embodiment, when external authentication is required for the key changing device, the key changing device generates a random number. In the embodiments of the present application, in order to distinguish the random number generated by the key changing device from a random number generated by the secure element, the random number generated by the key changing device is named as the first random number.

After the key changing device generates the first random number, on the one hand, the first random number is temporarily stored in the key changing device, and on the other hand, the first random number is sent to the smart device, enabling that the smart device obtains the first random number from the key changing device.

The smart device obtains the encryption key stored in the secure element, uses the obtained encryption key to encrypt the first random number to obtain the first ciphertext data corresponding to the first random number, and sends the external authentication instruction to the key changing device, where the external authentication instruction carries the first ciphertext data.

The key changing device receives the external authentication instruction; obtains the first ciphertext data from the external authentication instruction, decrypts the first ciphertext data to obtain a first plaintext data; if the first plaintext data is the same as the first random number, determines that the external authentication is successful; and if the first plaintext data is different from the first random number, determines that the external authentication fails.

When the external authentication is successful, the key changing device modifies a state value of the security state register corresponding to the directory of the new key to the first state value.

After the key changing device generates the first random number, on the one hand, the first random number is temporarily stored in the key changing device, on the other hand, the first random number is sent to the smart device, and the smart device sends the first random number to the secure element, enabling that the secure element encrypts the first random number based on the encryption key stored in the secure element to obtain the first ciphertext data corresponding to the first random number.

The secure element returns the first ciphertext data to the smart device. The smart device sends an external authentication instruction to the key changing device, where the external authentication instruction carries the first ciphertext data.

After the key changing device receives the external authentication instruction, the key changing device encrypts the first random number based on an external authentication key in the directory to which the new key belongs, to obtain the ciphertext data corresponding to the first random number. The key changing device compares the ciphertext data encrypted by the key changing device with the first ciphertext data. If the two are the same, the key changing device determines that the external authentication of the key changing device is successful. In this case, the key changing device modifies a state value of the security state register corresponding to the directory of the new key to the first state value. The state value of the security state register being the first state value indicates that files in the directory to which the new key belongs can be read. In this case, after receiving a reading instruction for the new key sent by the smart device, the key changing device allows the smart device to read the new key stored in the directory where the new key belongs.

If the ciphertext data encrypted by the key changing device is different from the first ciphertext data, the key changing device determines that the external authentication of the key changing device fails.

In an embodiment of the present application, the directory in the key changing device can be divided into a main directory and one or more sub-directories. For the key changing device, a main directory can correspond to a security state register, and a sub-directory can correspond to a security state register.

For example, in an embodiment, the directory structure corresponding to the key changing device is shown in <FIG>. Under the directory structure shown in <FIG>, the new key used to change the target key in the secure element is stored in a binary file under a sub-directory <NUM>.

In this case, when the key changing device encrypts the first random number, the key changing device uses the external authentication key corresponding to the sub-directory <NUM> to encrypt the first random number. In addition, for the case shown in <FIG>, after the external authentication of the key changing device is successful, the state value of the security state register corresponding to the sub-directory <NUM> is modified to the first state value. In this way, the smart device can read the new key stored in sub-directory <NUM>.

In the embodiments of the present application, for the key changing device, a sub-directory corresponds to a security state register. In this way, after using an external authentication key corresponding to a sub-directory to perform an external authentication of the key changing device and the external authentication of the key changing device is successful, the key changing device can only modify the state value of the security state register corresponding to the sub-directory, and state values of security state registers corresponding to other sub-directories remain unchanged, thus ensuring the security of the files under other sub-directories.

Optionally, in an embodiment, in step <NUM>, verifying whether the smart device has the second authority to change the key in the secure element can include the following process:
performing external authentication on the secure element; if the external authentication of the secure element is successful, determining that the smart device has the second authority.

Optionally, the smart device can perform external authentication on the secure element through the following process:
sending the second random number generated by the secure element to the key changing device, such that the key changing device encrypts the second random number based on an authentication key stored in the key changing device to obtain the second ciphertext data corresponding to the second random number; obtaining the second ciphertext data generated by the key changing device, and sending an external authentication instruction carrying the second ciphertext data to the secure element, such that the secure element performs the external authentication based on the second ciphertext data, and in response to determining that the external authentication is successful, the secure element modifies a state value of a security state register corresponding to the designated directory to a second state value, wherein the second state value indicates that the target key under the designated directory can be changed.

Optionally, in an embodiment, when external authentication is required for the secure element, the secure element can generate a random number. In the embodiments of the present application, in order to distinguish a random number generated by the secure element from a random number generated by the key changing device, a random number generated by the secure element is named as the second random number. After the secure element generates the second random number, on the one hand, the second random number is temporarily stored in the secure element, and on the other hand, the second random number is sent to the smart device.

After the key changing device receives the second random number, the key changing device encrypts the second random number based on an authentication key stored in the key changing device to obtain the second ciphertext data corresponding to the second random number. The smart device obtains the second ciphertext data from the key changing device and sends an external authentication instruction to the secure element, where the external authentication instruction carries the second ciphertext data.

The secure element obtains the second ciphertext data from the external authentication instruction. The secure element can decrypt the second ciphertext data to obtain the second plaintext data. If the second plaintext data is the same as the second random number, it is determined that the external authentication is successful; and if the second plaintext data is different from the second random number, it is determined that the external authentication fails.

When the external authentication is successful, the secure element modifies the state value of the security state register corresponding to the designated directory to the second state value.

Optionally, in an embodiment, when external authentication is required for the secure element, the secure element can generate a random number. In the embodiments of the present application, in order to distinguish a random number generated by the secure element from a random number generated by the key changing device, a random number generated by the secure element is named as the second random number. After the secure element generates the second random number, on the one hand, the second random number is temporarily stored in the secure element, on the other hand, the second random number is sent to the smart device, and the smart device sends the second random number to the key changing device.

The key changing device encrypts the second random number based on an internal authentication key stored in the key changing device to obtain the second ciphertext data corresponding to the second random number; and the key changing device returns the second ciphertext data to the smart device.

The smart device sends an external authentication instruction to the secure element, where the external authentication instruction carries the second ciphertext data. After the secure element receives the external authentication instruction, the secure element encrypts the second random number based on the external authentication key corresponding to the designated directory, and compares the ciphertext data encrypted by the secure element with the second ciphertext data.

If the two are the same, the secure element determines that the external authentication of the secure element is successful. In this case, the secure element modifies a state value of the security state register corresponding to the designated directory to the second state value. The state value of the security state register being the second state value indicating that the key in the designated directory can be changed. In this case, if the secure element receives the key changing instruction sent by the smart device, the secure element allows to change the target key in the designated directory.

If the ciphertext data encrypted by the secure element is different from the second ciphertext data, the secure element determines that the external authentication of the secure element fails.

In an embodiment of the present application, the directory in the secure element can be divided into a main directory and one or more sub-directories. For the secure element, a main directory can correspond to a security state register, and a sub-directory can correspond to a security state register.

For example, in an embodiment, the directory structure for the secure element is shown in <FIG>. In an embodiment of the present application, a master key under the sub-directory <NUM> in the directory corresponding to the secure element needs to be changed. In this case, when the secure element encrypts the second random number, the secure element uses the external authentication key corresponding to the sub-directory <NUM> to encrypt the second random number.

For the case shown in <FIG>, after the external authentication of the secure element is successful, a state value of the security state register corresponding to the sub-directory <NUM> is modified to the second state value. In this way, the smart device can change the master key stored in sub-directory <NUM>.

For the secure element, a sub-directory corresponds to a security state register. In this way, after using the external authentication key corresponding to a sub-directory to perform an external authentication of the secure element and the external authentication of the secure element is successful, for the secure element, only the state value of the security state register corresponding to the sub-directory can be modified, and state values of security state registers corresponding to other sub-directories remain unchanged, thus ensuring the security of the keys under other sub-directories.

In the embodiments of the present application, the security state register is used to represent the security state of its corresponding card (secure element or key changing device). In an embodiment, the security state register can correspond to <NUM> security states, and the state value for each security state can be a value from 0XF0 to OXFF. One state value corresponds to one authority. For example, if the state value corresponding to the authority to read the new key from the sub-directory <NUM> of the key changing device is OXF2, only when the state value of the security state register corresponding to the sub-directory <NUM> of the key changing device is 0XF2, the smart device can read the new key under the sub-directory <NUM>.

In order to understand the method provided by the embodiments of the present application, the following will take changing the master key under the sub-directory <NUM> in the SE chip of an access control device as an example to introduce the method provided by the embodiments of the present application, and the key changing device used is a CPU card, and the new key in the CPU card is stored in the sub-directory <NUM> of the CPU card. <FIG> is a second flow diagram of a method for changing a key in a secure element according to an embodiment of the present application. As shown in <FIG>, the method may include step <NUM> to step <NUM>.

In step <NUM>, the access control device reads the key changing instruction triggered by the CPU card attached on the card identification area of the access control device, where the key changing instruction is configured to change the master key under the sub-directory <NUM> of the SE chip of the access control device.

In an embodiment of the present application, when the CPU card is attached on the card identification area of the access control device, the CPU card triggers the key changing instruction to change the master key under the sub-directory <NUM> of the SE chip.

In step <NUM>, the access control device can read the key changing instruction triggered by the CPU card.

In step <NUM>, the access control device reads the first random number from the CPU card.

In step <NUM>, the access control device sends the first random number to the SE chip, and the SE chip encrypts the first random number based on the encryption key to obtain the first ciphertext data.

In step <NUM>, the encryption key used by the SE chip to encrypt the first random number can be the internal authentication key.

In step <NUM>, the SE chip returns the first ciphertext data to the access control device.

In step <NUM>, the access control device sends the external authentication instruction to the CPU card, where the external authentication instruction carries the first ciphertext data.

In step <NUM>, the CPU card encrypts the first random number based on the external authentication key corresponding to sub-directory <NUM>, and compares the encrypted ciphertext data with the first ciphertext data.

In step <NUM>, if the two are consistent, the CPU card modifies a state value of the security state register corresponding to sub-directory <NUM> to the first state value.

The first state value indicates that the new key under sub-directory <NUM> in the CPU card can be read.

In step <NUM>, the access control device reads the second random number from the SE chip.

In step <NUM>, the access control device sends the second random number to the CPU card, and the CPU card encrypts the second random number based on the internal authentication key stored in the CPU card to obtain the second ciphertext data.

In step <NUM>, the CPU card returns the second ciphertext data to the access control device.

In step <NUM>, the access control device sends the external authentication instruction to the SE chip, where the external authentication instruction carries the second ciphertext data.

In step <NUM>, the SE chip encrypts the second random number based on the external authentication key corresponding to sub-directory <NUM>, and compares the encrypted ciphertext data with the second ciphertext data.

In step <NUM>, if the two are consistent, the SE chip modifies the state value of the security state register corresponding to the sub-directory <NUM> to the second state value.

The second state value indicates that the key under sub-directory <NUM> in SE chip can be changed.

In step <NUM>, the access control device reads the new key under the sub-directory <NUM> in the CPU card, and changes the master key under the sub-directory <NUM> in the SE chip to the new key.

The specific implementation process corresponding to each step in the embodiment shown in <FIG> can refer to the embodiment shown in <FIG>, which will not be repeated here.

In the embodiment shown in <FIG>, the processes of external authentication for the CPU card in step <NUM> to step <NUM> can be performed simultaneously with the processes of external authentication for the SE chip in step <NUM> to step <NUM>. Alternatively, the processes of external authentication for the CPU card may be performed first, and then the processes of the external authentication for the SE chip may be performed. Alternatively, the processes of the external authentication for the SE chip may be performed first, and then the processes of the external authentication for the CPU card may be performed. <FIG> shows an example where the processes of external authentication for the CPU card are performed simultaneously with the processes of external authentication for the SE chip, which does not constitute a limitation of the embodiments of the present application.

Corresponding to the methods for changing the key in the secure element provided by the embodiments of the present application, based on the same idea, an embodiment of the present application further provides a system for changing a key in a secure element. As shown in <FIG>, the system includes a key changing device <NUM> and a smart device <NUM> installed with a secure element;.

Optionally, the smart device <NUM> can be configured to:
perform external authentication on the key changing device; and in response determining that the external authentication of the key changing device is successful, determine that smart device has the first authority to read data from key changing device.

Optionally, the smart device <NUM> can be configured to:
based on an encryption key stored in the secure element, encrypt a first random number generated by the key changing device to obtain a first ciphertext data corresponding to the first random number; carry the first ciphertext data in an external authentication instruction; and send the external authentication instruction to the key changing device; and.

The key changing device <NUM> can be further configured to receive the first ciphertext data; perform external authentication based on the first ciphertext data; and in response to determining that the external authentication is successful, modify a state value of a security state register corresponding to the directory of the new key to a first state value, where the first state value indicates that the new key under the directory to which the new key belongs can be read.

Optionally, the smart device <NUM> can be configured to:
perform external authentication on the secure element; and in response to determining that the external authentication of the secure element is successful, determine that the smart device has the second authority to change the key in the secure element.

Optionally, the smart device <NUM> can be further configured to:.

For the systems for changing the key in the secure element provided by the embodiments of the present application, the specific implementation processes of the functions corresponding to the key changing device and the smart device is the same as the specific implementation processes of the steps in the embodiments of the methods corresponding to <FIG>. Therefore, for the specific implementation processes of the functions corresponding to the key changing device and the smart device, reference may be made to the embodiments of the methods corresponding to <FIG>, which will not be repeated here.

In the system for changing the key in the secure element provided by the embodiments of the present application, the new key corresponding to the target key to be changed is written in the key changing device in advance, and the connection between the key changing device and the smart device is established. In this way, the smart device can obtain the key changing instruction triggered by the key changing device to change the target key under the designated directory in the secure element. After verifying that the smart device has the first authority to read the new key from the key changing device, and that the smart device has the second authority to change the target key under the designated directory in the secure element, the key in the secure element is changed based on the new key stored in the key changing device.

Through the system provided by the embodiments of the present application, without removing the secure element from the smart device, the change of the key stored in the secure element is realized, thereby greatly simplifying the changing operation of the key in the secure element. In addition, in the system provided by the embodiments of the present application, by verifying whether the smart device has the authority to read the key from the key changing device and whether the smart device has the authority to change the target key in the secure element, the security of the key in the secure element is further ensured.

Corresponding to the methods for changing the key in the secure element provided by the embodiments of the present application, an embodiment of the present application provides an apparatus for changing a key in a secure element, applied to the smart device installed with the secure element, including:.

Corresponding to the methods for changing the key in the secure element provided by the embodiments of the present application, an embodiment of the present application provides a computer device. As shown in <FIG>, the computer device includes a processor <NUM>, a transceiver <NUM>, a memory <NUM> and a bus interface.

The computer device <NUM> further includes: a computer program stored in the memory <NUM> and operable on the processor <NUM>. When the computer program is executed by the processor <NUM>, steps of any one of the above methods for changing the key in the secure element can be achieved, and the same technical effect can be achieved. To avoid repetition, details are not repeated here.

In <FIG>, the bus architecture may include any number of interconnected buses and bridges linking together various circuits for one or more processors represented by processor <NUM> and memory represented by memory <NUM>. The bus architecture can further link together various other circuits, such as peripherals, voltage regulators, and power management circuits, etc., which are well known in the art and therefore will not be further described herein. The bus interface provides an interface to the bus architecture. The transceiver <NUM> may include a plurality of elements, including a transmitter and a receiver, providing a unit for communicating with various other devices over transmission media.

The processor <NUM> is responsible for managing the bus architecture and general processing, and the memory <NUM> may store data used by the processor <NUM> when performing operations.

Corresponding to the methods for changing the key in the secure element provided by the embodiments of the present application, an embodiment of the present application provides a computer device, including a processor, a communication interface, a memory, and a communication bus; where the processor, the communication interface, and the memory communicate with each other through the communication bus, the memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory to achieve steps of any one of the above methods for changing the key in the secure element.

An embodiment of the present application further provides a computer-readable storage medium. A computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, steps of embodiments of the above methods for changing the key in the secure element are achieved, and the same technical effect can be achieved. To avoid repetition, details are not repeated here. The computer-readable storage medium includes, for example, a read-only memory (ROM), a random-access memory (RAM), a magnetic disk or an optical disk.

An embodiment of the present application further provides a computer program. When the computer program is executed by a processor, the steps of any one of the embodiments of the above methods for changing the key in the secure element can be achieved, and the same technical effect can be achieved. To avoid repetition, details are not repeated here.

It should be noted that, in this document, the term "include", "include" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or device that includes a set of elements includes not only those elements, but also other elements that are not explicitly listed, or other elements that are inherent to such a process, method, commodity, or device. Without further limitation, the element defined by the statement "including a. " do not preclude the existence of additional identical elements in the process, method, article, or apparatus that include the element.

Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is a better implementation. Based on this understanding, the essence of the technical solutions of the present application or the part of the technical solutions of the present application that contributes to related technologies can be embodied in the form of a computer software product, and the computer software product is stored in a storage medium (such as ROM, RAM, magnetic disk, optical disk, etc.). The computer software product includes several instructions to enable a terminal (such as a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present application.

Claim 1:
A method for changing a key in a secure element, applied to a smart device installed with the secure element, comprising:
after a connection between a key changing device and the smart device is established, obtaining (<NUM>) a key changing instruction sent by the key changing device, wherein the key changing instruction is configured to change a target key under a designated directory in the secure element;
verifying (<NUM>) whether the smart device has a first authority to read a new key from the key changing device, and whether the smart device has a second authority to change the target key in the secure element;
in response to determining that the smart device has the first authority and the second authority, reading (<NUM>) the new key stored in the key changing device, wherein the new key is written into the key changing device via a card writer in advance; and
changing (<NUM>) the target key under the designated directory in the secure element to the new key.