CN107196973B - data encryption and decryption method and device - Google Patents

data encryption and decryption method and device Download PDF

Info

Publication number
CN107196973B
CN107196973B CN201710613718.1A CN201710613718A CN107196973B CN 107196973 B CN107196973 B CN 107196973B CN 201710613718 A CN201710613718 A CN 201710613718A CN 107196973 B CN107196973 B CN 107196973B
Authority
CN
China
Prior art keywords
binary code
data
ciphertext
decryption
binary
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
CN201710613718.1A
Other languages
Chinese (zh)
Other versions
CN107196973A (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.)
Guangdong Hongqin Communication Technology Co Ltd
Original Assignee
Guangdong Hongqin Communication 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 Guangdong Hongqin Communication Technology Co Ltd filed Critical Guangdong Hongqin Communication Technology Co Ltd
Priority to CN201710613718.1A priority Critical patent/CN107196973B/en
Publication of CN107196973A publication Critical patent/CN107196973A/en
Application granted granted Critical
Publication of CN107196973B publication Critical patent/CN107196973B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0442Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply asymmetric encryption, i.e. different keys for encryption and decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0478Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload applying multiple layers of encryption, e.g. nested tunnels or encrypting the content with a first key and then with at least a second key

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses a data encryption method and a device, wherein the data encryption method comprises the following steps: acquiring original data, and encrypting the original data to generate encrypted data; acquiring a decryption program, converting the decryption program into a binary code, and calculating related information of the binary code; and splicing the relevant information of the binary code and the binary code into the encrypted data according to a preset format to obtain a ciphertext. By adding the binary code into the encrypted data, even if hackers invade the encrypted data and do not have any decryption information about the binary code, the real original data cannot be cracked, and the purpose of protecting the data security is achieved. Meanwhile, the invention also provides a data decryption method and a data decryption device.

Description

data encryption and decryption method and device
Technical Field
The invention relates to the technical field of encryption, in particular to a binary coding-based data encryption and decryption method and device.
Background
at present, in order to ensure the security of a file during network transmission, the file is usually encrypted, for example, using appointed characters or data with biometric information, such as a fingerprint, as a password. However, these data information can only exist as fixed data, and the data is the whole data of the information or the data which is encrypted normally, and there is no better management way except that the security area prevents external access.
Along with the rapid development of the internet, the activities of hackers are rampant day by day, and the hacking technology is updated day by day, so that the traditional encryption technology cannot resist the invasion of hackers and cannot ensure the security of data.
Disclosure of Invention
In view of the above problems, the present invention provides a method and an apparatus for encrypting and decrypting data, which achieve the purpose of preventing hackers from cracking the data and further protecting the security of the data.
In order to achieve the above object, according to a first aspect of the present invention, there is provided a data encryption method including:
Acquiring original data, encrypting the original data to generate encrypted data and a secret key;
Acquiring a decryption program corresponding to the secret key, converting the decryption program into a binary code, and calculating related information of the binary code, wherein the related information of the binary code comprises a length of the binary code, an identification feature code and an offset of the binary code;
And splicing the relevant information of the binary code and the binary code into the encrypted data according to a preset format to obtain a ciphertext.
preferably, the obtaining the original data, encrypting the original data, and generating encrypted data includes:
acquiring original data;
encrypting the original data by adopting a first encryption program to obtain first encrypted data;
and encrypting the first encrypted data by adopting a second encryption program to generate encrypted data, wherein the second encryption program is a preset and stored encryption program.
preferably, the splicing the relevant information of the binary code and the binary code into the encrypted data according to a preset format to obtain a ciphertext includes:
Sequentially connecting the identification feature code, the binary code length, the binary code offset, the binary code and the secret key to obtain a first data chain;
determining the insertion position of the binary code according to the offset of the binary code;
inserting the binary code into the encrypted data according to the insertion position to obtain a second data chain;
and splicing the second data chain after the first data chain to obtain a ciphertext.
According to a second aspect of the present invention, there is provided a data decryption method, the method comprising:
Acquiring a ciphertext, wherein the ciphertext comprises an identification feature code, binary coded related information, a binary code and encrypted data, and the binary coded related information comprises a binary code length, the identification feature code and a binary coded offset;
Reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, acquiring the binary code according to the binary code length and the offset of the binary code;
Converting the binary code into a decryption program;
And decrypting the ciphertext through the decryption program to obtain original data.
preferably, the reading and analyzing the ciphertext, determining whether the ciphertext contains a preset binary code according to the identification feature code, and if so, acquiring the binary code according to the binary code length and the binary code offset, including:
Reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, determining the insertion position of the binary code in encrypted data according to the offset of the binary code;
Determining the binary code according to the length of the binary code, and extracting the binary code at the position of the binary code inserted in the encrypted data.
Preferably, the decrypting the ciphertext through the decryption program to obtain the original data includes:
decrypting the ciphertext by using the decryption program to obtain the first decryption data, wherein the decryption program is a decryption program corresponding to a preset encryption program;
and decrypting the first decrypted data by adopting a decryption algorithm to obtain the original data.
According to a third aspect of the present invention, there is provided a data encryption apparatus comprising:
the first encryption module is used for acquiring original data, encrypting the original data and generating encrypted data and a secret key;
the conversion module is used for acquiring a decryption program corresponding to the secret key, converting the decryption program into a binary code, and calculating related information of the binary code, wherein the related information of the binary code comprises a length of the binary code, an identification feature code and an offset of the binary code;
and the second encryption module is used for splicing the relevant information of the binary code and the binary code into the encrypted data according to a preset format to obtain a ciphertext. .
Preferably, the first encryption module includes:
an acquisition unit configured to acquire original data;
The first encryption unit is used for encrypting the original data by adopting a first encryption program to obtain first encrypted data;
And the second encryption unit is used for encrypting the first encrypted data by adopting a second encryption program to generate encrypted data, wherein the second encryption program is a preset and stored encryption program.
preferably, the second encryption module includes:
the connection unit is used for sequentially connecting the identification feature code, the binary code length, the binary code offset, the binary code and the secret key to obtain a first data chain;
a determining unit, configured to determine an insertion position of the binary code according to the offset of the binary code;
The inserting unit is used for inserting the binary code into the encrypted data according to the inserting position to obtain a second data chain;
And the ciphertext acquisition unit is used for splicing the second data chain after the first data chain to obtain a ciphertext.
According to a fourth aspect of the present invention, there is provided a data decryption apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a ciphertext, the ciphertext comprises an identification feature code, binary coded related information, a binary code and encrypted data, and the binary coded related information comprises a binary code length, the identification feature code and a binary coded offset;
the analysis module is used for reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, acquiring the binary code according to the length of the binary code and the offset of the binary code;
the conversion module is used for converting the binary code into a decryption program;
and the decryption module is used for decrypting the ciphertext through the decryption program to obtain the original data.
preferably, the analysis module comprises:
the analysis unit is used for reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, determining the insertion position of the binary code in encrypted data according to the offset of the binary code;
an extraction unit, configured to determine the binary code according to the length of the binary code, and extract the binary code at an insertion position of the binary code in encrypted data.
Preferably, the decryption module includes:
the first decryption unit is used for decrypting the ciphertext by adopting the decryption program to obtain the first decryption data, wherein the decryption program is a decryption program corresponding to a preset encryption program;
And the second decryption unit is used for decrypting the first decrypted data by adopting a decryption algorithm to obtain the original data.
compared with the prior art, the data encryption method provided by the invention has the advantages that the original data are encrypted by a common encryption method to generate encrypted data; and then, converting a decryption program corresponding to the adopted common encryption method into binary codes, and adding the binary codes into the encrypted data to obtain the ciphertext. By adding the binary code into the encrypted data, the real original data cannot be cracked even if the encrypted data obtained by hackers through invasion does not have any decryption information about the binary code, and in the data decryption process, the binary code is decoded to restore the data, so that the data security is protected, and finally, the purposes of preventing the hackers from cracking the data and further protecting the data security are achieved.
Drawings
in order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flowchart of a data encryption method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a data decryption method according to a second embodiment of the present invention;
Fig. 3 is a schematic structural diagram of a data encryption apparatus according to a third embodiment of the present invention;
Fig. 4 is a schematic structural diagram of a data decryption apparatus according to a fourth 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 only a part of the embodiments of the present invention, and not all of the embodiments. 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" and "second," and the like in the description and claims of the present invention and the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprising" and "having," 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 set forth for a listed step or element but may include steps or elements not listed.
example one
fig. 1 is a schematic flow chart of a data encryption method according to an embodiment of the present invention, where the method includes the following steps:
s11, acquiring original data, encrypting the original data to generate encrypted data and a key;
specifically, the original data may include any data type to be encrypted, such as a fingerprint data type or other data information such as files.
meanwhile, when the original data is acquired, a part of memory space may be initialized, where the memory space includes two parts of space, one part is a storage space for storing the encryption program, the further stored encryption program may be a plurality of encryption programs, and the other part is a standby space, that is, the space does not have any data therein, so as to prepare for subsequently storing the relevant information of the binary code, where the relevant information of the binary code includes: identifying a signature code, a binary code length, a binary code offset, a binary code, and a decoding key. Of course, the storage location of the encryption program may also be customized, and the present invention is not limited thereto.
it can be further understood that if the data to be encrypted is in different file types or data formats, such as a fingerprint data type and a text data type, when initializing the memory space, multiple portions of memory space can be initialized, different encryption programs are correspondingly stored according to different data types, and multiple standby spaces are reserved for different subsequent binary coding information.
The corresponding step S11 specifically includes the following steps:
acquiring original data;
Encrypting the original data by adopting a first encryption program to obtain first encrypted data;
and encrypting the first encrypted data by adopting a second encryption program to generate encrypted data, wherein the second encryption program is a preset and stored encryption program.
it can be understood that, the data is generally encrypted by first using a first encryption program, where the first encryption program is the most common encryption method in the prior art; and then calling a second encryption program which is stored in advance, wherein a plurality of encryption programs can be stored in the initialized storage space, so that in the process of encrypting the original data, one encryption program in the storage space can be randomly called to encrypt the data, a random key is generated according to the called encryption program, the data which is encrypted commonly is encrypted again by using the random key, the random key is an encryption key and a decryption key in the subsequent process, and meanwhile, a corresponding decryption program can be generated according to the encryption program.
s12, acquiring a decryption program corresponding to the secret key, converting the decryption program into a binary code, and calculating related information of the binary code, wherein the related information of the binary code comprises a length of the binary code, an identification feature code and an offset of the binary code;
and S13, splicing the relevant information of the binary code and the binary code into the encrypted data according to a preset format to obtain a ciphertext.
Specifically, the step S13 specifically includes:
sequentially connecting the identification feature code, the binary code length, the binary code offset, the binary code and the secret key to obtain a first data chain;
determining the insertion position of the binary code according to the offset of the binary code;
Inserting the binary code into the encrypted data according to the insertion position to obtain a second data chain;
and splicing the second data chain after the first data chain to obtain a ciphertext.
it can be understood that, the connection is performed according to the sequence of the identification feature code, the binary code length, the binary code offset, and the binary code and the decoding key, and the obtained connected data packet is a first data chain, and the binary code is inserted into the encrypted data according to the insertion position to obtain a second data chain.
specifically, when the decryption program is compiled into an executable binary code format corresponding to the SOC, the converted binary code is preferably controlled within 60 bytes, and then the binary code length (1 byte), the identification feature code (1 byte), and the offset of the binary code (4 bytes) are calculated, and the above information is concatenated according to the identification feature code, the binary code length, the offset of the binary code, and the decoding key to obtain a concatenated packet, and the insertion position of the binary code of the encrypted data is determined according to the offset of the binary code; then the offset of the binary code obtains the insertion position, and the binary code is inserted into the encrypted data to obtain the inserted data; and splicing the inserted data after the connected data packet to obtain binary coded encrypted data, namely a ciphertext.
it can be understood that, after obtaining the encrypted data, that is, the encrypted data obtained by the ordinary encryption method, the user may also be asked whether to encrypt again using the binary coding method, if so, step S13 is executed, otherwise, the highest bit of the identification feature code is set to be not encrypted again using the binary coding, and then the ordinary encrypted data is output.
according to the technical scheme disclosed by the first embodiment of the invention, the original data is encrypted by a common encryption method to generate encrypted data; and then, converting a decryption program corresponding to the adopted common encryption method into binary codes, and adding the binary codes into the encrypted data to obtain the ciphertext. By adding the binary code into the encrypted data, the real original data cannot be cracked even if the encrypted data obtained by hackers through invasion does not have any decryption information about the binary code, and in the data decryption process, the binary code is decoded to restore the data, so that the data security is protected, and finally, the purposes of preventing the hackers from cracking the data and further protecting the data security are achieved.
example two
fig. 2 is a schematic flow chart of a data decryption method according to a second embodiment of the present invention, where the method includes:
S21, obtaining a ciphertext, wherein the ciphertext comprises the identification feature code, binary coded related information, binary code and encrypted data, and the binary coded related information comprises the binary code length, the identification feature code and the binary coded offset;
S22, reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, acquiring the binary code according to the binary code length and the binary code offset;
specifically, the first 6 bytes of the ciphertext are defined as: identifying a feature code (1 byte) and binary coded related information (5 bytes), wherein the binary coded related information sequentially comprises a decoding program length (1 byte) and a binary coded offset (4 bytes); after the ciphertext is obtained, reading the identification feature code of the first byte of the ciphertext, judging whether the identification feature code is read by using binary coding or not, if so, reading the first 6 bytes of the ciphertext, and analyzing according to the corresponding identification feature code and the relevant information of the binary coding;
specifically, according to the corresponding identification feature code and the binary code length corresponding to the binary code, reading data of the length of the binary code from the byte offset specified by the offset, loading the data into the memory, and reading the decoding key. The step S22 specifically includes the following steps:
reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, determining the insertion position of the binary code in encrypted data according to the offset of the binary code;
determining the binary code according to the length of the binary code, and extracting the binary code at the position of the binary code inserted in the encrypted data.
S23, converting the binary code into a decryption program;
and S24, obtaining the original data through the decryption program to the ciphertext.
the step S24 specifically includes:
decrypting the ciphertext by using the decryption program to obtain the first decryption data, wherein the decryption program is a decryption program corresponding to a preset encryption program;
and decrypting the first decrypted data by adopting a decryption algorithm to obtain the original data.
according to the technical scheme disclosed by the second embodiment of the invention, a ciphertext is obtained; reading and analyzing the ciphertext to obtain relevant information of the binary code, the binary code and the encrypted data; and decrypting the encrypted data through the decryption program to obtain original data. In the data decryption process, the binary code is decoded to restore the data, so that the safety of the data is protected.
EXAMPLE III
Corresponding to the data encryption method disclosed in the first embodiment of the present invention, a third embodiment of the present invention further provides a data encryption apparatus, referring to fig. 3, the apparatus including:
the first encryption module 10 is configured to obtain original data, encrypt the original data, and generate encrypted data and a secret key;
a conversion module 11, configured to obtain a decryption program corresponding to the secret key, convert the decryption program into a binary code, and calculate relevant information of the binary code, where the relevant information of the binary code includes a length of the binary code, an identification feature code, and an offset of the binary code;
And the second encryption module 12 is configured to splice the relevant information of the binary code and the binary code into the encrypted data according to a preset format to obtain a ciphertext. .
accordingly, the first encryption module 10 includes:
An acquisition unit 101 configured to acquire original data;
a first encryption unit 102, configured to encrypt the original data by using a first encryption program to obtain first encrypted data;
a second encryption unit 103, configured to encrypt the first encrypted data by using a second encryption program to generate encrypted data, where the second encryption program is a preset stored encryption program.
correspondingly, the second encryption module 12 includes:
a connection unit 121, configured to connect the identification feature code, the binary code length, the offset of the binary code, and the key in sequence to obtain a first data chain;
a determining unit 122, configured to determine an insertion position of the binary according to the offset of the binary;
an inserting unit 123, configured to insert the binary code into the encrypted data according to the insertion position, so as to obtain a second data chain;
And a ciphertext obtaining unit 124, configured to splice the second data chain after the first data chain, to obtain a ciphertext.
in the third embodiment of the invention, the original data is normally encrypted through the first encryption module to obtain encrypted data and a secret key; in a conversion module, acquiring a decryption program corresponding to the secret key, converting the decryption program into a binary code, and calculating related information of the binary code; and finally, splicing the relevant information of the binary code and the binary code into the encrypted data according to a preset format in a second encryption module to obtain a ciphertext. By adding the binary code into the encrypted data, even if hackers invade the encrypted data and do not have any decryption information about the binary code, the real original data cannot be cracked, and finally, the purpose of preventing the hackers from cracking the data and further protecting the data security is achieved.
example four
corresponding to the data decryption method provided in the second embodiment of the present invention, a fourth embodiment of the present invention further provides a data decryption apparatus, and referring to fig. 4, the apparatus includes:
an obtaining module 20, configured to obtain a ciphertext, where the ciphertext includes an identification feature code, binary-coded related information, a binary code, and encrypted data, and the binary-coded related information includes a binary code length, the identification feature code, and an offset of the binary code;
the analysis module 21 is configured to perform reading analysis on the ciphertext, determine whether the ciphertext contains a preset binary code according to the identification feature code, and if so, obtain the binary code according to the binary code length and the offset of the binary code;
a conversion module 22, configured to convert the binary code into a decryption program;
And the decryption module 23 is configured to decrypt the ciphertext through the decryption program to obtain original data.
Specifically, the analysis module 21 includes:
an analysis unit 211, configured to perform reading analysis on the ciphertext, determine whether the ciphertext includes a preset binary code according to the identification feature code, and if so, determine an insertion position of the binary code in encrypted data according to an offset of the binary code;
an extracting unit 212, configured to determine the binary code according to the length of the binary code, and extract the binary code at an insertion position of the binary code in the encrypted data.
correspondingly, the decryption module 23 includes:
The first decryption unit 231 is configured to decrypt the ciphertext by using the decryption program to obtain the first decrypted data, where the decryption program is a decryption program corresponding to a preset encryption program;
the second decryption unit 232 is configured to decrypt the first decrypted data by using a decryption algorithm to obtain the original data.
According to the technical scheme disclosed by the fourth embodiment of the invention, a ciphertext is obtained through the obtaining module; reading and analyzing the ciphertext in an analysis module, and judging whether the ciphertext is data encrypted by binary coding; if yes, obtaining a binary code, and converting the binary code into a decryption program in a conversion module; and finally, obtaining original data through a decryption module. In the data decryption process, the binary code is decoded to restore the data, so that the safety of the data is protected.
the embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
the previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. a method for data encryption, the method comprising:
Acquiring original data, encrypting the original data to generate encrypted data and a secret key;
acquiring a decryption program corresponding to the secret key, converting the decryption program into a binary code, and calculating related information of the binary code, wherein the related information of the binary code comprises a length of the binary code, an identification feature code and an offset of the binary code;
splicing the relevant information of the binary code and the binary code into the encrypted data according to a preset format to obtain a ciphertext;
The acquiring of the original data, encrypting the original data, and generating encrypted data includes:
Acquiring original data;
Encrypting the original data by adopting a first encryption program to obtain first encrypted data;
and encrypting the first encrypted data by adopting a second encryption program to generate encrypted data, wherein the second encryption program is a preset and stored encryption program.
2. the method according to claim 1, wherein the concatenating the binary-coded related information and the binary code into the encrypted data according to a preset format to obtain a ciphertext comprises:
Sequentially connecting the identification feature code, the binary code length, the binary code offset, the binary code and the secret key to obtain a first data chain;
Determining the insertion position of the binary code according to the offset of the binary code;
Inserting the binary code into the encrypted data according to the insertion position to obtain a second data chain;
And splicing the second data chain after the first data chain to obtain a ciphertext.
3. A method for decrypting data, the method comprising:
acquiring a ciphertext, wherein the ciphertext comprises binary coded related information, binary codes and encrypted data, and the binary coded related information comprises binary code length, identification feature codes and binary coded offset;
reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, acquiring the binary code according to the binary code length and the offset of the binary code;
converting the binary code into a decryption program;
decrypting the ciphertext through the decryption program to obtain original data;
wherein, the decrypting the ciphertext through the decryption program to obtain the original data includes:
decrypting the ciphertext by using the decryption program to obtain first decryption data, wherein the decryption program is a decryption program corresponding to a preset encryption program;
and decrypting the first decrypted data by adopting a decryption algorithm to obtain the original data.
4. the method according to claim 3, wherein the reading and analyzing the ciphertext, determining whether the ciphertext contains a preset binary code according to the identification feature code, and if so, acquiring the binary code according to the binary code length and the binary code offset comprises:
Reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, determining the insertion position of the binary code in encrypted data according to the offset of the binary code;
Determining the binary code according to the length of the binary code, and extracting the binary code at the position of the binary code inserted in the encrypted data.
5. a data encryption apparatus, characterized in that the apparatus comprises:
the first encryption module is used for acquiring original data, encrypting the original data and generating encrypted data and a secret key;
the conversion module is used for acquiring a decryption program corresponding to the secret key, converting the decryption program into a binary code, and calculating related information of the binary code, wherein the related information of the binary code comprises a length of the binary code, an identification feature code and an offset of the binary code;
the second encryption module is used for splicing the relevant information of the binary code and the binary code into the encrypted data according to a preset format to obtain a ciphertext;
Wherein the first encryption module comprises:
an acquisition unit configured to acquire original data;
the first encryption unit is used for encrypting the original data by adopting a first encryption program to obtain first encrypted data;
And the second encryption unit is used for encrypting the first encrypted data by adopting a second encryption program to generate encrypted data, wherein the second encryption program is a preset and stored encryption program.
6. the apparatus of claim 5, wherein the second encryption module comprises:
the connection unit is used for sequentially connecting the identification feature code, the binary code length, the binary code offset, the binary code and the secret key to obtain a first data chain;
A determining unit, configured to determine an insertion position of the binary code according to the offset of the binary code;
the inserting unit is used for inserting the binary code into the encrypted data according to the inserting position to obtain a second data chain;
and the ciphertext acquisition unit is used for splicing the second data chain after the first data chain to obtain a ciphertext.
7. A data decryption apparatus, characterized in that the apparatus comprises:
The system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a ciphertext, the ciphertext comprises binary code related information, binary codes and encrypted data, and the binary code related information comprises binary code length, identification feature codes and binary code offset;
The analysis module is used for reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, acquiring the binary code according to the length of the binary code and the offset of the binary code;
the conversion module is used for converting the binary code into a decryption program;
the decryption module is used for decrypting the ciphertext through the decryption program to obtain original data;
wherein the decryption module comprises:
The first decryption unit is used for decrypting the ciphertext by adopting the decryption program to obtain first decryption data, wherein the decryption program is a decryption program corresponding to a preset encryption program;
and the second decryption unit is used for decrypting the first decrypted data by adopting a decryption algorithm to obtain the original data.
8. the apparatus of claim 7, wherein the analysis module comprises:
The analysis unit is used for reading and analyzing the ciphertext, judging whether the ciphertext contains a preset binary code according to the identification feature code, and if so, determining the insertion position of the binary code in encrypted data according to the offset of the binary code;
an extraction unit, configured to determine the binary code according to the length of the binary code, and extract the binary code at an insertion position of the binary code in encrypted data.
CN201710613718.1A 2017-07-25 2017-07-25 data encryption and decryption method and device Active CN107196973B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710613718.1A CN107196973B (en) 2017-07-25 2017-07-25 data encryption and decryption method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710613718.1A CN107196973B (en) 2017-07-25 2017-07-25 data encryption and decryption method and device

Publications (2)

Publication Number Publication Date
CN107196973A CN107196973A (en) 2017-09-22
CN107196973B true CN107196973B (en) 2019-12-17

Family

ID=59885079

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710613718.1A Active CN107196973B (en) 2017-07-25 2017-07-25 data encryption and decryption method and device

Country Status (1)

Country Link
CN (1) CN107196973B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111835808B (en) * 2019-08-01 2023-11-14 北京骑胜科技有限公司 Data storage method and device, data reading method and device, and storage medium
FR3101981B1 (en) * 2019-10-11 2021-11-12 St Microelectronics Grenoble 2 Extraction and insertion of binary words
CN113111380B (en) * 2021-04-18 2023-07-04 上海丽昉网络科技有限公司 Data management method of transaction platform
CN113721956B (en) * 2021-08-26 2024-02-20 广州擎天实业有限公司 Method for updating excitation system control program

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101682682B (en) * 2007-05-30 2012-11-21 富士通株式会社 Image encyption device, image decyption device, method, and program
CN102012993B (en) * 2010-11-29 2012-07-11 北京卓微天成科技咨询有限公司 Methods and devices for selectively encrypting and decrypting data
US8942373B2 (en) * 2010-11-29 2015-01-27 Beijing Z & W Technology Consulting Co., Ltd. Data encryption and decryption method and apparatus
CN102437910A (en) * 2011-10-18 2012-05-02 国家超级计算深圳中心(深圳云计算中心) Data encryption/decryption checking method and system
CN105790925A (en) * 2014-12-24 2016-07-20 北京奇虎科技有限公司 Data encryption method, data decryption method, data encryption device and data decryption device

Also Published As

Publication number Publication date
CN107196973A (en) 2017-09-22

Similar Documents

Publication Publication Date Title
CN107196973B (en) data encryption and decryption method and device
CN109150835B (en) Cloud data access method, device, equipment and computer readable storage medium
CN103295046A (en) Method and device for generating and using safe two-dimensional codes
CN108965222B (en) Identity authentication method, system and computer readable storage medium
US20110041046A1 (en) Apparatus and method for protecting rfid data
CN110061967B (en) Service data providing method, device, equipment and computer readable storage medium
CN108833361B (en) Identity authentication method and device based on virtual account
CN106506487A (en) A kind of information Encrypt and Decrypt method and device
CN111740846B (en) Method and system for realizing smart card information reading of mobile terminal
CN104468937A (en) Data encryption and decryption methods and devices for mobile terminal and protection system
CN110929291A (en) Method and device for accessing text file and computer readable storage medium
CN104125064B (en) A kind of dynamic cipher authentication method, client and Verification System
CN112615834A (en) Security authentication method and system
KR102028151B1 (en) Encryption method and system using authorization key of device
CN115603907A (en) Method, device, equipment and storage medium for encrypting storage data
CN109831782B (en) Safety transmission verification method for electronic card information
KR101379711B1 (en) Method for file encryption and decryption using telephone number
CN114430346A (en) Login method and device and electronic equipment
CN117834186A (en) Data encryption transmission method and system
CN111148275B (en) Communication method, device and system based on equipment code
CN112199730A (en) Method and device for processing application data on terminal and electronic equipment
CN112307875A (en) Face verification method and face verification system
CN111026583A (en) Backup recovery method for multiple private keys of blockchain wallet and computer-readable storage medium
CN114329568A (en) File encryption method, device, system platform and file decryption method
CN115935299A (en) Authorization control method, device, computer equipment and storage medium

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