CN106850219B - Data processing method and terminal - Google Patents

Data processing method and terminal Download PDF

Info

Publication number
CN106850219B
CN106850219B CN201710030216.6A CN201710030216A CN106850219B CN 106850219 B CN106850219 B CN 106850219B CN 201710030216 A CN201710030216 A CN 201710030216A CN 106850219 B CN106850219 B CN 106850219B
Authority
CN
China
Prior art keywords
encryption
encrypted
data
offset
encrypted data
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.)
Active
Application number
CN201710030216.6A
Other languages
Chinese (zh)
Other versions
CN106850219A (en
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.)
Yulong Computer Telecommunication Scientific Shenzhen Co Ltd
Original Assignee
Yulong Computer Telecommunication Scientific Shenzhen 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 Yulong Computer Telecommunication Scientific Shenzhen Co Ltd filed Critical Yulong Computer Telecommunication Scientific Shenzhen Co Ltd
Priority to CN201710030216.6A priority Critical patent/CN106850219B/en
Publication of CN106850219A publication Critical patent/CN106850219A/en
Application granted granted Critical
Publication of CN106850219B publication Critical patent/CN106850219B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The embodiment of the invention provides a data processing method and a terminal, wherein the method comprises the following steps: encrypting data to be encrypted by adopting a first encryption algorithm to obtain first encrypted data; determining a ciphertext length of the first encrypted data; determining a target encryption offset according to the ciphertext length; determining a second encryption algorithm according to the target encryption offset; and encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data. Therefore, the data to be encrypted is encrypted twice, encrypted once, encrypted normally and encrypted once according to the offset, so that the encrypted ciphertexts have the same length, and other people are difficult to decrypt the data to be encrypted according to the length of the ciphertexts, and the security of data encryption is improved.

Description

Data processing method and terminal
Technical Field
The invention relates to the field of data processing, in particular to a data processing method and a terminal.
Background
In the prior art, there are two methods for encrypting data, one is symmetric encryption, and the other is asymmetric encryption. In the symmetric encryption, the keys for data encryption and decryption are the same, and the key is also sent when the sender sends the encrypted data to the receiver, and if the key is intercepted in the channel, the data is cracked, so that the security is lost, and the data is acquired by others. In asymmetric encryption, although keys for data encryption and decryption are different, the data length after data encryption is different by using different encryption algorithms, and a hacker can easily deduce which encryption algorithm is adopted according to the length of the encrypted data so as to crack the encrypted data, so that the security of data encryption needs to be improved.
Disclosure of Invention
The embodiment of the invention provides a data processing method and a terminal, which improve the security of data encryption.
A first aspect of an embodiment of the present invention provides a data processing method, including:
encrypting data to be encrypted by adopting a first encryption algorithm to obtain first encrypted data;
determining a ciphertext length of the first encrypted data;
determining a target encryption offset according to the ciphertext length;
determining a second encryption algorithm according to the target encryption offset;
and encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data.
With reference to the first aspect of the embodiment of the present invention, in a first possible implementation manner of the first aspect, the determining a target encryption offset according to the ciphertext length includes:
and determining the target encryption offset corresponding to the first ciphertext length according to the corresponding relation among the preset length, the second ciphertext length and the offset.
With reference to the first possible implementation manner of the first aspect of the embodiment of the present invention, in a second possible implementation manner of the first aspect, the preset length is greater than a ciphertext length of the first encrypted data.
With reference to the first aspect of the embodiment of the present invention to the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the determining a second encryption algorithm according to the target encryption offset includes:
and determining the second encryption algorithm corresponding to the target offset according to a preset corresponding relation between the offset and the encryption algorithm.
With reference to the first aspect of the embodiment of the present invention to the second possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, after the encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data, the method further includes:
determining a second decryption algorithm by using the target encryption offset;
decrypting the second encrypted data by adopting a second decryption algorithm and the target encryption offset to obtain first encrypted data;
and decrypting the first encrypted data by adopting a first decryption algorithm to obtain the data to be encrypted.
A second aspect of an embodiment of the present invention provides a terminal, including:
the first encryption unit is used for encrypting the data to be encrypted by adopting a first encryption algorithm to obtain first encrypted data;
a first determination unit configured to determine a ciphertext length of the first encrypted data;
the second determining unit is used for determining a target encryption offset according to the ciphertext length;
a third determining unit, configured to determine a second encryption algorithm according to the target encryption offset;
and the second encryption unit is used for encrypting the first encryption data according to the second encryption algorithm and the target encryption offset to obtain second encryption data.
With reference to the second aspect of the embodiment of the present invention, in a first possible implementation manner of the second aspect, the second determining unit is specifically configured to:
and determining the target encryption offset corresponding to the first ciphertext length according to the corresponding relation among the preset length, the second ciphertext length and the offset.
With reference to the first possible implementation manner of the second aspect of the embodiment of the present invention, in a second possible implementation manner of the second aspect, the preset length is greater than a ciphertext length of the first encrypted data. With reference to the second possible implementation manner of the second aspect to the second aspect of the embodiments of the present invention, in a third possible implementation manner of the second aspect, the third determining unit is specifically configured to:
and determining the second encryption algorithm corresponding to the target offset according to a preset corresponding relation between the offset and the encryption algorithm.
With reference to the second aspect of the second embodiment to the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect, the terminal further includes:
a fourth determining unit, configured to encrypt the first encrypted data according to the second encryption algorithm and the target encryption offset by the third determining unit to obtain second encrypted data, and then determine a second decryption algorithm by using the target encryption offset;
the second decryption unit is used for decrypting the second encrypted data by adopting a second decryption algorithm and the target encryption offset to obtain first encrypted data;
and the first decryption unit is used for decrypting the first encrypted data by adopting a first decryption algorithm to obtain the data to be encrypted.
The embodiment of the invention has the following beneficial effects:
according to the embodiment of the invention, a first encryption algorithm is adopted to encrypt data to be encrypted to obtain first encrypted data; determining a ciphertext length of the first encrypted data; determining a target encryption offset according to the ciphertext length; determining a second encryption algorithm according to the target encryption offset; and encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data. Therefore, the data to be encrypted is encrypted twice, encrypted once, encrypted normally and encrypted once according to the offset, so that the encrypted ciphertexts have the same length, and other people are difficult to decrypt the data to be encrypted according to the length of the ciphertexts, and the security of data encryption is improved.
Drawings
In order to more clearly illustrate the technical solutions in 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 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 is a schematic flow chart of a data processing method according to a first embodiment of the present invention;
fig. 2 is a schematic flowchart of a data processing method according to a second embodiment of the present invention;
fig. 3a is a schematic structural diagram of a terminal according to a first embodiment of the present invention;
fig. 3b is a schematic structural diagram of a terminal according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal according to a second embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," and "fourth," etc. in the description and claims of the invention and in the accompanying drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The terminal described in the embodiment of the present invention may include a smart Phone (such as an Android Phone, an iOS Phone, a Windows Phone, etc.), a tablet computer, a palm computer, a notebook computer, a mobile internet device (MID, mobile internet Devices), or a wearable device, and the terminal is merely an example, and is not exhaustive and includes but is not limited to the terminal.
It should be noted that, after data is encrypted, the security of the data can be improved and the privacy of the data can be ensured, generally speaking, the encryption algorithm includes a symmetric encryption algorithm and an asymmetric encryption algorithm, which are known, wherein an encryption key and a decryption key of the symmetric encryption algorithm are the same key algorithm, the encryption key and the decryption key used by the asymmetric encryption algorithm are different, one of the two keys is public and called a public key, and the other key is private and called a private key. Compared with a symmetric encryption algorithm, the asymmetric encryption algorithm has higher cracking difficulty and higher safety. In the embodiment of the invention, the data to be encrypted is encrypted twice, wherein the first encryption adopts an asymmetric encryption algorithm with higher security, so that the security of the data to be encrypted in the transmission process is ensured.
Fig. 1 is a schematic flow chart of a data processing method according to a first embodiment of the present invention. The data processing method described in this embodiment includes the following steps:
101. and encrypting the data to be encrypted by adopting a first encryption algorithm to obtain first encrypted data.
Alternatively, the data to be encrypted may include, but is not limited to: file data (Word, Excel, PPT, etc.), picture data (photograph, image, etc.), audio data (music, voice, etc.), video data (animation, video, etc.), and the like.
Optionally, in order to improve security of data encryption, in the embodiment of the present invention, an asymmetric encryption algorithm is used as the first encryption algorithm to encrypt data to be encrypted.
Alternatively, the commonly used asymmetric encryption algorithms are RSA, Elgamal, knapsack algorithm, Rabin, D-H, ECC, etc., and a key pair, i.e. a public key and a private key, is obtained by the first encryption algorithm, and the public key and the private key are two different keys. When encrypted with a public key, decryption needs to be performed with the corresponding private key, and when encrypted with a private key, decryption needs to be performed with the corresponding public key, which is known to the encryptor and the decryptor.
Alternatively, the user may select the first encryption algorithm himself, such as selecting an asymmetric encryption algorithm that is more secure but may be less secure, or selecting an asymmetric encryption algorithm that is more efficient but less secure. Of course, an asymmetric encryption algorithm chosen by the encryption tool employed by the terminal is also possible.
Optionally, the first encrypted data is obtained after the data to be encrypted is encrypted, and the length of the first encrypted data is changed compared with that of the data to be encrypted, wherein the length of the first encrypted data is determined by a first encryption algorithm, and the lengths of the first-stage encrypted data obtained after the first encrypted data is encrypted by different first encryption algorithms are different.
102. Determining a ciphertext length of the first encrypted data;
the length of the first encrypted data obtained by encrypting through the first encryption algorithm is different from the length of the data to be encrypted, and the terminal needs to determine the length of the first encrypted data so as to calculate the target encryption offset.
103. Determining a target encryption offset according to the ciphertext length;
and determining the target encryption offset, and further determining that the terminal selects the corresponding second encryption algorithm. And determining the target encryption offset corresponding to the first ciphertext length according to the corresponding relation among the preset length, the second ciphertext length and the offset.
Optionally, it is a known rule, which may also be referred to as a universal expansion, that specifies which encryption algorithm is used for the second encryption and the length of the second encrypted data obtained after encryption by using a preset length, which is known to both the encrypting party and the decrypting party, and the preset length must be much longer than the ciphertext length of the first encrypted data encrypted by using the various first encryption algorithms.
Optionally, in the prior art, the offset is broadly defined as a distance between an actual address of the storage unit and a segment address of a segment where the storage unit is located. For example, G represents the predetermined length, L represents the first ciphertext length, and the offset may be represented by F (G, L), which represents a multivariate equation algorithm, which is a known technology and will not be described herein. For example, when G is 30, the lengths of the first encrypted data X1, X2, and X3 obtained by encrypting by three different first encryption algorithms E1, E2, and E3 are L1-15, L2-20, and L3-25, respectively, and the offsets O1, O2, and O3 are obtained by corresponding relationships among a preset length, a second ciphertext length, and an offset, where O1, O2, and O3 may be character strings.
104. Determining a second encryption algorithm according to the target encryption offset;
the second encryption algorithm may be referred to as an offset algorithm, may be an already-disclosed encryption algorithm, or may be an encryption algorithm that is not yet disclosed, and the second encryption algorithm is determined by the target encryption offset. For example, for the undisclosed second encryption algorithm S, the public encryption algorithm a and the public encryption algorithm B may be used for combined encryption, and the data to be encrypted is divided into N shares, where K of the N shares are encrypted by using the encryption algorithm a, and the remaining (N-K) shares are encrypted by using the encryption algorithm B, so that the length of the finally obtained second encrypted data is equal to the preset length G.
Optionally, the terminal presets a corresponding relationship between the offset and the encryption algorithm, and the terminal determines a second encryption algorithm corresponding to the target encryption offset according to the preset corresponding relationship between the offset and the encryption algorithm. For example, the terminal has three known first encryption algorithms, which are E1, E2, and E3, the lengths of the first encrypted data X1, X2, and X3 obtained by using the three first encryption algorithms are L1, L2, and L3, respectively, assuming that the preset length G is 30, L1 is 15, L2 is 20, and L3 is 25, the calculated offsets are O1, O2, and O3, respectively, and for different offsets, we can use different second encryption algorithms for encryption, for example, O1 corresponds to encryption algorithm S1, O2 corresponds to encryption algorithm S2, and O3 corresponds to encryption algorithm S3.
105, encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data.
The terminal encrypts the first encrypted data by using a second encryption algorithm in combination with the target encryption offset to obtain second encrypted data, wherein the second encrypted data have the same length and are equal to a preset length G. For the disclosed encryption algorithm, the length of the ciphertext encrypted by the disclosed encryption algorithm is known, and the value of the preset length G is larger than the value of the ciphertext length encrypted by the disclosed encryption algorithm.
Optionally, the second encryption algorithm may be a public encryption algorithm or a non-public encryption algorithm, and after the data is encrypted by the second encryption algorithm, the length of the second encrypted data is equal to the preset length. For example, the first encrypted data X1, X2, and X3 are encrypted by using the second encryption algorithms S1, S2, and S3, respectively, to obtain the second encrypted data Y1, Y2, and Y3, and even if the lengths of X1, X2, and X3 are different, the algorithms S1, S2, and S3 are different, but the lengths of the finally obtained second encrypted data Y1, Y2, and Y3 are the same and equal to the preset length G, that is, the second encrypted data with the same length is obtained by using different second encryption algorithms. For example, when the preset length G is 30, the lengths X1, X2, and X3 obtained after the first encryption are 15, 20, and 25, respectively, but the lengths Y1, Y2, and Y3 obtained after the second encryption are 30, and 30, respectively. Because the preset length is larger than the cipher text length value encrypted by all the public encryption algorithms, other people can not easily deduce which algorithm is adopted for encryption according to the length of the second encryption data.
Optionally, if the data to be encrypted needs to be sent in multiple times, multiple times of encryption are required, and the process of encryption and the algorithm used in each time are the same. For example, when data needs to be transmitted for multiple times, data I to be encrypted is divided into four parts, I1, I2, I3 and I4, and is transmitted for four times, ciphertexts Y1, Y2, Y3 and Y4 are obtained after encryption, and the lengths of Y1, Y2, Y3 and Y4 are the same as a preset length, so that other people except an encryption party and a decryption party cannot easily deduce which encryption algorithm is adopted, and the data to be encrypted cannot be decrypted.
Therefore, by using the data processing method in the embodiment of the present invention, the second encrypted data obtained after encrypting different data to be encrypted has the same length, and even if different encryption algorithms are used, the length of the finally obtained second encrypted data is still the same, and the length tends to the known preset length of the encrypting party and the decrypting party, which is larger than the length of the ciphertext obtained after encrypting by using any encryption algorithm, so that others cannot simply calculate the decryption algorithm from the length of the second encrypted data, thereby breaking the data to be encrypted.
It can be seen that, according to the embodiment of the present invention, the first encryption algorithm is adopted to encrypt the data to be encrypted, so as to obtain the first encrypted data; determining a ciphertext length of the first encrypted data; determining a target encryption offset according to the ciphertext length; determining a second encryption algorithm according to the target encryption offset; and encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data. Therefore, the data to be encrypted is encrypted twice, encrypted once, encrypted normally and encrypted once according to the offset, so that the encrypted ciphertexts have the same length, and other people are difficult to decrypt the data to be encrypted according to the length of the ciphertexts, and the security of data encryption is improved.
In accordance with the above, please refer to fig. 2, which is a flowchart illustrating a data processing method according to a second embodiment of the present invention. The data processing method described in this embodiment includes the following steps:
201. encrypting data to be encrypted by adopting a first encryption algorithm to obtain first encrypted data;
202. determining a ciphertext length of the first encrypted data;
203. determining a target encryption offset according to the ciphertext length;
204. determining a second encryption algorithm according to the target encryption offset;
205. and encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data.
The above steps 201 to 205 may refer to steps 101 to 105 of the data processing method described in fig. 1.
206. Determining a second decryption algorithm by using the target encryption offset;
the terminal restores the length of the second encrypted data by using the target encryption offset and the preset length, so that the length of the second encrypted data is changed into the ciphertext length of the first encrypted data, and the terminal determines a corresponding second decryption algorithm by checking the length of the second encrypted data at the moment and combining the target encryption offset.
207. Decrypting the second encrypted data by adopting a second decryption algorithm and the target encryption offset to obtain first encrypted data;
and then decrypting the second encrypted data by using a second decryption algorithm and the target encryption offset to obtain the first encrypted data.
208. And decrypting the first encrypted data by adopting a first decryption algorithm to obtain the data to be encrypted.
The first-stage encryption algorithm and the first decryption algorithm are known by the encryption party and the decryption party, if public key encryption is adopted, decryption is needed by using a private key, and if private key encryption is adopted, decryption of the first encrypted data can be achieved by using the first decryption algorithm and combining with a corresponding secret key by the decryption party, so that the data to be encrypted is obtained.
It can be seen that, according to the embodiment of the present invention, the first encryption algorithm is adopted to encrypt the data to be encrypted, so as to obtain the first encrypted data; determining a ciphertext length of the first encrypted data; determining a target encryption offset according to the ciphertext length; determining a second encryption algorithm according to the target encryption offset; encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data; determining a second decryption algorithm by using the target encryption offset; decrypting the second encrypted data by adopting a second decryption algorithm and the target encryption offset to obtain first encrypted data; and decrypting the first encrypted data by adopting a first decryption algorithm to obtain the data to be encrypted. Therefore, the data to be encrypted is encrypted twice, encrypted once and encrypted once according to the offset, so that the encrypted ciphertexts have the same length, other people are difficult to decrypt the data to be encrypted according to the length of the ciphertexts, the encrypted data is decrypted by adopting a corresponding decryption algorithm after the encrypted data is received, and is restored into the data to be encrypted, and further, the security of data encryption is improved.
In accordance with the foregoing, the following is a device for implementing the data processing method according to the foregoing embodiment of the present invention, and specifically includes:
please refer to fig. 3a, which is a schematic structural diagram of a terminal according to an embodiment of the present invention. The terminal described in this embodiment includes: the first encryption unit 301, the first determination unit 302, the second determination unit 303, the third determination unit 304, and the second encryption unit 305 are specifically as follows:
a first determining unit 301 configured to determine a ciphertext length of the first encrypted data;
a second determining unit 302, configured to determine a target encryption offset according to the ciphertext length;
a third determining unit 303, configured to determine a second encryption algorithm according to the target encryption offset;
a second encrypting unit 304, configured to encrypt the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data.
Optionally, the second determining unit is specifically configured to:
and determining the target encryption offset corresponding to the ciphertext length of the first encryption data according to the preset corresponding relation between the ciphertext length and the offset.
Optionally, the preset length is greater than a length of a ciphertext obtained by encrypting data by using any encryption algorithm.
Optionally, the third determining unit is specifically configured to:
and determining the second encryption algorithm corresponding to the target offset according to a preset corresponding relation between the offset and the encryption algorithm.
Optionally, as shown in fig. 3b, fig. 3b is a modified structure of fig. 3a, and compared with fig. 3a, the terminal depicted in fig. 3a may further include:
the fourth determining unit 306, the second decrypting unit 307 and the first decrypting unit 308 are specifically as follows:
a fourth determining unit 306, configured to, after the third determining unit encrypts the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data, determine a second decryption algorithm by using the target encryption offset;
a second decryption unit 307, configured to decrypt the second encrypted data by using a second decryption algorithm and the target encryption offset to obtain first encrypted data;
the first decryption unit 308 is configured to decrypt the first encrypted data by using a first decryption algorithm to obtain the data to be encrypted.
It can be seen that, according to the embodiment of the present invention, the first encryption algorithm is adopted to encrypt the data to be encrypted, so as to obtain the first encrypted data; determining a ciphertext length of the first encrypted data; determining a target encryption offset according to the ciphertext length; determining a second encryption algorithm according to the target encryption offset; and encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data. Therefore, the data to be encrypted is encrypted twice, encrypted once, encrypted normally and encrypted once according to the offset, so that the encrypted ciphertexts have the same length, and other people are difficult to decrypt the data to be encrypted according to the length of the ciphertexts, and the security of data encryption is improved.
Fig. 4 is a schematic structural diagram of a terminal according to a second embodiment of the present invention. The terminal described in this embodiment includes: at least one input device 1000; at least one output device 2000; at least one processor 3000, e.g., a CPU; and a memory 4000, the input device 1000, the output device 2000, the processor 3000, and the memory 4000 being connected by a bus 5000.
The input device 1000 may be a touch panel, a physical button, or a mouse.
The output device 2000 may be a display screen.
The memory 4000 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 4000 is used for storing a set of program codes, and the input device 1000, the output device 2000 and the processor 3000 are used for calling the program codes stored in the memory 4000 to execute the following operations:
the processor 3000 is configured to:
encrypting data to be encrypted by adopting a first encryption algorithm to obtain first encrypted data;
determining a ciphertext length of the first encrypted data;
determining a target encryption offset according to the ciphertext length;
determining a second encryption algorithm according to the target encryption offset;
and encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data.
Optionally, the processor 3000 determines a target encryption offset according to the ciphertext length, including:
and determining the target encryption offset corresponding to the ciphertext length of the first encryption data according to the preset corresponding relation between the ciphertext length and the offset.
Optionally, the preset length of the processor 3000 is greater than a length of a ciphertext obtained by encrypting data using any encryption algorithm.
Optionally, the determining, by the processor 3000, a second encryption algorithm according to the target encryption offset includes:
and determining the second encryption algorithm corresponding to the target offset according to a preset corresponding relation between the offset and the encryption algorithm.
Optionally, after the processor 3000 encrypts the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data, the method further includes:
determining a second decryption algorithm by using the target encryption offset;
decrypting the second encrypted data by adopting a second decryption algorithm and the target encryption offset to obtain first encrypted data;
and decrypting the first encrypted data by adopting a first decryption algorithm to obtain the data to be encrypted.
An embodiment of the present invention further provides a computer storage medium, where the computer storage medium may store a program, and the program includes, when executed, some or all of the steps of any one of the data processing methods described in the above method embodiments.
While the invention has been described in connection with various embodiments, other variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed invention, from a review of the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps, and the word "a" or "an" does not exclude a plurality. A single processor or other unit may fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus (device), or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein. A computer program stored/distributed on a suitable medium supplied together with or as part of other hardware, may also take other distributed forms, such as via the Internet or other wired or wireless telecommunication systems.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the invention has been described in conjunction with specific features and embodiments thereof, it will be evident that various modifications and combinations can be made thereto without departing from the spirit and scope of the invention. Accordingly, the specification and figures are merely exemplary of the invention as defined in the appended claims and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of the invention. It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A data processing method, comprising:
encrypting data to be encrypted by adopting a first encryption algorithm to obtain first encrypted data;
determining a ciphertext length of the first encrypted data;
determining a target encryption offset according to the ciphertext length of the first encrypted data, wherein the target encryption offset is determined according to a preset length and the ciphertext length of the first encrypted data, and the numerical value of the preset length is larger than the numerical value of the ciphertext length encrypted by a public encryption algorithm;
determining a second encryption algorithm according to the target encryption offset;
and encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data, wherein the ciphertext length of the second encrypted data is the preset length.
2. The method of claim 1, wherein determining a target encryption offset based on the ciphertext length of the first encrypted data comprises:
and determining the target encryption offset corresponding to the ciphertext length of the first encryption data according to the corresponding relation among the preset length, the ciphertext length and the offset.
3. The method according to claim 2, wherein the preset length is greater than a ciphertext length of the first encrypted data.
4. The method of any of claims 1 to 3, wherein determining a second encryption algorithm based on the target encryption offset comprises:
and determining the second encryption algorithm corresponding to the target encryption offset according to a preset corresponding relation between the offset and the encryption algorithm.
5. The method according to any one of claims 1 to 3, wherein after encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data, the method further comprises:
determining a second decryption algorithm by using the target encryption offset;
decrypting the second encrypted data by adopting a second decryption algorithm and the target encryption offset to obtain first encrypted data;
and decrypting the first encrypted data by adopting a first decryption algorithm to obtain the data to be encrypted.
6. A terminal, comprising:
the first encryption unit is used for encrypting the data to be encrypted by adopting a first encryption algorithm to obtain first encrypted data;
a first determination unit configured to determine a ciphertext length of the first encrypted data;
a second determining unit, configured to determine a target encryption offset according to the ciphertext length of the first encrypted data, where the target encryption offset is determined according to a preset length and the ciphertext length of the first encrypted data, and a value of the preset length is greater than a value of the ciphertext length encrypted by a public encryption algorithm;
a third determining unit, configured to determine a second encryption algorithm according to the target encryption offset;
and the second encryption unit is used for encrypting the first encrypted data according to the second encryption algorithm and the target encryption offset to obtain second encrypted data, and the ciphertext length of the second encrypted data is the preset length.
7. The terminal according to claim 6, wherein the second determining unit is specifically configured to:
and determining the target encryption offset corresponding to the ciphertext length of the first encryption data according to the corresponding relation among the preset length, the ciphertext length and the offset.
8. The terminal according to claim 7, wherein the predetermined length is greater than a ciphertext length of the first encrypted data.
9. The terminal according to any one of claims 6 to 8, wherein the third determining unit is specifically configured to:
and determining the second encryption algorithm corresponding to the target encryption offset according to a preset corresponding relation between the offset and the encryption algorithm.
10. The terminal according to any of claims 6 to 8, wherein the terminal further comprises:
a fourth determining unit, configured to encrypt the first encrypted data according to the second encryption algorithm and the target encryption offset by the third determining unit to obtain second encrypted data, and then determine a second decryption algorithm by using the target encryption offset;
the second decryption unit is used for decrypting the second encrypted data by adopting a second decryption algorithm and the target encryption offset to obtain first encrypted data;
and the first decryption unit is used for decrypting the first encrypted data by adopting a first decryption algorithm to obtain the data to be encrypted.
CN201710030216.6A 2017-01-16 2017-01-16 Data processing method and terminal Active CN106850219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710030216.6A CN106850219B (en) 2017-01-16 2017-01-16 Data processing method and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710030216.6A CN106850219B (en) 2017-01-16 2017-01-16 Data processing method and terminal

Publications (2)

Publication Number Publication Date
CN106850219A CN106850219A (en) 2017-06-13
CN106850219B true CN106850219B (en) 2020-06-05

Family

ID=59124409

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710030216.6A Active CN106850219B (en) 2017-01-16 2017-01-16 Data processing method and terminal

Country Status (1)

Country Link
CN (1) CN106850219B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108173640B (en) * 2017-12-11 2020-12-15 上海高顿教育科技有限公司 High-security symmetric encryption and decryption method for character strings
CN110636067A (en) * 2019-09-24 2019-12-31 天津五八到家科技有限公司 Data encryption method, data decryption method and device
CN114978573B (en) * 2022-03-30 2024-02-20 潍柴动力股份有限公司 Encryption method, device and system of OTA data

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455557A (en) * 2002-03-25 2003-11-12 联合特里西斯株式会社 Changeable length/fixed length data conversion method and apparatus
CN101061661A (en) * 2004-10-20 2007-10-24 思科技术公司 Enciphering method
CN101471769A (en) * 2007-12-28 2009-07-01 北京大唐高鸿数据网络技术有限公司 Enciphering/deciphering method for VoIP medium transmission
CN101833681A (en) * 2010-04-02 2010-09-15 深圳市科陆电子科技股份有限公司 Electronic label system, compression and encryption method thereof
WO2012011455A1 (en) * 2010-07-20 2012-01-26 日本電気株式会社 Encryption device, decryption device, encryption method, decryption method, and computer program
CN102819716A (en) * 2012-07-20 2012-12-12 腾讯科技(深圳)有限公司 Method, device and system for encrypting and decrypting picture
CN105760765A (en) * 2016-02-04 2016-07-13 北京致远协创软件有限公司 Data encrypting method and device and data decrypting method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455557A (en) * 2002-03-25 2003-11-12 联合特里西斯株式会社 Changeable length/fixed length data conversion method and apparatus
CN101061661A (en) * 2004-10-20 2007-10-24 思科技术公司 Enciphering method
CN101471769A (en) * 2007-12-28 2009-07-01 北京大唐高鸿数据网络技术有限公司 Enciphering/deciphering method for VoIP medium transmission
CN101833681A (en) * 2010-04-02 2010-09-15 深圳市科陆电子科技股份有限公司 Electronic label system, compression and encryption method thereof
WO2012011455A1 (en) * 2010-07-20 2012-01-26 日本電気株式会社 Encryption device, decryption device, encryption method, decryption method, and computer program
CN102819716A (en) * 2012-07-20 2012-12-12 腾讯科技(深圳)有限公司 Method, device and system for encrypting and decrypting picture
CN105760765A (en) * 2016-02-04 2016-07-13 北京致远协创软件有限公司 Data encrypting method and device and data decrypting method and device

Also Published As

Publication number Publication date
CN106850219A (en) 2017-06-13

Similar Documents

Publication Publication Date Title
US9819656B2 (en) Method for secure communication using asymmetric and symmetric encryption over insecure communications
EP3324572B1 (en) Information transmission method and mobile device
CN109034796B (en) Alliance chain-based transaction supervision method, electronic device and readable storage medium
CN113364760A (en) Data encryption processing method and device, computer equipment and storage medium
WO2016115889A1 (en) Method and system for controlling encryption of information and analyzing information as well as terminal
WO2020232800A1 (en) Data processing method and system in block chain network and related device
TW202113646A (en) Private key generation and use method, apparatus and device in asymmetric key
JP2018142013A (en) Systems and methods for faster public key encryption using associated private key portion
CN106487659B (en) Information encryption method, information encryption device and terminal
CN107707562B (en) Method and device for encrypting and decrypting algorithm of asymmetric dynamic token
JP2019514314A (en) Method, system and medium for using dynamic public key infrastructure to send and receive encrypted messages
CN106850219B (en) Data processing method and terminal
CN110061957A (en) Data encryption, decryption method, user terminal, server and data management system
CN106161472A (en) A kind of method of data encryption, Apparatus and system
CN104038336A (en) Data encryption method based on 3DES
CN105959279A (en) Computer information transmission system and method based on encryption processing
EP3382929A1 (en) Technique to generate symmetric encryption algorithms
CN111245771A (en) Instant message encryption and decryption method, device, equipment and storage medium
US20160241387A1 (en) System and method for manipulating both the plaintext and ciphertext of an encryption process prior to dissemination to an intended recipient
TWI599903B (en) Encryption and decryption system and encryption and decryption method of electronic device
CN109361506B (en) Information processing method
KR101912443B1 (en) Public key based encryption method and key generation server
CN112149166B (en) Unconventional password protection method and intelligent bank machine
CN115051790A (en) Data encryption method, data decryption method and device, and storage medium
CN111212068B (en) Method for encrypting and decrypting characters by input method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant