Encryption method and device for resisting side channel attack, equipment and user identification card
By generating round encryption subkeys in the SIM card and hiding the operations during the encryption process, the problem of the SIM card being vulnerable to side-channel attacks during the encryption process is solved, improving security and enhancing the privacy of user data and property. Security.
Patent Information
- Application Number
- CN202410743277.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-10
AI Technical Summary
Existing SIM cards are vulnerable to side-channel attacks during the encryption process. Attackers extract the root key through leaked information such as power consumption information, making the SIM card less secure and threatening user privacy and property security.
Generate round encryption subkeys by reading the pre-stored trusted root key, and perform encryption operations to hide the round encryption subkeys and plaintext data during the round encryption process, including byte substitution, obfuscated sorting, and row shifting. Operation to generate encrypted ciphertext data, reducing the possibility of an attacker extracting the root key from the leaked information.
It improves the security of user identification cards, reduces the possibility of attackers extracting root keys from leaked information, enhances the privacy of user data and property security, and effectively resists side channel attacks.
Smart Images

Figure CN118632233A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication security technology, and in particular to an encryption method and device, equipment, and a user identification card for resisting side channel attacks. Background Art
[0002] Subscriber Identity Module (SIM) or Universal Subscriber Identity Module (USIM, also known as upgraded SIM card, for ease of explanation, SIM card will be used instead) is an IC card held by mobile users of the GSM (Global System for Mobile Communications) system. When a SIM card accesses the network, it will actively initiate a request to the base station and perform authentication and key negotiation through the AKA (Authentication and Key Agreement, the authentication and key negotiation protocol of the third-generation mobile communication network) protocol. The core part of the protocol is based on the AES (Advanced Encryption Standard, a symmetric encryption algorithm) algorithm. The SIM card and the base station share the root key, and the root key participates in the AES encryption to generate the authentication parameters used later. That is, the root key is the trusted root in the SIM card. By obtaining these two secret parameters, the identity of the SIM card can be forged and the corresponding SIM card can be completely cloned.
[0003] Side Channel Attack (SCA) refers to a non-invasive attack that obtains ciphertext information through various leaked information generated by encryption software or encryption hardware during operation. For example, a side channel attack can be based on the idea that the power consumption information generated during the operation of a cryptographic device is related to the operation and number of operations currently performed by the device. By sampling the power consumption information generated during the AKA process of the SIM card multiple times, the value of the root key in the SIM card is obtained through certain analysis, so that the SIM card can be cloned, resulting in lower security of the SIM card, posing a threat to the privacy and property safety of users. Summary of the invention
[0004] The embodiment of this specification first provides an encryption method for resisting side channel attacks, which is applied to a user identification card. The method hides the encryption operation of plaintext data in the round encryption process so that an attacker cannot analyze and extract the root key of the user identification card from the leakage information such as power consumption data caused by the encryption operation, thereby improving the security of the user identification card, and enhancing the privacy of user data and property security. The method includes:
[0005] The pre-stored trusted root key is read, and a round encryption subkey is generated according to the trusted root key; a multi-round round encryption process is performed on the plaintext data to be encrypted by using the round encryption subkey, and during the round encryption process, the round encryption subkey and the plaintext data are encrypted and hidden to obtain the encrypted ciphertext data.
[0006] Further, in some embodiments, in addition to the initial round encryption process, the round encryption process includes at least a byte replacement operation; the encryption operation of the round encryption subkey and the plaintext data is hidden to obtain the encrypted ciphertext data, including: obfuscating and sorting the round encryption subkey and each byte in the plaintext data, and performing the byte replacement operation on the obfuscated and sorted round encryption subkey and plaintext data to obtain a first intermediate encryption state; arranging the first intermediate encryption state in reverse order of the obfuscated sorting to restore it to obtain a second intermediate encryption state after the byte replacement operation; performing the remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain the ciphertext data after one round of encryption.
[0007] Further, in some embodiments, the obfuscated ordering of the round encryption subkey and each byte in the plaintext data includes: determining an initial index sequence of each byte in the round encryption subkey and the plaintext data, and generating an obfuscated index sequence based on the initial index sequence; and reordering each byte in the round encryption subkey and the plaintext data according to the obfuscated index sequence to achieve obfuscated ordering of each byte in the round encryption subkey and the plaintext data.
[0008] Further, in some embodiments, the user identification card includes a byte encryption order obfuscation module, and generating an obfuscated index sequence based on the initial index sequence includes: controlling the byte encryption order obfuscation module to generate an obfuscated random number; and reordering the initial index sequence according to the obfuscated random number to obtain an obfuscated index sequence.
[0009] Further, in some embodiments, controlling the byte encryption order obfuscation module to generate an obfuscated random number includes: obtaining a current system time; inputting the current system time into the byte encryption order obfuscation module so that a random number generator in the byte encryption order obfuscation module generates the obfuscated random number based on the current system time.
[0010] Further, in some embodiments, controlling the byte encryption order obfuscation module to generate an obfuscated random number includes: obtaining electrical signal noise; inputting the electrical signal noise into the byte encryption order obfuscation module so that a random number generator in the byte encryption order obfuscation module generates the obfuscated random number based on the electrical signal noise.
[0011] Further, in some embodiments, except for the last round of round encryption process, the remaining round encryption operations include a row shift operation, a column confusion operation and a round key addition operation; the performing the remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain the encrypted ciphertext data includes: performing the row shift operation, the column confusion operation and the round key addition operation in sequence on the second intermediate encryption state after the byte replacement operation to obtain the encrypted ciphertext data.
[0012] Further, in some embodiments, for the last round of the round encryption process, the remaining round encryption operations include a row shift operation and a round key addition operation; the performing the remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain the encrypted ciphertext data includes: performing the row shift operation and the round key addition operation in sequence on the second intermediate encryption state after the byte replacement operation to obtain the encrypted ciphertext data.
[0013] Furthermore, in some implementations, for the initial round encryption process, the method further includes: performing a round key addition operation on the round encryption subkey and the plaintext data.
[0014] Further, in some embodiments, the trusted root key includes an authentication key, and generating a round encryption subkey based on the trusted root key includes: performing a key expansion operation on the authentication key to obtain a key expansion matrix; and determining the round encryption subkey of each round of the round encryption process based on the key expansion matrix.
[0015] The embodiment of this specification also provides an encryption device for resisting side channel attacks, which is provided with a user identification card, and the device includes:
[0016] A key generation module, used to read a pre-stored trusted root key and generate a round encryption subkey according to the trusted root key;
[0017] The encryption operation hiding module is used to perform multiple rounds of round encryption on the plaintext data to be encrypted through the round encryption subkey, and perform encryption operation hiding on the round encryption subkey and the plaintext data during the round encryption process to obtain encrypted ciphertext data.
[0018] Further, in some embodiments, in addition to the initial round encryption process, the round encryption process includes at least a byte replacement operation; the encryption operation hiding module may include: an obfuscation sorting unit, used to perform obfuscation sorting on the round encryption subkey and each byte in the plaintext data, and perform the byte replacement operation on the obfuscated round encryption subkey and the plaintext data to obtain a first intermediate encryption state; an obfuscation restoration unit, used to perform reverse order of the obfuscation sorting on the first intermediate encryption state to restore it to obtain a second intermediate encryption state after the byte replacement operation; and a remaining round encryption unit, used to perform remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain ciphertext data after one round of encryption.
[0019] Furthermore, in some embodiments, the obfuscation sorting unit is used to: determine an initial index sequence of each byte in the round encryption subkey and the plaintext data, and generate an obfuscation index sequence based on the initial index sequence; and reorder each byte in the round encryption subkey and the plaintext data according to the obfuscation index sequence to achieve obfuscation sorting of each byte in the round encryption subkey and the plaintext data.
[0020] Furthermore, in some embodiments, the user identification card includes a byte encryption order obfuscation module, and the obfuscation sorting unit is used to: control the byte encryption order obfuscation module to generate an obfuscated random number; and reorder the initial index sequence by the obfuscated random number to obtain an obfuscated index sequence.
[0021] Furthermore, in some embodiments, the obfuscation sorting unit is used to: obtain the current system time; input the current system time into the byte encryption order obfuscation module, so that the random number generator in the byte encryption order obfuscation module generates the obfuscated random number based on the current system time.
[0022] Furthermore, in some embodiments, the obfuscation sorting unit is used to: obtain electrical signal noise; input the electrical signal noise into the byte encryption order obfuscation module, so that the random number generator in the byte encryption order obfuscation module generates the obfuscated random number based on the electrical signal noise.
[0023] Furthermore, in some embodiments, except for the last round of round encryption process, the remaining round encryption operations include a row shift operation, a column confusion operation and a round key addition operation; the remaining round encryption unit is used to: sequentially perform the row shift operation, the column confusion operation and the round key addition operation on the second intermediate encryption state after the byte replacement operation to obtain the encrypted ciphertext data.
[0024] Furthermore, in some embodiments, for the last round of the round encryption process, the remaining round encryption operations include a row shift operation and a round key addition operation; the remaining round encryption unit is used to: sequentially perform the row shift operation and the round key addition operation on the second intermediate encryption state after the byte replacement operation to obtain the encrypted ciphertext data.
[0025] Furthermore, in some embodiments, for the initial round encryption process, the encryption device resistant to side-channel attacks further includes an initial round key adding unit, which can be used to perform round key adding operations on the round encryption subkey and the plaintext data.
[0026] Further, in some embodiments, the trusted root key includes an authentication key, and the key generation module can be used to: perform a key expansion operation on the authentication key to obtain a key expansion matrix; and determine the round encryption subkey of each round of the round encryption process based on the key expansion matrix.
[0027] The embodiment of this specification also provides a user identification card, the user identification card comprising:
[0028] A key generation module, used to read a pre-stored trusted root key and generate a round encryption subkey according to the trusted root key;
[0029] The round encryption module is used to perform multiple rounds of round encryption on the plaintext data to be encrypted using the round encryption subkey, and perform encryption operations and hide the round encryption subkey and the plaintext data during the round encryption process to obtain encrypted ciphertext data.
[0030] Furthermore, in some embodiments, the user identification card also includes a byte encryption order obfuscation module, which is used to obfuscate the round encryption subkey and each byte in the plaintext data; the round encryption module is used to perform the byte replacement operation on the obfuscated round encryption subkey and the plaintext data to obtain a first intermediate encryption state; the byte encryption order obfuscation module is used to reverse the obfuscated order of the first intermediate encryption state to restore it to obtain a second intermediate encryption state after the byte replacement operation; the round encryption module is used to perform the remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain ciphertext data after one round of encryption.
[0031] The embodiment of this specification also provides an electronic device, including a user identification card and a power supply circuit in the embodiment of this specification; wherein the power supply circuit supplies power to the user identification card so that the user identification card executes the steps of the encryption method for resisting side channel attacks in the embodiment of this specification.
[0032] The embodiments of the present specification also provide a computer program product, wherein the computer program product stores at least one instruction, and the at least one instruction is suitable for being loaded by a processor and executing the encryption method steps for resisting side-channel attacks in the embodiments of the present specification.
[0033] The embodiments of the present specification also provide a storage medium, wherein the storage medium stores a computer program, wherein the computer program is suitable for being loaded by a processor and executing the steps of the encryption method for resisting side-channel attacks in the embodiments of the present specification.
[0034] The embodiments of the present specification also provide a terminal device, including: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the encryption method for resisting side channel attacks in the embodiments of the present specification.
[0035] In the embodiment of the present specification, by reading the pre-stored trusted root key and generating the round encryption subkey according to the trusted root key, the round encryption subkey can be used to perform multiple rounds of round encryption on the plaintext data to be encrypted, and the round encryption subkey and the plaintext data are encrypted and hidden during the round encryption process to obtain the encrypted ciphertext data. On the one hand, by generating the round encryption subkey through the trusted root key, the number of times the trusted root key is used in the encryption process can be reduced, the possibility of being extracted can be reduced, and the security of the user identification card can be improved. Then, the round encryption subkey is used to perform multiple rounds of round encryption on the plaintext data to be encrypted, thereby improving the security of the encrypted ciphertext data; on the other hand, the round encryption subkey and the plaintext data are encrypted and hidden during the round encryption process, so that the leaked information generated during the encryption process, such as the power consumption information of the software or hardware when performing the encryption operation, will not have statistical characteristics related to the trusted root key, thereby reducing the possibility of the attacker extracting the trusted root key of the user identification card from the leaked information, effectively resisting the side channel attack, further improving the security of the user identification card, and thus ensuring the privacy of user data and property security. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A schematic diagram of a flow chart of an encryption method for resisting side channel attacks is provided for the embodiments of this specification;
[0037] Figure 2 A schematic diagram of a process for hiding the encryption operation of round encryption subkeys and plaintext data provided in an embodiment of this specification;
[0038] Figure 3 A schematic diagram of a process for obfuscating and sorting bytes in round encryption subkeys and plaintext data provided in an embodiment of this specification;
[0039] Figure 4A schematic diagram of a process for encrypting plaintext data to resist side channel attacks provided in an embodiment of this specification;
[0040] Figure 5 A schematic diagram of the structure of a user identification card provided in an embodiment of this specification;
[0041] Figure 6 A schematic diagram of the structure of an encryption device that resists side channel attacks provided in an embodiment of this specification;
[0042] Figure 7 A schematic diagram of the structure of a terminal device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0044] See also Figure 1 , which is a flowchart of an encryption method for resisting side channel attacks in an embodiment of this specification. In the embodiment of this specification, the encryption method for resisting side channel attacks can be applied to a user identification card or a user identification device, or can be applied to an encryption device for resisting side channel attacks provided with a user identification card or an electronic device equipped with a user identification card or an encryption device for resisting side channel attacks, and this exemplary embodiment does not make any special restrictions on this. Figure 1 The process shown is described in detail. The encryption method for resisting side channel attacks in the embodiment of this specification may specifically include the following steps:
[0045] Step S102, reading a pre-stored trusted root key, and generating a round encryption subkey according to the trusted root key;
[0046] Step S104, performing multiple rounds of round encryption processes on the plaintext data to be encrypted using the round encryption subkey, and performing encryption operations and hiding on the round encryption subkey and the plaintext data during the round encryption process to obtain encrypted ciphertext data.
[0047] According to the encryption method for resisting side-channel attacks in the embodiments of this specification, on the one hand, by generating round encryption subkeys through a trusted root key, the number of times the trusted root key is used in the encryption process can be reduced, the possibility of being extracted can be reduced, and the security of the user identification card can be improved. Then, the round encryption subkeys are used to perform multiple rounds of round encryption on the plaintext data to be encrypted, thereby improving the security of the encrypted ciphertext data; on the other hand, during the round encryption process, the round encryption subkeys and plaintext data are encrypted and hidden. In this way, the leaked information generated during the encryption process, such as the power consumption information of the software or hardware when performing the encryption operation, will not have statistical characteristics related to the trusted root key, thereby reducing the possibility of an attacker extracting the trusted root key of the user identification card from the leaked information, further improving the security of the user identification card, and thereby ensuring the privacy of user data and the security of property.
[0048] The following is a detailed description of the encryption method for resisting side channel attacks provided in the embodiments of this specification.
[0049] In step S102, a pre-stored trusted root key is read, and a round encryption subkey is generated according to the trusted root key.
[0050] In an example embodiment of the present specification, the trusted root key refers to the key pre-set by the operator in the SIM card for encrypting and transmitting data. For example, the trusted root key can be an authentication key (Key identifier, Ki), or an operator root key (Operator Variant Algorithm Configuration Field, OP), or a new authentication key OPc calculated by the authentication key Ki and the operator root key OP; of course, the trusted root key can also be a combination of two or more keys, and the present embodiment is not limited to this. The following description will take the trusted root key as a combination of the authentication key Ki and the authentication key OPc as an example.
[0051] The AES algorithm is a common symmetric encryption algorithm. A symmetric encryption algorithm means that the encryption process and the decryption process use the same key. For example, plaintext data can generate ciphertext data through a trusted root key on the user identification card SIM side. After receiving the ciphertext data, the base station or authentication center on the network side can perform a reverse encryption process on the ciphertext data based on the same trusted root key to complete the decryption and obtain the plaintext data. The AES algorithm generally uses block encryption, which is to group the plaintext data into multiple plaintext blocks, each of which has the same length. Each encryption is performed to encrypt a plaintext block until the entire plaintext data is encrypted, which is a round encryption process. In the standard specification of the AES algorithm, the block length of plaintext data can only be 128 bits, that is, the block length of each plaintext block is 16 bytes (8 bits per byte). The key length can be 128 bits, 192 bits, or 256 bits. Different key lengths have different recommended encryption rounds. For example, AES-128 can use 10 encryption rounds, AES-192 can use 12 encryption rounds, and AES-256 can use 14 encryption rounds. For ease of explanation, the following description will take the AES-128 algorithm with a key length of 128 bits as an example.
[0052] The round encryption subkey refers to the extended key obtained by expanding the trusted root key, which is used to participate in the round encryption process. The number of round encryption subkeys is generally the number of encryption rounds plus 1. For example, taking the AES-128 algorithm as an example, the recommended number of encryption rounds is generally 10 rounds, then the trusted root key can be expanded to obtain 11 round encryption subkeys, and the length of each round encryption subkey is 128 bits.
[0053] For example, the key expansion process of the trusted root key can use the Rijndael key expansion algorithm to expand the trusted root key into several round encryption sub-keys. The key expansion process can include cyclic exclusive OR (XOR) of round key words, the addition of round constants (Round Constants) and word shift (Shift Rows) operations; of course, other key expansion algorithms can also be used to expand the trusted root key to obtain round encryption sub-keys. This example embodiment does not specifically limit the method of expanding the trusted root key to obtain round encryption sub-keys.
[0054] The trusted root key is usually pre-set directly into the storage module of the SIM card when the SIM card is produced by the manufacturer. The SIM card can be installed in electronic devices such as smart phones and IoT devices. The electronic devices supply power to the SIM card. At this time, the SIM card can achieve certain encryption computing capabilities through its pre-set logic processing circuit. When it is detected that encrypted data needs to be transmitted, the SIM card can read the trusted root key pre-stored in the storage module and use it for related encryption operations, such as expanding the trusted root key to obtain round encryption subkeys.
[0055] In step S104, the plaintext data to be encrypted is subjected to a multi-round round encryption process using the round encryption subkey, and encryption operations are performed on the round encryption subkey and the plaintext data during the round encryption process to hide the encrypted ciphertext data.
[0056] In an example embodiment of this specification, plaintext data refers to relevant data that needs to be communicated with the network side. For example, the plaintext data can be a random challenge (RAND) forwarded by a base station on the network side, or an authentication request initiated by the SIM card side, a response (RES) generated, or some key materials used for communication. This example embodiment does not specifically limit the data type of the plaintext data to be encrypted. The plaintext data in this embodiment can be the full amount of plaintext data, or it can be a grouping of the full amount of plaintext data into multiple plaintext blocks, without limitation thereto.
[0057] Cryptographic operation hiding refers to the process of hiding cryptographic operations that may leak information during the encryption of plaintext data. For the power consumption curve collected during the round encryption of plaintext data by an electronic device equipped with a SIM card, each sampling point on it represents the power consumption caused by a specific operation and a specific operand, and there is a dependency relationship between the two. In a side channel attack, when a trusted root key is obtained by analyzing multiple power consumption curves, it is actually a statistical analysis of the power consumption change characteristics caused by a fixed specific operation and operand. This means that when analyzing, it is necessary to first extract the power consumption value corresponding to the same specific operation and operand from each power consumption curve before analysis. Since the encryption algorithm is always executed in a specific order, it is only necessary to align the power consumption curve according to a certain pattern to ensure that each power consumption sampling point at the same time corresponds to the same specific operation and operand, thereby extracting the trusted root key of the SIM card. Cryptographic operation hiding can eliminate the statistical characteristics of the power consumption curve with specific operations and specific operands, so that the leakage information caused by software or hardware such as the power consumption curve does not contain the relevant statistical characteristics of the encryption operation.
[0058] For example, encryption operation hiding can be achieved by reordering the encryption subkey and plaintext data in each round of encryption and performing the corresponding encryption operation, and restoring the data processing process after the corresponding encryption operation is performed in the reordered order. In this way, when an attacker performs a side channel attack, he cannot extract the trusted root key by aligning the statistical characteristics of the power consumption curve to analyze the sampling points, and effectively hides the statistical characteristics related to the encryption operation in the power consumption curve and other information, thereby reducing the possibility of leakage of the trusted root key due to information such as the power consumption curve, and improving the security of the SIM card.
[0059] Hiding the encryption operation can be a process of adding additional random calculation operations while performing the encryption operation in the round encryption process, or a built-in interference noise module in the SIM card is used to generate random operation noise in the process of performing the encryption operation in the round encryption process. By adding additional random calculation operations when performing encryption operations, such as performing XOR operations, multiplication and addition operations on the generated random numbers, the sampling points on the leaked power consumption curve are not associated with the encryption operation and the operands, thereby reducing the possibility of leaking the trusted root key due to information such as the power consumption curve, and improving the security of the SIM card.
[0060] Of course, encryption operation hiding may also be other types of processing procedures that can achieve hiding of encryption operations and operands in the round encryption process, and the embodiments of this specification do not specifically limit this.
[0061] By generating round encryption subkeys through a trusted root key, the number of times the trusted root key is used in the encryption process can be reduced, the possibility of being extracted can be reduced, and the security of the user identification card can be improved. Then, the plaintext data to be encrypted can be subjected to multiple rounds of round encryption processes through the round encryption subkeys, thereby improving the security of the encrypted ciphertext data. By performing encryption operations on the round encryption subkeys and plaintext data during the round encryption process, the leaked information generated during the encryption process, such as the power consumption information of the software or hardware when performing encryption operations, will not have statistical characteristics related to the trusted root key, thereby reducing the possibility of an attacker extracting the trusted root key of the user identification card from the leaked information, further improving the security of the user identification card, and thereby ensuring the privacy of user data and property security.
[0062] Next, step S102 and step S104 are described in detail.
[0063] In an example embodiment of the present specification, the trusted root key may include an authentication key (Ki) and an operator authentication key (OPc). Specifically, the following steps may be used to generate a round encryption subkey based on the trusted root key, specifically including:
[0064] A key expansion operation may be performed on the authentication key to obtain a key expansion matrix, and a round encryption subkey of each round of the round encryption process may be determined based on the key expansion matrix.
[0065] For example, the authentication key can be a 128-bit key, which can be represented as a 4*4 key matrix. Then, the 4 bytes in each column of the 4*4 key matrix can be combined into a word. The 4 words in the 4 columns of the key matrix are represented as W[0], W[1], W[2] and W[3], forming an array W in word units. Then, the array W can be expanded with 40 new columns to form a key expansion matrix with a total of 44 columns. The new columns can be generated by the following recursive method:
[0066] If the number of columns i is not a multiple of 4, then the i-th column can be determined by equation (1):
[0067]
[0068] If the number of columns i is a multiple of 4, then the i-th column can be determined by equation (2):
[0069]
[0070] Among them, T can represent a function, and function T can be composed of a word rotation operation, a byte substitution operation and a round constant XOR operation; among them, the word rotation operation refers to an operation operation of rotating 4 bytes in a word to the left by 1 byte. For example, the input word [b0, b1, b2, b3] can be transformed into [b1, b2, b3, b0] through a word rotation operation; the byte substitution operation refers to an operation operation of performing byte substitution on the result after the word rotation operation using a standard S box (Substitution Box); the round constant XOR operation refers to an operation operation of performing an XOR operation on the result after the byte substitution operation with the round constant.
[0071] After obtaining the 4*44 key expansion matrix W, the round encryption subkey (k0-k10) of each round of the round encryption process can be obtained by sequentially taking 4*4 matrices in the key expansion matrix W.
[0072] In an example embodiment of this specification, when plaintext data is encrypted by the AES algorithm, it can be implemented through a multi-round round encryption process. The general round encryption process may include a byte substitution operation (SubBytes), a row shift operation (ShiftRows), a column confusion operation (MixColumns) and a round key addition operation (Add Round Key). Among them:
[0073] The byte substitution operation refers to an encryption operation that replaces each byte (8 bits) in the input data matrix one-to-one by looking up a fixed standard S-box. The standard S-box provides non-linear obfuscation, which greatly increases the difficulty of cryptanalysis.
[0074] The row shift operation refers to an encryption operation that circularly shifts each row in the data matrix after the byte replacement operation to the left according to different offsets. For example, the first row in the data matrix can be kept unchanged, the second row can be shifted left by 1 byte, the third row can be shifted left by 2 bytes, and the fourth row can be shifted left by 3 bytes.
[0075] The column confusion operation refers to applying a fixed multiplication operation to each column in the data matrix after the row shift operation, forming a linear diffusion confusion encryption operation to ensure that a change in one byte can affect the state of the entire data matrix.
[0076] The round key addition operation refers to an encryption operation of performing a bit-by-bit exclusive OR (XOR) operation on each byte in the data matrix after the column confusion operation and the byte of the round encryption subkey corresponding to the current round number, further integrating the key information into the encryption process.
[0077] For example, before the plaintext data to be encrypted is encrypted by AES, the plaintext data to be encrypted can be grouped to obtain multiple plaintext data blocks with a length of 16 bytes, and then the trusted root key can be expanded to obtain multiple round encryption subkeys (such as k0-k10). Taking the length of the trusted root key as 128 bits as an example, a 10-round round encryption process can be used to encrypt the plaintext data block to obtain the encrypted ciphertext data. Specifically, before starting the 10-round round encryption process, the plaintext data can be subjected to an initial round encryption process, that is, the plaintext data and the round encryption subkey (k0) are subjected to an initial round key addition operation to achieve a preliminary combination of the plaintext data and the key; then the obtained data matrix is subjected to a subsequent 10-round round encryption process to obtain the ciphertext data. Among the 10-round round encryption process, only the last round encryption process has no column confusion operation, and the remaining round encryption processes all perform byte substitution operations, row shift operations, column confusion operations, and round key addition operations in sequence.
[0078] Specifically, for the initial round encryption process, the round encryption subkey (k0) and the plaintext data may be subjected to round key addition operations; for the last round encryption process, it may include byte replacement operations, row shift operations, and round key addition operations; for the intermediate round encryption processes, it may include byte replacement operations, row shift operations, column confusion operations, and round key addition operations.
[0079] Optionally, except for the initial round encryption process, the remaining round encryption processes may include at least a byte substitution operation; Figure 2 The steps in the above code are used to encrypt the round encryption subkey and plaintext data and obtain the encrypted ciphertext data. Figure 2 As shown, it may specifically include:
[0080] Step S202, performing obfuscated sorting on the round encryption subkey and each byte in the plaintext data, and performing the byte replacement operation on the obfuscated and sorted round encryption subkey and plaintext data to obtain a first intermediate encryption state;
[0081] Step S204, performing a reverse order of the obfuscation sorting on the first intermediate encrypted state, and restoring the first intermediate encrypted state after the byte replacement operation;
[0082] Step S206, performing the remaining rounds of encryption operations on the second intermediate encrypted state after the byte replacement operation to obtain ciphertext data after one round of encryption.
[0083] Among them, obfuscation sorting refers to the process of rearranging the bytes in the round encryption subkey and plaintext data in a random order. After the bytes in the round encryption subkey and plaintext data are obfuscated and sorted, when the byte replacement operation is performed on the obfuscated and sorted round encryption subkey and plaintext data, the power consumption information generated by the byte replacement operation will not contain statistical information related to the round encryption subkey. By obfuscating and sorting the bytes in the round encryption subkey and plaintext data in each round of round encryption, attackers will not be able to align the power consumption curve, nor can they obtain statistical features related to the trusted root key through power consumption curve analysis, effectively improving the security of the trusted root key in the SIM card.
[0084] The first intermediate encryption state refers to the data result of performing a byte replacement operation on the round encryption subkey and the plaintext data after the obfuscation sorting. The second intermediate encryption state refers to the intermediate encryption state obtained by reversing the obfuscation sorting of the first intermediate encryption state. It should be noted that the "first" and "second" in the "first intermediate encryption state" and "second intermediate encryption state" here are only used to distinguish the intermediate data results obtained by different processing processes, and do not have any special meaning, and should not cause any special limitation to this example embodiment.
[0085] After obtaining the first intermediate encryption state, the first intermediate encryption state can be arranged in reverse order of the obfuscation sorting to restore the second intermediate encryption state after the byte replacement operation. This can ensure that the second intermediate encryption state after the byte replacement operation complies with the AES algorithm process, and the remaining rounds of encryption operations can be performed according to the original encryption process, avoiding the situation where subsequent encryption operations are executed incorrectly due to the obfuscation sorting.
[0086] By performing obfuscated sorting and restoration of the obfuscated sorting on the plaintext data before and after the byte replacement operation, the possibility of leakage of the trusted root key caused by the byte replacement operation during the round encryption process can be effectively reduced. By performing byte replacement operations on the obfuscated plaintext data, the power consumption information generated during the byte replacement operation can be made to have no direct association with the trusted root key, which destroys the possible statistical characteristics or fixed encryption rules of the byte replacement operation in the time dimension, reducing the possibility of extracting the trusted root key from the power consumption information; and in each round of round encryption, the byte replacement operation part is obfuscated and sorted, reducing the possibility of attackers aligning and analyzing the trusted root key from the power consumption information generated by the previous and subsequent rounds of round encryption processes, further improving the security of the SIM card.
[0087] The usual power consumption side channel attack method wants to extract the trusted root key from the SIM card, which is mainly obtained by collecting the power consumption curve generated when the AES encryption algorithm is executed for the first time in the AKA process for analysis. More specifically, the power consumption curve generated during the first round (a total of 10 rounds) and the second round of AES encryption is collected (the round encryption subkey involved in the encryption process is the closest to the trusted root key at this time, for details, see the trusted root key extension part in the embodiment of this specification). In order to achieve the purpose, it is necessary to collect enough power consumption curves. When analyzing, it is in the time dimension to match the changes in power consumption on different curves at the same time, so as to determine the correct trusted root key, which means that strict alignment between power consumption curves is the key to obtaining the trusted root key. In this embodiment, the plaintext data of the byte replacement operation and the round encryption subkey are confused and sorted at the byte replacement operation that is most easily analyzed in each round of encryption, so that the power consumption curve corresponding to the byte replacement operation has no statistical characteristics, and it is impossible to obtain data related to the trusted root key based on the power consumption curve.
[0088] In an exemplary embodiment of this specification, it is possible to Figure 3 The steps in the above code implement the obfuscated sorting of bytes in the round encryption subkey and plaintext data, refer to Figure 3 As shown, it may specifically include:
[0089] Step S302, determining the initial index sequence of each byte in the round encryption subkey and the plaintext data, and generating an obfuscated index sequence based on the initial index sequence;
[0090] Step S304: reorder the round encryption subkey and each byte in the plaintext data according to the obfuscation index sequence to achieve obfuscation ordering of the round encryption subkey and each byte in the plaintext data.
[0091] Among them, the obfuscated index sequence refers to an index sequence used to obfuscate and sort the bytes in the round encryption sub-key and the plaintext data. For example, the obfuscated index sequence can be obtained by randomly arranging the initial index sequence, or the obfuscated index sequence can be obtained by reordering the initial index sequence according to a specific shift operation. The embodiments of this specification do not specifically limit the method for generating the obfuscated index sequence based on the initial index sequence.
[0092] After obtaining the obfuscation index sequence, the bytes in the round encryption subkey and the plaintext data can be reordered according to the obfuscation index sequence to achieve obfuscation ordering of the bytes in the round encryption subkey and the plaintext data.
[0093] An obfuscated index sequence is generated through an initial index sequence, and then the obfuscated index sequence can be used to implement obfuscated sorting of each byte in the round-encrypted subkey and the plaintext data, thereby improving the security of the trusted root key in the SIM card; at the same time, compared with directly randomly reordering each byte in the round-encrypted subkey and the plaintext data, the obfuscated index sequence generated by the initial index sequence is used to reorder each byte in the round-encrypted subkey and the plaintext data. After the byte replacement operation is performed, the output result after the byte replacement operation can be reversed according to the obfuscated index sequence, thereby improving the efficiency of reverse restoration of the output result after the byte replacement operation, reducing the difficulty of reverse restoration, and reducing the amount of calculation generated during obfuscated sorting and reverse obfuscated sorting.
[0094] In an optional embodiment, the user identification card may include a byte encryption order obfuscation module, and the following steps may be performed to generate an obfuscated index sequence based on the initial index sequence:
[0095] The byte encryption order obfuscation module can be controlled to generate obfuscated random numbers, and the initial index sequence is reordered by the obfuscated random numbers to obtain an obfuscated index sequence.
[0096] Among them, the byte encryption order obfuscation module refers to a calculation module preset in the SIM card for reordering or reversely restoring the bytes in the round encryption subkey and plaintext data. The byte encryption order obfuscation module can realize the obfuscated sorting function of the round encryption subkey and plaintext data, and can also realize the reverse obfuscation sorting function of restoring the byte order of the round encryption subkey and plaintext data after the byte replacement operation.
[0097] The generation of an obfuscated index sequence based on an initial index sequence can be achieved through a byte encryption order obfuscation module. For example, the byte encryption order obfuscation module can be composed of a random number generator, and the initial index sequence can be a sequence composed of index numbers from 0 to 15. The index numbers from 0 to 15 can be randomly arranged by a random number generator, and the initial index sequence can be rearranged according to the index numbers generated by the random arrangement to obtain an obfuscated index sequence; of course, the index numbers in the initial index sequence can also be randomly arranged in other ways to obtain an obfuscated index sequence. The embodiment of this specification does not specifically limit the method of randomly arranging the initial index sequence to generate an obfuscated index sequence.
[0098] Optionally, the following steps may be used to control the byte encryption order obfuscation module to generate an obfuscated random number, which may specifically include:
[0099] The current system time can be obtained and input into the byte encryption order obfuscation module, so that the random number generator in the byte encryption order obfuscation module generates an obfuscated random number based on the current system time. The current system time refers to the system time when the electronic device equipped with the SIM card performs round encryption on the plaintext data, and the obfuscated random number used to reorder the initial index sequence is obtained by inputting the current system time into the random number generator of the byte encryption order obfuscation module.
[0100] By using the current system time as the seed data of the random number generator, the randomness of the obfuscated random numbers can be effectively improved, the predictability of the obfuscated random numbers can be reduced, and the trusted root key of the SIM card is not easily leaked during the encryption process, thereby improving the security of the trusted root key of the SIM card.
[0101] Optionally, the following steps may be used to control the byte encryption order obfuscation module to generate an obfuscated random number, which may specifically include:
[0102] The electrical signal noise can be obtained and input into the byte encryption order obfuscation module, so that the random number generator in the byte encryption order obfuscation module generates an obfuscated random number based on the electrical signal noise. The electrical signal noise refers to the electrical signal generated by a module randomly selected during the operation of the SIM card or an electronic device equipped with the SIM card. For example, the electrical signal noise can be a voltage signal of a microprocessor or processor of the SIM card or an electronic device equipped with the SIM card during the operation, or it can be a current signal, or it can be a captured electromagnetic field interference signal. The embodiments of this specification do not specifically limit the type of electrical signal noise.
[0103] By using electrical signal noise as the seed data of the random number generator, the randomness of the obfuscated random numbers can be effectively improved, the predictability of the obfuscated random numbers can be reduced, and the trusted root key of the SIM card is not easily leaked during the encryption process, thereby improving the security of the trusted root key of the SIM card.
[0104] Figure 4 A schematic diagram of a process for encrypting plaintext data to resist side-channel attacks provided in an embodiment of this specification.
[0105] refer to Figure 4 As shown, the operator authentication key Opc 401 and the plaintext data block 402 obtained by grouping the plaintext data can be merged, for example, by an XOR operation, and then the authentication key Ki 403 can be expanded to obtain multiple round encryption subkeys k0-k10 to complete the preprocessing operation of AES encryption.
[0106] The AES-128 encryption of the plaintext data block 402 may include an initial round encryption and 10 rounds of round encryption, wherein the initial round encryption may perform a round key addition operation on the data matrix after the operator authentication key Opc 401 and the plaintext data block 402 are initially merged, and the round encryption subkey k0, so as to achieve the initial fusion of the data matrix and the round encryption subkey k0, and the data matrix obtained at this time already contains the operator authentication key Opc 401, the plaintext data and the authentication key Ki 403. For the 10 rounds of round encryption, except for the last round of round encryption, the remaining 9 rounds of round encryption process may include byte substitution operation, row shift operation, column confusion operation and round key addition operation executed in sequence, and the last round of round encryption process has less column confusion operation than the remaining 9 rounds of round encryption process.
[0107] For the 10-round round encryption process, before the byte replacement operation of each round decryption process, the initial index sequence of each byte of the operator authentication key Opc401, the plaintext data block 402 and the round encryption subkey can be reordered based on the obfuscated random number generated by the byte encryption order obfuscation module 404 to obtain the obfuscated index sequence, and then the order of each byte of the operator authentication key Opc 401, the plaintext data block 402 and the round encryption subkey is reordered through the obfuscated index sequence to achieve byte obfuscation, and then the byte reordering result is subjected to the byte replacement operation, and the output result after the byte replacement operation is reversely sorted to achieve reverse byte obfuscation, so as to restore the initial order of each byte of the operator authentication key Opc401, the plaintext data block 402 and the round encryption subkey. In this way, while ensuring that the accuracy of subsequent encryption operations is not affected, the possibility of the power consumption curve causing the byte replacement operation leaking the trusted root key can be effectively reduced, and the statistical characteristics existing in the power consumption curve can be broken in the time dimension, so that attackers cannot obtain the trusted root key in the SIM card by aligning the power consumption curve analysis, effectively improving the security of the trusted root key in the SIM card and ensuring the security of the user's privacy data and property.
[0108] In addition, the embodiment of this specification also provides a user identification card, Figure 5 FIG. 1 shows a schematic diagram of the structure of a user identification card provided in an embodiment of this specification. Figure 5 As shown, the user identification card 500 in the embodiment of this specification may include a key expansion module 510 and a round encryption module 520. Among them:
[0109] The key expansion module 510 may be used to read a pre-stored trusted root key and generate a round encryption subkey according to the trusted root key;
[0110] The round encryption module 520 may be used to perform multiple rounds of round encryption on the plaintext data to be encrypted using the round encryption subkey, and perform encryption operations and hide the round encryption subkey and the plaintext data during the round encryption process to obtain encrypted ciphertext data.
[0111] In an optional embodiment of the present specification, the user identification card 500 may further include a byte encryption order obfuscation module 530, and the byte encryption order obfuscation module 530 may be used to obfuscate and sort the bytes in the round encryption subkey and the plaintext data;
[0112] The round encryption module 520 may be configured to perform the byte substitution operation by obfuscating the sorted round encryption subkeys and the plaintext data to obtain a first intermediate encryption state;
[0113] The byte encryption order obfuscation module 530 may be used to reverse the obfuscation order of the first intermediate encryption state to restore the second intermediate encryption state after the byte replacement operation;
[0114] The round encryption module 520 may be used to perform the remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain ciphertext data after one round of encryption.
[0115] The above-mentioned user identification card embodiment corresponds to the method embodiment, and the specific description can refer to the description of the method embodiment part, which will not be repeated here. The user identification card embodiment is obtained based on the corresponding method embodiment, and has the same technical effect as the corresponding method embodiment, and the specific description can refer to the corresponding method embodiment.
[0116] See also Figure 6 , is a schematic diagram of the structure of a device for optimizing a certificate anti-counterfeiting system provided in an embodiment of this specification. Figure 6 As shown, the encryption device 600 for resisting side channel attacks can be implemented as all or part of an electronic device through software, hardware, or a combination of both. According to some embodiments, the encryption device 600 for resisting side channel attacks includes a key generation module 610 and an encryption operation hiding module 620, which may specifically include:
[0117] The key generation module 610 is used to read the pre-stored trusted root key and generate a round encryption subkey according to the trusted root key;
[0118] The encryption operation hiding module 620 is used to perform multiple rounds of round encryption on the plaintext data to be encrypted using the round encryption subkey, and perform encryption operation hiding on the round encryption subkey and the plaintext data during the round encryption process to obtain encrypted ciphertext data.
[0119] In an optional embodiment of the present specification, in addition to the initial round encryption process, the round encryption process includes at least a byte replacement operation; the encryption operation hiding module 620 may include:
[0120] a confusion sorting unit, configured to perform confusion sorting on the round encryption subkey and each byte in the plaintext data, and perform the byte replacement operation on the round encryption subkey and the plaintext data after the confusion sorting, so as to obtain a first intermediate encryption state;
[0121] an obfuscation restoration unit, configured to perform a reverse order of the obfuscation sorting on the first intermediate encrypted state, and restore the first intermediate encrypted state to obtain a second intermediate encrypted state after a byte replacement operation;
[0122] The remaining round encryption unit is used to perform remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain ciphertext data after one round of encryption.
[0123] In an optional embodiment of the present specification, the obfuscation sorting unit is used to:
[0124] Determine the round encryption subkey and the initial index sequence of each byte in the plaintext data, and generate an obfuscated index sequence based on the initial index sequence;
[0125] The bytes in the round encryption subkey and the plaintext data are reordered according to the obfuscation index sequence to achieve obfuscation ordering of the bytes in the round encryption subkey and the plaintext data.
[0126] In an optional embodiment of the present specification, the user identification card includes a byte encryption order obfuscation module, and the obfuscation ordering unit is used to:
[0127] Controlling the byte encryption order obfuscation module to generate an obfuscated random number;
[0128] The initial index sequence is reordered using the obfuscated random number to obtain an obfuscated index sequence.
[0129] In an optional embodiment of the present specification, the obfuscation sorting unit is used to:
[0130] Get the current system time;
[0131] The current system time is input into the byte encryption order obfuscation module, so that a random number generator in the byte encryption order obfuscation module generates the obfuscated random number based on the current system time.
[0132] In an optional embodiment of the present specification, the obfuscation sorting unit is used to:
[0133] Acquire electrical signal noise;
[0134] The electrical signal noise is input into the byte encryption order obfuscation module, so that a random number generator in the byte encryption order obfuscation module generates the obfuscated random number based on the electrical signal noise.
[0135] In an optional embodiment of the present specification, except for the round encryption process of the last round, the remaining round encryption operations include a row shift operation, a column confusion operation and a round key addition operation; the remaining round encryption units are used to:
[0136] The row shift operation, the column confusion operation and the round key addition operation are sequentially performed on the second intermediate encrypted state after the byte replacement operation to obtain encrypted ciphertext data.
[0137] In an optional embodiment of the present specification, for the last round of round encryption process, the remaining round encryption operations include a row shift operation and a round key addition operation; the remaining round encryption unit is used to:
[0138] The row shift operation and the round key addition operation are sequentially performed on the second intermediate encrypted state after the byte replacement operation to obtain encrypted ciphertext data.
[0139] In an optional embodiment of the present specification, for the initial round encryption process, the encryption device 600 for resisting side channel attacks further includes an initial round key adding unit, which can be used to:
[0140] A round key addition operation is performed on the round encryption subkey and the plaintext data.
[0141] In an optional embodiment of the present specification, the trusted root key includes an authentication key, and the key generation module 610 can be used to:
[0142] Performing a key expansion operation on the authentication key to obtain a key expansion matrix;
[0143] A round encryption subkey of each round of the round encryption process is determined based on the key expansion matrix.
[0144] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0145] The embodiments of this specification also provide a computer storage medium, which can store multiple instructions. The instructions are suitable for being loaded by a processor and executing the encryption method for resisting side channel attacks recorded in the embodiments of this specification. The specific execution process can be found in the specific description of the embodiment of the encryption method for resisting side channel attacks, which will not be repeated here.
[0146] The present specification also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded by a processor and executes the encryption method for resisting side channel attacks recorded in the embodiments of the present specification. The specific execution process can be found in the specific description of the embodiment of the encryption method for resisting side channel attacks, which will not be repeated here.
[0147] The present specification also provides an electronic device, which may include a user identification card and a power supply circuit in the embodiments of the present specification; wherein the power supply circuit supplies power to the user identification card so that the user identification card executes the steps of the encryption method for resisting side channel attacks in the embodiments of the present specification. The specific execution process can be found in the specific description of the encryption method for resisting side channel attacks in the embodiments, which will not be repeated here.
[0148] The embodiments of this specification also provide Figure 7 The schematic diagram of the terminal device is shown in FIG. Figure 7 At the hardware level, the terminal device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-mentioned voice activity detection method.
[0149] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0150] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0151] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0152] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0153] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0154] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0155] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0156] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0157] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0158] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0159] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0160] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0161] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0162] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0163] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0164] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0165] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. An encryption method for resisting side channel attacks, applied to a user identification card, the method comprising: Reading a pre-stored trusted root key, and generating a round encryption subkey according to the trusted root key; The round encryption subkey is used to perform multiple rounds of round encryption on the plaintext data to be encrypted, and during the round encryption process, the round encryption subkey and the plaintext data are encrypted and hidden to obtain encrypted ciphertext data.
2. The encryption method for resisting side channel attacks according to claim 1, wherein, in addition to the initial round encryption process, the round encryption process at least includes a byte substitution operation; The step of performing an encryption operation on the round encryption subkey and the plaintext data to obtain encrypted ciphertext data includes: Obfuscating and sorting the bytes in the round encryption subkey and the plaintext data, and performing the byte replacement operation on the obfuscated and sorted round encryption subkey and the plaintext data to obtain a first intermediate encryption state; Arrange the first intermediate encrypted state in reverse order of the obfuscation sorting to restore the first intermediate encrypted state after the byte replacement operation; The remaining rounds of encryption operations are performed on the second intermediate encrypted state after the byte replacement operation to obtain ciphertext data after one round of encryption.
3. According to the encryption method for resisting side channel attacks in claim 2, the step of confusing and sorting the bytes in the round encryption subkey and the plaintext data comprises: Determine the initial index sequence of each byte in the round encryption subkey and the plaintext data, and generate an obfuscated index sequence based on the initial index sequence; The bytes in the round encryption subkey and the plaintext data are reordered according to the obfuscation index sequence to achieve obfuscation ordering of the bytes in the round encryption subkey and the plaintext data.
4. According to the encryption method for resisting side channel attacks of claim 3, the user identification card includes a byte encryption order obfuscation module, and the generating of the obfuscated index sequence based on the initial index sequence includes: Controlling the byte encryption order obfuscation module to generate an obfuscated random number; The initial index sequence is reordered using the obfuscated random number to obtain an obfuscated index sequence.
5. According to the encryption method for resisting side channel attacks of claim 4, the step of controlling the byte encryption order obfuscation module to generate an obfuscated random number comprises: Get the current system time; The current system time is input into the byte encryption order obfuscation module, so that a random number generator in the byte encryption order obfuscation module generates the obfuscated random number based on the current system time.
6. According to the encryption method for resisting side channel attacks in claim 4, the step of controlling the byte encryption order obfuscation module to generate an obfuscated random number comprises: Acquire electrical signal noise; The electrical signal noise is input into the byte encryption order obfuscation module, so that a random number generator in the byte encryption order obfuscation module generates the obfuscated random number based on the electrical signal noise.
7. According to the encryption method for resisting side channel attacks of claim 2, except for the round encryption process of the last round, the remaining round encryption operations include a row shift operation, a column confusion operation and a round key addition operation; The step of performing the remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain the encrypted ciphertext data includes: The row shift operation, the column confusion operation and the round key addition operation are sequentially performed on the second intermediate encrypted state after the byte replacement operation to obtain encrypted ciphertext data.
8. According to the encryption method for resisting side channel attacks of claim 7, for the last round of round encryption process, the remaining round encryption operations include a row shift operation and a round key addition operation; The step of performing the remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain the encrypted ciphertext data includes: The row shift operation and the round key addition operation are sequentially performed on the second intermediate encrypted state after the byte replacement operation to obtain encrypted ciphertext data.
9. The encryption method for resisting side channel attacks according to claim 2, for the initial round encryption process, the method further comprises: A round key addition operation is performed on the round encryption subkey and the plaintext data.
10. The encryption method for resisting side channel attacks according to claim 1, wherein the trusted root key includes an authentication key, and the step of generating a round encryption subkey according to the trusted root key includes: Performing a key expansion operation on the authentication key to obtain a key expansion matrix; A round encryption subkey of each round of the round encryption process is determined based on the key expansion matrix.
11. An encryption device resistant to side channel attacks, provided with a user identification card, the device comprising: A key generation module, used to read a pre-stored trusted root key and generate a round encryption subkey based on the trusted root key; The encryption operation hiding module is used to perform multiple rounds of round encryption on the plaintext data to be encrypted through the round encryption subkey, and perform encryption operation hiding on the round encryption subkey and the plaintext data during the round encryption process to obtain encrypted ciphertext data.
12. A user identification card, comprising: A key expansion module, used to read a pre-stored trusted root key and generate a round encryption subkey according to the trusted root key; The round encryption module is used to perform multiple rounds of round encryption on the plaintext data to be encrypted using the round encryption subkey, and perform encryption operations and hide the round encryption subkey and the plaintext data during the round encryption process to obtain encrypted ciphertext data.
13. The user identification card according to claim 12, further comprising a byte encryption order obfuscation module, wherein the byte encryption order obfuscation module is used to obfuscate and sort each byte in the round encryption subkey and the plaintext data; The round encryption module is used to perform the byte substitution operation by obfuscating the sorted round encryption subkeys and the plaintext data to obtain a first intermediate encryption state; The byte encryption order obfuscation module is used to perform an obfuscation order reverse order on the first intermediate encryption state to restore the second intermediate encryption state after the byte replacement operation; The round encryption module is used to perform the remaining round encryption operations on the second intermediate encryption state after the byte replacement operation to obtain ciphertext data after one round of encryption.
14. An electronic device, characterized in that: include: A user identification card and a power supply circuit as claimed in claim 12 or claim 13; wherein the power supply circuit supplies power to the user identification card so that the user identification card performs the steps of the encryption method for resisting side channel attacks as claimed in any one of claims 1 to 10.
Citation Information
Cited By
AES encryption circuit based on SRAM memory logic architecture
CN119166585A
Method and system for defending side channel attack of password software and test method of defending side channel attack of password software
CN119402171A
Unmanned aerial vehicle chip sensitive data access control method based on trusted execution environment
CN120705880A
Environment-adaptive data dynamic encryption method and device
CN121396597A
An environment-adaptive dynamic data encryption method and device
CN121396597B
