Movatterモバイル変換


[0]ホーム

URL:


CN114866343A - Data processing method and device - Google Patents

Data processing method and device
Download PDF

Info

Publication number
CN114866343A
CN114866343ACN202210778105.4ACN202210778105ACN114866343ACN 114866343 ACN114866343 ACN 114866343ACN 202210778105 ACN202210778105 ACN 202210778105ACN 114866343 ACN114866343 ACN 114866343A
Authority
CN
China
Prior art keywords
index
plaintext
read
network
decryption
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210778105.4A
Other languages
Chinese (zh)
Inventor
曹淋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co LtdfiledCriticalAlipay Hangzhou Information Technology Co Ltd
Priority to CN202210778105.4ApriorityCriticalpatent/CN114866343A/en
Publication of CN114866343ApublicationCriticalpatent/CN114866343A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

The embodiment of the specification provides a data processing method, which is executed by a sending end based on a circular queue, wherein the circular queue is configured with a plaintext writing index, an encrypted reading index and a network writing index, and is respectively used for determining a position where a plaintext has been written, a position where encryption has been completed and a position where a ciphertext has been sent. The data processing method comprises the following steps: under the condition that the encryption read index is judged not to be equal to the plaintext write index and the plaintext data in the position pointed by the encryption read index is replaced by encrypted ciphertext data, updating the encryption read index to point to the next position; and under the condition that the network write index is judged not to be equal to the encrypted read index, sending a target ciphertext pointed by the network write index to a receiving end, and updating the network write index to point to the next position.

Description

Data processing method and device
Technical Field
One or more embodiments disclosed in the present specification relate to the field of data security technologies, and in particular, to a data processing method and apparatus.
Background
With the advent of the big data age, data security issues have raised concerns for various parties. In a scenario involving data transmission, generally, one party encrypts a plaintext of data held by the other party, and then transmits an encrypted text generated by the encryption to the other party, so that the other party decrypts and restores the encrypted text data to obtain a corresponding plaintext of data.
However, at present, the performance of the data encryption and decryption transmission mode is limited, and the transmission speed, the resource overhead and the like are difficult to meet the increasing practical application requirements. Therefore, a scheme is needed to effectively improve the performance of data encryption and decryption transmission.
Disclosure of Invention
One or more embodiments of the present specification describe a data processing method, which deploys multiple sets of indexes for a circular queue, and proposes a scheme for data encryption and decryption transmission based on a multiple-index queue, thereby effectively improving the performance of data encryption and decryption transmission.
According to a first aspect, a data processing method is provided, which is executed by a sending end based on a circular queue, wherein the circular queue is configured with a plaintext write index, an encrypted read index and a network write index, and is respectively used for determining a position where a plaintext has been written, a position where encryption has been completed and a position where a ciphertext has been sent; the method comprises the following steps: under the condition that the encryption read index is judged not to be equal to the plaintext write index and the plaintext data in the position pointed by the encryption read index is replaced by encrypted ciphertext data, updating the encryption read index to point to the next position; and under the condition that the network write index is judged not to be equal to the encrypted read index, sending a target ciphertext pointed by the network write index to a receiving end, and updating the network write index to point to the next position.
In one embodiment, the respective indices of the circular queue configuration initially point to the same location.
In one embodiment, the circular queue is further configured with an encryption write index for determining the location of plaintext where encryption has been initiated; wherein, when it is determined that the encrypted read index is not equal to the plaintext write index and the plaintext data in the location pointed by the encrypted read index is replaced with encrypted ciphertext data, updating the encrypted read index to point to the next location includes: under the condition that the encryption write index is judged not to be equal to the plaintext write index, encryption and replacement of plaintext data in a position pointed by the encryption write index are started, and the encryption write index is updated to point to the next position; and updating the encryption read index to point to the next position under the condition that the encryption read index is judged not to be equal to the encryption write index and the replacement is completed.
In one embodiment, when it is determined that the network write index is not equal to the encrypted read index, sending a target ciphertext pointed by the network write index to a receiving end, includes: and sending the target ciphertext to a receiving end under the condition that the network write index is judged not to be equal to the encrypted read index and the data volume of the target ciphertext is not larger than the current available cache capacity of the receiving end.
In one embodiment, after sending the target ciphertext pointed to by the network write index to the receiving end, the method further includes: receiving an acknowledgement message from the receiving end indicating successful receipt of the target ciphertext and a current available buffer capacity of the receiving end.
In one embodiment, the circular queue is further configured with a network read index for determining a position of a ciphertext that has been successfully received by the receiving end; wherein after updating the network write index to point to a next location, the method further comprises: and under the condition that the network read index is judged not to be equal to the network write index and the confirmation message aiming at the target ciphertext is not received from the receiving end within the preset time length, sending the target ciphertext to the receiving end again.
In one embodiment, the circular queue is further configured with a network read index for determining a position of a ciphertext that has been successfully received by the receiving end; wherein after updating the network write index to point to a next location, the method further comprises: and updating the network read index to point to the next position under the condition that the network read index is judged not to be equal to the network write index and the confirmation message aiming at the target ciphertext is received from the receiving end.
In a specific embodiment, the circular queue is further configured with a plaintext read index; after updating the network read index to point to the next position, updating the plaintext read index to be equal to the network read index; wherein the method further comprises: and writing the plaintext data to be transmitted into the position pointed by the plaintext write index under the condition that the next index corresponding to the plaintext write index is judged not to be equal to the plaintext read index, and updating the plaintext write index to point to the next position.
According to a second aspect, a data processing method is provided, which is executed by a receiving end based on a circular queue, wherein the circular queue is configured with a network write index, a decryption read index and a plaintext read index, and is used for determining a position where a ciphertext has been written, a position where decryption has been completed and a position where a plaintext has been read, respectively; the method comprises the following steps: under the condition that the decryption read index is judged not to be equal to the network write index and the ciphertext data in the position pointed by the decryption read index is replaced by the decrypted plaintext data, updating the decryption read index to point to the next position; and under the condition that the plaintext read index is not equal to the decryption read index, reading the plaintext data pointed by the plaintext read index, and updating the plaintext read index to point to the next position.
In one embodiment, the respective indices of the circular queue configuration initially point to the same location.
In one embodiment, the circular queue is further configured with a decryption write index for determining the location of the ciphertext for which decryption has been initiated; wherein, when it is determined that the decryption read index is not equal to the network write index and the ciphertext data in the location to which the decryption read index is directed is replaced with the plaintext data obtained by decryption, updating the decryption read index to point to the next location, includes: under the condition that the decryption write index is judged not to be equal to the network write index, starting decryption and replacement of ciphertext data in the position pointed by the decryption write index, and updating the decryption write index to point to the next position; and updating the decryption read index to point to the next position under the condition that the decryption read index is judged not to be equal to the decryption write index and the replacement is completed.
In a specific embodiment, the circular queue is further configured with a plaintext write index; wherein after updating the decryption read index to point to a next location and before reading the plaintext data pointed to by the plaintext read index, the method further comprises: updating the plaintext write index to be equal to the decrypted read index; reading the plaintext data pointed by the plaintext read index under the condition that the plaintext read index is not equal to the decryption read index, wherein the reading of the plaintext data pointed by the plaintext read index comprises the following steps: and reading the plaintext data pointed by the plaintext read index under the condition that the plaintext read index is judged not to be equal to the plaintext write index.
In one embodiment, the method further comprises: receiving a target ciphertext and a corresponding target serial number from a sending end; and writing the target ciphertext into the annular queue according to the target serial number and the network write index.
In a specific embodiment, writing the target ciphertext into the circular queue according to the target sequence number and the network write index includes: judging whether the target serial number meets a plurality of conditions, wherein the conditions at least comprise: the target sequence number is positioned in a closed interval formed by an expected sequence number and a maximum sequence number; under the condition that the judgment result is met, writing the target ciphertext into a position which is moved forward by a difference value position from the position pointed by the network write index, and performing self-reduction updating on the current available cache capacity; the difference value is obtained by subtracting the expected serial number from the target serial number; wherein after writing the target ciphertext to the ring queue, the method further comprises: traversing positions between the network write index and the plaintext read index, and when the position is traversed to the ith position, if the position is not empty, performing self-increment updating on the expected sequence number and the maximum sequence number, and updating the network write index to point to the next position; if it is empty, the traversal is ended.
Further, in a more specific embodiment, after ending the traversal, the method further comprises: and sending a confirmation message to the sending end, wherein the confirmation message indicates that all the ciphertext data before the expected sequence number are received completely and indicates the current available cache capacity.
In another aspect, in a specific embodiment, the conditions further include: storing no data identical to the target plaintext in a position shifted forward by a difference position from a position pointed by the network write index; and/or the index after moving the difference position from the position of the network writing index forward does not exceed the plain text reading index.
According to a third aspect, a data processing apparatus is provided, where the apparatus is integrated at a sending end, and operates based on a circular queue provided in the sending end, where the circular queue is configured with a plaintext write index, an encrypted read index, and a network write index, and is used to determine a position where a plaintext has been written, a position where encryption has been completed, and a position where a ciphertext has been sent, respectively; the device comprises:
the encryption unit is configured to update the encryption read index to point to the next position under the condition that the encryption read index is judged not to be equal to the plaintext write index and the plaintext data in the position pointed by the encryption read index is replaced by encrypted ciphertext data; and the network unit is configured to send a target ciphertext pointed by the network write index to a receiving end and update the network write index to point to the next position under the condition that the network write index is judged not to be equal to the encrypted read index.
According to a fourth aspect, there is provided a data processing apparatus, the apparatus being integrated at a receiving end and being executed based on a circular queue provided in the receiving end, the circular queue being configured with a network write index, a decryption read index, and a plaintext read index, and being configured to determine a position where a ciphertext has been written, a position where decryption has been completed, and a position where a plaintext has been read, respectively; the device comprises: the decryption unit is configured to update the decryption read index to point to the next position under the condition that the decryption read index is judged not to be equal to the network write index and the ciphertext data in the position pointed by the decryption read index is replaced by the decrypted plaintext data; and the plaintext unit is configured to read the plaintext data pointed by the plaintext read index and update the plaintext read index to point to the next position under the condition that the plaintext read index is judged not to be equal to the decryption read index.
In one embodiment, the apparatus further includes a network unit configured to write the target ciphertext into the circular queue according to a target sequence number and a network write index received from the sender corresponding to the target ciphertext.
In a specific embodiment, the network element is specifically configured to: judging whether the target sequence number meets a plurality of conditions, wherein the conditions at least comprise: the target sequence number is located in a closed interval formed by an expected sequence number and a maximum sequence number. Under the condition that the judgment result is met, writing the target ciphertext into a position which is moved forward by a difference value position from the position pointed by the network write index, and performing self-reduction updating on the current available cache capacity; the difference is obtained by subtracting the expected sequence number from the target sequence number. Traversing positions between the network write index and the plaintext read index, and when the position is traversed to the ith position, if the position is not empty, performing self-increment updating on the expected sequence number and the maximum sequence number, and updating the network write index to point to the next position; if it is empty, the traversal is ended.
Further, in a more specific embodiment, the network element is further configured to: and after the traversal is finished, sending a confirmation message to the sending end, wherein the confirmation message indicates that all the ciphertext data before the expected sequence number are received completely and indicates the current available cache capacity.
In another aspect, in a specific embodiment, the conditions further include: storing no data identical to the target plaintext in a position shifted forward by a difference position from a position pointed by the network write index; and/or the index after moving the difference position from the position of the network writing index forward does not exceed the plain text reading index.
According to a fifth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method of the first or second aspect.
According to a sixth aspect, there is provided a computing device comprising a memory having stored therein executable code and a processor which, when executing the executable code, implements the method of the first or second aspect.
By adopting the method and the device provided by the embodiment of the specification, the data transmission and the encryption and decryption are tightly coupled by introducing the multi-index ring, so that the encryption and decryption transmission performance of the data is effectively improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows an architectural diagram of a data transmission apparatus according to an embodiment;
FIG. 2 shows an architectural diagram of a data receiving device according to one embodiment;
FIG. 3 illustrates a flow diagram of a data processing method according to one embodiment;
FIG. 4 shows a flow diagram of a data processing method according to another embodiment.
Detailed Description
The scheme provided by the specification is described below with reference to the accompanying drawings.
As mentioned above, the current encryption and decryption transmission mode for data has limited performance. Specifically, the inventor finds that network transmission and encryption/decryption in the existing scheme belong to a loosely coupled function, and buffer occupies too much space and switches, so that performance is limited.
Based on this, the inventor has developed a multi-index ring (or referred to as multi-index queue) so that multiple stages of data processing can share one ring queue (or referred to as ring buffer). Specifically, a normal ring is provided with a read index and a write index for reading and writing data stored in the ring, and a multi-index ring is provided with a plurality of sets of read and write indexes.
Further, a data encryption and decryption scheme based on the multi-index ring is provided. Specifically, a data transmitting device and a data receiving device, or called a transmitting end and a receiving end, which are implemented based on a multi-index ring are provided, and the two devices can be used independently or jointly. These two devices will be described separately below.
Fig. 1 shows an architecture diagram of a data transmission apparatus according to an embodiment, in which constituent units of the transmission apparatus 10 shown include a plaintext unit 11, an encryption unit 12, and a network unit 13, and a multi-index ring 14 is provided in the transmission apparatus 10. The multiple sets of indexes (or multiple indexes) provided by the multiple index ring 14 at least include a plaintext write index 111, an encrypted read index 122, and a network write index 131, which are used to determine a location where plaintext has been written, a location where encryption has been completed, and a location where ciphertext has been sent, respectively. It should be noted that each index initially points to the same location of the multi-index ring 14; in addition, reference herein to "locations" is to the location of memory cells in a circular array, or alternatively, the location of a unit buffer in a circular buffer. Typically, the circular array is assigned a static array for identifying the location of each storage location therein, and accordingly, the index value may be an array element.
For an original plaintext data, after sequentially processing by the plaintext unit 11, the encryption unit 12 and the network unit 13 in the transmitting apparatus 10, the original plaintext data is encrypted and transmitted to the receiving end. For ease of understanding, the functions performed by these three units are described sequentially below. It should be noted that the three units share the multi-index ring 14, but may actually work independently and in parallel, for example, each unit triggers the implementation of a function in a polling manner, thereby increasing data processing efficiency.
The plaintext unit 11 is configured to: and writing the plaintext data to be transmitted into the position pointed by the plaintext write index 111, and updating the plaintext write index to point to the next position. In one embodiment, the plaintext data to be transmitted may be newly generated plaintext data, and accordingly, the write operation may be triggered by the generation of the plaintext data. In another embodiment, the plaintext data to be transmitted may be data indicated in a data request sent by the receiving end, and accordingly, the write operation may be triggered by receiving the data request.
On the other hand, in one embodiment, the multi-index ring 14 is also configured with a clear text read index 112 that indicates the location of data that has been consumed by the various units in the transmitting device 10. It is to be understood that the consumed data in the storage unit may be overwritten by newly generated data, thereby enabling reuse of the storage unit. Accordingly, the plaintext unit 11 may be configured to: judging whether the next index corresponding to the plaintext write index 111 is equal to the plaintext read index 112, further, under the condition that the next index corresponding to the plaintext write index 111 is not equal to the plaintext read index 112, writing the plaintext data to be transmitted into the position pointed by the plaintext write index 111, and updating the plaintext write index to point to the next position; otherwise, judging again.
It should be noted that, the usage of the storage unit by the circular queue is performed according to a single direction (for example, clockwise direction shown in fig. 1), where the inequality among the locations means that the location pointed by the former is after the location pointed by the latter, for example, the fact that the next index corresponding to the plaintext write index 111 is not equal to the plaintext read index 112 means that the location pointed by the next index corresponding to the plaintext write index 111 is after the location pointed by the plaintext read index 112.
The plaintext unit 11 is described above.
The encryption unit 12 is configured to: under the condition that the encryption read index 122 is judged not to be equal to the plaintext write index 111 and the plaintext data in the position pointed by the encryption read index 122 is replaced by encrypted ciphertext data, updating the encryption read index 122 to point to the next position; otherwise, judging again.
In one embodiment, the multi-index ring 14 is also configured with an encryption write index 121 that is used to determine the location of the plaintext where encryption has been initiated. Accordingly, the encryption unit 12 includes: a first encryption subunit configured to: in the case that it is determined that the encrypted write index 121 is not equal to the plaintext write index 111, starting encryption and replacement of plaintext data in a position to which the encrypted write index 121 points, and updating the encrypted write index 121 to point to a next position; otherwise, judging again; a second encryption subunit configured to: if the encrypted read index 122 is not equal to the encrypted write index 121 and the replacement is completed, updating the encrypted read index 122 to point to the next position; otherwise, judging again. It should be noted that the first encryption subunit and the second encryption subunit may operate in parallel.
The encryption unit 12 is described above.
The network unit 13 is configured to: in the case that the network write index 131 is determined not to be equal to the encrypted read index 122, sending the target ciphertext pointed by the network write index 131 to the receiving end, and updating the network write index 131 to point to the next location, for example, updating the network write index 131 from 0x00 to 0x 02; otherwise, judging again.
In one embodiment, the network unit 13 is specifically configured to: and under the condition that the network write index 131 is judged not to be equal to the encrypted read index 122 and the data volume of the target ciphertext is not larger than the current available cache capacity of the receiving end, sending the target ciphertext pointed by the network write index 131 to the receiving end, and updating the network write index 131 to point to the next position.
In one embodiment, the network unit 13 is further configured to: and receiving a confirmation message from the receiving end, wherein the confirmation message indicates that the target ciphertext and the current available buffer capacity of the receiving end are successfully received.
In one embodiment, the multi-index ring 14 is further configured with a network read index 132 for determining the location of ciphertext that has been successfully received by the receiving end. Based on this, in a specific embodiment, the network unit 13 is further configured to: and under the condition that the network read index 132 is judged not to be equal to the network write index 131 and the confirmation message aiming at the target ciphertext is not received from the receiving end within the preset time length, sending the target ciphertext to the receiving end again. In another specific embodiment, the network unit 13 is further configured to: in the case where it is determined that the network read index 132 is not equal to the network write index 131 and the confirmation message for the target ciphertext is received from the receiving end, the network read index 132 is updated to point to the next location.
On the other hand, in a specific embodiment, the multi-index ring 14 is further configured with a plaintext read index 112, and the network unit 13 is further configured to: after updating the network read index 132 to point to the next location, the plaintext read index 112 is also updated to be equal to the network read index.
The network unit 13 is described above.
According to another embodiment, the multi-index ring 14 is further configured with a network read index 132, and in this case, the plaintext unit 11 may be configured to: and writing the plaintext data to be transmitted into the position pointed by the plaintext write index 111 under the condition that the next index corresponding to the plaintext write index 111 is judged not to be equal to the network read index 132, and updating the plaintext write index to point to the next position.
The constituent elements of the transmission apparatus 10 are described above. In the functional implementation of the transmitting device 10, by introducing the multi-index ring, the transmission and encryption of data are tightly coupled, so that the encryption and transmission performance of data is effectively improved. It should be noted that the transmitting apparatus 10 disclosed in the embodiment of the present specification may be used in cooperation with an existing receiving device, and may also be used in cooperation with a receiving apparatus disclosed in the embodiment of the present specification.
Fig. 2 shows an architecture diagram of a data receiving apparatus according to an embodiment, wherein the shown constituent units of the receiving apparatus 20 include a network unit 21, a decryption unit 22 and a plaintext unit 23, and a multi-index ring 24 is provided in the receiving apparatus 20. The multiple sets of indexes (or multiple indexes) provided by the multiple index ring 24 at least include a network write index 211, a decryption read index 222 and a plaintext read index 232, which are used to determine the position where ciphertext has been written, the position where decryption has been completed, and the position where plaintext has been read, respectively. It is noted that each index initially points to the same location in the multi-index ring 24.
One piece of ciphertext data received from the transmitting end is decrypted into plaintext and then read after sequentially passing through the processing of the network unit 21, the decryption unit 22, and the plaintext unit 23 in the receiving apparatus 20. For ease of understanding, the functions performed by these three units are described sequentially below. It should be noted that the three units share the multi-index ring 24, but may actually work independently and in parallel, for example, each uses a polling method to trigger the implementation of the function, thereby increasing the data processing efficiency.
A network unit 21 configured to: any one ciphertext received from the transmit end is written into the multi-index ring 24 and the network write index 211 is updated to point to the next location. For clarity of description, any one ciphertext may be referred to as a target ciphertext.
Considering that there may be a situation where the ciphertexts are out of order, for example, the sending end sends the ciphertexts a first and then sends the ciphertexts B, but the receiving end receives the ciphertexts a first and then receives the ciphertexts B, or the receiving end receives only the ciphertexts B but does not receive the ciphertexts a within a period of time. Thus, to cope with out-of-order, in one embodiment, the network unit 21 is configured to: and receiving the target ciphertext and the corresponding target serial number from the sending end, and writing the target ciphertext into the multi-index ring 24 according to the target serial number and the network write index 211. It should be understood that the sequence number is generated by the sender for sequentially numbering the ciphertexts. Further, in a specific embodiment, the network unit 21 is specifically configured to: when the ciphertext corresponding to the good sequence before the target serial number is judged to have been written into the multi-index ring 24, the target ciphertext is written into the multi-index ring 24.
In another specific embodiment, to substantially improve the processing efficiency, the network unit 21 is specifically configured to: firstly, judging whether the target serial number meets a plurality of conditions, wherein the conditions at least comprise: the target sequence number is located in a closed interval formed by the expected sequence number and the maximum sequence number. It should be noted that the expected sequence number indicates that the receiving end has successfully received the ciphertexts corresponding to all the sequence numbers before the expected sequence number, and the maximum sequence number is calculated based on the expected sequence number and the currently available buffer.
Then, under the condition that each condition in a plurality of conditions is judged to be satisfied, writing the target ciphertext into a position pointed by the network write index after moving the position pointed by the difference position forwards, and performing self-decreasing updating (for example, decreasing by 1) on the current available cache capacity; where the difference is the target sequence number minus the expected sequence number.
Then, the position between the network write index and the plaintext read index is traversed, and the position is moved forward during the traversal. While traversing to the ith position from the net write index, if it is not empty, then self-increment updates (e.g., both add 1) the expected sequence number and the maximum sequence number and update the net write index 211 to point to the next position; and if the current traversal is not finished, exiting the current traversal.
Further, in a more specific embodiment, after exiting the traversal, an acknowledgement message is sent to the sender indicating that the ciphertext data preceding the current expected sequence number has all been received and indicating the current available buffer capacity. Therefore, the sending end can send the current expected sequence number and the ciphertext corresponding to the sequence number after the current expected sequence number to the receiving end according to the current expected sequence number and the current available buffer capacity.
On the other hand, in a more specific embodiment, the several conditions may further include: the same data as the target plaintext is not stored in the position shifted forward from the position pointed to by the network write index 211 by the above-described difference position. In another more specific embodiment, the several conditions may further include: the index shifted forward by the difference position from the position pointed to by the network write index 211 does not exceed the plaintext read index 232.
Therefore, even if ciphertext disorder occurs in the communication process, the ciphertext can be accurately and efficiently received and written.
In the above, the network unit 21 is introduced.
A decryption unit 22 configured to: when the decryption read index 222 is judged not to be equal to the network write index 211 and the ciphertext data in the position pointed by the decryption read index 222 is replaced by the decrypted plaintext data, updating the decryption read index 222 to point to the next position; otherwise, judging again.
In one embodiment, the multi-index ring 24 is also configured with a decryption write index 221 that is used to determine the location of the ciphertext that has initiated decryption. Based on this, decryption unit 22 may comprise a first decryption subunit and a second decryption subunit, wherein the first decryption subunit is configured to: under the condition that the decrypted write index 221 is judged not to be equal to the network write index 211, starting decryption and replacement of the ciphertext data in the position pointed by the decrypted write index 221, and updating the decrypted write index 221 to point to the next position; otherwise, judging again; the second decryption subunit is configured to: in the case where it is determined that the decrypted read index 222 is not equal to the decrypted write index 221 and the replacement is completed, the decrypted read index 222 is updated to point to the next position. It should be noted that the first encryption subunit and the second encryption subunit may operate in parallel.
On the other hand, in one embodiment, multi-index ring 24 is further configured with plain text write index 231, and accordingly decryption unit 22 is further configured to: after the decryption read index 222 is updated to point to the next location as described above, the plaintext write index 231 is updated to be equal to the decryption read index 222.
Decryption unit 22 is described above.
A plaintext unit 23 configured to: in the case that the plaintext read index 232 is not equal to the decrypted read index 222, the plaintext data pointed by the plaintext read index 232 is read, and the plaintext read index 232 is updated to point to the next position.
In one embodiment, multi-index ring 24 is further configured with plaintext write index 231, at which point plaintext unit 23 is configured to: in the case that the plaintext read index 232 is not equal to the plaintext write index 231, the plaintext data pointed by the plaintext read index 232 is read, and the plaintext read index 232 is updated to point to the next position.
The constituent units of the receiving device 20 are described above. In the functional implementation of the receiving apparatus 20, by introducing the multi-index ring, the transmission and decryption of data are tightly coupled, thereby effectively improving the transmission and decryption performance of data. It should be noted that the receiving apparatus 20 disclosed in the embodiment of the present specification may be used with an existing transmitting device, or may be used with the transmitting apparatus 10 disclosed in the embodiment of the present specification.
The data transmitting apparatus and the data receiving apparatus are described above separately. Correspondingly, the embodiment of the specification also discloses a data processing method. Fig. 3 is a flowchart of a data processing method according to an embodiment, which is performed by a transmitting end based on a circular queue configured with a plaintext write index, an encrypted read index, and a network write index, respectively for determining a location where plaintext has been written, a location where encryption has been completed, and a location where ciphertext has been transmitted. It is to be understood that the transmitting end may be implemented as any device, server, or device cluster with computing and processing capabilities, for example, a terminal device such as a user smart phone or the transmitting device 10 shown in fig. 1.
As shown in fig. 3, the method comprises the steps of:
step S310, under the condition that the encryption read index is judged not to be equal to the plaintext write index and the plaintext data in the position pointed by the encryption read index is replaced by encrypted ciphertext data, updating the encryption read index to point to the next position; step S320, sending the target ciphertext pointed by the network write index to the receiving end and updating the network write index to point to the next position when it is determined that the network write index is not equal to the encrypted read index.
In one embodiment, the respective indices of the circular queue configuration initially point to the same location.
In an embodiment, the circular queue is further configured with an encryption write index for determining a location of a plaintext for which encryption has been started, and accordingly, step S310 may be specifically implemented as: under the condition that the encryption write index is judged not to be equal to the plaintext write index, encryption and replacement of plaintext data in a position pointed by the encryption write index are started, and the encryption write index is updated to point to the next position; and under the condition that the encryption read index is judged not to be equal to the encryption write index and the replacement is completed, updating the encryption read index to point to the next position.
In one embodiment, step S320 includes: and under the condition that the network write index is judged not to be equal to the encrypted read index and the data volume of the target ciphertext is not larger than the current available cache capacity of the receiving end, sending the target ciphertext to the receiving end, and updating the network write index to point to the next position.
In one embodiment, after the step S320 is performed, the method further includes: receiving an acknowledgement message from the receiving end indicating successful receipt of the target ciphertext and a current available buffer capacity of the receiving end.
In one embodiment, the circular queue is further configured with a network read index for determining a position of a ciphertext that has been successfully received by the receiving end; after the step S320 is executed, the method further includes: and under the condition that the network read index is judged not to be equal to the network write index and the confirmation message aiming at the target ciphertext is not received from the receiving end within the preset time length, sending the target ciphertext to the receiving end again.
In one embodiment, the circular queue is further configured with a network read index for determining a position of a ciphertext that has been successfully received by the receiving end; after the step S320 is executed, the method further includes: and updating the network read index to point to the next position under the condition that the network read index is judged not to be equal to the network write index and the confirmation message aiming at the target ciphertext is received from the receiving end.
Further, in a specific embodiment, the circular queue is further configured with a plaintext read index; after the network read index is updated to point to the next position, the plaintext read index is also updated to be equal to the network read index; and, the method further comprises: and writing the plaintext data to be transmitted into the position pointed by the plaintext write index under the condition that the next index corresponding to the plaintext write index is judged not to be equal to the plaintext read index, and updating the plaintext write index to point to the next position.
In summary, with the data processing method executed by the sending end disclosed in the embodiments of the present specification, by introducing the multi-index ring, the transmission and encryption of data are tightly coupled, so as to effectively improve the encryption and transmission performance of data.
Fig. 4 is a flowchart of a data processing method performed by a receiving end based on a circular queue configured with a network write index, a decryption read index, and a plaintext read index for determining a location where ciphertext has been written, a location where decryption has been completed, and a location where plaintext has been read, respectively, according to another embodiment. It is to be understood that the receiving end may be implemented as any device, server, or device cluster with computing and processing capabilities, for example, a terminal device such as a user smart phone or the receiving device 20 shown in fig. 2.
As shown in fig. 4, the method comprises the steps of:
step S410, under the condition that the decryption read index is judged not to be equal to the network write index and the ciphertext data in the position pointed by the decryption read index is replaced by the decrypted plaintext data, updating the decryption read index to point to the next position; in step S420, under the condition that it is determined that the plaintext read index is not equal to the decryption read index, the plaintext data pointed by the plaintext read index is read, and the plaintext read index is updated to point to the next position.
In one embodiment, the respective indices of the circular queue configuration initially point to the same location.
In another embodiment, the circular queue is further configured with a decryption write index for determining the location of the ciphertext for which decryption has been initiated; correspondingly, step S410 specifically includes: under the condition that the decryption write index is judged not to be equal to the network write index, starting decryption and replacement of ciphertext data in the position pointed by the decryption write index, and updating the decryption write index to point to the next position; and updating the decryption read index to point to the next position under the condition that the decryption read index is judged not to be equal to the decryption write index and the replacement is completed.
Further, in a specific embodiment, the circular queue is further configured with a plaintext write index; wherein after step S410 and before step S420, the method further comprises: updating the plaintext write index to be equal to the decrypted read index; further, step S420 includes: and reading the plaintext data pointed by the plaintext read index under the condition that the plaintext read index is judged not to be equal to the plaintext write index.
In one embodiment, the method further comprises: receiving a target ciphertext and a corresponding target sequence number from a sending end; and writing the target ciphertext into the annular queue according to the target serial number and the network write index.
In a specific embodiment, writing the target ciphertext into the circular queue according to the target sequence number and the network write index includes: judging whether the target sequence number meets a plurality of conditions, wherein the conditions at least comprise: the target sequence number is positioned in a closed interval formed by an expected sequence number and a maximum sequence number; under the condition that the judgment result is met, writing the target ciphertext into a position which is moved forward by a difference value position from the position pointed by the network write index, and performing self-reduction updating on the current available cache capacity; the difference value is obtained by subtracting the expected serial number from the target serial number; wherein after writing the target ciphertext to the ring queue, the method further comprises: traversing positions between the network write index and the plaintext read index, and when the position is traversed to the ith position, if the position is not empty, performing self-increment updating on the expected sequence number and the maximum sequence number, and updating the network write index to point to the next position; if it is empty, the traversal is ended.
In a more specific embodiment, after ending the traversal, the method further comprises: and sending a confirmation message to the sending end, wherein the confirmation message indicates that all the ciphertext data before the expected sequence number are received completely and indicates the current available cache capacity.
In a more specific embodiment, the number of conditions further includes: storing no data identical to the target plaintext in a position shifted forward by a difference position from a position pointed by the network write index; and/or the index after moving the difference position from the position of the network writing index forward does not exceed the plain text reading index.
In summary, with the data processing method executed by the receiving end disclosed in the embodiments of the present specification, by introducing the multi-index ring, the transmission and decryption of data are tightly coupled, so as to effectively improve the decryption and transmission performance of data.
According to an embodiment of another aspect, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method described in connection with fig. 3 or 4.
According to an embodiment of yet another aspect, there is also provided a computing device comprising a memory having stored therein executable code, and a processor that, when executing the executable code, implements the method described in connection with fig. 3 or fig. 4. Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in this invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium.
The above-mentioned embodiments, objects, technical solutions and advantages of the present invention are further described in detail, it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the present invention should be included in the scope of the present invention.

Claims (20)

CN202210778105.4A2022-07-042022-07-04Data processing method and devicePendingCN114866343A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202210778105.4ACN114866343A (en)2022-07-042022-07-04Data processing method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210778105.4ACN114866343A (en)2022-07-042022-07-04Data processing method and device

Publications (1)

Publication NumberPublication Date
CN114866343Atrue CN114866343A (en)2022-08-05

Family

ID=82626988

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202210778105.4APendingCN114866343A (en)2022-07-042022-07-04Data processing method and device

Country Status (1)

CountryLink
CN (1)CN114866343A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6148365A (en)*1998-06-292000-11-14Vlsi Technology, Inc.Dual pointer circular queue
CN1529256A (en)*2003-10-172004-09-15中兴通讯股份有限公司Dual-ring quene-based, non-interrupt PCI communication method
US6832261B1 (en)*2001-02-042004-12-14Cisco Technology, Inc.Method and apparatus for distributed resequencing and reassembly of subdivided packets
CN101105786A (en)*2006-07-142008-01-16中兴通讯股份有限公司 A Dual-CPU Communication Method Based on Shared Memory
CN101309261A (en)*2008-07-142008-11-19成都卫士通信息产业股份有限公司Network datagram processing method, system and device
CN101841545A (en)*2010-05-142010-09-22中国科学院计算技术研究所TCP stream restructuring and/or packetizing method and device
CN111711566A (en)*2020-07-032020-09-25西安电子科技大学 Receiver out-of-order rearrangement method in multi-path routing scenario
CN113253956A (en)*2021-07-072021-08-13北京辰光信安电子有限公司Print file processing method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6148365A (en)*1998-06-292000-11-14Vlsi Technology, Inc.Dual pointer circular queue
US6832261B1 (en)*2001-02-042004-12-14Cisco Technology, Inc.Method and apparatus for distributed resequencing and reassembly of subdivided packets
CN1529256A (en)*2003-10-172004-09-15中兴通讯股份有限公司Dual-ring quene-based, non-interrupt PCI communication method
CN101105786A (en)*2006-07-142008-01-16中兴通讯股份有限公司 A Dual-CPU Communication Method Based on Shared Memory
CN101309261A (en)*2008-07-142008-11-19成都卫士通信息产业股份有限公司Network datagram processing method, system and device
CN101841545A (en)*2010-05-142010-09-22中国科学院计算技术研究所TCP stream restructuring and/or packetizing method and device
CN111711566A (en)*2020-07-032020-09-25西安电子科技大学 Receiver out-of-order rearrangement method in multi-path routing scenario
CN113253956A (en)*2021-07-072021-08-13北京辰光信安电子有限公司Print file processing method and device

Similar Documents

PublicationPublication DateTitle
CN108449256B (en) Message push processing method, device, computer equipment and storage medium
KR20000028662A (en)Computer, data sharing system, and method for maintaining replica consistency
US20170055247A1 (en)Data transmission method and apparatus and data receiving method and apparatus
CN109358867B (en)Automatic upgrading method, device and system for unmanned vehicle application and storage medium
CN101369879B (en) A method and device for requesting data retransmission
WO2021147668A1 (en)Software upgrading method and device
CN114265788A (en) A device, method, device and medium for memory management
CN114205552B (en)Code stream encryption method, code stream decryption method, device, electronic equipment and medium
CN107094085B (en)Signaling transmission method and device
JP7046983B2 (en) Packet transmission method and equipment
CN117201437A (en)Message processing method, device, medium and electronic equipment
CN113448770B (en)Method, electronic device and computer program product for recovering data
CN111181698B (en)Data processing method, device, equipment and medium
CN102801782B (en)A kind of synchronous updating method of data and system
CN109525633B (en)Block chain network, message sending method and message receiving method based on block chain network
CN114866343A (en)Data processing method and device
CN101510872B (en)Remote customer dialing authentication service client terminal, server and transmission/acceptance method
CN105141696A (en)File uploading method and device
JP2007221522A (en) Polling device, terminal device, polling method and program
CN112491903A (en)Account checking method, device and system among multiple systems
CN105900395A (en) Communication device, communication method, and communication program
US20150047027A1 (en)Apparatus and method for transmitting and receiving messages
CN107592361B (en)Data transmission method, device and equipment based on dual IB network
CN114222290B (en)Communication method, device, equipment and storage medium
CN109104465B (en)Multi-party file transmission method and agent management system

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20220805


[8]ページ先頭

©2009-2025 Movatter.jp