Data protection method and device

By acquiring and processing first information and data, and selecting appropriate protection solutions and verification methods, the problem of low software data protection efficiency and security in the existing technology is solved, efficient data protection and verification are achieved, and data security is enhanced. .

CN117668872BActive Publication Date: 2024-09-17BEIJING HAITAI FANGYUAN HIGH TECH
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202311650365.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-04
Publication Date
2024-09-17
Estimated Expiration
2043-12-04

AI Technical Summary

Technical Problem

The existing technology has low execution efficiency and low security in software data protection, and it is difficult to effectively prevent tampering and verification.

Method used

By obtaining the first information and the first data, selecting data masking protection or integrity protection based on the first information, and generating verification information for data masking deprotection and integrity protection verification, thereby improving data protection efficiency and security.

Benefits of technology

It improves the efficiency of data protection and verification, enhances data security, avoids the limitations of a single protection process, and uses national secret algorithms to improve security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117668872B
    Figure CN117668872B
Patent Text Reader

Abstract

The present application discloses a data protection method and device, the method comprising: obtaining first information and first data, the first information being used to indicate data masking protection and / or integrity protection for the first data; determining verification information according to the first information and the first data, the verification information being used to perform data masking deprotection and / or integrity protection verification for the first data; and outputting the verification information and the first information. The method can improve the efficiency of data protection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of information security, and in particular, to a data protection method and device. Background Art

[0002] At present, with the development of informatization and computer technology, network security issues have become a common challenge faced by mankind in the information age. Among them, software can be easily tampered with during use. For example, network attacks such as computer network viruses, malicious codes, rogue software or Trojan programs can cause security problems in software data. To solve these security problems, the existing technology generally adopts the national standard GB / T37092-2018 "Security Requirements for Information Security Technology Cryptographic Modules", which clearly requires that all software and firmware components within the cryptographic boundary should be verified using approved integrity technology.

[0003] Currently, the efficiency of data protection needs to be improved. Summary of the invention

[0004] The embodiments of the present application provide a data protection method and device to improve the efficiency of data protection.

[0005] In a first aspect, an embodiment of the present application provides a data protection method, comprising:

[0006] Acquire first information and first data, wherein the first information is used to indicate data masking protection and / or integrity protection for the first data; determine verification information based on the first information and the first data, wherein the verification information is used to perform data masking deprotection and / or integrity protection verification for the first data; and output the verification information and the first information.

[0007] According to the method, with the first device as the execution subject, the first device can set the first information, and determine to perform data masking protection and / or integrity protection on the first data according to the first information. Accordingly, the data user can verify the first data through data masking deprotection and / or integrity protection verification to ensure data security. The data protection and verification process is highly efficient and can improve the data protection efficiency.

[0008] In one possible design, the first information is used to indicate that data masking protection is to be performed on the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information.

[0009] According to this design, the first device can select to perform data masking protection only on the first data for the first value according to the first information to obtain the second data, where the second data represents the first data after data masking protection, thereby improving the efficiency of the first device in performing data masking protection.

[0010] In one possible design, the first information is used to indicate that integrity protection is to be performed on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information.

[0011] According to this design, the first device can select to perform integrity protection only on the first data for the second value based on the first information to obtain third data, where the third data represents the first data after integrity protection, thereby improving the efficiency of the first device in performing integrity protection.

[0012] In one possible design, the method also includes: outputting the first data.

[0013] According to this design, the first device only performs integrity protection on the first data, obtains the third data, and outputs the first data and the third data. Accordingly, when the second device performs integrity protection verification, it verifies the integrity of the first data based on the third data to learn whether the first data passes the integrity protection verification, thereby improving the verification efficiency of the second device. Since data masking protection is not required, the second device can obtain the first data without data masking protection.

[0014] In one possible design, the first information is used to indicate data masking protection and integrity protection for the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information, and third data obtained after integrity protection is performed on the first data according to the first information.

[0015] According to this design, the first device can select data masking protection and integrity protection for the first data according to the first information as the third value, and obtain the second data and the third data, the second data represents the first data after data masking protection, and the third data represents the first data after integrity protection. In this design, the second device can perform data masking deprotection according to the obtained second data to obtain the first data. The second device can also verify the integrity of the first data according to the third data to know whether the first data passes the integrity protection verification, thereby improving the efficiency of the first device in performing data masking protection and integrity protection.

[0016] In a second aspect, an embodiment of the present application provides a data protection method, including:

[0017] Obtain verification information and first information, where the verification information is determined based on the first information and first data, and the first information is used to indicate data masking protection and / or integrity protection for the first data; perform data masking deprotection and / or integrity protection verification for the first data based on the verification information.

[0018] The beneficial effects of the second aspect and each possible design of the second aspect can refer to the description of the beneficial effects in the first aspect and the corresponding possible designs, and will not be repeated here.

[0019] In one possible design, the first information is used to indicate data masking protection for the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information; and de-masking the first data according to the verification information includes: de-masking the second data according to the first information to obtain the first data.

[0020] In one possible design, the first information is used to indicate that integrity protection is to be performed on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information; the integrity protection verification of the first data according to the verification information includes: performing integrity protection on the first data according to the first information to obtain fourth data; comparing the third data and the fourth data; and determining whether the first data passes the integrity protection verification based on the comparison result of the third data and the fourth data.

[0021] In one possible design, the method also includes: receiving the first data.

[0022] In one possible design, the first information is used to indicate data masking protection and integrity protection for the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information, and third data obtained after integrity protection is performed on the first data according to the first information; data masking deprotection of the first data according to the verification information includes: data masking deprotection of the second data according to the first information to obtain the first data; integrity protection verification of the first data according to the verification information includes: integrity protection of the first data according to the first information to obtain fourth data; comparing the third data and the fourth data; and determining whether the first data passes the integrity protection verification based on the comparison result of the third data and the fourth data.

[0023] In a third aspect, an embodiment of the present application further provides a data protection device, including a communication module and a processing module. Among them: the communication module is used to obtain first information and first data, the first information is used to indicate data masking protection and / or integrity protection for the first data; the processing module is used to determine verification information based on the first information and the first data, the verification information is used to perform data masking deprotection and / or integrity protection verification for the first data; the communication module is also used to output the verification information and the first information.

[0024] In a possible design, the communication module is further used to: output the first data.

[0025] In a fourth aspect, an embodiment of the present application further provides a data protection device, comprising a communication module and a processing module. The communication module is used to obtain verification information and first information, wherein the verification information is determined based on the first information and first data, and the first information is used to indicate that data masking protection and / or integrity protection is to be performed on the first data; the processing module is used to perform data masking deprotection and / or integrity protection verification on the first data based on the verification information.

[0026] In one possible design, the first information is used to indicate data masking protection for the first data, and the verification information includes second data obtained after data masking protection for the first data is performed according to the first information; the processing module is specifically used to: perform data masking deprotection on the second data according to the first information to obtain the first data.

[0027] In one possible design, the first information is used to indicate that integrity protection is to be performed on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information; the processing module is specifically used to: perform integrity protection on the first data according to the first information to obtain fourth data; compare the third data with the fourth data; and determine whether the first data passes the integrity protection verification based on the comparison result of the third data and the fourth data.

[0028] In a possible design, the communication module is also used to: receive the first data.

[0029] In one possible design, the first information is used to indicate that data masking protection and integrity protection are to be performed on the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information, and third data obtained after integrity protection is performed on the first data according to the first information; the processing module is specifically used to: perform data masking and deprotection on the second data according to the first information to obtain the first data; the processing module is specifically used to: perform integrity protection on the first data according to the first information to obtain fourth data; compare the third data and the fourth data; and determine whether the first data passes the integrity protection verification based on the comparison result of the third data and the fourth data.

[0030] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method of the first aspect, the second aspect, and any one of their designs is implemented.

[0031] In the sixth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the processor implements the first aspect, the second aspect, and any one of the designed methods.

[0032] The technical effects brought about by the third to sixth aspects and any one of their designs can refer to the technical effects brought about by the corresponding designs in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0034] Figure 1 A flowchart of a data protection method provided in an embodiment of the present application;

[0035] Figure 2 A schematic diagram of the structure of a data protection system provided in an embodiment of the present application;

[0036] Figure 3 A schematic diagram of a device structure provided in an embodiment of the present application;

[0037] Figure 4 A schematic diagram of another device structure provided in an embodiment of the present application. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.

[0039] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.

[0040] In the technical solution of this application, the collection, dissemination, and use of data are in compliance with the requirements of relevant national laws and regulations.

[0041] Before introducing a data protection method provided by an embodiment of the present application, in order to facilitate understanding, the technical background of the embodiment of the present application is first introduced below.

[0042] At present, with the development of informatization and computer technology, network security issues have become a common challenge faced by mankind in the information age. Among them, data can be easily tampered with during use. For example, network attacks such as computer network viruses, malicious codes, rogue software or Trojan programs can cause data security issues. To solve these security issues, the existing technology generally adopts the national standard GB / T 37092-2018 "Security Requirements for Information Security Technology Cryptographic Modules", which clearly requires that all software and firmware components within the cryptographic boundary should be verified using approved integrity technology.

[0043] Among them, the systems for implementing software protection in the prior art are relatively complex. For example, existing software protection systems such as Sigstore are an automated tool for product signing and verification. Its advantages lie in the automated signing and verification of components, the construction of publicly auditable log services, and the support of open source ecology. Sigstore consists of three main components: Fulcio, Rekor, and Cosign. Fulcio, a certificate authority, issues certificates based on OIDC identities and can only sign short-term certificates of less than 20 minutes. OIDC is an authentication + authorization protocol based on OAuth 2.0, which is used for user identity authentication and safely exposes user data to third parties. Github, Google and other accounts can be used to provide authentication for Fulcio. Rekor, a fully public log, uses Trillian (which provides the function of only adding log mode, which is a generalization and extension of the idea of ​​Certificate Transparency) as a tamper-proof log service, records evidence of the validity of the signature, and provides a service for storing and verifying signatures based on RESTful API. Cosign, a signature client, provides signing, verification and storage support for container images or products (artifacts, such as executable files). Signatures are written to the following supported OCI registries (Oracle Cloud Infrastructure Container Registry, a Docker registry service managed by Oracle that can securely store and share container images. Docker images can be easily pushed and pulled using Docker commands and APIs.), and container images and artifacts can also be stored in the registry.

[0044] Therefore, the existing technology Sigstore is composed of three main components: Fulcio, Rekor and Cosign. Each component includes several main modules and needs to execute a series of tasks such as certificate issuance, certificate verification, digital signature calculation, digital signature verification, etc. In addition, the system adopts foreign cryptographic algorithms, which may have security risks. Therefore, the existing technology has low execution efficiency and security for software protection.

[0045] In order to solve the above problems, the present application provides a data protection method to improve the efficiency of data protection. In the present application example, multiple protection schemes can be selected by taking the value of the first information, and the first data can be subjected to data masking protection and / or integrity protection according to the multiple protection schemes, thereby avoiding the execution of data protection according to a single process, so the method can improve the efficiency of data protection. Among them, the first data can be protected data, such as software data.

[0046] In addition, the use of national encryption algorithms when obtaining verification data can improve data security.

[0047] Figure 1 The flowchart of a data protection method is shown as an example. Exemplarily, the execution subject of the method may be a first device.

[0048] Step 101: A first device obtains first information and first data.

[0049] Optionally, the first information is set by the first device to indicate that data masking protection and / or integrity protection is performed on the first data. Data masking protection is a technology that hides sensitive information by converting and editing the original data, for example, by performing an XOR calculation on the first data to achieve data masking protection. Integrity protection is a technology that encrypts and backs up data to ensure that the data is not illegally tampered with, damaged or lost, for example, by encrypting the first data and storing it in a separate memory space to achieve integrity protection of the first data, ensuring that the integrity and accuracy of the data are not destroyed.

[0050] In the present application, the first device can determine different protection schemes according to different values ​​of the first information. For example, the first information takes the first value, indicating that data shielding protection is performed on the first data; the first information takes the second value, indicating that integrity protection is performed on the first data; the first information takes the third value, indicating that data shielding protection and integrity protection are performed on the first data. For example, for the first device, the first information can be represented as W, W=1 means "only perform data shielding protection", W=2 means "only perform integrity protection", and W=3 means "perform data shielding protection and integrity protection".

[0051] For example, Figure 2 As shown, the manufacturer's device that produces software can be used as the first device to provide data shielding protection and / or integrity protection for the device to be protected. The device or apparatus provided by the manufacturer may include software module data, and the software module data serves as a storage area for storing the first data to be protected. The first data may be software data. In addition, it is not excluded that the first device is a device that includes the data to be protected, for example, the first device includes software module data.

[0052] In the present application, the second device may perform data protection verification on the data, for example, the second device may perform masking deprotection and / or integrity verification on the protected data. The second device may be a user device or a detection device. For example, the first device is a manufacturer of a software module, and the second device may be a device including the software module or a user device of the software module. The second device may obtain verification software or verification data provided by the first device. The verification software or verification data may be used by the second device to verify the data. Generally speaking, the first device and the second device are different devices.

[0053] Optionally, the verification software or verification data can be stored in the software module, or the data verification function can be integrated into the protected software module, so that the software module can verify its own data, that is, the software module itself can serve as the second device or as a part of the second device.

[0054] Exemplarily, the first device may perform step 101 before the software module leaves the factory. For example, the terminal device is a carrier of software data, and the manufacturer may perform step 101 before the terminal device leaves the factory. The value of W may be determined according to the protection method required. For example, for some data that requires data masking protection, W=1 may be set; for some data that requires integrity protection, W=2 may be set; for some data that requires data masking protection and integrity protection, W=3 may be set.

[0055] Step 102: The first device determines verification information according to the first information and the first data, where the verification information is used to perform data masking deprotection and / or integrity protection verification of the first data.

[0056] Different values ​​of the first information may enable the first device to adopt different protection schemes, such as data shielding protection, integrity protection, or data shielding protection and integrity protection. Different protection schemes correspond to different verification information.

[0057] The following describes the process of determining the verification information in different protection schemes according to different values ​​of the first information.

[0058] In the first case, when the first information is the first value, data masking protection is adopted. At this time, the verification information is the second data, and the second data is obtained after performing data masking protection on the first data according to the first information.

[0059] For example, the first information is W=1, the second data is represented by C, and C can satisfy the following formula:

[0060] C=M⊕T,(Formula 1)

[0061] Wherein, M is the first data, that is, the original data to be protected. T can be information related to W.

[0062] As an example, T may satisfy the following formula:

[0063] T=GenMask(PRK, W, MLen), (Formula 2)

[0064] Here, PRK represents a pseudo-random key.

[0065] MLen represents the data length of the first data. For example, the length of the first data is MLen bits.

[0066] The GenMask function may be a function that outputs data of a specific length based on a hash-based message authentication code (HMAC) algorithm. For example, the GenMask function may call the HMAC function multiple times to obtain multiple message authentication codes (MACs) of a specific length, and then combine these MACs to obtain a mask value, that is, T in Formula 2. The specific length is, for example, 256 bits.

[0067] Among them, the HMAC function is a message authentication code function based on hash operation, which usually adds an additional key (such as PRK) as input based on the HASH function. The HMAC function calls the HASH function to calculate an output value of a specific length, also known as a check code, usually recorded as MAC.

[0068] The function value generated based on the HMAC algorithm may be referred to as a hash value. In this application, the names of the function value generated based on the HMAC algorithm, such as hash value, hash value, etc., may be interchangeable.

[0069] For example, the first device may determine that the initialized hash value T0 is equal to an empty string, and perform m HMAC iterations, wherein the hash value after the i-th iteration satisfies:

[0070] T i =HMAC(PRK, T i-1 ||W||i), i=1, 2,...,m;

[0071] The first device may concatenate the hash values ​​after the i-th iteration, and use the concatenated data as T, where the bit length of T is equal to MLen bits, and T satisfies:

[0072] T=MSB(T1||T2||T3||...||T m , MLen);

[0073] m = ceil(MLen / HashLen);

[0074] Here, m represents the number of iterative operations.

[0075] T1||T2||T3||...||T m Indicates T1, T2, ..., T m Make splicing.

[0076] MSB(T1||T2||T3||...||T m, MLen) means to fetch data (T1||T2||T3||...||T m ), HashLen represents the bit length of the hash value output by the hash algorithm used by the HMAC algorithm, ceil represents rounding up, T i-1 ||W||i represents the i-1 , W, i are concatenated. The hash algorithm is also called the hash algorithm, such as the SM3 algorithm.

[0077] It can be understood that in various formulas of the present application, rounding methods such as rounding up, rounding down and rounding off can be replaced with each other.

[0078] Optionally, the PRK in the present application may be generated by performing repeated serial iterations using an HMAC function.

[0079] As an example, PRK may satisfy the following formula:

[0080] PRK = GenPRK(P, Salt, n) (Formula 4)

[0081] Wherein, P represents the protection password, n represents the number of iterations, Salt represents the salt value, and GenPRK represents the operation of generating PRK. The PRK length can be the hash value length of the hash algorithm used by HMAC.

[0082] For example, the first device may determine that the initialization data string Z0=Salt, and perform n HMAC iterations, wherein the data string after the i-th iteration satisfies:

[0083] Z i =HMAC(P, Z i-1 ), i = 1, 2, ..., n;

[0084] The first device can generate the final iteration result Z n As PRK.

[0085] As another example, T can be obtained by the first device querying a table related to the first information, and the table can contain the correspondence between different values ​​of the first information and different values ​​of T, that is, T related to the first information can be determined by looking up the table instead of calculating by a formula without calculating by a formula. The correspondence in the table can satisfy the above formula.

[0086] Optionally, based on the first case, the first device may store the second data in “software module data”, for example, storing C in Figure 2 In the first case, since integrity protection is not required, the first device can store the following information: Figure 2The data in the "Software Integrity Verification Data" area shown is set to an empty string.

[0087] Among them, the data in the "software integrity verification data" area can be used to perform data integrity protection verification.

[0088] In the second case, when the first information is the second value, integrity protection is adopted, and the verification information is the third data, which can be obtained by integrity protection of the first data according to the first information. The third data can also be called software integrity verification data.

[0089] The third data may be obtained by performing integrity protection on the first data according to the first information. Specifically, the third data may be obtained according to the second data. Referring to the description in the first case, the second data may be obtained by performing data masking protection on the first data according to the first information.

[0090] For example, the first information is W=2, the third data is a software authentication code (SAC), and the SAC can satisfy the following formula:

[0091] SAC = HMAC (PRK, C), (Formula 5)

[0092] Wherein, C represents the second data, PRK represents the key, and PRK and C can refer to the description in the first case.

[0093] Optionally, based on the second case, the first device may store the third data in the "software integrity verification data" area, such as storing the SAC in Figure 2 In the second case, since data masking protection is not required, that is, the second data is not necessary for the verification of case 2, the first device sets the second data to an empty string or data M after obtaining the third data according to the second data. Figure 2 After the second data in the "software module data" area shown in the figure obtains SAC, the data in the "software module data" area is set to an empty string or original data M to be protected.

[0094] Optionally, the first device may output the first data. The action of "outputting the first data" may be understood as setting the data in the "software module data" area to the original data M; or, it may be understood as setting the data in the "software module data" area to an empty string, additionally outputting the original data M to the second device or storing the original data M in other storage space outside the "software module data" area.

[0095] In the third case, the first information is the third value, and data masking protection and integrity protection are adopted. In this case, the verification information includes the second data and the third data. The second data is obtained after the first data is masked according to the first information, and the third data is obtained after the first data is integrity protected according to the first information. The method for obtaining the second data can refer to the description in the first case, and the method for obtaining the third data can refer to the description in the second case, which will not be repeated.

[0096] For example, the first information is W=3, and the verification information includes the second data C and the third data SAC, wherein C can be obtained by referring to the above formula 1, and SAC can be obtained by referring to the above formula 5.

[0097] Optionally, based on the third case, after obtaining the second data, the first device may store the second data in the "software module data", for example, storing C in Figure 2 The "software module data" shown in FIG. 1 and the third data is stored in the "software integrity verification data" area, such as storing SAC in Figure 2 The "Software Integrity Verification Data" area is shown.

[0098] Optionally, before executing step 102, the first device may generate a password authentication code (PAC), which is also referred to as a password verification code in this application. The PAC may be used to verify the password to be verified obtained by the second device.

[0099] In this application, PAC can be obtained based on PRK.

[0100] As an example, PAC may satisfy the following formula:

[0101] PAC = HMAC (PRK, Salt). (Formula 6)

[0102] Salt indicates the salt value.

[0103] Step 103: The first device outputs verification information and first information.

[0104] Correspondingly, the second device obtains the verification information and the first information.

[0105] As an example, the first device is a manufacturer's device that produces software, and the second device is a user device, or a device or apparatus provided by the manufacturer. The first device outputs verification information and the first information to the second device. When the second device obtains the user's verification instruction, the second device can perform data masking deprotection and / or integrity verification on the first data according to the verification information. For example, Figure 2The figure shows the logical structure of the data protection and verification area in the product provided by the manufacturer. The first device stores the verification information and the first information in the data protection area. Figure 2 In the corresponding area shown, the second device can be a device other than the product. During the data verification process of the device, the second device can read the verification information and the first information and other parameters from the data protection and verification area of ​​the device. For another example, the first device and the second device can be different devices. After protecting the data, the first device can send the verification information and the first information to the second device through the interface between the first device and the second device. Figure 2 Shown may be a logical structure of the data protection and authentication areas in the second device.

[0106] For example, for the first case in step 102, the action of the first device outputting the verification information may include storing the second data C in the "software module data" area. The action of the first device outputting the first information may be storing the first information W in the "protection scheme" field. The "protection scheme" field may be located at Figure 2 The "Configuration Data" area is shown.

[0107] For the aforementioned second situation, the action of the first device outputting the verification information may include storing the third data SAC into the “software integrity verification data” area.

[0108] For the aforementioned third case, the action of the first device outputting the verification information may include storing the second data C in the "software module data" area and storing the third data SAC in the "software integrity verification data" area. The action of the first device outputting the first information in the second and third cases can refer to the description of the first case and will not be repeated.

[0109] Optionally, the first device may also output a salt value, an iteration number, and a password verification code, so that the second device can perform data masking and deprotection and / or verify the integrity of the data according to the salt value, the iteration number, and the password verification code. For example, the first device may store the Salt involved in the data protection calculation or processing in the "Salt Value" field, the Salt may be pseudo-random data, and n may be stored in the "Iteration Number" field. The first device may store the PAC in the "Password Verification Data" area.

[0110] The "Salt Value" field and the "Iteration Count" field mentioned above may be located in the "Configuration Data" area.

[0111] The "software module data" area, "configuration data" area, "password verification data" area, and "software integrity verification data" area can be located in the system file (system, SYS). The system file can be included in the software module or stored separately from the software module, which is not specifically limited in this application. Figure 2 The "software module data" area, "configuration data" area, "password verification data" area and "software integrity verification data" area may use other names, and this application does not specifically limit them.

[0112] After acquiring the verification information and the first information, the second device may perform data masking deprotection and / or integrity protection verification on the first data according to the verification information.

[0113] In the present application, the second device can determine different verification schemes according to different values ​​of the first information. For example, the first information takes the first value, indicating that the first device performs data masking protection on the first data, and accordingly, the second device can perform data masking and deprotection to obtain the first data; the first information takes the second value, indicating that the first device performs integrity protection on the first data, and accordingly, the second device can verify the integrity of the first data according to the third data included in the verification information; the first information takes the third value, indicating that the first device performs data masking and integrity protection on the first data, and accordingly, the second device can perform data masking and deprotection to obtain the first data, and verify the integrity of the first data according to the third data.

[0114] Optionally, taking the first data as software data as an example, the timing for the second device to verify the software data may be any one or more of the following timings:

[0115] 1) During the software startup phase, the second device can verify the software data to determine whether the software has been tampered with or errors such as data anomalies have occurred.

[0116] 2) During the operation, the second device verifies the software data according to the verification operation manually triggered by the user.

[0117] 3) The second device periodically verifies the software data, for example, once every 24 hours or less.

[0118] The following introduces the verification process of the verification information in different verification schemes according to different values ​​of the first information.

[0119] For the first case in step 102, the second device may obtain the verification information and the first information. The verification information is the second data. For example, the second device may obtain Figure 2 The "software module data" area shown obtains the second data and the first information is obtained from the "configuration data" area.

[0120] Based on the first information, the second device can learn that the first device performs data masking protection on the first data, and thus can obtain the first data by deprotecting the data masking.

[0121] Specifically, the second device may perform data masking and deprotection on the second data according to the first information to obtain the first data.

[0122] For example, W=1, the second device can obtain the second data C and the first information W output by the first device. In addition, the second device can also obtain Salt, W, n and PAC output by the first device. The second device performs data masking and deprotection on the second data according to the first information to obtain the deprotected first data.

[0123] Exemplarily, the first data M and C after deprotection satisfy the following relationship:

[0124] M=C⊕T,(Formula 7)

[0125] Wherein, C represents the second data stored in the “software module data”, W represents the first information, and T may be information related to W.

[0126] As an example, T may satisfy the following formula:

[0127] T=GenMask(PRK, W, CLen), (Formula 8)

[0128] Wherein, CLen represents the data length of the second data, for example, the length of the second data is CLen bits. GenMask can refer to the description of formula 2 in step 102, which will not be repeated here.

[0129] Optionally, the second device may set a verification flag, which may be used to indicate whether the integrity protection of the first data has passed the verification. The verification flag may be represented by V.

[0130] In the first case, since the second device does not need to perform integrity protection verification, the second device can set the verification flag to a value representing "verification passed". For example, if the second device determines that W=1, it will perform an XOR operation on C in the "software module data" and T generated by the operation to obtain the deprotected M, and then set V to a value representing "verification passed".

[0131] For the second case in step 102, the verification information output by the first device is the third data, and the first information may be a second value representing data integrity protection. The second device may adopt a verification scheme for integrity protection verification based on the first information being the second value, and perform integrity protection verification on the first data based on the third data.

[0132] Among them, the second device can perform integrity protection on the first data according to the first information, obtain fourth data, compare the third data and the fourth data, and determine whether the first data passes the integrity protection verification according to the comparison result of the third data and the fourth data.

[0133] Since data shielding protection is not required, the second device can read the first data output by the first device. For example, the second device can receive the first data from the first device, or Figure 2 The "software module data" area shown reads the first data M.

[0134] For example, W=2, and the second device receives the first data M and the first information W.

[0135] In addition, the second device can also obtain Salt, W, n, PAC and verification information SAC output by the first device. The second device can refer to formula 5 in step 102 to obtain SAC*, for example, SAC*=HMAC(PRK, C), where C and PRK can refer to the description in step 102 and will not be repeated.

[0136] Among them, SAC* can be used as the fourth data, and SAC is the third data. The second device can compare SAC and SAC*. If SAC is equal to SAC*, the second device can determine that the first data has passed the integrity verification. The second device can set the verification mark V of the integrity check to a value representing "verification passed". If SAC is not equal to SAC*, the second device can determine that the first data has not passed the integrity verification. The second device can set the verification mark to a value representing "verification failed".

[0137] For the third case in step 102, the verification information output by the first device is the second data and the third data, and the first information is the third value representing data masking protection and data integrity protection. The second device can use data masking deprotection and integrity protection verification to perform data masking deprotection and integrity protection verification on the first data based on the first information being the third value.

[0138] For example, W=3, the second device can obtain the second data C, the third data SAC and the first information W.

[0139] The second device may perform data masking and deprotection according to the second data C to obtain the first data M.

[0140] Referring to the description of the method in which the second device performs data masking and deprotection when the second device obtains the verification information and the first information (the verification information is the second data), the first data M and C after deprotection satisfy the aforementioned formula 7.

[0141] After obtaining the first data M through data masking and deprotection, the second device can also verify the integrity of the first data based on the third data. The second device can obtain the fourth data SAC* in accordance with the method in the second case, and compare SAC with SAC* to see if they are consistent. If SAC* is consistent with SAC, the second device sets V to a value representing "verification passed". If SAC is not equal to SAC*, the second device can set the verification flag to a value representing "verification failed".

[0142] Optionally, before verifying the verification information, the second device may also generate a password verification code PAC* to be verified. The second device may generate PAC* in the same manner as the PAC generated in step 102. For example, PAC* may satisfy Formula 6, ie, PAC* = HMAC (PRK, Salt).

[0143] In addition, the second device can also compare PAC with PAC* to determine whether the two are consistent. If PAC* and PAC are consistent, it means that the password verification is successful, and the second device can continue to verify the obtained verification information. If PAC* is not equal to PAC, it means that the password verification is not successful, and the second device can report an error "invalid password" and terminate the verification.

[0144] Based on the same technical concept, the present application exemplarily provides a data protection device. The device can be used to perform the actions described in the above method embodiment. In this embodiment, the structure of the device can be as follows: Figure 3 shown.

[0145] like Figure 3 As shown, the present application exemplarily provides a data protection device which may include a communication module 301 and a processing module 302 .

[0146] Among them, when implementing the function of the first device in the present application, the communication module 301 is used to obtain first information and first data, and the first information is used to indicate data masking protection and / or integrity protection for the first data; the processing module 302 is used to determine verification information based on the first information and the first data, and the verification information is used to perform data masking deprotection and / or integrity protection verification for the first data; the communication module 301 is also used to output the verification information and the first information.

[0147] Optionally, the first information is used to indicate that data masking protection is performed on the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information.

[0148] Optionally, the first information is used to indicate that integrity protection is to be performed on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information.

[0149] Optionally, the communication module 301 is further used to: output the first data.

[0150] Optionally, the first information is used to indicate data masking protection and integrity protection for the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information, and third data obtained after integrity protection is performed on the first data according to the first information.

[0151] When implementing the function of the second device in the present application, the communication module 301 is used to obtain verification information and first information, where the verification information is determined based on the first information and first data, and the first information is used to indicate data masking protection and / or integrity protection for the first data; the processing module 302 is used to perform data masking deprotection and / or integrity protection verification for the first data based on the verification information.

[0152] Optionally, the first information is used to indicate data masking protection for the first data, and the verification information includes second data obtained after data masking protection for the first data is performed according to the first information; the processing module 302 is specifically used to: perform data masking deprotection on the second data according to the first information to obtain the first data.

[0153] Optionally, the first information is used to indicate that integrity protection is to be performed on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information; the processing module 302 is specifically used to: perform integrity protection on the first data according to the first information to obtain fourth data; compare the third data with the fourth data; and determine whether the first data passes the integrity protection verification based on the comparison result of the third data and the fourth data.

[0154] Optionally, the communication module 301 is further used to: receive the first data.

[0155] Optionally, the first information is used to indicate that data masking protection and integrity protection are to be performed on the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information, and third data obtained after integrity protection is performed on the first data according to the first information; the processing module 302 is specifically used to: perform data masking and deprotection on the second data according to the first information to obtain the first data; the processing module 302 is specifically used to: perform integrity protection on the first data according to the first information to obtain fourth data; compare the third data and the fourth data; and determine whether the first data passes the integrity protection verification based on the comparison result of the third data and the fourth data.

[0156] Based on the same inventive concept as the above method embodiment, an electronic device is also provided in the embodiment of the present application. The electronic device can be used to perform the actions described in the above method embodiment. In this embodiment, the structure of the electronic device can be as follows: Figure 4 As shown, it includes a memory 401 and one or more processors 402 .

[0157] The memory 401 is used to store computer programs executed by the processor 402. The memory 401 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0158] The memory 401 may be a volatile memory, such as a random-access memory (RAM); the memory 401 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 401 is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 401 may be a combination of the above memories.

[0159] The processor 402 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 402 is used to implement the above method when calling the computer program stored in the memory 401.

[0160] The specific connection medium between the memory 401 and the processor 402 is not limited in the embodiment of the present application. Figure 4 In the embodiment, the memory 401 and the processor 402 are connected via a bus 403. The bus 403 is connected to the processor 402 via a bus 403. Figure 4 The connections between other components are shown in bold lines, which are only for illustration and are not intended to be limiting. Bus 403 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0161] Optionally, the processor 402 may be configured to execute any one or more of the actions performed by the communication module 301 and the processing module 302 above.

[0162] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method in the above embodiment.

[0163] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0164] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A data protection method, characterized in that: include: The first device acquires first information and first data, where the first information is used to indicate that data masking protection and / or integrity protection is performed on the first data; When the first information is used to indicate that data masking protection and integrity protection are performed on the first data, the first device determines verification information according to the first information and the first data, and the verification information is used to perform data masking deprotection and integrity protection verification on the first data; the verification information includes second data obtained after data masking protection is performed on the first data according to the first information, and third data obtained after integrity protection is performed on the first data according to the first information; The first device sends the verification information and the first information to the second device; The second device receives the verification information and the first information from the first device; The second device performs data masking and deprotection on the second data according to the first information to obtain the first data after data masking and deprotection; The second device performs integrity protection on the first data after data masking and deprotection according to the first information to obtain fourth data; The second device compares the third data with the fourth data; The second device determines whether the first data after data masking and deprotection passes the integrity protection verification according to the comparison result of the third data and the fourth data.

2. The method according to claim 1, characterized in that The first information is used to instruct the first device to perform data masking protection on the first data, and the verification information includes second data obtained after performing data masking protection on the first data according to the first information; The second device performs data masking and deprotection on the second data according to the first information to obtain the first data after data masking and deprotection.

3. The method according to claim 1, characterized in that The first information is used to instruct the first device to perform integrity protection on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information; The second device performs integrity protection on the first data according to the first information to obtain fourth data; The second device compares the third data with the fourth data; The second device determines whether the first data passes the integrity protection verification according to a comparison result of the third data and the fourth data.

4. The method according to claim 3, characterized in that The method further comprises: The first device outputs the first data.

5. A data protection method, characterized in that: include: Acquire verification information and first information, where the verification information is determined based on the first information and first data, and the first information is used to indicate that data masking protection and / or integrity protection is performed on the first data; When the first information is used to indicate that data masking protection and integrity protection are to be performed on the first data, data masking deprotection and integrity protection verification of the first data are performed according to the verification information; The verification information includes second data obtained after performing data masking protection on the first data according to the first information, and third data obtained after performing integrity protection on the first data according to the first information; The performing data masking and deprotection of the first data according to the verification information includes: Perform data masking and deprotection on the second data according to the first information to obtain the first data; The performing integrity protection verification of the first data according to the verification information includes: Performing integrity protection on the first data according to the first information to obtain fourth data; comparing the third data and the fourth data; Determine whether the first data passes integrity protection verification according to a comparison result of the third data and the fourth data.

6. The method according to claim 5, characterized in that The first information is used to indicate that data masking protection is performed on the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information; The performing data masking and deprotection of the first data according to the verification information includes: The second data is deprotected by data masking according to the first information to obtain the first data.

7. The method according to claim 5, characterized in that The first information is used to indicate that integrity protection is performed on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information; The performing integrity protection verification of the first data according to the verification information includes: Performing integrity protection on the first data according to the first information to obtain fourth data; comparing the third data and the fourth data; Determine whether the first data passes integrity protection verification according to a comparison result of the third data and the fourth data.

8. The method according to claim 7, characterized in that The method further comprises: The first data is received.

9. A data protection system, characterized in that: The method comprises a first device and a second device, wherein the first device is configured to execute: Acquire first information and first data, where the first information is used to indicate that data masking protection and / or integrity protection is to be performed on the first data; When the first information is used to indicate that data masking protection and integrity protection are performed on the first data, verification information is determined according to the first information and the first data, and the verification information is used to perform data masking deprotection and integrity protection verification on the first data; the verification information includes second data obtained after data masking protection is performed on the first data according to the first information, and third data obtained after integrity protection is performed on the first data according to the first information; outputting the verification information and the first information; The second device is used to perform: receiving the verification information and the first information; De-shielding and protecting the second data according to the first information to obtain the first data after de-shielding and protecting; Performing integrity protection on the first data after the data masking and deprotection according to the first information to obtain fourth data; comparing the third data and the fourth data; Determine whether the first data after data masking and deprotection passes integrity protection verification according to a comparison result of the third data and the fourth data.

10. The system according to claim 9, characterized in that The first information is used to instruct the first device to perform data masking protection on the first data, and the verification information includes second data obtained after performing data masking protection on the first data according to the first information; The second device performs data masking and deprotection on the second data according to the first information to obtain the first data after data masking and deprotection.

11. The system according to claim 9, characterized in that The first information is used to instruct the first device to perform integrity protection on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information; The second device performs integrity protection on the first data according to the first information to obtain fourth data; The second device compares the third data with the fourth data; The second device determines whether the first data passes the integrity protection verification according to a comparison result of the third data and the fourth data.

12. The system according to claim 11, characterized in that The first device is also used for: The first data is output.

13. A data protection device, characterized in that: include: a communication module, used to obtain verification information and first information, where the verification information is determined according to the first information and first data, and the first information is used to indicate that data masking protection and / or integrity protection is performed on the first data; When the first information is used to indicate that data masking protection and integrity protection are performed on the first data, the processing module is used to perform data masking deprotection and integrity protection verification on the first data according to the verification information; The verification information includes second data obtained after performing data masking protection on the first data according to the first information, and third data obtained after performing integrity protection on the first data according to the first information; The processing module is specifically used for: Perform data masking and deprotection on the second data according to the first information to obtain the first data; The processing module is specifically used for: Performing integrity protection on the first data according to the first information to obtain fourth data; comparing the third data and the fourth data; Determine whether the first data passes integrity protection verification according to a comparison result of the third data and the fourth data.

14. The device according to claim 13, characterized in that The first information is used to indicate that data masking protection is performed on the first data, and the verification information includes second data obtained after data masking protection is performed on the first data according to the first information; The processing module is specifically used for: The second data is deprotected by data masking according to the first information to obtain the first data.

15. The device according to claim 13, characterized in that The first information is used to indicate that integrity protection is performed on the first data, and the verification information includes third data obtained after integrity protection is performed on the first data according to the first information; The processing module is specifically used for: Performing integrity protection on the first data according to the first information to obtain fourth data; comparing the third data and the fourth data; Determine whether the first data passes integrity protection verification according to a comparison result of the third data and the fourth data.

16. The device according to claim 15, characterized in that The communication module is also used for: The first data is received.

17. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of any one of the methods in claims 1 to 8.

18. A computer-readable storage medium, characterized in that: The device stores program codes, and when the program codes are run on an electronic device, the program codes are used to enable the electronic device to execute the steps of any method described in claims 1 to 8.

Citation Information

Patent Citations

  • Authorisation of the installation of a software version

    CN101427259A

  • Data storage method and device

    CN104657681A

  • System and method for high-efficiency data integrity auditing supporting safety duplication eliminating in cloud environment

    CN107483585A

  • Safety protection method, device and system

    CN109362108A

  • Data storage method and device

    CN110110551A