Method, apparatus and device for processing data
By including data index, encryption, and type fields in data query instructions, electronic devices can automatically locate, verify, decrypt, and deserialize data, solving the problems of insufficient automation and security in data reading in computer software, achieving fast and secure data reading, and reducing development costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG GEELY HLDG GRP CO LTD
- Filing Date
- 2024-10-10
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies for data reading in computer software suffer from low automation and insufficient security, leading to increased development costs and reduced work efficiency.
By including data index fields, data encryption fields, and data type fields in the data query instructions, electronic devices automatically perform data location, verification, decryption, and deserialization processes to ensure the integrity and security of data reading.
It automates and secures the reading of computer software data, prevents the spread of erroneous data, reduces development costs, and improves work efficiency.
Smart Images

Figure CN119312366B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a data processing method, apparatus, and device. Background Technology
[0002] In the field of secure storage of computer software, data retrieval is required. During the operation of computer software, a large amount of data is generated.
[0003] Therefore, there is an urgent need for a solution that can automatically, quickly, and securely read data. Summary of the Invention
[0004] This application provides a data processing method, apparatus, and device to achieve automatic, fast, and secure data reading.
[0005] In a first aspect, embodiments of this application provide a data processing method, including: in response to a data query instruction, reading the data to be read indicated by the data query instruction.
[0006] Based on the data index field in the data query instruction, the data to be read is processed to determine the data index field.
[0007] If the data index field of the read data is determined to be valid, then the read data is validated according to each field in the data query instruction.
[0008] If the verification process of the read data is successful, the read data will be decrypted and deserialized sequentially to obtain the processed data; and the processed data will be fed back to the user.
[0009] In one possible implementation, the data to be read includes a first verification value, which is generated based on the data index field, data encryption field, and data type field obtained when storing the data to be read.
[0010] Based on the fields in the data query command, the retrieved data is validated, including:
[0011] A second verification value is generated based on the data index field, data encryption field, and data type field in the data query instruction.
[0012] If the second check value is determined to be consistent with the first check value, then the verification process for the read data is considered successful.
[0013] If the second check value is determined to be inconsistent with the first check value, then the verification process for the read data is deemed unsuccessful.
[0014] In one possible implementation, the data index field of the read data is determined based on the data index field in the data query instruction, including:
[0015] The data index field in the data query command is compared with the data index field in the read data.
[0016] If it is determined that the data index field in the data query instruction is consistent with the data index field in the read data, then the determination process for the data index field of the read data is considered successful.
[0017] If it is determined that the data index field in the data query instruction is inconsistent with the data index field in the read data, then the determination process for the data index field of the read data will fail.
[0018] In one possible implementation, before sequentially decrypting and deserializing the read data to obtain the processed data, the method further includes:
[0019] Compare the data type field in the data query command with the data type field in the data to be read.
[0020] If it is determined that the data type field in the data query instruction is consistent with the data type field in the data to be read, then the steps of decrypting and deserializing the read data in sequence are executed to obtain the processed data.
[0021] In one possible implementation, the read data is sequentially decrypted and deserialized to obtain processed data, including:
[0022] Based on the data encryption field in the data query instruction, determine the decryption algorithm corresponding to the data to be read; and based on the decryption algorithm corresponding to the data to be read, decrypt the data to be read to obtain the decrypted data.
[0023] The decrypted data is input into a preset first function for calculation and processing to obtain a first return value; wherein the first return value represents the calculation result of the first function; in response to the first return value being consistent with the pre-stored first preset return value, it is determined that the decryption of the data to be read is successful; wherein the pre-stored first preset return value indicates that the format of the decrypted data is correct.
[0024] The decrypted data is deserialized to obtain the processed data.
[0025] In one possible implementation, after deserializing the decrypted data to obtain processed data, the method further includes:
[0026] Data conforming to a preset encoding format is input into a preset second function for calculation and processing to obtain a second return value; wherein, the second return value represents the calculation and processing result obtained after the data conforming to the preset encoding format is input into the second function.
[0027] If the second return value matches the pre-stored second preset return value, it is determined that the deserialization of the decrypted data was successful; wherein, the pre-stored second preset return value represents the calculation result obtained after the data to be read is input into the second function.
[0028] In one possible implementation, the method further includes:
[0029] In response to a data storage instruction, the data index field of the data to be stored, as indicated by the data storage instruction, is determined; wherein the data storage instruction is used to indicate the storage of the data to be stored; the data to be stored carries a data type field and a data encryption field.
[0030] Based on the preset mapping relationship, the pre-stored data type field corresponding to the data to be stored is determined according to the data index field of the data to be stored; wherein, the preset mapping relationship represents the correspondence between the data index field and the data type field.
[0031] If it is determined that the pre-stored data type field corresponding to the data to be stored is consistent with the data type field carried in the data to be stored, then the data to be stored is serialized and encrypted in sequence to obtain and store the encrypted data.
[0032] The first verification value of the data to be stored is generated based on the data type field, the data encryption field, and the determined data index field of the data to be stored.
[0033] In one possible implementation, determining the data index field of the data to be stored as indicated by the data storage instruction includes:
[0034] If the data index field of the data to be stored is not stored, then the data message format of the data to be stored is determined. Based on the data message format of the data to be stored, the key information of the data to be stored is determined, and based on the key information of the data to be stored, the data index field of the data to be stored is generated.
[0035] If the data index field of the data to be stored is stored, then the stored data index field is determined to be the data index field of the data to be stored.
[0036] In one possible implementation, the data to be stored is sequentially serialized and encrypted to obtain and store the encrypted data, including:
[0037] The data to be stored is serialized to obtain data that conforms to the preset encoding format.
[0038] Data conforming to a preset encoding format is input into a preset third function for calculation and processing, resulting in a third return value; the third return value represents the calculation result of the third function; if the third return value is consistent with the pre-stored third preset return value, it is determined that the serialization processing of the data to be stored is successful; the pre-stored third preset return value indicates that the input data conforms to the serialized data format specification.
[0039] Based on the data encryption field carried by the data to be stored, determine the encryption algorithm corresponding to the data to be stored; and encrypt the data that conforms to the preset encoding format according to the encryption algorithm corresponding to the data to be stored to obtain the encrypted data.
[0040] The encrypted data is processed by a preset fourth function to obtain a fourth return value; the fourth return value represents the result of the fourth function's processing; in response to the fourth return value being consistent with the pre-stored fourth preset return value, it is determined that the encryption of data conforming to the preset encoding format is successful; the pre-stored fourth preset return value indicates that the format of the encrypted data is correct.
[0041] Store encrypted data.
[0042] Secondly, embodiments of this application provide a data processing apparatus, including: a reading unit, configured to read data to be read as indicated by a data query instruction in response to a data query instruction.
[0043] The determination unit is used to determine the data index field of the read data based on the data index field in the data query instruction.
[0044] The first processing unit is used to perform verification processing on the data to be read according to each field in the data query instruction if it is determined that the data index field of the read data has passed the judgment processing.
[0045] The second processing unit is used to, if it is determined that the verification process of the read data has passed, sequentially decrypt and deserialize the read data to obtain the processed data; and then feed back the processed data to the user.
[0046] In one possible implementation, the data to be read includes a first verification value, which is generated based on the data index field, data encryption field, and data type field obtained when storing the data to be read.
[0047] The first processing unit includes:
[0048] The first generation module is used to generate a second verification value based on the data index field, data encryption field, and data type field in the data query instruction.
[0049] The first determining module is used to determine that the verification processing of the read data has passed if the second verification value is consistent with the first verification value.
[0050] The first determining module is further configured to determine that the verification processing of the read data to be read fails if the second verification value is inconsistent with the first verification value.
[0051] In one possible implementation, the determination unit includes:
[0052] The comparison module is used to compare the data index field in the data query command with the data index field in the read data.
[0053] The second determining module is used to determine that the determination process of the data index field of the read data is successful if the data index field in the determined data query instruction is consistent with the data index field in the read data.
[0054] The second determining module is also used to determine that the determination process of the data index field of the read data fails if the data index field in the determined data query instruction is inconsistent with the data index field in the read data.
[0055] In one possible implementation, prior to the second processing unit, the following is also included:
[0056] The comparison unit is used to compare the data type field in the data query instruction with the data type field in the data to be read.
[0057] The first determining unit is used to perform the steps of decrypting and deserializing the read data sequentially to obtain the processed data if the data type field in the determined data query instruction is consistent with the data type field in the data to be read.
[0058] In one possible implementation, the second processing unit includes:
[0059] The decryption module is used to determine the decryption algorithm corresponding to the data to be read based on the data encryption field in the data query instruction; and to decrypt the data to be read according to the decryption algorithm to obtain the decrypted data.
[0060] The first calculation module is used to input the decrypted data into a preset first function for calculation and processing to obtain a first return value; wherein the first return value represents the calculation result of the first function; in response to the first return value being consistent with the pre-stored first preset return value, it is determined that the decryption of the data to be read is successful; wherein the pre-stored first preset return value indicates that the format of the decrypted data is correct.
[0061] The first processing module is used to deserialize the decrypted data to obtain the processed data.
[0062] In one possible implementation, after the second processing unit, the following is further included:
[0063] The calculation unit is used to input data conforming to a preset encoding format into a preset second function for calculation and processing, and to obtain a second return value; wherein, the second return value represents the calculation result obtained after the data conforming to the preset encoding format is input into the second function.
[0064] The second determining unit is used to determine that the deserialization processing of the decrypted data is successful in response to the second return value being consistent with the pre-stored second preset return value; wherein the pre-stored second preset return value represents the calculation result obtained after the data to be read is input into the second function.
[0065] In one possible implementation, the device further includes:
[0066] The third determining unit is used to determine the data index field of the data to be stored as indicated by the data storage instruction in response to the data storage instruction; wherein the data storage instruction is used to indicate the storage of the data to be stored; the data to be stored carries the data type field and the data encryption field of the data to be stored.
[0067] The fourth determining unit is used to determine the pre-stored data type field corresponding to the data to be stored based on a preset mapping relationship and the data index field of the determined data to be stored; wherein, the preset mapping relationship represents the correspondence between the data index field and the data type field.
[0068] The third processing unit is used to perform serialization and encryption processing on the data to be stored in sequence if it is determined that the pre-stored data type field corresponding to the data to be stored is consistent with the data type field carried in the data to be stored, so as to obtain and store the encrypted data.
[0069] The generation unit is used to generate the first verification value of the data to be stored based on the data type field carried in the data to be stored, the data encryption field carried in the data to be stored, and the determined data index field of the data to be stored.
[0070] In one possible implementation, the third determining unit includes:
[0071] The third determining module is used to determine the data message format of the data to be stored if the data index field of the data to be stored is not stored, determine the key information of the data to be stored based on the data message format of the data to be stored, and generate the data index field of the data to be stored based on the key information of the data to be stored.
[0072] The fourth determination module is used to determine, if there is a data index field for the data to be stored, the stored data index field as the data index field for the data to be stored.
[0073] In one possible implementation, the third processing unit includes:
[0074] The second processing module is used to serialize the data to be stored to obtain data that conforms to a preset encoding format.
[0075] The second calculation module is used to input data conforming to a preset encoding format into a preset third function for calculation and processing, and to obtain a third return value; wherein the third return value represents the calculation result of the third function; in response to the third return value being consistent with the pre-stored third preset return value, it is determined that the serialization processing of the data to be stored is successful; wherein the pre-stored third preset return value represents that the input data conforms to the serialized data format specification.
[0076] The encryption module is used to determine the encryption algorithm corresponding to the data to be stored based on the data encryption field carried by the data to be stored; and to encrypt the data that conforms to the preset encoding format according to the encryption algorithm corresponding to the data to be stored, so as to obtain the encrypted data.
[0077] The third calculation module is used to process the encrypted data in a preset fourth function to obtain a fourth return value; wherein the fourth return value represents the calculation result of the fourth function; in response to the fourth return value being consistent with the pre-stored fourth preset return value, it is determined that the encryption of the data conforming to the preset encoding format is successful; wherein the pre-stored fourth preset return value indicates that the format of the encrypted data is correct.
[0078] The storage module is used to store encrypted data.
[0079] Thirdly, embodiments of this application provide a data processing device, including: a memory and a processor.
[0080] The memory stores the instructions that the computer executes.
[0081] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0082] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0083] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0084] The data processing method, apparatus, and device provided in this application, on the one hand, compare the values obtained from processing each field in the data query instruction with the values obtained from processing each field of the data already stored in the electronic device to determine whether the stored data is consistent with the data to be read in the data query instruction. This avoids reading erroneous or tampered data, thus ensuring the integrity of data reading; furthermore, it prevents the spread of erroneous data and ensures the security of computer software development and operation. On the other hand, through the design of this solution, developers only need to input a data query instruction containing the data index field, data encryption field, and data type field of the data to be read. The electronic device can automatically locate, verify, decrypt, and provide feedback on the data to be read based on the data index field, data encryption field, and data type field, thus automating the data reading process of computer software. In addition, this solution improves upon the software, ensuring data security without adding additional hardware, thus achieving automatic, fast, and secure data reading. Attached Figure Description
[0085] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0086] Figure 1 Flowchart of the data processing method provided in this application Figure 1 ;
[0087] Figure 2 Flowchart of the data processing method provided in this application Figure 2 ;
[0088] Figure 3 Schematic diagram of the data processing apparatus provided in this application Figure 1 ;
[0089] Figure 4 Schematic diagram of the data processing apparatus provided in this application Figure 2 ;
[0090] Figure 5 A schematic diagram of the structure of the data processing device provided in this application.
[0091] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0092] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0093] After storing data in computer software, it is necessary to retrieve the stored data. During the operation of computer software, a large amount of data is generated; conversely, developers need to store and retrieve large amounts of data during the development process of computer software.
[0094] To ensure the normal operation of computer software or the smooth progress of the development process, it is necessary to guarantee the security of data reading.
[0095] In one example, a data tamper-proof mechanism is designed on the existing carrier of computer software, i.e., at the hardware level; for example, a self-encrypting drive (SED) is set up. By preventing tampering with the stored data, the security of reading the data is ensured.
[0096] However, designing data anti-tampering mechanisms at the hardware level would increase the cost of computer software development.
[0097] In another example, to ensure the security of data storage and retrieval, developers manually back up or encrypt data during computer software development.
[0098] However, the aforementioned process of backing up or encrypting data increases the complexity of the development process, adds extra workload to developers, and reduces their efficiency.
[0099] This application provides a data processing method, apparatus, and device to solve the above-mentioned technical problems.
[0100] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0101] Figure 1 Flowchart of the data processing method provided in this application Figure 1 ,like Figure 1 As shown, the method includes:
[0102] S101. In response to a data query command, read the data to be read as indicated by the data query command.
[0103] For example, the executing entity of this application embodiment may be an electronic device, a server, a terminal device, or other apparatus or device capable of executing the solution of this embodiment, and there is no limitation thereto. This embodiment is described with an electronic device as the executing entity.
[0104] In the development of computer software, for example, in-vehicle applications, developers need to read the data stored in the computer software in order to update its functions.
[0105] When developers need to read data stored in computer software, they send a data query command to the electronic device. The data query command instructs the electronic device to read the data to be read. The data query command includes the data index field, data encryption field, and data type field of the data to be read.
[0106] The data index field represents the index information of the data. The data index field can be integer or string data; the size of the data index field can be 128 bytes. For example, when the data index field is integer data, it can be: vehicle identification code (e.g., 12584313134) or vehicle mileage (e.g., 52690); when the data index field is string data, it can be: username (e.g., Xiaoming), vehicle color (e.g., red), vehicle model (e.g., AYHG), or last repair date (e.g., January 1, 2024).
[0107] The data encryption field represents the encrypted information of the data. This field specifies the encryption algorithm used to read the data. For example, the encryption algorithm could be Message Digest Algorithm 5 (MD5) or Advanced Encryption Standard (ASE).
[0108] Data type fields represent the type of data. For example, data type fields include: numeric, text, and date.
[0109] After receiving a data query instruction, the electronic device executes a data read command based on the data index field, data encryption field, and data type field in the data query instruction to ultimately read the data.
[0110] S102. Based on the data index field in the data query instruction, perform data index field determination processing on the read data.
[0111] For example, the data index field has a one-to-one correspondence with the data already stored in the computer software. That is, each piece of stored data in the electronic device corresponds to only one data index field. Therefore, after the electronic device identifies the data index field of the data to be read in the data query instruction, it can locate the data already stored in the electronic device and thus obtain the data index field of the data already stored in the electronic device.
[0112] Electronic devices can determine whether the data to be retrieved, as indicated by the data query instruction, exists in the electronic device by comparing the data index field of the data to be retrieved in the data query instruction with the data index field of the stored data.
[0113] S103. If it is determined that the data index field of the read data has passed the judgment process, then the read data is verified according to each field in the data query instruction.
[0114] For example, the electronic device determines the data index field of the data to be read in the data query instruction, and after successfully comparing it with the data index field of the stored data, it determines that the data to be queried as indicated by the data query instruction exists in the electronic device.
[0115] After the electronic device determines the data to be queried, it then obtains the data index field, data encryption field, and data type field of the data already stored in the electronic device corresponding to the data to be queried.
[0116] Next, the electronic device performs verification processing by comparing the data index field, data encryption field, and data type field in the data query command with the same fields of the data already stored in the electronic device. For example, the electronic device can combine the data index field and data encryption field in the data query command to obtain a first combined value; then combine the data index field and data encryption field of the data already stored in the device to obtain a second combined value. By comparing the first combined value with the second combined value, the electronic device can determine whether the data in the data query command is consistent with the data already stored in the electronic device, thereby achieving the verification processing of the read data.
[0117] S104. If it is determined that the verification process of the read data has passed, the read data is decrypted and deserialized in sequence to obtain the processed data; and the processed data is fed back to the user.
[0118] For example, if the electronic device determines that the verification process for the data to be queried has passed, it then decrypts the read data (i.e., the data already stored in the electronic device). For instance, the electronic device identifies the encrypted data field of the data to be read, determines the decryption algorithm corresponding to that encrypted field, and thus decrypts the data to be read.
[0119] After decryption, the electronic device performs deserialization on the decrypted data to be read. Deserialization refers to processing the serialized data into the original structure of the data, that is, a data format that can be recognized by developers.
[0120] After deserializing the data to be read, the electronic device returns the data in its original structure to the user (e.g., a developer). For example, the electronic device can return the processed data to the user through a graphical user interface (GUI), a desktop operating system, or other visualization tools.
[0121] This application provides a data processing method that compares the values obtained from processing each field (data index field, data encryption field, and data type field) in a data query instruction with the values obtained from processing each field (data index field, data encryption field, and data type field) of data already stored in an electronic device. This comparison determines whether the stored data is consistent with the data to be read in the data query instruction, thereby avoiding the reading of erroneous or tampered data and ensuring the integrity of data reading. Furthermore, it prevents the spread of erroneous data and ensures the security of computer software development and operation.
[0122] Furthermore, compared to the need for developers to manually store and back up data, in this embodiment, developers can input a data query command containing the data index field, data encryption field, and data type field of the data to be read. The electronic device can then automatically locate, verify, decrypt, and provide feedback on the data to be read based on the data index field, data encryption field, and data type field. This automates the data reading process of computer software and improves the work efficiency of developers.
[0123] In addition, this embodiment ensures data reading security by decrypting only after successful verification of the data to be read. By improving the data reading method in software, existing hardware resources can be utilized without the need to purchase new hardware, thereby reducing costs.
[0124] Figure 2 Flowchart of the data processing method provided in this application Figure 2 ,like Figure 2 As shown, in this embodiment... Figure 1 Based on the embodiments, the data processing method is described in detail, which includes:
[0125] S201. In response to the data storage instruction, determine the data index field of the data to be stored indicated by the data storage instruction; wherein the data storage instruction is used to indicate the storage of the data to be stored; the data to be stored carries a data type field and a data encryption field of the data to be stored.
[0126] For example, the executing entity of this application embodiment may be an electronic device, a server, a terminal device, or other apparatus or device capable of executing the solution of this embodiment, and there is no limitation thereto. This embodiment is described with an electronic device as the executing entity.
[0127] In the development of computer software, for example, in-vehicle applications, developers need to store data in the in-vehicle applications in order to record and update various data in the applications.
[0128] In this embodiment, the storage format of data in the electronic device is defined, namely, the data storage format includes: data index field, data encryption field, data type field, and data verification field.
[0129] When developers need to store data in an in-vehicle application, they send a data storage instruction to the electronic device. This instruction includes the data index field, data type field, and data encryption field for the data to be stored.
[0130] The electronic device receives a data storage instruction and analyzes the data index field in the instruction. Figure 1 As mentioned in the embodiments, the data index field of each piece of data is unique. Therefore, by analyzing the data index field in the data storage instruction, for example, by comparing it with the data index fields of each piece of data already stored in the electronic device, the electronic device can determine whether the same data (i.e., the data stored last time) already exists in the electronic device, and then proceed with the subsequent data storage process.
[0131] In one example, step S201, "determining the data index field of the data to be stored as indicated by the data storage instruction," includes the following process:
[0132] If the data index field of the data to be stored is not stored, then the data message format of the data to be stored is determined. Based on the data message format of the data to be stored, the key information of the data to be stored is determined, and based on the key information of the data to be stored, the data index field of the data to be stored is generated.
[0133] If the data index field of the data to be stored is stored, then the stored data index field is determined to be the data index field of the data to be stored.
[0134] For example, in some cases, the data index field in the data storage instruction cannot be found in the electronic device; to address such situations, this embodiment proposes the following solution process:
[0135] First, the electronic device analyzes the data to be stored as indicated by the data storage command to obtain the data message format of the data to be stored. For example, the data message format includes the storage format of the data to be stored, such as the field composition of the data to be stored, the meaning of each field, the content of each field, and the encoding method.
[0136] Next, the electronic device determines the key information indicating the data to be stored within the data message format, based on the data message format of the data to be stored. For example, the key information may be one of the contents included in the data message format.
[0137] Finally, the electronic device generates a data index field for the data to be stored based on the key information of the data to be stored.
[0138] For example, when an electronic device analyzes the data to be stored, it obtains data message formats including: a unique identifier for the vehicle (vehicle_id, e.g., "VH123"), the vehicle's location information (e.g., represented by latitude and longitude information), the event type (event_type, e.g., "speed_alert", representing a speed warning), and the timestamp of the event (e.g., "20240613082030").
[0139] Electronic devices analyze data message formats to quickly retrieve specific types of events that occurred at a specific time for a vehicle. This allows them to determine the vehicle's unique identifier, event type, and the timestamp of the event within the data message format—all crucial information.
[0140] Next, the electronic device arranges the vehicle's unique identifier, event type, and event timestamp from the key information in a certain way, for example, by arranging them in the order of the vehicle's unique identifier, event type, and event timestamp, and then generates a data index field for the data to be stored.
[0141] S202. Based on the preset mapping relationship, determine the pre-stored data type field corresponding to the data to be stored according to the data index field of the determined data to be stored; wherein, the preset mapping relationship represents the correspondence between the data index field and the data type field.
[0142] For example, the electronic device determines the data type field of the data to be stored based on the data index field of the data to be stored according to a preset mapping relationship; wherein, the preset mapping relationship may be pre-stored in the electronic device, or the electronic device may obtain it by retrieving an external database.
[0143] For example, the preset mapping relationship could be: if the data index field is a vehicle identification code, then the data type field is determined to be numeric; if the data index field is a username, then the data type field is determined to be text; if the data index field is the most recent maintenance date, then the data type field is determined to be date.
[0144] S203. If it is determined that the pre-stored data type field corresponding to the data to be stored is consistent with the data type field carried in the data to be stored, then the data to be stored is serialized and encrypted in sequence to obtain and store the encrypted data.
[0145] For example, the electronic device compares the data type field corresponding to the data to be stored with the data type field corresponding to the previously stored data; if the data type field corresponding to the data to be stored is consistent with the data type field corresponding to the previously stored data, the determination is passed and the process proceeds to the next step.
[0146] After the data type is determined, the electronic device serializes the data to be stored; serialization refers to converting the data to be stored into a preset encoding format. The preset encoding format can be JSON, XML, or binary format.
[0147] After successful serialization, the electronic device encrypts the serialized data to be stored. By reading the encryption field of the data to be stored, the electronic device identifies the encryption algorithm specified by the developer and then encrypts the data according to the specified algorithm.
[0148] In one example, step S203, "serializing and encrypting the data to be stored sequentially to obtain and store the encrypted data," includes the following process:
[0149] The data to be stored is serialized to obtain data that conforms to the preset encoding format.
[0150] Data conforming to a preset encoding format is input into a preset third function for calculation and processing, resulting in a third return value; the third return value represents the calculation result of the third function; if the third return value is consistent with the pre-stored third preset return value, it is determined that the serialization processing of the data to be stored is successful; the pre-stored third preset return value indicates that the input data conforms to the serialized data format specification.
[0151] Based on the data encryption field carried by the data to be stored, determine the encryption algorithm corresponding to the data to be stored; and encrypt the data that conforms to the preset encoding format according to the encryption algorithm corresponding to the data to be stored to obtain the encrypted data.
[0152] The encrypted data is processed by a preset fourth function to obtain a fourth return value; the fourth return value represents the result of the fourth function's processing; in response to the fourth return value being consistent with the pre-stored fourth preset return value, it is determined that the encryption of data conforming to the preset encoding format is successful; the pre-stored fourth preset return value indicates that the format of the encrypted data is correct.
[0153] Store encrypted data.
[0154] For example, this embodiment also includes determining whether serialization and encryption were successful.
[0155] The process of determining whether the serialization of data to be stored was successful can include the following steps:
[0156] First, the electronic device pre-stores the serialized data format specification, which may include the length and format of the serialized data to be stored. For example, for integer data, the serialized length is defined as 4 bytes; for string data, the serialized length is defined as 8 bytes; and the format of the serialized data is binary.
[0157] Next, the serialized data (i.e., data conforming to a preset encoding format) is input into a third function, which checks the length and format of the serialized data. For example, checking the length of the serialized data can be done by the `validateSerializedBinaryData` function, and verifying the format of the serialized data can be done by the `parseFromBinary` function.
[0158] After the third function's calculation and processing, a third return value is output. If the third return value matches the pre-stored third preset return value, for example, if both the third return value and the pre-stored third preset return value are 1, it indicates that the input data conforms to the serialized data format specification, thus indicating successful serialization. Conversely, if the third return value is not equal to the pre-stored third preset return value, for example, if the third return value is 0 while the pre-stored third preset return value is 1, it indicates that the input data does not conform to the serialized data format specification, thus indicating serialization failure. The electronic device can generate and send a serialization failure prompt message and exit the data storage process.
[0159] Determining whether the encryption of data to be stored was successful can include the following process:
[0160] First, the electronic device uses a fourth function to verify the encrypted data according to the encryption format specification corresponding to the encryption algorithm. This can include checking whether specific verification information exists in the encrypted data. For example, taking the ASE algorithm as an example, the verification information can be a 16-byte initialization vector, which can be stored together with the encrypted data in the form of a prefix or suffix. For instance, checking whether specific verification information exists in the encrypted data can be implemented using the verifyEncryptedFormat function.
[0161] Next, the fourth function outputs a fourth return value. If the fourth return value is equal to the pre-stored fourth preset return value, for example, both are 1, it indicates that the encrypted data is in the correct format, and thus the data encryption is successful. Conversely, if the fourth return value is not equal to the pre-stored fourth preset return value, for example, the fourth return value is 0 while the pre-stored fourth preset return value is 1, it indicates that the encrypted data is in the wrong format, and thus the data encryption fails. The electronic device can generate and send a prompt message indicating that the data encryption failed, and then exit the data storage process.
[0162] S204. Generate the first verification value of the data to be stored based on the data type field carried in the data to be stored, the data encryption field carried in the data to be stored, and the determined data index field of the data to be stored.
[0163] For example, the electronic device generates a first verification value for the data to be stored based on the data index field, data type field, and data encryption field corresponding to the data to be stored.
[0164] For example, the first verification value of the data to be stored can be generated by adding the data index field, the data type field, and the data encryption field. For example, the first verification value = data index field + data type field + data encryption field. This addition can be just a formal combination.
[0165] After generating the first check value of the data to be stored, the electronic device stores the first check value of the data to be stored and completes the data storage process.
[0166] S205. In response to a data query command, read the data to be read as indicated by the data query command.
[0167] The specific process of this step can be found in step S101, and will not be repeated here.
[0168] S206. Based on the data index field in the data query instruction, perform data index field determination processing on the read data.
[0169] The specific process of this step can be found in step S102, and will not be repeated here.
[0170] In one example, step S206 includes the following process:
[0171] The data index field in the data query command is compared with the data index field in the read data.
[0172] If it is determined that the data index field in the data query instruction is consistent with the data index field in the read data, then the determination process for the data index field of the read data is considered successful.
[0173] If it is determined that the data index field in the data query instruction is inconsistent with the data index field in the read data, then the determination process for the data index field of the read data will fail.
[0174] For example, the electronic device compares the data index field in the data query instruction with the data index field of the data to be read. If they match, the data index field is used to determine the data and the subsequent data reading process begins.
[0175] Conversely, if the data index field in the data query instruction is inconsistent with the data index field of the data to be read, it indicates that the data index field in the data query instruction cannot locate the data already stored in the electronic device. In other words, the data requested by the data query instruction does not exist in the electronic device, and the determination of the data index field fails. In such cases, the electronic device terminates the data reading process and can generate a message indicating that the data index field determination failed. After generation, the electronic device sends this message to the developers.
[0176] S207. If it is determined that the data index field of the read data has passed the judgment process, then the read data is verified according to each field in the data query instruction.
[0177] The specific process of this step can be found in step S103, and will not be repeated here.
[0178] In one example, step S207, "verifying the read data according to each field in the data query instruction," includes the following process:
[0179] A second verification value is generated based on the data index field, data encryption field, and data type field in the data query instruction.
[0180] If the second check value is determined to be consistent with the first check value, then the verification process for the read data is considered successful.
[0181] If the second check value is determined to be inconsistent with the first check value, then the verification process for the read data is deemed unsuccessful.
[0182] For example, the data to be read includes a first verification value, which is generated based on the data index field, data encryption field, and data type field obtained when storing the data to be read.
[0183] If the data index field of the data to be read passes the verification process, the electronic device generates a second verification value based on each field in the data query instruction. The second verification value is then compared with the first verification value included in the data to be read. If the comparison results are consistent, the verification process of the data to be read is determined to have passed. Otherwise, the verification process of the data to be read is determined to have failed, the data reading process is terminated, and the electronic device generates and sends a prompt message indicating that the data verification process has failed.
[0184] For example, if the first verification value equals the data index field, the data type field, and the data encryption field, the second verification value is calculated using the same logic. That is, the second verification value is a combination of the data index field, the data type field, and the data encryption field in the data query instruction.
[0185] By comparing the first and second check values, it can be determined whether the data index field, data type field, and data encryption field of the data to be read completely match the data index field, data encryption field, and data type field in the data query instruction. This allows it to determine whether the data to be read has been tampered with (e.g., by an unauthorized user), thus ensuring data integrity and consistency. It also prevents the reading of incorrect or tampered data, thereby preventing the spread of erroneous data and ensuring the smooth progress of computer software development.
[0186] For example, a cyclic redundancy check (CRC) or hash value verification method can be used to compare the first check value with the second check value.
[0187] If CRC checksum is used, firstly, the electronic device serializes the first checksum and the second checksum respectively (for example, converting the first checksum and the second checksum into binary format); next, the electronic device calculates the CRC checksum of the serialized first checksum and the CRC checksum of the second checksum according to the CRC algorithm selected by the developer (for example, CRC-16, CRC-32); then, the electronic device compares the CRC checksum of the first checksum with the CRC checksum of the second checksum; if they are equal, the checksum is deemed to have passed; otherwise, the checksum is deemed to have failed.
[0188] If hash value verification is used, firstly, the electronic device serializes the first and second check values respectively (for example, converting the first and second check values into string format); next, the electronic device calculates the hash value of the serialized first check value and the hash value of the second check value according to the selected hash function (for example, SHA-256, SHA-512); then, the electronic device compares the hash values of the first and second check values; if they are equal, the verification is deemed to have passed; otherwise, the verification is deemed to have failed.
[0189] S208. Compare the data type field in the data query instruction with the data type field in the data to be read.
[0190] If it is determined that the data type field in the data query instruction is consistent with the data type field in the data to be read, then the steps of decrypting and deserializing the read data in sequence are executed to obtain the processed data.
[0191] For example, the electronic device compares the data type field in the data query instruction with the data type field in the data to be read, and determines whether the data type field in the data query instruction matches the data type field in the data to be read based on the comparison result.
[0192] If the data type field in the data query instruction matches the data type field in the data to be read, it indicates that the data type field in the data query instruction matches the data type field in the data to be read, and the subsequent data reading process continues.
[0193] Conversely, if the data type field in the data query instruction is inconsistent with the data type field in the data to be read, the data reading process is terminated, and the electronic device generates and sends a message to the developer indicating that the data type field determination has failed.
[0194] By comparing the data type field in the data query command with the data type field in the data to be read, it can be determined whether the data type of the data that the developer wants to query is consistent with the data type of the data that they want to obtain. This avoids data type conversion errors during the data reading process and ensures the security of the data reading process.
[0195] S209. If it is determined that the verification process of the read data has passed, the read data is decrypted and deserialized in sequence to obtain the processed data; and the processed data is fed back to the user.
[0196] The process for this step can be referred to in step S104, and will not be repeated here.
[0197] In one example, step S209 includes the following process:
[0198] Based on the data encryption field in the data query instruction, determine the decryption algorithm corresponding to the data to be read; and based on the decryption algorithm corresponding to the data to be read, decrypt the data to be read to obtain the decrypted data.
[0199] The decrypted data is input into a preset first function for calculation and processing to obtain a first return value; wherein the first return value represents the calculation result of the first function; in response to the first return value being consistent with the pre-stored first preset return value, it is determined that the decryption of the data to be read is successful; wherein the pre-stored first preset return value indicates that the format of the decrypted data is correct.
[0200] The decrypted data is deserialized to obtain the processed data.
[0201] For example, the electronic device reads the data encryption field in the data query instruction and identifies the specification of the decryption algorithm contained in the data encryption field in the data query instruction; then, the electronic device decrypts the data to be read according to the specified decryption algorithm, and after the decryption is completed, the decrypted data is obtained.
[0202] This embodiment also includes determining whether data decryption was successful, which can be achieved through the following process:
[0203] First, the electronic device determines the format of the decrypted data according to the specified decryption algorithm; for example, it can be in binary format.
[0204] The first function is used to check the format of the decrypted data. For example, the decrypted data is input into the first function, which verifies the format of the decrypted data and then outputs a first return value. For instance, when the format of the decrypted data is binary, the isValidBinaryFormat function can be used to check whether the format of the decrypted data is binary.
[0205] If the first function returns 1, meaning it matches the pre-stored first preset return value (e.g., equal to 1), it indicates that the format of the decrypted data conforms to the data format corresponding to the specified decryption algorithm, thus confirming successful decryption of the data to be read. Conversely, if the first function returns 0, meaning it does not match the pre-stored first preset return value, it indicates that the format of the decrypted data does not conform to the data format corresponding to the specified decryption algorithm, thus confirming decryption failure of the data to be read. Subsequently, the electronic device terminates the data reading process and generates and sends a data decryption failure message to the developers.
[0206] S210. Input the data that conforms to the preset encoding format into the preset second function for calculation and processing to obtain the second return value; wherein, the second return value represents the calculation and processing result obtained after the data that conforms to the preset encoding format is input into the second function.
[0207] For example, this embodiment also includes determining whether data deserialization was successful, which can be achieved through the following process:
[0208] During the data storage phase, which can be viewed as the process corresponding to steps S201-S204, the electronic device inputs the data to be stored into the calculation function. The calculation function performs calculations on the data to be stored and outputs the initial verification value of the data to be stored. For example, the calculation function could be `calculateSHA256`.
[0209] During the data reading phase, data conforming to the preset encoding format, i.e., data in the deserialization state, is input into the calculation function. The calculation function performs calculations on the data conforming to the preset encoding format and outputs the calculated verification value of the data conforming to the preset encoding format.
[0210] The electronic device compares the initial checksum with the calculated checksum using a second function and outputs a second return value; the second function can be the verifyChecksums function.
[0211] S211. In response to the second return value being consistent with the pre-stored second preset return value, it is determined that the deserialization processing of the decrypted data is successful; wherein, the pre-stored second preset return value represents the calculation result obtained after the data to be read is input into the second function.
[0212] For example, the electronic device compares the second return value output by the second function with a pre-stored second preset return value (e.g., equal to 1). If they are equal, it indicates that the deserialized data conforming to the preset encoding format is consistent with the data to be stored in the storage stage, thus determining that deserialization was successful. Conversely, if the second return value output by the second function is 0, and the second return value is inconsistent with the pre-stored second preset return value, it indicates that the deserialized data conforming to the preset encoding format is inconsistent with the data to be stored in the storage stage, thus determining that deserialization failed. Subsequently, the electronic device terminates the data reading process, generates and sends a data deserialization failure message to the developers.
[0213] After successful deserialization, the electronic device sends the processed data back to the developers.
[0214] This application provides a data processing method in which, during the data storage stage, the data index field, data type field, and data encryption field of the data to be stored are added together to obtain a first verification value; during the data reading stage, the data index field, data type field, and data encryption field of the data query instruction are added together to obtain a second verification value; by verifying whether the first verification value and the second verification value are equal, it is determined whether the data to be read in the electronic device has been tampered with by external force, thereby ensuring the consistency and integrity of the data; and preventing developers from reading data of the wrong type and using it during the development process, which could cause abnormal operation of the computer software and ensure the normal progress of computer software development.
[0215] Furthermore, during the data storage phase, this embodiment also addresses the situation where the data index field in the data storage instruction cannot be found in the electronic device. By analyzing the message format of the data to be stored, the key information indicated in the data message format is determined, and an index field for the data to be stored is generated based on this key information. In this way, developers do not need to manually create a corresponding data index field for each piece of data to be stored, reducing repetitive work, automating data storage, and improving development efficiency.
[0216] Figure 3 Schematic diagram of the data processing apparatus provided in this application Figure 1 ,like Figure 3 As shown, the data processing apparatus provided in this embodiment includes:
[0217] The reading unit 301 is used to read the data to be read as indicated by the data query instruction in response to the data query instruction.
[0218] The determination unit 302 is used to perform determination processing on the data index field of the read data based on the data index field in the data query instruction.
[0219] The first processing unit 303 is used to perform verification processing on the read data according to each field in the data query instruction if it is determined that the data index field of the read data has passed the judgment processing.
[0220] The second processing unit 304 is used to, if it is determined that the verification process of the read data has passed, sequentially perform decryption and deserialization processing on the read data to obtain the processed data; and to provide feedback on the processed data to the user.
[0221] The data processing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0222] Figure 4 Schematic diagram of the data processing apparatus provided in this application Figure 2 ,like Figure 4 As shown, the data processing apparatus provided in this embodiment includes:
[0223] The reading unit 401 is used to read the data to be read as indicated by the data query instruction in response to the data query instruction.
[0224] The determination unit 402 is used to perform determination processing on the data index field of the read data based on the data index field in the data query instruction.
[0225] The first processing unit 403 is used to perform verification processing on the read data according to each field in the data query instruction if it is determined that the data index field of the read data has passed the judgment processing.
[0226] The second processing unit 404 is used to, if it is determined that the verification process of the read data has passed, sequentially perform decryption and deserialization processing on the read data to obtain the processed data; and to feed back the processed data to the user.
[0227] In one possible implementation, the data to be read includes a first verification value, which is generated based on the data index field, data encryption field, and data type field obtained when storing the data to be read.
[0228] The first processing unit 403 includes:
[0229] The first generation module 4031 is used to generate a second verification value based on the data index field, data encryption field, and data type field in the data query instruction.
[0230] The first determining module 4032 is used to determine that the verification processing of the read data has passed if the second verification value is consistent with the first verification value.
[0231] The first determining module 4032 is further configured to determine that the verification processing of the read data to be read fails if the second verification value is inconsistent with the first verification value.
[0232] In one possible implementation, the determination unit 402 includes:
[0233] The comparison module 4021 is used to compare the data index field in the data query instruction with the data index field in the read data.
[0234] The second determining module 4022 is used to determine that the determination process of the data index field of the read data is successful if the data index field in the determined data query instruction is consistent with the data index field in the read data.
[0235] The second determining module 4022 is further configured to determine that the determination process of the data index field of the read data fails if the data index field in the determined data query instruction is inconsistent with the data index field in the read data.
[0236] In one possible implementation, prior to the second processing unit 404, the following is also included:
[0237] The comparison unit 405 is used to compare the data type field in the data query instruction with the data type field in the data to be read.
[0238] The first determining unit 406 is used to perform the following steps if the data type field in the determined data query instruction is consistent with the data type field in the data to be read, then perform decryption and deserialization processing on the read data in sequence to obtain the processed data.
[0239] In one possible implementation, the second processing unit 404 includes:
[0240] The decryption module 4041 is used to determine the decryption algorithm corresponding to the data to be read based on the data encryption field in the data query instruction; and to decrypt the data to be read based on the decryption algorithm to obtain the decrypted data.
[0241] The first calculation module 4042 is used to input the decrypted data into a preset first function for calculation and processing to obtain a first return value; wherein the first return value represents the calculation result of the first function; in response to the first return value being consistent with the pre-stored first preset return value, it is determined that the decryption of the data to be read is successful; wherein the pre-stored first preset return value represents that the format of the decrypted data is correct.
[0242] The first processing module 4043 is used to deserialize the decrypted data to obtain the processed data.
[0243] In one possible implementation, after the second processing unit 404, the following is further included:
[0244] The calculation unit 407 is used to input data conforming to a preset encoding format into a preset second function for calculation and processing, and to obtain a second return value; wherein, the second return value represents the calculation and processing result obtained after the data conforming to the preset encoding format is input into the second function.
[0245] The second determining unit 408 is used to determine that the deserialization processing of the decrypted data is successful in response to the second return value being consistent with the pre-stored second preset return value; wherein, the pre-stored second preset return value represents the calculation result obtained after the data to be read is input into the second function.
[0246] In one possible implementation, the device further includes:
[0247] The third determining unit 409 is used to determine the data index field of the data to be stored indicated by the data storage instruction in response to the data storage instruction; wherein the data storage instruction is used to indicate the storage of the data to be stored; the data to be stored carries a data type field and a data encryption field of the data to be stored.
[0248] The fourth determining unit 410 is used to determine the pre-stored data type field corresponding to the data to be stored based on a preset mapping relationship and according to the data index field of the determined data to be stored; wherein, the preset mapping relationship represents the correspondence between the data index field and the data type field.
[0249] The third processing unit 411 is used to perform serialization and encryption processing on the data to be stored in sequence if it is determined that the pre-stored data type field corresponding to the data to be stored is consistent with the data type field carried in the data to be stored, so as to obtain and store the encrypted data.
[0250] The generation unit 412 is used to generate a first verification value for the data to be stored based on the data type field carried in the data to be stored, the data encryption field carried in the data to be stored, and the determined data index field of the data to be stored.
[0251] In one possible implementation, the third determining unit 409 includes:
[0252] The third determining module 4091 is used to determine the data message format of the data to be stored if the data index field of the data to be stored is not stored, determine the key information of the data to be stored based on the data message format of the data to be stored, and generate the data index field of the data to be stored based on the key information of the data to be stored.
[0253] The fourth determining module 4092 is used to determine, if there is a data index field for the data to be stored, that the stored data index field is the data index field for the data to be stored.
[0254] In one possible implementation, the third processing unit 411 includes:
[0255] The second processing module 4111 is used to serialize the data to be stored to obtain data that conforms to a preset encoding format.
[0256] The second calculation module 4112 is used to input data conforming to a preset encoding format into a preset third function for calculation and processing, and obtain a third return value; wherein, the third return value represents the calculation and processing result of the third function; in response to the third return value being consistent with the pre-stored third preset return value, it is determined that the serialization processing of the data to be stored is successful; wherein, the pre-stored third preset return value represents that the input data conforms to the serialized data format specification.
[0257] The encryption module 4113 is used to determine the encryption algorithm corresponding to the data to be stored based on the data encryption field carried by the data to be stored; and to encrypt the data that conforms to the preset encoding format according to the encryption algorithm corresponding to the data to be stored, so as to obtain the encrypted data.
[0258] The third calculation module 4114 is used to process the encrypted data in a preset fourth function to obtain a fourth return value; wherein the fourth return value represents the calculation result of the fourth function; in response to the fourth return value being consistent with the pre-stored fourth preset return value, it is determined that the encryption of the data conforming to the preset encoding format is successful; wherein the pre-stored fourth preset return value represents that the format of the encrypted data is correct.
[0259] Storage module 4115 is used to store encrypted data.
[0260] The data processing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0261] Figure 5 A schematic diagram of the structure of the data processing device provided in this application. Figure 5 As shown, the data processing device provided in this embodiment includes at least one processor 501 and a memory 502. Optionally, the device further includes a communication component 503. The processor 501, memory 502, and communication component 503 are connected via a bus 504.
[0262] In a specific implementation, at least one processor 501 executes computer execution instructions stored in memory 502, causing at least one processor 501 to perform the above-described method.
[0263] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0264] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0265] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0266] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0267] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0268] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0269] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0270] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0271] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0272] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0273] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0274] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0275] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0276] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A data processing method, characterized in that, The method includes: In response to a data query instruction, the system reads the data to be read as indicated by the data query instruction; the data query instruction includes: a data index field, a data encryption field, and a data type field; Based on the data index field in the data query instruction, the data to be read is subjected to a data index field determination process; the determination process is used to compare whether the data index field of the data to be read from the stored data is consistent with the data index field in the data query instruction; If it is determined that the data index field of the read data is consistent with the data index field in the data query instruction, then the judgment process is deemed successful, and the read data is verified according to each field in the data query instruction. The verification process is used to verify whether the second verification value of the data query instruction is consistent with the first verification value of the read data that has passed the judgment process. The second verification value is obtained based on the data index field, data encryption field, and data type field of the data query instruction, and the first verification value is obtained based on the data index field, data encryption field, and data type field obtained when storing the read data. If it is determined that the second verification value is consistent with the first verification value, then the verification process is deemed successful, and the data type field of the read data is compared with the data type field in the data query instruction. If they match, the read data is then decrypted and deserialized sequentially to obtain the processed data. The processed data is then fed back to the user.
2. The method according to claim 1, characterized in that, Also includes: If it is determined that the second verification value is inconsistent with the first verification value, then it is determined that the verification process for the read data will fail.
3. The method according to claim 1, characterized in that, Also includes: If it is determined that the data index field in the data query instruction is inconsistent with the data index field in the read data, then the determination process for the data index field of the read data fails.
4. The method according to claim 1, characterized in that, The read data is sequentially decrypted and deserialized to obtain the processed data, including: Based on the data encryption field in the data query instruction, determine the decryption algorithm corresponding to the data to be read; and based on the decryption algorithm corresponding to the data to be read, decrypt the data to be read to obtain the decrypted data. The decrypted data is input into a preset first function for calculation and processing to obtain a first return value; wherein the first return value represents the calculation result of the first function; in response to the first return value being consistent with a pre-stored first preset return value, it is determined that the decryption of the data to be read is successful; wherein the pre-stored first preset return value indicates that the format of the decrypted data is correct; The decrypted data is then deserialized to obtain the processed data.
5. The method according to claim 4, characterized in that, After deserializing the decrypted data to obtain the processed data, the process further includes: Data conforming to a preset encoding format is input into a preset second function for calculation and processing to obtain a second return value; wherein, the second return value represents the calculation and processing result obtained after the data conforming to the preset encoding format is input into the second function; In response to the second return value being consistent with the pre-stored second preset return value, it is determined that the deserialization processing of the decrypted data was successful; wherein, the pre-stored second preset return value represents the calculation result obtained after the data to be read is input into the second function.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: In response to a data storage instruction, the data index field of the data to be stored indicated by the data storage instruction is determined; wherein the data storage instruction is used to indicate the storage of the data to be stored; the data to be stored carries a data type field and a data encryption field of the data to be stored; Based on a preset mapping relationship, the pre-stored data type field corresponding to the data to be stored is determined according to the data index field of the data to be stored; wherein, the preset mapping relationship represents the correspondence between the data index field and the data type field; If it is determined that the pre-stored data type field corresponding to the data to be stored is consistent with the data type field carried in the data to be stored, then the data to be stored is serialized and encrypted in sequence to obtain and store the encrypted data. A first verification value for the data to be stored is generated based on the data type field carried in the data to be stored, the data encryption field carried in the data to be stored, and the determined data index field of the data to be stored.
7. The method according to claim 6, characterized in that, Determining the data index field of the data to be stored as indicated by the data storage instruction includes: If the data index field of the data to be stored is not stored, then the data message format of the data to be stored is determined, the key information of the data to be stored is determined according to the data message format of the data to be stored, and the data index field of the data to be stored is generated according to the key information of the data to be stored. If a data index field for the data to be stored is stored, then the stored data index field is determined to be the data index field for the data to be stored.
8. The method according to claim 6, characterized in that, The data to be stored is sequentially serialized and encrypted to obtain and store the encrypted data, including: The data to be stored is serialized to obtain data that conforms to a preset encoding format; The data conforming to the preset encoding format is input into a preset third function for calculation and processing to obtain a third return value; wherein, the third return value represents the calculation and processing result of the third function; in response to the third return value being consistent with the pre-stored third preset return value, it is determined that the serialization processing of the data to be stored is successful; wherein, the pre-stored third preset return value represents that the input data conforms to the serialized data format specification; Based on the data encryption field carried by the data to be stored, determine the encryption algorithm corresponding to the data to be stored; and encrypt the data that conforms to the preset encoding format according to the encryption algorithm corresponding to the data to be stored to obtain the encrypted data. The encrypted data is processed by a preset fourth function to obtain a fourth return value; wherein the fourth return value represents the result of the calculation of the fourth function; in response to the fourth return value being consistent with a pre-stored fourth preset return value, it is determined that the encryption of the data conforming to the preset encoding format is successful; wherein the pre-stored fourth preset return value indicates that the format of the encrypted data is correct. Store the encrypted data.
9. A data processing apparatus, characterized in that, include: A reading unit is used to read the data to be read as indicated by the data query instruction in response to the data query instruction; The data query instruction includes: a data index field, a data encryption field, and a data type field; The determination unit is used to perform data index field determination processing on the read data to be read according to the data index field in the data query instruction; the determination processing is used to compare whether the data index field of the data to be read from the stored data is consistent with the data index field in the data query instruction; The first processing unit is configured to determine that the judgment process has passed if it is determined that the data index field of the read data is consistent with the data index field in the data query instruction, and to perform verification processing on the read data according to each field in the data query instruction; the verification processing is used to verify whether the second verification value of the data query instruction is the same as the first verification value of the read data that has passed the judgment process; the second verification value is obtained based on the data index field, data encryption field, and data type field of the data query instruction, and the first verification value is obtained based on the data index field, data encryption field, and data type field obtained when storing the read data; The second processing unit is configured to determine that the verification process has passed if the second verification value is consistent with the first verification value, and to compare the data type field of the data to be read that has passed the verification process with the data type field in the data query instruction; if they are consistent, to perform decryption and deserialization processing on the read data in sequence to obtain the processed data; and to provide feedback on the processed data to the user.
10. A data processing device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-8.
12. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-8.
Citation Information
Patent Citations
Query method and device for UTXO
CN106503053A
Asynchronous multiparty data interaction method based on block chain system and storage medium
CN107622096A
Database data verification method and device, equipment and storage medium
CN115794862A
Method, device and system based on Graphql request mode
CN115982258A