Data processing method and electronic equipment
By authenticating and defining the files in the storage device, the problem of low data interaction efficiency in the encryption environment is solved, and the storage device obtains data content in a timely manner, and avoids packet misunderstanding.
Patent Information
- Application Number
- CN202311605553.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-27
- Publication Date
- 2025-05-27
AI Technical Summary
In an encrypted environment, data interaction efficiency is low, and the storage device cannot obtain the written data content in time. Since the encrypted data packet is named randomly, the storage device may mistake the received data packet A as data packet B, resulting in the inability to correctly process the instructions carried by data packet A.
By accessing the storage device, the files stored in the storage device are authenticated by file, the bit value is defined to represent the bit value written when reading the file, the target data is converted into a binary sequence, and the file is read in sequence so that the storage device can access the target encoding by recording the bit value, and obtain the target data by analyzing the target encoding.
It improves the efficiency of data interaction in an encrypted environment, enables storage devices to obtain the written data content in a timely manner, ensures timely processing of carrying instructions, and avoids the problem of misunderstanding of data packets.
Smart Images

Figure CN120045121A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage, and in particular, to a data processing method and an electronic device. Background Art
[0002] Currently, in order to improve the security of the data writing system, when the system receives a written data packet, it usually encrypts the data packet first, then randomly names the encrypted data packet, and then stores the randomly named encrypted data packet in the storage device. Then the storage device will receive the randomly named data packet. If the data packet carries instruction information for performing other operations, in an encrypted environment, the corresponding operations cannot be directly executed. Instead, the data packet needs to be decrypted first to obtain the content of the data packet. Such methods can improve the security of data, but the efficiency of data interaction in an encrypted environment is relatively low. The storage device cannot timely obtain the content of the stored data, and it is also difficult to ensure the timely processing of the carried instructions. Moreover, since the encrypted data packet is randomly named, the storage device may misidentify the received data packet A as data packet B, resulting in the inability to correctly process the instructions carried by data packet A. Summary of the Invention
[0003] Embodiments of this application disclose a data processing method and an electronic device, which solve the technical problems of low efficiency of data interaction in an encrypted environment and the inability of the storage device to timely obtain the written data content.
[0004] This application provides a data processing method applied to an electronic device. The method includes: accessing a storage device and performing file authentication on a first file and a second file stored in the storage device; if the file authentication is successful, defining a first bit value to represent the bit value read from the first file and written to the storage device during reading, and defining a second bit value to represent the bit value read from the second file and written to the storage device during reading; converting target data to be written to the storage device into a binary sequence, where the binary sequence includes the first bit value and / or the second bit value; based on the binary sequence, sequentially reading the first file and / or the second file, so that the storage device obtains a target code composed of the first bit value and the second bit value by recording the bit values corresponding to the read files, and obtains the target data by parsing the target code.
[0005] In some embodiments of the present application, file authentication of the first file stored in the storage device includes: based on a preset number of reads, sending a first read command to the storage device, where the first read command is used to read the first file; receiving first encoded data fed back by the storage device in response to each first read command; based on the first encoded data fed back each time, constructing first mapping data having a mapping relationship with the first encoded data; sending a second read command to the storage device; receiving second encoded data fed back by the storage device in response to each second read command; based on the second encoded data fed back each time, constructing second mapping data having a mapping relationship with the second encoded data; if the first mapping data is the same as the second mapping data, determining that the authentication of the first file is successful.
[0006] In some embodiments of the present application, file authentication of the second file stored in the storage device includes: based on a preset number of reads, sending a third read command to the storage device, where the third read command is used to read the second file; receiving third encoded data fed back by the storage device in response to each third read command; based on the third encoded data fed back each time, constructing third mapping data having a mapping relationship with the third encoded data; sending a fourth read command to the storage device; receiving fourth encoded data fed back by the storage device in response to each fourth read command; based on the fourth encoded data fed back each time, constructing fourth mapping data having a mapping relationship with the fourth encoded data; if the third mapping data is the same as the fourth mapping data, determining that the authentication of the second file is successful.
[0007] In some embodiments of the present application, the method further includes: if both the first file and the second file are authenticated successfully, determining that the file authentication is successful.
[0008] In some embodiments of the present application, the storage device further includes a third file, and the method further includes: based on a preset number of reads, sending a fifth read command to the storage device, where the fifth read command is used to read the third file; receiving fifth encoded data fed back by the storage device in response to each fifth read command; based on the fifth encoded data fed back each time, constructing fifth mapping data having a mapping relationship with the fifth encoded data; sending a sixth read command to the storage device; receiving sixth encoded data fed back by the storage device in response to each sixth read command; based on the sixth encoded data fed back each time, constructing sixth mapping data having a mapping relationship with the sixth encoded data; if the fifth mapping data is the same as the sixth mapping data, determining that the authentication of the third file is successful; when the authentication of the third file is successful, defining target encoded data to represent the data fed back by the storage device when the third file is read.
[0009] In some embodiments of the present application, after the third file authentication is successful, the method further includes: constructing a relationship mapping table based on the fifth encoded data and the fifth mapping data, or based on the sixth encoded data and the sixth mapping data; sending a seventh read command to the storage device within a preset time; obtaining the data written to the storage device after a specified time based on the relationship mapping table and the target encoded data fed back by the storage device in response to the seventh read command, so as to facilitate determining whether the data written to the storage device is correct.
[0010] In some embodiments of the present application, before performing file authentication on the first file and the second file stored in the storage device, the method further includes: performing address authentication on the first file and the second file, including: querying the first file and the second file in the storage device based on the logical addresses of the first file and the second file; if the first file and the second file are queried in the storage device, performing preset read and write operations on the first file and the second file respectively; when receiving the feedback from the storage device indicating that the read and write operations are completed, determining that the address authentication on the first file and the second file is completed.
[0011] The present application also provides a data processing method, which is applied to a storage device. The storage device is communicatively connected to an electronic device, and the storage device stores a first file and a second file. The method includes: receiving the authentication result of the first file and the second file sent by the electronic device; if the authentication result indicates that the first file and the second file are authenticated successfully, obtaining the definition information carried by the authentication result, where the definition information includes: defining a first bit value to represent the bit value written to the storage device when reading the first file, and defining a second bit value to represent the bit value written to the storage device when reading the second file; receiving the target data written by the electronic device and recording the corresponding bit value when reading the file when detecting that the electronic device reads the first file and / or the second file; obtaining a target code composed of the first bit value and the second bit value based on the recorded corresponding bit value when reading the file; parsing the target code to obtain the target data; obtaining the indication information for indicating an operation in the target data after a preset time, and performing a corresponding operation according to the indication information.
[0012] In some embodiments of the present application, the method further includes: in response to a first read command, constructing first encoded data such that the electronic device determines first mapping data based on the first encoded data; in response to a second read command, constructing second encoded data such that the electronic device determines second mapping data based on the second encoded data; in response to a third read command, constructing third encoded data such that the electronic device determines third mapping data based on the third encoded data; in response to a fourth read command, constructing fourth encoded data such that the electronic device determines fourth mapping data based on the fourth encoded data; in response to a fifth read command, constructing fifth encoded data such that the electronic device determines fifth mapping data based on the fifth encoded data; in response to a sixth read command, constructing sixth encoded data such that the electronic device determines sixth mapping data based on the sixth encoded data.
[0013] In some embodiments of the present application, the storage device further includes a third file, and the method further includes: if authentication information indicating successful authentication of the third file sent by the electronic device is received, obtaining an acquisition instruction carried in the authentication information, where the acquisition instruction is used to acquire target encoded data; in response to a seventh read command, acquiring the target code recorded at a specified time and sending the target code recorded at the specified time to the electronic device as the target encoded data.
[0014] The present application also provides an electronic device, which includes a processor and a memory, and the processor is configured to implement the data processing method when executing a computer program stored in the memory.
[0015] In the data processing method provided by the present application, by accessing a storage device, file authentication is performed on a first file and a second file in the storage device, and when the file authentication is successful, a first bit value is defined to represent reading the first file and the bit value written to the storage device during reading, and a second bit value is defined to represent reading the second file and the bit value written to the storage device during reading, so that the storage device can clearly identify the written data by reading the file. The target data to be written to the storage device is converted into a binary sequence, and based on the binary sequence, the first file and / or the second file are sequentially read, so that the storage device obtains a target code composed of the first bit value and the second bit value by recording the bit values corresponding to the read files, and the target data is obtained by parsing the target code. The present application forms a coded value by accessing files, enabling the storage device to determine the target data written based on the coded value, thereby improving the data interaction efficiency in an encrypted environment. Description of the Drawings
[0016] Figure 1 is a schematic structural diagram of the electronic device provided by the embodiments of the present application.
[0017] Figure 2 It is a flowchart of the data processing method provided by an embodiment of the present application.
[0018] Figure 3 It is a schematic diagram of constructing first mapping data having a mapping relationship with the first encoded data provided by an embodiment of the present application.
[0019] Figure 4 It is a schematic diagram of writing target data provided by an embodiment of the present application.
[0020] Figure 5 It is a flowchart of the data processing method provided by an embodiment of the present application.
[0021] Figure 6 It is a flowchart of the data processing method provided by an embodiment of the present application. Detailed implementation manners
[0022] For ease of understanding, some descriptions of concepts related to the embodiments of the present application are exemplarily given for reference.
[0023] It should be noted that in the present application, "at least one" means one or more, and "a plurality" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0024] Currently, in order to improve the security of the data writing system, when the system receives a written data packet, it usually encrypts the data packet first, then randomly names the encrypted data packet, and then stores the randomly named encrypted data packet in the storage device. Then the storage device will receive the randomly named data packet. If the data packet carries instruction information for performing other operations, in the encrypted environment, the corresponding operation cannot be directly performed, and the data packet needs to be decrypted first to obtain the content of the data packet. Such methods can improve the security of data, but the efficiency of data interaction in the encrypted environment is low. The storage device cannot timely obtain the content of the stored data, and it is also difficult to ensure the timely processing of the carried instructions. Moreover, since the encrypted data packet is randomly named, the storage device may misidentify the received data packet A as data packet B, resulting in the inability to correctly process the instructions carried by data packet A.
[0025] To solve the technical problem that the efficiency of data interaction in an encrypted environment is low and the correctness of the parsed data packet cannot be determined, resulting in the inability to process the instructions carried in the correct data packet in a timely manner, the data processing method and electronic device provided by the embodiments of the present application will be described below. First, the structures of the electronic device and the storage device will be described.
[0026] Figure 1 FIG. 4 is a schematic structural diagram of the electronic device provided by the embodiments of the present application. The data processing method of the present application is applied to the electronic device 10, and the electronic device 10 includes, but is not limited to, a storage device 12 and at least one processor 13 connected by a communication bus 11. In other embodiments of the present application, the storage device 12 may be a device externally connected to the electronic device 10, and the present application does not limit this.
[0027] The electronic device 10 may be a mobile phone, a computer, etc.
[0028] The storage device 12 may be an internal component of the electronic device 10 or a device externally connected to the electronic device 10, and the present application does not limit this.
[0029] The storage device 12 may be a storage product such as a Secure Digital (SD) card, a USB flash drive, an Embedded Multi Media Card (EMMC), an Embedded Multi Media Controller Product (EMCP), a USB Flash (USF), or a Solid State Drive (SSD).
[0030] The schematic Figure 1 is only an example of the electronic device 10 and does not limit the electronic device 10. It may include more or fewer components than shown in the figure, or combine some components, or different components. For example, the electronic device 10 may further include input / output devices, network access devices, etc.
[0031] To solve the above problems, please refer to Figure 2 as shown in Figure 2 FIG. 5 is a flowchart of the data processing method provided by the embodiments of the present application, which is applied to an electronic device (such as Figure 1 the electronic device 10). According to different requirements, the order of the steps in this flowchart may be changed, and some steps may be omitted.
[0032] Step S201: Access the storage device and perform file authentication on the first file and the second file stored in the storage device.
[0033] In some embodiments of the present application, a user can create a file on an electronic device and store the file in a storage device. If the location of the file in the storage device remains unchanged, the logical address corresponding to the file is also fixed. Therefore, when the electronic device reads a file in the storage device, the read command sent by the electronic device to the storage device can carry the logical address of the file to be read.
[0034] In some embodiments of the present application, based on the characteristic that the logical address remains unchanged, multiple files (for example, a first file and a second file) are created on the electronic device, and the created files (for example, the first file and the second file) are stored in the storage device. The logical address of the first file stored in the storage device and the logical address of the second file stored in the storage device are obtained. For example, the logical address of the first file is 0xAA, and the logical address of the second file is 0xBB.
[0035] In some embodiments of the present application, after the first file and the second file are created, in order to set the meaning represented when reading the first file for the first file and the meaning represented when reading the second file for the second file, address authentication and file authentication can be performed on the first file and the second file. Among them, performing address authentication on the first file and the second file includes: querying the first file and the second file in the storage device based on the logical address of the first file and the logical address of the second file. For example, the logical address of the first file is 0xAA, and the logical address of the second file is 0xBB. The electronic device sends a read command carrying 0xAA to the storage device to query whether the first file exists in the storage device. The electronic device sends a read command carrying 0xBB to the storage device to query whether the second file exists in the storage device. If the file corresponding to 0xAA and the file corresponding to 0xBB are queried in the storage device, it is determined that the first file and the second file are queried in the storage device.
[0036] In some embodiments of the present application, when the first file is queried based on the logical address of the first file and the second file is queried based on the logical address of the second file, the electronic device then performs preset read and write operations on the first file and the second file respectively to perform the interaction between the electronic device and the storage device, such as reading data and writing data, etc. In this embodiment, the preset read and write operation can be an operation of an M sequence. The M sequence can include operation contents composed of read operations and write operations. For example, after presetting 5 read operations, 2 write operations are performed, and then 3 read operations are performed. The above is only an example, and the actual application is not limited to this.
[0037] In some embodiments of the present application, when the electronic device performs the operation of the M sequence on the storage device, it can send the operation content in the operation of the M sequence to the storage device. When the storage device determines that the operation of the M sequence is completed based on the operation content, the electronic device receives the feedback from the storage device that the operation of the M sequence is completed, and the electronic device thus determines that the authentication of the first file and the second file is completed.
[0038] In some embodiments of the present application, after the electronic device determines that the address authentication of the first file and the second file is completed, it can perform file authentication on the first file and the second file. During the file authentication process, the number of reading times can be preset, for example, 256 times. The electronic device sends 256 read commands to the storage device (for ease of description, each read command described here is simply referred to as the "first read command"). The first read command carries the logical address of the first file and is used to read the first file in the storage device. When the electronic device receives the first encoded data fed back by the storage device in response to each first read command, it constructs the first mapping data having a mapping relationship with the first encoded data.
[0039] In one example, Figure 3 is a schematic diagram of constructing the first mapping data having a mapping relationship with the first encoded data provided by an embodiment of the present application. As Figure 3 shown, each time the storage device receives the first read command, it constructs a first encoded data. The first encoded data can be a byte of data, a total of 8 bits, composed of the numbers 0 and 1. Each first encoded data constructed each time the first read command is received is different until 256 times are constructed. In one example, the first encoded data can be 00000000. When the electronic device receives 00000000, it converts the binary to hexadecimal 0x00, and the first mapping data is 0x00.
[0040] In some embodiments of the present application, in order to verify whether the constructed first mapping data is accurate, the electronic device can read the first file again. The electronic device can send a second read command to the storage device, with the same number of readings as the first read command (for ease of description, each read command described here is simply referred to as the "second read command"). Then, when the electronic device receives the second encoded data fed back by the storage device in response to each second read command, it constructs the second mapping data having a mapping relationship with the second encoded data. If the first mapping data is the same as the second mapping data, it is determined that the authentication of the first file is successful. In one example, if the 256 data constructed by the first mapping data and the second mapping data are all the same, it is determined that the authentication of the first file is successful.
[0041] In some embodiments of the present application, after the first file authentication is successful, the second file can be authenticated. The authentication steps for the second file are the same as those for the first file. Authenticating the second file includes: based on a preset number of reading times, such as 256 times, sending a third read command to the storage device. The third read command carries the logical address of the second file for reading the second file. Receiving the third encoded data fed back by the storage device in response to each third read command. The electronic device constructs third mapping data having a mapping relationship with the third encoded data based on the third encoded data fed back each time. Sending a fourth read command to the storage device and receiving the fourth encoded data fed back by the storage device in response to each fourth read command. Constructing fourth mapping data having a mapping relationship with the fourth encoded data based on the fourth encoded data fed back each time. If the third mapping data is the same as the fourth mapping data, it is determined that the second file authentication is successful.
[0042] Step S202, if the file authentication is successful, define a first bit value to represent the bit value read from the first file and written to the storage device during reading, and define a second bit value to represent the bit value read from the second file and written to the storage device during reading.
[0043] In some embodiments of the present application, if both the first file and the second file are authenticated successfully and it is determined that the file authentication is successful, then data interaction can be completed between the electronic device and the storage device according to the specified encoding method. Define the authenticated first file and second file. Define a first bit value to represent the bit value read from the first file and written to the storage device when reading the first file, and define a second bit value to represent the bit value read from the second file and written to the storage device when reading the second file.
[0044] In one example, the electronic device can determine the data written by the electronic device by reading the first file and / or the second file. When the electronic device reads the first file or the second file, data writing can be performed simultaneously. Therefore, when the electronic device reads the first file, the storage device records the first bit value, indicating that the data written by the electronic device to the storage device is the first bit value, such as 0. When the electronic device reads the second file, the storage device records the second bit value, indicating that the data written by the electronic device to the storage device is the second bit value, such as 1.
[0045] Step S203, convert the target data to be written to the storage device into a binary sequence.
[0046] In some embodiments of the present application, obtain the target data to be written to the storage device. The target data can be written by byte, and each byte contains eight bits, including bit (BIT) 0 to BIT7. Taking the target data as one byte as an example, convert the target data into a binary sequence. For example, if the target data is 0x00, then after conversion into a binary sequence, it is 00000000.
[0047] Step S204: Sequentially read the first file and / or the second file based on the binary sequence, so that the storage device obtains a target code composed of a first bit value and a second bit value by recording the bit values corresponding to the read files, and obtains the target data by parsing the target code.
[0048] In some embodiments of the present application, after the electronic device converts the target data into binary, the target data becomes a binary sequence composed of 0s and 1s. The electronic device reads the first file and / or the second file according to the value of each bit. So that the storage device obtains a target code composed of the first bit value and / or the second bit value by recording the bit values corresponding to the read files, and obtains the target data written by the electronic device by parsing the target code.
[0049] In one example, Figure 4 is a schematic diagram of writing target data provided by an embodiment of the present application. As Figure 4 shown, the target data is 0x01. After being converted into binary, BIT0 to BIT7 are 00000001, BIT7 is the high bit, and BIT0 is the low bit. Then the electronic device reads the first file 7 times and the second file once according to 00000001. So that the storage device records the table as Figure 4 shown, and obtains 0x01 by parsing 00000001.
[0050] In the embodiments of the present application, by accessing the storage device, file authentication is performed on the first file and the second file in the storage device. When the file authentication is successful, it is defined that the first bit value represents the bit value written to the storage device when reading the first file, and the second bit value represents the bit value written to the storage device when reading the second file, and the written data can be made clear to the storage device by reading the files. Convert the target data to be written to the storage device into a binary sequence. Based on the binary sequence, sequentially read the first file and / or the second file, so that the storage device obtains a target code composed of the first bit value and the second bit value by recording the bit values corresponding to the read files, and obtains the target data by parsing the target code. The present application forms a coded value by accessing the files, so that the storage device can determine the written target data based on the coded value, improving the data interaction efficiency in the encrypted environment.
[0051] In other embodiments of the present application, in order to determine whether the latest target data is correctly written into the storage device, when creating the first file and the second file in the storage device, the electronic device may also create a third file at the same time, which is used to verify whether the data written into the storage device by the electronic device is correct. The electronic device can determine this by reading the third file in the storage device. The third file is the same as the first file and the second file, and the address authentication and file authentication of the third file are required. Among them, the address authentication and file authentication of the third file are the same as those of the first file and the second file. The address authentication of the third file includes: based on the logical address of the third file, query the third file in the storage device. If the third file is found in the storage device, perform a preset read and write operation on the third file. When the electronic device receives the feedback from the storage device indicating that the read and write operation is completed, it is determined that the address authentication of the third file is completed.
[0052] In some embodiments of the present application, after determining that the address authentication of the third file is completed, file authentication is performed on the third file, including: based on a preset number of reads, for example, 256 times, the electronic device sends a fifth read command to the storage device (for the sake of convenience of description, each read command described here is simply referred to as the "fifth read command"). The fifth read command carries the logical address of the third file and is used to read the third file. The electronic device receives the fifth encoded data fed back by the storage device in response to each fifth read command, and based on the fifth encoded data fed back each time, constructs fifth mapped data having a mapping relationship with the fifth encoded data. The electronic device sends a sixth read command to the storage device, receives the sixth encoded data fed back by the storage device in response to each sixth read command, and based on the sixth encoded data fed back each time, constructs sixth mapped data having a mapping relationship with the sixth encoded data. If the fifth mapped data is the same as the sixth mapped data, it is determined that the third file authentication is successful.
[0053] In some embodiments of the present application, after the third file authentication is successful, the electronic device may define target encoded data to represent the data triggered by the storage device to feed back when reading the third file. Among them, the target encoded data may be the data newly written into the storage device, that is, the target encoding newly recorded by the storage device.
[0054] In some embodiments of the present application, after the third file authentication is successful, the electronic device may construct a relationship mapping table based on the fifth encoded data and the fifth mapped data, or based on the sixth encoded data and the sixth mapped data. The electronic device sends a seventh read command to the storage device, and based on the target encoded data and the relationship mapping table fed back by the storage device in response to the seventh read command, obtains the data written into the storage device after a specified time, which is convenient for determining whether the data written into the storage device is correct. Among them, the relationship mapping table may be generated when performing file authentication on the third file, as Figure 3 shown. The specified time may be the time when the data is newly written.
[0055] In one example, in order to verify whether the written data is correct, after the electronic device writes 0x00 to the storage device, the third file is read within a preset time. Then, the electronic device can receive the target encoded data 00000000 fed back by the storage device, and traverse the relationship mapping table using 0000000 to determine that the data newly written to the storage device is 0x00.
[0056] In some embodiments of the present application, after sequentially reading the first file and / or the second file, it may further include verifying the data written to the storage device. For example, the electronic device can send a seventh read command to the storage device within a preset time so that the electronic device can determine whether the data written to the storage device is correct.
[0057] In some embodiments of the present application, since the target data carries indication information for performing an operation, in order to improve the execution efficiency, after the electronic device writes the target data to the storage device, it may not send a seventh read command to the storage device. When the storage device does not receive the seventh read command within a preset time, the storage device can perform a corresponding operation based on the indication information. If the electronic device sends a seventh read command to the storage device within a preset time and, when receiving the target encoded data fed back by the storage device, verifies whether the target encoded data is correct. If the target encoded data is correct, a message indicating that the written data is correct is sent to the storage device to trigger the storage device to perform the operation corresponding to the indication information. If the electronic device verifies that the target encoded data is incorrect, new target data is written to the storage device again.
[0058] Figure 5 is a flowchart of the data processing method provided by the embodiments of the present application, applied to a storage device (such as Figure 1 the storage device 12). According to different requirements, the order of the steps in this flowchart can be changed, and some steps can be omitted.
[0059] Step S501: Receive the authentication results of the first file and the second file sent by the electronic device.
[0060] In some embodiments of the present application, the storage device stores the first file and the second file created by the electronic device. In order to assist the electronic device in completing the address authentication and file authentication of the first file and the second file, the storage device responds to the first read command to construct the first encoded data, so that the electronic device determines the first mapping data based on the first encoded data. The storage device responds to the second read command to construct the second encoded data, so that the electronic device determines the second mapping data based on the second encoded data, and when the first mapping data is the same as the second mapping data, the electronic device determines that the file authentication of the first file is completed.
[0061] In some embodiments of the present application, the storage device responds to a third read command to construct third encoded data, enabling the electronic device to determine third mapping data based on the third encoded data, and responds to a fourth read command to construct fourth encoded data, enabling the electronic device to determine fourth mapping data based on the fourth encoded data. When the third mapping data is the same as the fourth mapping data, the electronic device determines that the file authentication of the second file is completed.
[0062] In some embodiments of the present application, the authentication result of the first file and the second file sent by the electronic device is received. The authentication result may include indicating that the authentication of the first file and the second file is successful, or indicating that the authentication of the first file and the second file is not successful.
[0063] Step S502, if the authentication result indicates that the authentication of the first file and the second file is successful, obtain the definition information carried by the authentication result.
[0064] In some embodiments of the present application, if the authentication result indicates that the authentication of the first file and the second file is successful, then obtain the definition information carried by the authentication result. The definition information may include defining that the first bit value represents reading the first file and the bit value written to the storage device during reading, and defining that the second bit value represents reading the second file and the bit value written to the storage device during reading. Among them, the first bit value may be 0, and the second bit value may be 1. If the authentication result indicates that the authentication of the first file and the second file is not successful, continue the authentication.
[0065] Step S503, receive the target data written by the electronic device and record the corresponding bit value when detecting that the electronic device reads the first file and / or the second file.
[0066] In some embodiments of the present application, since the first bit value represents reading the first file and the bit value written to the storage device when reading the first file, and the second bit value represents reading the second file and the bit value written to the storage device when reading the first file, when detecting that the electronic device reads the first file, record the first bit value, and when detecting that the electronic device reads the second file, record the second bit value.
[0067] Step S504, based on the recorded corresponding bit value when reading the file, obtain the target code composed of the first bit value and the second bit value.
[0068] In some embodiments of the present application, obtain the target code based on the recorded order. In an example, if it is detected that the electronic device reads the first file 7 times continuously and then reads the second file 1 time, the sequentially recorded bit values are 00000001, as Figure 4 shown. The target code is 00000001.
[0069] Step S505, parse the target code to obtain the target data;
[0070] In some embodiments of the present application, after determining the target code, since the target code is binary, the binary can be converted into hexadecimal to obtain the hexadecimal target data. For example, converting 00000001 to 0x01, then the storage device obtains a byte 0x01.
[0071] Step S506, obtain the indication information for indicating the execution of the operation in the target data, and execute the corresponding operation according to the indication information.
[0072] In some embodiments of the present application, in order to enable the storage device to determine the received data content, the data is written into the storage device in the form of coding. After the storage device parses the target data, if no other instructions from the electronic device (such as the seventh read command for verifying the written target data) are received within the preset time, the indication information for indicating the execution of the operation carried in the target data can be obtained, and the corresponding operation is executed according to the indication information. Among them, the operations corresponding to the indication information may include operations such as update and upgrade.
[0073] In the embodiments of the present application, the storage device creates the first file and the second file through the electronic device, and stores the target data in the storage device in the form of coding. In the encrypted environment, the storage device can determine the specific content of the received target data without performing encryption and decryption operations again, can more effectively execute the indication information carried by the target data, and to a certain extent can also avoid the storage device obtaining incorrect indication information and avoid executing incorrect operations.
[0074] In other embodiments of the present application, the storage device further includes a third file for determining whether the correct target data is written into the storage device for the electronic device. The creation time of the third file can be the same as that of the first file and the second file. The third file also requires address authentication and file authentication, including: the storage device responds to the fifth read command to construct the fifth coded data, so that the electronic device determines the fifth mapping data based on the fifth coded data, and the electronic device responds to the sixth read command to construct the sixth coded data, so that the electronic device determines the sixth mapping data based on the sixth coded data, so that when the fifth mapping data is the same as the sixth mapping data, the electronic device determines that the authentication of the third file is completed.
[0075] In some embodiments of the present application, when the storage device receives the authentication information sent by the electronic device indicating that the third file authentication is successful, the storage device obtains the acquisition instruction carried in the authentication information, and the acquisition instruction is used to obtain the target coding data. The storage device responds to the seventh read command, which is used to read the third file, obtains the target coding recorded at the specified time, and sends the target coding recorded at the specified time to the electronic device as the target coding data. Wherein, the specified time may be the time when the data is last written, so that the electronic device can determine whether the data written last is correct by issuing the seventh read command.
[0076] In some embodiments of the present application, after the storage device obtains the target data, if it receives the seventh read command sent by the electronic device within the preset time, it may not start the process of executing the indication information carried by the target data first until after the preset time, when the storage device receives the message sent by the electronic device indicating that the written data is correct, triggering the storage device to execute the operation corresponding to the indication information.
[0077] Figure 6 is a flowchart of the data processing method provided by the embodiments of the present application, as Figure 6 shown is a flowchart of the interaction between the electronic device and the storage device, including the following steps:
[0078] Step S601, the electronic device creates the first file, the second file, and the third file, and stores the first file, the second file, and the third file in the storage device.
[0079] Step S602, the electronic device performs address authentication and file authentication on the first file, the second file, and the third file.
[0080] Step S603, when the address authentication and file authentication of the first file, the second file, and the third file are successful, the electronic device sequentially reads the first file and / or the second file based on the received target data.
[0081] Step S604, when the storage device detects that the electronic device reads the first file and / or the second file, it records the first bit value and / or the second bit value.
[0082] Step S605, the storage device obtains the target coding according to the recorded first bit value and / or the second bit value, and obtains the target data written by the electronic device by parsing the target coding.
[0083] Step S606, whether the storage device detects that the electronic device reads the third file within the preset time.
[0084] In some embodiments of the application, if the storage device does not detect that the electronic device reads the third file within a preset time, jump to execute S609. If the storage device detects that the electronic device reads the third file within a preset time, continue to execute step S607.
[0085] Step S607, when the storage device detects that the electronic device reads the third file within a preset time, feedback the latest obtained target encoding as target encoding data to the electronic device, so that the electronic device can verify whether the data written to the storage device is correct.
[0086] Step S608, the storage device receives that the data determined to be written by the electronic device is correct.
[0087] Step S609, the storage device obtains the indication information in the target data and performs corresponding operations according to the indication information.
[0088] In some embodiments of the present application, such as Figure 6 For the specific description of the embodiments shown, reference can be made to such as Figure 2 And such as Figure 5 The embodiments shown are not described repeatedly here.
[0089] In the embodiments of the present application, the embodiments described in the present application can run on any system platform based on file operations, and the data is stored in the storage device through the encoding and decoding operations of the present application. In an encrypted system platform environment, the encoding method shown in the embodiments of the present application can be used to enable data interaction between external devices and storage devices, avoiding the dilemma of system-encrypted data and increasing the security and efficiency of data interaction. In a non-encrypted system environment, the encoding method shown in the embodiments of the present application can be used to avoid the dilemma that plaintext data is easily cracked.
[0090] Please continue to refer to Figure 1 , in this embodiment, the memory 12 may be an internal memory of the electronic device 10, that is, a memory built into the electronic device 10. In other embodiments, the memory 12 may also be an external memory of the electronic device 10, that is, a memory externally connected to the electronic device 10.
[0091] In some embodiments, the memory 12 is used to store program codes and various data, and realizes high-speed and automatic access to programs or data during the operation of the electronic device 10.
[0092] The memory 12 may include a random access memory and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, at least one magnetic disk storage device, a flash memory device, or other volatile solid state storage devices.
[0093] In one embodiment, the processor 13 may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any other conventional processor, etc.
[0094] If the program code and various data in the memory 12 are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above-described embodiment methods of this application, for example, a data processing method, it may also be completed by a computer program instructing related hardware. The computer program may be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-described various method embodiments may be implemented. Among them, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, an executable file, or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disc, a computer memory, a Read-Only Memory (ROM), etc.
[0095] It can be understood that the above-described module division is a logical function division, and there may be other division methods in actual implementation. In addition, in each embodiment of this application, the various functional modules may be integrated in the same processing unit, or each module may exist physically alone, or two or more modules may be integrated in the same unit. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of a combination of hardware and software functional modules.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and not to limit them. Although the present application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present application can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present application.
Claims
1. A data processing method, applied to an electronic device, characterized in that, the method includes: accessing a storage device, and performing file authentication on a first file and a second file stored in the storage device; if the file authentication is successful, defining a first bit value to represent the bit value when reading the first file and writing to the storage device during reading, and defining a second bit value to represent the bit value when reading the second file and writing to the storage device during reading; converting target data to be written to the storage device into a binary sequence, the binary sequence including the first bit value and / or the second bit value; based on the binary sequence, sequentially reading the first file and / or the second file, so that the storage device obtains a target code composed of the first bit value and the second bit value by recording the bit values corresponding to the read files, and obtains the target data by parsing the target code.
2. The data processing method according to claim 1, characterized in that, performing file authentication on the first file stored in the storage device includes: based on a preset number of reading times, sending a first read command to the storage device, the first read command being used to read the first file; receiving first encoded data fed back by the storage device in response to each first read command; based on the first encoded data fed back each time, constructing first mapping data having a mapping relationship with the first encoded data; sending a second read command to the storage device; receiving second encoded data fed back by the storage device in response to each second read command; based on the second encoded data fed back each time, constructing second mapping data having a mapping relationship with the second encoded data; if the first mapping data is the same as the second mapping data, determining that the first file authentication is successful.
3. The data processing method according to claim 2, characterized in that, performing file authentication on the second file stored in the storage device includes: based on a preset number of reading times, sending a third read command to the storage device, the third read command being used to read the second file; receiving third encoded data fed back by the storage device in response to each third read command; based on the third encoded data fed back each time, constructing third mapping data having a mapping relationship with the third encoded data; sending a fourth read command to the storage device; receiving fourth encoded data fed back by the storage device in response to each fourth read command; based on the fourth encoded data fed back each time, constructing fourth mapping data having a mapping relationship with the fourth encoded data; if the third mapping data is the same as the fourth mapping data, determining that the second file authentication is successful.
4. The data processing method according to claim 3, characterized in that, the method further includes: if both the first file and the second file are authenticated successfully, determining that the file authentication is successful.
5. The data processing method according to claim 1, characterized in that, the storage device further includes a third file, and the method further includes: Based on a preset number of read times, issue a fifth read command to the storage device, where the fifth read command is used to read the third file; Receive fifth encoded data fed back by the storage device in response to each fifth read command; Based on the fifth encoded data fed back each time, construct fifth mapping data having a mapping relationship with the fifth encoded data; Issue a sixth read command to the storage device; Receive sixth encoded data fed back by the storage device in response to each sixth read command; Based on the sixth encoded data fed back each time, construct sixth mapping data having a mapping relationship with the sixth encoded data; If the fifth mapping data is the same as the sixth mapping data, determine that the authentication of the third file is successful; When the authentication of the third file is successful, define target encoded data to represent the data triggered by the storage device to feed back when reading the third file.
6. The data processing method according to claim 5, wherein, after the authentication of the third file is successful, the method further includes: Based on the fifth encoded data and the fifth mapping data, or based on the sixth encoded data and the sixth mapping data, construct a relationship mapping table; Issue a seventh read command to the storage device within a preset time; Based on the relationship mapping table and the target encoded data fed back by the storage device in response to the seventh read command, obtain the data written to the storage device after a specified time, so as to determine whether the data written to the storage device is correct.
7. The data processing method according to claim 1, wherein, before performing file authentication on the first file and the second file stored in the storage device, the method further includes: Perform address authentication on the first file and the second file, including: Based on the logical addresses of the first file and the second file, query the first file and the second file in the storage device; If the first file and the second file are queried in the storage device, perform preset read and write operations on the first file and the second file respectively; When receiving the feedback from the storage device indicating that the read and write operations are completed, determine that the address authentication of the first file and the second file is completed.
8. A data processing method applied to a storage device, wherein, the storage device is communicatively connected to an electronic device, the storage device stores a first file and a second file, and the method includes: Receive the authentication results of the first file and the second file sent by the electronic device; If the authentication results indicate that the authentication of the first file and the second file is successful, obtain the definition information carried by the authentication results, where the definition information includes: defining a first bit value to represent the bit value written to the storage device when reading the first file, and defining a second bit value to represent the bit value written to the storage device when reading the second file; Receive the target data written by the electronic device and record the corresponding bit values when reading the file when detecting that the electronic device reads the first file and / or the second file. Based on the bit values corresponding to the record when reading the file, obtain a target code composed of the first bit value and the second bit value; Parse the target code to obtain the target data; After a preset time, obtain the indication information in the target data for indicating an operation to be performed, and perform a corresponding operation according to the indication information.
9. The data processing method according to claim 8, wherein, the method further includes: In response to a first read command, construct first encoded data, so that the electronic device determines first mapped data based on the first encoded data; In response to a second read command, construct second encoded data, so that the electronic device determines second mapped data based on the second encoded data; In response to a third read command, construct third encoded data, so that the electronic device determines third mapped data based on the third encoded data; In response to a fourth read command, construct fourth encoded data, so that the electronic device determines fourth mapped data based on the fourth encoded data; In response to a fifth read command, construct fifth encoded data, so that the electronic device determines fifth mapped data based on the fifth encoded data; In response to a sixth read command, construct sixth encoded data, so that the electronic device determines sixth mapped data based on the sixth encoded data.
10. The data processing method according to claim 8, wherein, the storage device further includes a third file, and the method further includes: If authentication information indicating successful authentication of the third file sent by the electronic device is received, obtain the acquisition instruction carried in the authentication information, where the acquisition instruction is used to acquire target encoded data; In response to a seventh read command, acquire the target code recorded at a specified time, and send the target code recorded at the specified time as the target encoded data to the electronic device.
11. An electronic device, wherein, the electronic device includes a storage device and a processor; wherein the storage device is connected to the processor; the storage device is configured to store program instructions; the processor is configured to read the program instructions stored in the storage device to implement the data processing method according to any one of claims 1 to 7.