Hardware-based data protection method
By employing a hardware-based data protection method, utilizing hardware modules to generate and negotiate keys, and combining this with the AEAD algorithm for encryption and decryption, the security and performance bottlenecks of open-source cryptographic libraries are resolved, achieving efficient and secure data protection.
Patent Information
- Application Number
- CN202411380006.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-09-29
AI Technical Summary
Existing software encryption methods based on open-source cryptography libraries such as OpenSSL and Crypto++ suffer from problems such as poor security, low performance bottlenecks, high dependency, high complexity, vulnerability to side-channel attacks, and security vulnerabilities.
A hardware-based data protection method is adopted, which generates a public key, a private key, plaintext key, and an initialization vector through a hardware module. Additional verification data is generated using a preset public key and cryptographic suite. Key negotiation and encryption are performed, and the plaintext key is encrypted using a symmetric key and an initialization vector. The negotiation result is generated by combining the AEAD algorithm, and decryption is performed using the corresponding private key during the decryption stage.
It improves the security and computational efficiency of data encryption, enhances forward security, simplifies the implementation process, improves the flexibility and compatibility of the system, reduces the direct use of symmetric keys, and enhances key security.
Smart Images

Figure CN119358047B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and particularly provides a hardware-based data protection method. BACKGROUND
[0002] The mainstream method for implementing the current data encryption scheme is a software method based on an open source cryptography library such as OpenSSL or Crypto++.
[0003] The mainstream method has problems such as poor security, low performance bottleneck, certain dependency and complexity, security vulnerabilities, limited customization, and poor ability to resist side channel attacks. For example, the software method using the open source cryptography library is prone to expose the key in the unprotected memory during the encryption and decryption process, thereby causing the security system to fail. The universality of the open source cryptography library leads to low performance, especially in application scenarios requiring high throughput and low latency, and the software method has limited performance. The use of the open source cryptography library introduces additional dependencies and complexity, which brings challenges to the deployment, maintenance, and configuration of the system, especially in embedded or resource-constrained environments. Although the open source library has been extensively reviewed, there are still potential vulnerabilities. Using an outdated or not timely updated library version can easily cause security problems. In addition, the configuration and use of the library need to follow best practices, otherwise vulnerabilities can also be introduced.
[0004] Correspondingly, there is a need in the art for a new hardware-based data protection method to solve the above problems. SUMMARY
[0005] In order to overcome at least one of the above-mentioned defects, the present application is proposed to provide a hardware-based data protection method to solve or at least partially solve the technical problem of poor software encryption effect in the prior art.
[0006] In a first aspect, the present application provides a hardware-based data protection method, the method comprising at least an encryption phase, and the hardware on which the method is based comprising at least a first module, the method comprising: generating, based on the first module, a first public key, a first private key, a key plaintext, and an initialization vector; obtaining additional verification data based on a preset second public key, a preset cipher suite, and the first public key; obtaining a first symmetric key based on the second public key and the first private key; encrypting the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain a negotiation result; and encrypting a data plaintext to be protected based on the key plaintext to obtain a data ciphertext, wherein the negotiation result is used for decrypting the data ciphertext.
[0007] According to the technical scheme, encryption is based on hardware, security and operation efficiency are improved; in each encryption process, the first public key, the first private key, the first key plaintext and the initialization vector are randomly generated by hardware, and forward security of the encryption process is enhanced.
[0008] In one of the technical solutions of the hardware-based data protection method, the additional verification data is obtained based on the preset second public key, the preset cipher suite and the first public key, including: performing hash calculation on the second public key to obtain a first hash value; and splicing the first hash value, the cipher suite and the first public key to obtain the additional verification data.
[0009] According to the technical scheme, all additional information, including the cipher suite, the first public key and the first hash value of the first public key, is protected, so that the integrity of the information is ensured.
[0010] In one of the technical solutions of the hardware-based data protection method, the first symmetric key is obtained based on the second public key and the first private key, including: performing key agreement on the second public key and the first private key to obtain a first shared key; and performing key derivation on the first shared key to obtain a key with a length of K and record it as the first symmetric key.
[0011] According to the technical scheme, one part of the shared key after negotiation is intercepted, the security strength is unchanged, and the efficiency of the encryption process is improved.
[0012] In one of the technical solutions of the hardware-based data protection method, the key plaintext is encrypted based on the first symmetric key, the additional verification data and the initialization vector to obtain a negotiation result, including: encrypting the key plaintext based on the first symmetric key, the additional verification data and the initialization vector to obtain key ciphertext and an authentication tag; and splicing the additional verification data, the initialization vector, the key ciphertext and the authentication tag to obtain the negotiation result.
[0013] According to the technical scheme, a high-strength symmetric key is used to encrypt and protect the key used to encrypt and protect data, instead of directly using the symmetric key to encrypt and protect the data, which on the one hand enhances the security of the key, and on the other hand enables a technical person to flexibly define a suitable encryption scheme according to actual conditions, for example, selecting a suitable encryption algorithm type.
[0014] In one of the technical solutions of the hardware-based data protection method, the cipher suite at least includes encryption algorithm information, and the method further includes: determining whether the initialization vector is needed for the encryption process of the data plaintext to be protected based on the encryption algorithm information; and if yes, encrypting the data plaintext based on the key plaintext and the initialization vector to obtain the data ciphertext.
[0015] According to the encryption algorithm information such as the type of the encryption algorithm in the cipher suite, the initialization vector is selectively used to perform the encryption step, so that the technical personnel can indirectly define the specific encryption step according to the actual situation such as the device performance or the security requirement, and the flexibility and compatibility of the technical solution are improved.
[0016] In one of the technical solutions of the hardware-based data protection method, the method further includes at least a decryption phase, and the hardware on which the method is based further includes at least a second module, and the method further includes: generating a second private key based on the second module; and decrypting the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext.
[0017] According to the technical means of the decryption phase of the data provided by the technical means of the encryption phase of the data provided in the foregoing technical solution, the data can be more comprehensively protected.
[0018] In one of the technical solutions of the hardware-based data protection method, the decryption of the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext includes: splitting the negotiation result to obtain the additional verification data, the initialization vector, the key ciphertext, and the authentication tag; splitting the additional verification data to obtain the first public key; obtaining a second symmetric key based on the first public key and the second private key; decrypting the key ciphertext based on the second symmetric key, the additional verification data, and the initialization vector to obtain the key plaintext; and decrypting the data ciphertext based on the key plaintext to obtain the data plaintext.
[0019] In one of the technical solutions of the hardware-based data protection method, the obtaining of the second symmetric key based on the first public key and the second private key includes: performing key negotiation on the first public key and the second private key to obtain a second shared key; and performing key derivation on the second shared key to obtain a key with a length of K and denoted as the second symmetric key.
[0020] In one of the technical solutions of the hardware-based data protection method, the additional verification data is split to obtain the first hash value, and before the second symmetric key is obtained based on the first public key and the second private key, the method further comprises: performing hash calculation on the second private key to obtain a second hash value; determining whether the second hash value is the same as the first hash value; if yes, performing the step of obtaining the second symmetric key based on the first public key and the second private key.
[0021] Through the above technical solution, the hash value calculated at the first user end according to the second public key can be compared with the hash value calculated at the second user end according to the second private key, and if they are consistent, the subsequent step is performed, thereby further ensuring the security and integrity of the data.
[0022] In one of the technical solutions of the hardware-based data protection method, the additional verification data is split to obtain the first hash value, and before the second symmetric key is obtained based on the first public key and the second private key, the method further comprises: performing hash calculation on the second private key to obtain a second hash value; determining whether the second hash value is the same as the first hash value; if yes, performing the step of obtaining the second symmetric key based on the first public key and the second private key.
[0023] In a second aspect, the application provides a hardware-based data protection system, comprising:
[0024] A first module configured to generate a first public key, a first private key, a key plaintext, and an initialization vector;
[0025] An encryption module configured to: obtain additional verification data based on a preset second public key, a preset cryptographic suite, and the first public key; obtain a first symmetric key based on the second public key and the first private key; encrypt the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain a negotiation result; and encrypt a data plaintext to be protected based on the key plaintext to obtain a data ciphertext, wherein the negotiation result is used to decrypt the data ciphertext.
[0026] In one of the technical solutions of the hardware-based data protection system, the system further comprises:
[0027] A second module configured to generate a second private key;
[0028] A decryption module configured to decrypt the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext.
[0029] In a third aspect, an intelligent device is provided, comprising at least one processor; and a memory connected with the at least one processor in communication; wherein the memory has stored therein a computer program, which, when executed by the at least one processor, implements the method of any one of the technical solutions of the hardware-based data protection method described above.
[0030] In a fourth aspect, a computer-readable storage medium is provided, which has stored therein a plurality of program codes, the program codes being adapted to be loaded and run by a processor to perform the hardware-based data protection method of any one of the technical solutions of the hardware-based data protection method described above.
[0031] Scheme 1. A hardware-based data protection method, characterized in that the method comprises at least an encryption phase, the hardware on which the method is based comprises at least a first module, and the method comprises:
[0032] Based on the first module, a first public key, a first private key, a key plaintext, and an initialization vector are generated;
[0033] Based on a preset second public key, a preset cipher suite, and the first public key, additional verification data is obtained;
[0034] Based on the second public key and the first private key, a first symmetric key is obtained;
[0035] Based on the first symmetric key, the additional verification data, and the initialization vector, the key plaintext is encrypted to obtain a negotiation result;
[0036] Based on the key plaintext, a data plaintext to be protected is encrypted to obtain a data ciphertext, wherein the negotiation result is used to decrypt the data ciphertext.
[0037] Scheme 2. The hardware-based data protection method according to scheme 1, characterized in that the obtaining of the additional verification data based on the preset second public key, the preset cipher suite, and the first public key comprises:
[0038] A first hash value is obtained by performing a hash calculation on the second public key;
[0039] The first hash value, the cipher suite, and the first public key are spliced to obtain the additional verification data.
[0040] Scheme 3. The hardware-based data protection method according to scheme 1, characterized in that the obtaining of the first symmetric key based on the second public key and the first private key comprises:
[0041] performing key agreement with respect to the second public key and the first private key to obtain a first shared key;
[0042] performing key derivation with respect to the first shared key to obtain a key with a length of K and denoted as the first symmetric key.
[0043] Scheme 4. The hardware-based data protection method according to Scheme 1, characterized in that the encryption of the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain the negotiation result comprises:
[0044] encrypting the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain a key ciphertext and an authentication tag;
[0045] concatenating the additional verification data, the initialization vector, the key ciphertext, and the authentication tag to obtain the negotiation result.
[0046] Scheme 5. The hardware-based data protection method according to any one of Schemes 1 to 4, characterized in that the cipher suite at least comprises encryption algorithm information, and the method further comprises:
[0047] based on the encryption algorithm information, determining whether the process of encrypting the data plaintext to be protected needs the initialization vector;
[0048] if yes, encrypting the data plaintext based on the key plaintext and the initialization vector to obtain the data ciphertext.
[0049] Scheme 6. The hardware-based data protection method according to Scheme 5, characterized in that the method further comprises at least a decryption phase, and the hardware on which the method is based further comprises at least a second module, and the method further comprises:
[0050] generating a second private key based on the second module;
[0051] decrypting the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext.
[0052] Scheme 7. The hardware-based data protection method according to Scheme 6, characterized in that the decryption of the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext comprises:
[0053] splitting the negotiation result to obtain the additional verification data, the initialization vector, the key ciphertext, and the authentication tag;
[0054] splitting the additional verification data to obtain the first public key;
[0055] obtaining a second symmetric key based on the first public key and the second private key;
[0056] decrypting the key ciphertext based on the second symmetric key, the additional verification data, and the initialization vector to obtain the key plaintext;
[0057] decrypting the data ciphertext based on the key plaintext to obtain the data plaintext.
[0058] Scheme 8. The hardware-based data protection method according to scheme 7, wherein the obtaining a second symmetric key based on the first public key and the second private key comprises:
[0059] performing key agreement for the first public key and the second private key to obtain a second shared key;
[0060] performing key derivation for the second shared key to obtain a key with a length of K and denoted as the second symmetric key.
[0061] Scheme 9. The hardware-based data protection method according to scheme 7, wherein the additional verification data is further split to obtain the first hash value, and before the obtaining a second symmetric key based on the first public key and the second private key, the method further comprises:
[0062] performing hash calculation for the second private key to obtain a second hash value;
[0063] determining whether the second hash value is same as the first hash value;
[0064] if yes, performing the obtaining the second symmetric key based on the first public key and the second private key.
[0065] Scheme 10. The hardware-based data protection method according to any one of schemes 7 to 9, wherein the additional verification data is further split to obtain a cipher suite, and the cipher suite at least comprises the encryption algorithm information, and the method further comprises:
[0066] determining, based on the encryption algorithm information, whether the initialization vector is needed in the process of decrypting the data ciphertext;
[0067] if yes, decrypting the data ciphertext based on the key plaintext and the initialization vector to obtain the data plaintext.
[0068] Scheme 11. A hardware-based data protection system, comprising:
[0069] The first module is configured to generate a first public key, a first private key, a key plaintext, and an initialization vector;
[0070] The encryption module is configured to: obtain additional verification data based on a preset second public key, a preset cipher suite, and the first public key; obtain a first symmetric key based on the second public key and the first private key; encrypt the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain a negotiation result; and encrypt a data plaintext to be protected based on the key plaintext to obtain a data ciphertext, wherein the negotiation result is used to decrypt the data ciphertext.
[0071] Scheme 12. The hardware-based data protection system according to scheme 11, characterized in that the system further comprises:
[0072] The second module is configured to generate a second private key.
[0073] The decryption module is configured to decrypt the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext.
[0074] Scheme 13. An intelligent device, characterized in that it comprises:
[0075] at least one processor;
[0076] and a memory in communication connection with the at least one processor;
[0077] wherein the memory stores a computer program which, when executed by the at least one processor, implements the hardware-based data protection method according to any one of schemes 1 to 10.
[0078] Scheme 14. A computer readable storage medium, wherein a plurality of program codes are stored, characterized in that the program codes are adapted to be loaded and run by a processor to execute the hardware-based data protection method according to any one of schemes 1 to 10. BRIEF DESCRIPTION OF DRAWINGS
[0079] The disclosure of the present application will become more apparent from the following description in conjunction with the accompanying drawings. It is readily understood by those skilled in the art that the drawings are merely for the purpose of illustration and are not intended to limit the scope of protection of the present application. In addition, similar numerals are used to represent similar components throughout the drawings, wherein:
[0080] Figure 1 is a main step flow diagram of a hardware-based data protection method according to an embodiment of the present application;
[0081] Figure 2 is a main step procedure flow diagram of encrypting data plaintext according to an embodiment of the present application;
[0082] Figure 3 is a main step flow diagram of a hardware-based data protection method according to an embodiment of the present application;
[0083] Figure 4 is a main step procedure flow diagram of decrypting data ciphertext according to an embodiment of the present application;
[0084] Figure 5 is an application scenario diagram of a hardware-based data protection method according to an embodiment of the present application;
[0085] Figure 6 is a main structure block diagram of a hardware-based data protection system according to an embodiment of the present application;
[0086] Figure 7 is a main structure block diagram of a hardware-based data protection system according to an embodiment of the present application;
[0087] Figure 8 is a main structure diagram of a smart device according to an embodiment of the present application.
[0088] List of reference signs :
[0089] 61: first module; 62: encryption module; 63: second module; 64: decryption module; 81: memory; 82: processor. DETAILED DESCRIPTION
[0090] Some embodiments of the present application will be described below with reference to the accompanying drawings. Those skilled in the art will understand that these embodiments are only used to explain the technical principles of the present application, and are not intended to limit the protection scope of the present application.
[0091] In the description of the present application, "module", "processor" can include hardware, software or a combination of both. A module can include hardware circuit, various suitable sensors, communication port, memory, and can also include software part such as program code, and can be a combination of software and hardware. The processor can be a central processor, microprocessor, image processor, digital signal processor or any other suitable processor. The processor has data and / or signal processing function. The processor can be implemented in software, hardware or a combination of both. The non-transitory computer readable storage medium includes any suitable medium that can store program code, such as magnetic disk, hard disk, optical disk, flash memory, read-only memory, random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B or both A and B. The term "at least one of A or B" or "at least one of A and B" has similar meaning as "A and / or B", which can include only A, only B or both A and B. The singular form of the term "one", "this" can also include plural forms.
[0092] The related user personal information that can be involved in the embodiments of the present application is strictly in accordance with the requirements of laws and regulations, follows the principles of legality, legitimacy and necessity, is based on the reasonable purpose of business scene, and processes the personal information that is actively provided by the user in the process of using the product / service or generated due to the use of the product / service, and authorized by the user.
[0093] The user personal information processed by the present application will be different due to specific product / service scene, and the specific scene of the user using the product / service shall be used as the reference, which can involve the user's account information, device information, driving information, vehicle information or other related information. The present application will treat the user's personal information and its processing with high diligence and obligation.
[0094] The present application attaches great importance to the security of user personal information, and has taken security protection measures in accordance with industry standards, which are reasonable and feasible to protect the user's information and prevent unauthorized access, public disclosure, use, modification, damage or loss of personal information.
[0095] Please refer to the attached Figure 1 , Figure 1 is the main step flowchart of the hardware-based data protection method according to an embodiment of the present application. As Figure 1 shown, the method of the present application mainly includes steps S1-S5:
[0096] Step S1, based on the first module, generating the first public key, the first private key, the key plaintext and the initialization vector:
[0097] In the embodiment, the first module is an entity hardware, and the technical solution of the application is implemented based on the first module. Different from a software encryption mode based on an open source or proprietary cryptography library (such as OpenSSL or Crypto++) completed by a programming language (such as C, C++, Java, etc.), the application implements hardware encryption based on the first module, where the first module can be a hardware security engine (HSE), a field-programmable gate array (FPGA), or the like, and the specific form is not limited. The first module can have a function of automatically generating an encryption instruction, and automatically execute an encryption action corresponding to the encryption instruction subsequently, or the first module only has a function of executing an action and does not have a function of issuing an instruction. Therefore, if the first module belongs to the latter, the technical solution of the application should also be implemented based on a module or a system that has a function of issuing an encryption instruction. The first user is generally a data sender or an encryption party, and can also be a data sender (encryption party) and a data receiver (decryption party), and the specific form is not limited. The first public key and the first private key are public and private keys in a key pair used for encryption and / or decryption by the first user. The initialization vector is a parameter used for an encryption algorithm. In the embodiment, the first public key, the first private key, a key plaintext, and the initialization vector are randomly generated by the first module.
[0098] In step S2, additional verification data is obtained based on the preset second public key, the preset cipher suite, and the first public key.
[0099] In the embodiment, the cipher suite is a kind of encryption algorithm pre-stored. In an embodiment, the cipher suite can be a common algorithm pre-set by a data encryption end (or a data sending end) and a data decryption end (or a data receiving end), and can also include a key exchange algorithm and a message authentication code component. The second public key is a public key part of a second public-private key pair pre-set. The additional verification data is additional verification data obtained after being encrypted by an encryption algorithm. In an embodiment, step S2 can further include steps S21 and S22. In step S21, a first hash value is obtained by performing hash calculation on the second public key. In step S22, the first hash value, the cipher suite, and the first public key are spliced to obtain the additional verification data. In the embodiment, the second public key is calculated by hash (SHA-1 calculation) to obtain the first hash value, and then the first hash value, the cipher suite, and the first public key are spliced according to the byte sequence to obtain the additional verification data.
[0100] In step S3, a first symmetric key is obtained based on the second public key and the first private key.
[0101] In the embodiment, the first symmetric key is a key used for encrypting the key plaintext. In an implementation, step S3 can further include: step S31, performing key agreement with the second public key and the first private key to obtain a first shared key; and step S32, performing key derivation with the first shared key to obtain a key with a length of K and denoted as the first symmetric key. In the embodiment, the key agreement is a process of establishing a shared key to ensure the security and confidentiality of the data encryption process, wherein the shared key is a key subsequently appended to the agreement result so as to complete decryption of the data based on the key.
[0102] Step S4, encrypting the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain an agreement result:
[0103] In the embodiment, the key plaintext is encrypted to obtain a key ciphertext, wherein the agreement result at least includes the key ciphertext. In an implementation, step S4 can further include steps S41-S42: step S41, encrypting the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain a key ciphertext and an authentication tag; and step S42, concatenating the additional verification data, the initialization vector, the key ciphertext, and the authentication tag to obtain the agreement result. In the implementation, the authentication tag is generated in the ciphertext, and a generation process thereof uses an authentication part in an encryption algorithm such as an AEAD algorithm (for example, an AES-GCM algorithm, an AES-CCM algorithm, or the like), and is usually appended at the end of the ciphertext. If the ciphertext is tampered with or forged, the authentication tag will fail in a subsequent verification process. The key ciphertext, the authentication tag, the additional verification data, and the initialization vector are concatenated in byte sequence to obtain the agreement result.
[0104] Step S5, encrypting the data plaintext to be protected based on the key plaintext to obtain a data ciphertext, wherein the agreement result is used for decrypting the data ciphertext:
[0105] In the embodiment, the data plaintext is data to be protected, which can be data to be sent or data to be stored, and the data format can be text, code, picture, or the like, and is not limited in particular. Correspondingly, the encrypted data is a data ciphertext. In an implementation, the process of encrypting the data plaintext can further include: step S51, determining whether an initialization vector is needed for the process of encrypting the data plaintext based on encryption algorithm information; and step S52, if yes, encrypting the data plaintext based on the key plaintext and the initialization vector to obtain the data ciphertext. In the implementation, the process of encrypting the data plaintext further depends on the type of the encryption algorithm information, and whether the initialization vector is needed is determined according to the type.
[0106] On the basis of the above embodiments, please refer to the attached Figure 2 The preferred embodiments are provided, Figure 2 The main step procedure flow diagram of encrypting data plaintext is shown. As Figure 2 The main steps of encryption can be described as:
[0107] 1. Based on HSE (the first module), tsk (temporary ECC private key, i.e. the first private key) and pk (ECC public key, i.e. the second public key) are subjected to ECDH (Elliptic Curve Encryption Scheme) key agreement to obtain ss (shared key);
[0108] 2. Based on HSE, the key derivation is performed on ss to obtain k (symmetric key) of a specific length;
[0109] 3. SHA-1 calculation (hash function calculation) is performed on pk to obtain pks (the first hash value);
[0110] 4. cs (cipher suite), pks, tpk (sender temporary ECC public key, i.e. the first public key) are spliced according to byte sequence to obtain aad (additional authentication data of AEAD algorithm, i.e. additional authentication data);
[0111] 5. Based on HSE, AEAD encryption is performed on km (key plaintext for encrypting data, i.e. the first key plaintext) using aad, iv (initialization vector) and k to obtain kc (key ciphertext for encrypting data, i.e. key ciphertext), wherein the encryption algorithm is obtained by analyzing cs;
[0112] 6. aad, iv, kc and tag (authentication tag of AED algorithm, i.e. authentication tag) are spliced according to byte sequence to obtain res (all necessary information containing decrypted kc, i.e. negotiation result);
[0113] 7. Based on HSE, encryption is performed on dm using km and iv to obtain dc, specifically, whether to use iv is selected according to the type of encryption algorithm, wherein the encryption algorithm is obtained by analyzing cs;
[0114] In Figure 2In the provided implementation, the encryption process uses HSE to improve the security and operation efficiency of the system; the tsk, tpk, km and iv of each information interaction are randomly generated by the HSE, thereby enhancing the forward security of the system; the key derivation does not use KDF, but only intercepts the ss to obtain k, thereby ensuring that the security strength remains unchanged while improving the efficiency; all additional information is protected, including the cipher suite, the temporary public key and the public key hash, thereby ensuring the integrity of the information; the AEAD encryption algorithm is used, which removes the MAC algorithm compared with the open source library algorithm, thereby simplifying the implementation process and improving the performance; the data encryption algorithm can be defined according to the device performance or security requirements, thereby improving the flexibility and compatibility of the system; the cipher suite ID is agreed upon through the protocol, and the cipher suite cs only occupies 1 byte, thereby simplifying the negotiation information and reducing the negotiation steps of the two parties.
[0115] In another embodiment, the method of the application further comprises at least a decryption phase, and the hardware on which the method is based further comprises at least a second module, and the method further comprises steps S6-S7: step S6, generating a second private key based on the second module:
[0116] In this embodiment, the second module is an entity hardware, and relative to the first module applied to the data encryption phase, the second module in this embodiment is applied to the data decryption phase. In some application scenarios, the functional principles realized by the two are the same, and the second module is the first module, for example: after the data is encrypted in a specific device or apparatus containing the first module, the encrypted data is saved to a cloud server, and in the subsequent process, the encrypted data is downloaded to the above-mentioned device or apparatus, and the data decryption is completed by the first module in the device or apparatus. The second private key is the private key part of the aforementioned second public-private key pair.
[0117] Step S7, decrypting the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext:
[0118] In this embodiment, the negotiation result contains the key ciphertext used to decrypt the data ciphertext, so that the key ciphertext can be obtained based on the negotiation result, and the key plaintext can be decrypted based on the second private key to obtain the key plaintext, and finally the data ciphertext is decrypted by using the key plaintext to obtain the data plaintext.
[0119] In one embodiment, please refer to the accompanying Figure 3 , the accompanying Figure 3 is the main step flow diagram of the hardware-based data protection method according to one embodiment of the application. As shown in Figure 3 , step S7 can further comprise steps S71-S75:
[0120] Step S71, splitting the negotiation result to obtain additional verification data, an initialization vector, a key ciphertext and an authentication tag;
[0121] Step S72, splitting the additional verification data to obtain the first public key;
[0122] Step S73, obtaining the second symmetric key based on the first public key and the second private key;
[0123] Step S74, decrypting the key ciphertext based on the second symmetric key, the additional verification data and the initialization vector to obtain the key plaintext;
[0124] Step S75, decrypting the data ciphertext based on the key plaintext to obtain the data plaintext.
[0125] In the embodiment, the negotiation result is split, i.e. the inverse operation of the splicing operation performed in the decryption phase, and the additional verification data is split in the same way.
[0126] In one implementation of the embodiment, step S73 can further include steps S731 and S732: step S731, performing key negotiation on the first public key and the second private key to obtain a second shared key; and step S732, performing key derivation on the second shared key to obtain a key with a length of K and denoted as the second symmetric key. In the implementation, the key negotiation and the key derivation are the same as the processes described in steps S31 and S32, which will not be described herein.
[0127] In one implementation of the embodiment, before step S73 is performed, it can further include: performing hash calculation on the second private key to obtain a second hash value; determining whether the second hash value is the same as the first hash value; and if yes, performing the step of obtaining the second symmetric key based on the first public key and the second private key. The implementation can compare the hash value calculated according to the second public key at the first user end with the hash value calculated according to the second private key at the second user end, and if they are consistent, the subsequent steps are performed, further ensuring the security and integrity of the data.
[0128] In one implementation of the embodiment, step S75 can further include steps S751 and S752: step S751, determining whether the initialization vector is needed in the process of decrypting the data ciphertext based on the encryption algorithm information; and step S752, if yes, decrypting the data ciphertext based on the key plaintext and the initialization vector to obtain the data plaintext. The implementation corresponds to steps S51 and S52, i.e. if it is determined that the initialization vector is needed according to the type of the encryption algorithm information, the initialization vector is needed in the process of encrypting and decrypting the data.
[0129] Based on the embodiment, please refer to the accompanying drawings Figure 4 The provided implementation, Figure 4is a main step procedure flow diagram of decrypting data ciphertext according to an embodiment of the present application. As shown in Figure 4 The main steps of decrypting data ciphertext can be described as follows:
[0130] Step 8, res is split to obtain tag, kc, iv and aad;
[0131] Step 9, aad is further split to obtain tpk and pks (first hash value);
[0132] Step 10, pk corresponding to sk (ECC private key, i.e. second private key) is derived based on HSE;
[0133] Step 11, whether the SHA-1 value (second hash value) of the derived pk is equal to pks (first hash value) is calculated, if yes, the next step is continued, otherwise the decryption process is terminated;
[0134] Step 12, ss is obtained by ECDH key agreement of sk and tpk based on HSE;
[0135] Step 13, k (second symmetric key) is obtained by key derivation of ss based on HSE;
[0136] Step 14, kc is decrypted by AEAD based on HSE using aad, iv, tag and k to obtain km (second key plaintext);
[0137] Step 15, dm is decrypted by HSE using km and iv to obtain dm, and whether iv is used is selected according to the type of encryption algorithm.
[0138] In the embodiments provided in Figure 4 , the decryption process uses HSE to improve the security and operation efficiency of the system; the key derivation does not use KDF, but only intercepts ss to obtain k, which ensures that the security strength does not change while improving the efficiency; the AEAD encryption algorithm is used, which removes the MAC algorithm compared with the open source library algorithm, simplifies the implementation process and improves the performance; the data encryption algorithm can be defined according to the device performance or security requirements, which improves the flexibility and compatibility of the system.
[0139] Please refer to the accompanying Figure 5 , Figure 5 is an application scenario diagram of a hardware-based data protection method according to an embodiment of the present application. As shown in Figure 5As shown, in the new business platform, the hardware-based data protection method provided by the present application is used to encrypt and protect the published data. For example, in the field of automotive engineering, when the vehicle controller is produced offline, the HSE will generate a respective ECC key, and pass the negotiation information and public key to the background server through the diagnostic communication tool, wherein the negotiation information at least includes the second public key and the cipher suite. The background server encrypts the data according to the negotiation information of the receiver, sends the negotiation result to the diagnostic communication tool, and stores the larger ciphertext data in the cloud, which can be downloaded from the cloud when the vehicle needs.
[0140] So far, the hardware-based data protection method of the present application has been described. It should be noted that although the above embodiments describe the steps in a specific order, those skilled in the art can understand that in order to achieve the effect of the present application, the different steps do not necessarily have to be executed in such an order, they can be executed simultaneously (in parallel) or in other order, and these changes are within the protection scope of the present application.
[0141] Further, the present application also provides a hardware-based data protection system.
[0142] Referring to the accompanying Figure 6 , Figure 6 is the main structure block diagram of the hardware-based data protection system according to an embodiment of the present application. As shown, Figure 6 The hardware-based data protection system in the embodiments of the present application mainly includes a first module 61 and an encryption module 62. In some embodiments, one or more of the first module 61 and the encryption module 62 can be combined together into one module. In some embodiments, the first module 61 can be configured to generate a first public key, a first private key, a key plaintext, and an initialization vector. The encryption module 62 can be configured to: obtain additional verification data based on a preset second public key, a preset cipher suite, and the first public key; obtain a first symmetric key based on the second public key and the first private key; encrypt the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain a negotiation result; encrypt a data plaintext to be protected based on the key plaintext to obtain a data ciphertext, wherein the negotiation result is used to decrypt the data ciphertext.
[0143] In another embodiment, referring to the accompanying Figure 7The hardware-based data protection system provided in the application can further include a second module 63 and a decryption module 64. The second module 63 is configured to generate a second private key. The decryption module 64 is configured to decrypt the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext. In some embodiments, one or more of the second module 63 and the decryption module 64 can be combined into one module. In this case, the second module 63 can also be used to generate the preset second public key. The second public key and the second private key form a second public-private key pair.
[0144] The hardware-based data protection system described above is used to perform Figure 1 The hardware-based data protection method embodiments shown above have similar technical principles, technical problems solved and technical effects. For the convenience and brevity of description, the specific working process and related description of the hardware-based data protection system can refer to the description of the hardware-based data protection method embodiments, which will not be repeated here.
[0145] Those skilled in the art can understand that all or part of the processes in the method of the above-mentioned embodiment can also be completed by a computer program instructing related hardware. The computer program can be stored in a computer readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms, etc. The computer readable storage medium can include any entity or device, medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code.
[0146] Further, the application also provides an intelligent device. In an embodiment of an intelligent device according to the application, the intelligent device can include at least one processor and a memory in communication connection with the at least one processor. The memory stores a computer program which, when executed by the at least one processor, implements the method described in any of the above-mentioned embodiments. The intelligent device described in the application can include a driving device, an intelligent vehicle, a robot and the like. Please refer to the exemplary intelligent device shown in FIG. 8. Figure 8 , Figure 8 The memory 81 and the processor 82 are in communication connection through a bus, as shown in FIG. 8.
[0147] In some embodiments of the present application, the intelligent device can further comprise at least one sensor for sensing information. The sensor is in communication with any of the processors mentioned in the present application. Optionally, the intelligent device can further comprise an autonomous driving system for guiding the intelligent device to drive by itself or to assist driving. The processor is in communication with the sensor and / or the autonomous driving system for completing the method described in any of the above embodiments.
[0148] Further, the present application also provides a computer readable storage medium. In an embodiment of the computer readable storage medium according to the present application, the computer readable storage medium can be configured to store a program for executing the hardware-based data protection method of the above-mentioned method embodiments, which can be loaded and run by the processor to implement the above-mentioned hardware-based data protection method. For the convenience of illustration, only the parts related to the embodiments of the present application are shown, and the specific technical details not disclosed are referred to the method part of the embodiments of the present application. The computer readable storage medium can be a storage device formed by various electronic devices, and optionally, the computer readable storage medium in the embodiments of the present application is a non-transitory computer readable storage medium.
[0149] Further, it should be understood that, since the setting of each module is only for illustrating the functional units of the device of the present application, the corresponding physical device of the module can be the processor itself, or a part of software, a part of hardware, or a part of combination of software and hardware in the processor. Therefore, the number of each module in the figure is only illustrative.
[0150] Those skilled in the art can understand that each module in the device can be adaptively split or combined. Such splitting or combining of specific modules will not cause the technical solution to deviate from the principles of the present application, therefore, the technical solution after splitting or combining will fall within the protection scope of the present application.
[0151] So far, the technical solution of the present application has been described in combination with the preferred embodiments shown in the drawings, but those skilled in the art can easily understand that the protection scope of the present application is obviously not limited to these specific embodiments. Those skilled in the art can make equivalent changes or replacements to the related technical features without deviating from the principles of the present application, and the technical solution after such changes or replacements will fall within the protection scope of the present application.
Claims
1. A hardware-based data protection method, characterized by, The method comprises at least an encryption phase, the hardware on which the method is based comprises at least a first module, and the method comprises: generating, based on the first module, a first public key, a first private key, a key plaintext, and an initialization vector; the initialization vector is a parameter for an encryption algorithm; performing hash calculation on a preset second public key to obtain a first hash value, splicing the first hash value, a preset cipher suite, and the first public key to obtain additional verification data; the cipher suite comprises at least encryption algorithm information; obtaining a first symmetric key based on the second public key and the first private key; encrypting the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain a key ciphertext and an authentication tag; and splicing the additional verification data, the initialization vector, the key ciphertext, and the authentication tag to obtain a negotiation result; encrypting a data plaintext to be protected based on the key plaintext to obtain a data ciphertext, wherein the negotiation result is used for decrypting the data ciphertext.
2. The hardware-based data protection method of claim 1, wherein, The obtaining of the first symmetric key based on the second public key and the first private key comprises: performing key negotiation on the second public key and the first private key to obtain a first shared key; performing key derivation on the first shared key to obtain a key with a length of K and record the key as the first symmetric key.
3. The hardware-based data protection method of claim 1 or 2, wherein, The method further comprises: determining, based on the encryption algorithm information, whether the initialization vector is needed in the process of encrypting the data plaintext to be protected; if yes, encrypting the data plaintext based on the key plaintext and the initialization vector to obtain the data ciphertext.
4. The hardware-based data protection method of claim 3, wherein, The method further comprises at least a decryption phase, the hardware on which the method is based further comprises at least a second module, and the method further comprises: generating, based on the second module, a second private key; decrypting the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext.
5. The hardware-based data protection method of claim 4, wherein, The decryption of the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext comprises: splitting the negotiation result to obtain the additional verification data, the initialization vector, the key ciphertext, and the authentication tag; splitting the additional verification data to obtain the first public key; obtaining a second symmetric key based on the first public key and the second private key; decrypting the key ciphertext based on the second symmetric key, the additional verification data, and the initialization vector to obtain the key plaintext; decrypting the data ciphertext based on the key plaintext to obtain the data plaintext.
6. The hardware-based data protection method of claim 5, wherein, The obtaining of the second symmetric key based on the first public key and the second private key comprises: performing key negotiation on the first public key and the second private key to obtain a second shared key; performing key derivation on the second shared key to obtain a key with a length of K and record the key as the second symmetric key.
7. The hardware-based data protection method of claim 6, wherein, The additional verification data is also split to obtain the first hash value, and before the second symmetric key is obtained based on the first public key and the second private key, the method further comprises: performing hash calculation on a second public key corresponding to the second private key to obtain a second hash value; determining whether the second hash value is the same as the first hash value; if yes, performing the step of obtaining the second symmetric key based on the first public key and the second private key.
8. The hardware-based data protection method according to any of claims 5 to 7, characterized in that, The additional verification data is also split to obtain the password suite, wherein the password suite at least includes the encryption algorithm information, and the method further comprises: based on the encryption algorithm information, determining whether the process of decrypting the data ciphertext needs the initialization vector; if yes, based on the key plaintext and the initialization vector, decrypting the data ciphertext to obtain the data plaintext.
9. A hardware-based data protection system, characterized by The system comprises: a first module configured to generate a first public key, a first private key, a key plaintext, and an initialization vector; the initialization vector is a parameter for an encryption algorithm; an encryption module configured to: perform hash calculation on a preset second public key to obtain a first hash value; splice the first hash value, a preset password suite, and the first public key to obtain additional verification data; the password suite at least includes encryption algorithm information; obtain a first symmetric key based on the second public key and the first private key; encrypt the key plaintext based on the first symmetric key, the additional verification data, and the initialization vector to obtain key ciphertext and an authentication tag; splice the additional verification data, the initialization vector, the key ciphertext, and the authentication tag to obtain a negotiation result; and encrypt data plaintext to be protected based on the key plaintext to obtain data ciphertext, wherein the negotiation result is used to decrypt the data ciphertext.
10. The hardware-based data protection system of claim 9, wherein, The system further comprises: a second module configured to generate a second private key; a decryption module configured to decrypt the data ciphertext based on the negotiation result and the second private key to obtain the data plaintext.
11. A smart device, comprising: comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory has stored therein a computer program, and the computer program is executed by the at least one processor to implement the hardware-based data protection method in any one of claims 1 to 8.
12. A computer readable storage medium having stored therein a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by the processor to execute the hardware-based data protection method in any one of claims 1 to 8. The program code is adapted to be loaded and run by the processor to execute the hardware-based data protection method in any one of claims 1 to 8.
Citation Information
Patent Citations
Data encryption-decryption method and apparatus
CN108763917A
Hardware encryption and decryption system and method
CN110287721A