Data encryption hiding, extraction and decryption method
By combining phased header construction with encrypted steganography, the problem of theft and blocking of sensitive data transmission in the open Internet environment is solved, and the secure, efficient and covert transmission of sensitive information is achieved.
Patent Information
- Application Number
- CN202511139795.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-11-28
AI Technical Summary
In the open internet environment, legitimate users face the risk of sensitive data being stolen, traced, and maliciously blocked during cross-platform data transmission. Existing encryption technologies are easily blocked by adversaries, and information hiding technologies fail to meet the needs of practical applications.
By employing a phased approach to constructing information headers and combining encryption with steganography, encrypted data is constructed and embedded into a carrier image by generating featureless marker information and carrier invariants, thereby achieving encrypted protection and covert transmission of sensitive information.
It effectively resists malicious blocking and tracing, enabling secure and efficient transmission of sensitive information, and is suitable for cross-platform secure data transmission scenarios.
Smart Images

Figure CN121037030A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of secure communication technology, specifically relating to a method for encrypting, hiding, extracting, and decrypting data. Background Technology
[0002] In the open internet environment, the user groups, their usage behaviors, intentions, and scenarios cannot be fully perceived and controlled. Therefore, legitimate users face risks such as the theft of sensitive data, tracing, and malicious blocking when transmitting and sharing data across platforms. While encryption technology can ensure the confidentiality and integrity of sensitive information, the ciphertext is easily obstructed by adversaries. Information hiding technology can conceal the encrypted transmission of sensitive information, but current mainstream research focuses primarily on algorithm design and optimization, and no data concealment transmission solution has yet been developed to meet the needs of practical applications. Summary of the Invention
[0003] The purpose of this invention is to provide a method for encrypting, hiding, extracting, and decrypting data, which has a secure and efficient embedding and extraction process to achieve encrypted protection and covert transmission of sensitive information.
[0004] To achieve the above objectives, the solution of the present invention is:
[0005] A data encryption and hiding method, comprising,
[0006] Based on the data to be hidden, the data to be encrypted is obtained; wherein, the data to be encrypted is composed of a file header and the data to be hidden;
[0007] The data to be encrypted is encrypted to obtain ciphertext data;
[0008] Based on the ciphertext data, encrypted data is obtained; wherein, the encrypted data is composed of an encrypted header and the ciphertext data concatenated together;
[0009] Obtain the embedded header and concatenate it with the encrypted data to obtain the data to be embedded;
[0010] The data to be embedded is embedded into the carrier image to obtain a dense carrier image.
[0011] The data to be encrypted is composed of a file header and the data to be hidden. The file header includes a file identifier and a file length value. When the data to be hidden is a file, the file header also includes a filename field.
[0012] The process of encrypting the data to be encrypted to obtain ciphertext data includes,
[0013] Obtain the encryption key, and encrypt the data to be encrypted using a preset encryption algorithm to obtain ciphertext data; wherein, the encryption key is the hash value of a string concatenated from the user password, featureless marker information, and carrier invariants, or the encryption key is the hash value of a string concatenated from a fixed key, featureless marker information, and carrier invariants, wherein the carrier invariants are information extracted from the carrier image that can remain unchanged after the information is hidden, such as the number of pixels in the carrier image, the highest bit of the pixel value, the DC component of the DCT coefficients, image data not used as a steganographic carrier, and parameters that can be extracted from image areas that are actively reserved for non-hidden information, etc.
[0014] The encrypted data is composed of an encrypted header and ciphertext data. The encrypted header includes a cryptographic algorithm identifier and a hash value of the data to be encrypted. The cryptographic algorithm identifier is used to record the encryption algorithm and hash algorithm used.
[0015] This includes obtaining the embedded information header, including...
[0016] The embedded header includes featureless marker information, a second information hiding method, a password identifier, and encrypted data length information; wherein, the second information hiding method can be a randomly selected information hiding method E2, the password identifier indicates when the user sets a password, and the embedded header also includes a password hash value.
[0017] The method for generating the featureless marker information is as follows:
[0018] A first information hiding method is preset, wherein the first information hiding method is an information hiding method E1 for generating featureless marker information, wherein E1 is an information hiding method with an embedding rate of less than 1; according to the information hiding method E1, u bytes of random number are obtained as one-time carrier data, where u is the carrier length required to hide 4 bytes of fixed marker information using the information hiding method E1; wherein the fixed marker information is used to determine whether the image is a cryptic carrier image during decryption;
[0019] The fixed marker information is embedded into the disposable carrier data using a preset information hiding method E1 to obtain featureless marker information.
[0020] The process involves embedding the data to be embedded into a carrier image to obtain a dense carrier image, including:
[0021] Based on the carrier invariants and hidden capacity of the carrier image, the starting embedding position of the data to be embedded is obtained;
[0022] Carrier data is extracted from the carrier image. The carrier data is composed of a first segment and a second segment. The first segment is the carrier data before the starting embedding position, and the second segment is the carrier data after the starting embedding position. The first segment is spliced after the second segment to form the constructed carrier data.
[0023] The first u+1 bytes of the data to be embedded are embedded into the constructed carrier data using a preset embedding information header hiding method E3. u is the carrier length required to hide 4 bytes of fixed marker information, i.e., u bytes of featureless marker information and 1 byte of randomly selected information hiding method E2 and password identifier; wherein, the fixed marker information is used to determine whether the image is a encrypted carrier image during decryption.
[0024] Compare the amount of data to be embedded with the hidden capacity. If the amount of data to be embedded does not exceed the hidden capacity, continue to embed the remaining content of the data to be embedded into the carrier data using the randomly selected information hiding method E2 to obtain the encrypted carrier data. If the amount of data to be embedded exceeds the hidden capacity, end the current operation process and give the corresponding prompt information.
[0025] Based on the dense carrier data, the dense carrier data corresponding to the first segment and the second segment are obtained respectively, and the dense carrier data corresponding to the second segment is spliced after the dense carrier data corresponding to the first segment to obtain the reconstructed carrier data;
[0026] The reconstructed carrier data is written to the corresponding position in the carrier image to obtain a dense carrier image.
[0027] Specifically, based on the carrier invariants and hidden capacity of the carrier image, the starting embedding position of the data to be embedded is obtained, including:
[0028] The hiding capacity of the carrier image is obtained based on the carrier image and the preset third information hiding method; wherein, the preset third information hiding method can adopt the embedded information header hiding method E3;
[0029] Extract carrier invariants from the carrier image to obtain the hash value of the carrier invariants;
[0030] The starting embedding position of the data to be embedded is obtained by taking the modulo of the value corresponding to the last 4 bytes of the hash value of the carrier invariant with the value of the hidden capacity.
[0031] A data extraction and decryption method, comprising,
[0032] Extract dense carrier data from the dense carrier image and reconstruct it based on the embedding start position obtained from the carrier invariant;
[0033] Based on the reconstructed encrypted carrier data, extract the embedded information header and identify whether it is an encrypted carrier image, whether a password is used, and obtain the number of embedded data bytes; if the user sets a password when hiding, verify the password's correctness before obtaining the number of embedded data bytes; if the password is correct, further obtain the number of embedded data bytes; otherwise, end the current operation process and give the corresponding prompt information; if no password is used, directly obtain the number of embedded data bytes.
[0034] Based on the number of embedded data bytes, extract the data of that number of bytes, which is the encrypted data;
[0035] Based on the encrypted data, the cryptographic algorithm identifier is extracted from the encrypted header to obtain the ciphertext data;
[0036] Based on the cryptographic algorithm identifier, the ciphertext data is decrypted to obtain the ciphertext data;
[0037] Based on the encrypted data, the file header and hidden data are obtained;
[0038] The hidden data is parsed based on the file header information to obtain the decrypted data.
[0039] By adopting the above-mentioned scheme, this invention proposes a data concealment scheme to address the risks of theft, tracking, and blocking of sensitive data transmission in open network environments, achieving encrypted protection and covert transmission of sensitive information. This invention achieves confidentiality protection of sensitive data through phased header construction and a combination of encryption and steganography, effectively resisting malicious blocking and tracing, and is suitable for cross-platform secure data transmission scenarios. Attached Figure Description
[0040] Figure 1 This is a schematic diagram of the embedded data encapsulation format of the present invention;
[0041] Figure 2 This is a flowchart of the embedded data construction process of the present invention. Detailed Implementation
[0042] The technical solution and beneficial effects of the present invention will be described in detail below with reference to the accompanying drawings.
[0043] like Figure 1 and Figure 2As shown, this invention provides a method for data encryption, hiding, extraction, and decryption. The encryption and hiding process includes phased processing of the data and phased construction of the information header, while the extraction and decryption process includes phased extraction and phased parsing of the data. This invention can weaken the features of the encrypted carrier image, enhance its resistance to analysis and attacks, and ensure that even if the same carrier image, the same password, and the same secret information are used for multiple hiding operations, the generated featureless marker information, the data encryption key, and the generated encrypted carrier data are all different each time, and the position of the carrier image modification also changes accordingly, but the secret information can still be correctly extracted and the appearance of the encrypted carrier image remains the same.
[0044] The different stages of encryption and decryption involve constructing and parsing the file header, encrypted header, and embedded header. The file header contains a 1-byte file identifier and filename length, and n bytes of filename, where n is determined by the filename length in the first byte. The encrypted header contains a 1-byte cryptographic algorithm identifier and a 32-byte hash value of the data to be encrypted. The embedded header contains u bytes of a featureless marker, where u is determined by the system's preset information hiding method E1, a 1-byte randomly selected information hiding method and password identifier, a 32-byte hash value of the password, the presence of which is determined by the password identifier in the first byte, and a 4-byte length of the encrypted data.
[0045] 1. Receive user input of the carrier image, the data to be hidden, and optional information.
[0046] (1) Users upload the carrier image intended to be used to hide data. This can be done by the user providing the file path of the carrier image, dragging and dropping the image file, or copying and pasting the image.
[0047] (2) The user inputs data to be hidden. The data type to be hidden can be text, image, file, etc. The data input method can be the user inputting text and image information through the session window, or giving the storage path of the file to be hidden.
[0048] (3) Set a password, where the password is optional and serves as a PIN code for extracting data from the image containing the encrypted carrier. The password is set by the user as needed.
[0049] 2. Data Preprocessing
[0050] (1) Based on the data to be hidden, set the file header for the data to be hidden. The file header includes information such as file identifier, filename length, and filename. The file identifier and filename length in the file header are 1 byte long, with the highest bit being the file identifier and the lowest 7 bits being the filename length. The following setting method can be used:
[0051] ① Set the file identifier bit in the file information header, using 1 bit. If the data to be hidden is text content, set the file type identifier bit to 0; if the data to be hidden is a file or image, set the file type identifier bit to 1.
[0052] ② Set the file length value in the file information header, represented by 7 bits. If the data to be hidden is text, set its value to 0; if the data to be hidden is a file, set its value to n according to the length of the file name with extension, where n is the number of bytes in the file name with extension.
[0053] ③ If the data to be hidden is a file, then the file name is further set in the file information header, that is, the file name including the file extension is stored in the file name field of the file information header, with a length of n bytes; if the data to be hidden is text, then there is no file name field in the file information header.
[0054] (2) Concatenate the data to be hidden after the file information header to obtain the data to be encrypted.
[0055] 3. Data encryption
[0056] (1) Set the encryption header according to the system parameters. The encryption header includes the cryptographic algorithm identifier and the hash value of the data to be encrypted. The cryptographic suite is represented by 1 byte and the hash value of the data to be encrypted is represented by 32 bytes. The specific setting method is as follows:
[0057] ① Set the cipher suite according to system parameters. That is, the developers set the cipher suite to be used by the system and its representation method. Use 1 byte to store the cryptographic algorithm information used by the system, including symmetric encryption algorithm, hash algorithm, etc., and set the cipher suite field in the encryption information header to the corresponding value.
[0058] ② Calculate the hash value Hash(data to be encrypted) of the data to be encrypted according to the hash algorithm specified by the system, and set the message authentication code field in the encrypted information header to the hash value. Here, Hash(·) is the hash algorithm specified by the system, and the data to be encrypted is the data obtained in the preprocessing stage, which includes the file information header and the content of the data to be hidden.
[0059] (2) Generate featureless label information
[0060] The developers set fixed marker information and information hiding method E1 for the system to generate featureless marker information. The fixed marker information is used to determine whether the input image is a cryptic carrier image generated by this system during information extraction; its content is 4 bytes of fixed information set by the developers. E1 is an information hiding method with an embedding rate of less than 1. The steganography method E1 for generating featureless marker information can be an information hiding method based on encoding schemes such as STC encoding, (7,4) Hamming code, or unit augmented matrix. The specific generation method of featureless marker information is as follows:
[0061] ① Based on the information hiding method E1 selected by the system for generating featureless marker information, generate u bytes of random number as one-time carrier data, where u is the carrier length required to hide 4 bytes of fixed marker information using the selected information hiding method E1;
[0062] ② The system-selected information hiding method E1 for generating featureless marker information is used to embed 4 bytes of steganographic marker information into one-time carrier data to obtain u bytes of coded carrier data containing marker information. This coded carrier data is the featureless marker information.
[0063] (3) Extracting vector invariants
[0064] Carrier invariants are information extracted from the carrier image that remains unchanged after information is hidden. Examples include the number of pixels in the carrier image, the most significant bit of the pixel value, the DC component of the DCT coefficients, image data not used as a steganographic carrier, and even parameters that can be extracted from image regions that are not actively reserved to hide information.
[0065] (4) Generate encryption key
[0066] The developers assigned a 256-bit random number to the system as a fixed key for generating the data encryption key when the user has not set a password. The data encryption key is generated as follows:
[0067] ① If the user sets a password, the hash value of the string formed by concatenating the password, featureless marker information, and carrier invariant is calculated. The resulting hash value is the encryption key for encrypting the data to be encrypted. The specific calculation method of the hash value is Hash(password‖featureless marker information‖carrier invariant), where Hash(·) is the hash algorithm specified by the system in the cipher suite.
[0068] ② If the user has not set a password, the hash value of the string formed by concatenating the system fixed key, the featureless marker information, and the carrier invariant is calculated. The resulting hash value is the encryption key for encrypting the data to be encrypted. The specific calculation method of the hash value is Hash(password‖featureless marker information‖carrier invariant), where Hash(·) is the hash algorithm specified by the system in the cipher suite.
[0069] (5) According to the encryption algorithm specified by the system in the cipher suite, encrypt the data to be encrypted with the generated data encryption key to obtain ciphertext data, and concatenate the ciphertext data after the encryption header to obtain the encrypted data.
[0070] 4. Construction of data to be embedded
[0071] (1) Based on the relevant parameters of the preceding operation, set the embedded information header of the encrypted data. The embedded information header includes featureless marker information, a randomly selected information hiding method E2, a password identifier, the hash value of the password, and the length of the encrypted data. Among them, the embedding algorithm identifier and the password identifier are 1-byte data, with the high 7 bits of the byte being the information hiding method identifier and the low 7 bits being the password identifier. The following are some possible settings:
[0072] ① Set no-feature marker information in the embedded information header, and fill the no-feature marker information field in the embedded information header with a length of u bytes of no-feature marker information;
[0073] ② Set the information hiding method information in the embedded information header. Randomly select one information hiding method E2 from multiple information hiding methods set by the system, and fill the information hiding method field in the embedded information header with the identifier information corresponding to information hiding method E2. The system provides multiple information hiding methods and assigns a 7-bit identifier to each method.
[0074] ③ Set the password identifier information in the embedded information header. Based on whether the user sets a password in the previous operation stage, set the password identifier field in the embedded information header. If the user sets a password, set the value of the password identifier field to 1; if the user does not set a password, set the value of the password identifier field to 0.
[0075] ④ If the user has set a password, the password hash is further set in the embedded header. The hash value of the password is calculated using the SM3 algorithm and filled into the password hash field. If the user has not set a password, there is no password hash field in the embedded header. The specific calculation method for the hash value is SM3(password), where SM3(·) is the hash algorithm issued by the State Cryptography Administration.
[0076] ⑤ Set the length of encrypted data in the embedded information header, and fill the embedded information length field with the value corresponding to the number of bytes of encrypted data. The length of encrypted data is 4 bytes.
[0077] (2) Concatenate the encrypted data after the embedded information header to obtain the data to be embedded.
[0078] 5. Data embedding
[0079] (1) Based on the carrier invariants in the pre-operation process and the hidden capacity of the selected carrier image, calculate the starting embedding position of the data to be embedded, as follows:
[0080] ①Based on the carrier image selected by the user and the embedded information header hiding method E3 set by the system, calculate the information hiding capacity C1 of the selected carrier image under the embedded information header hiding method E3. The embedded information header hiding method E3 set by the system is a method set by the developers for the system, and any algorithm that can achieve image steganography can be selected.
[0081] ② The SM3 algorithm is used to calculate the hash value of the carrier invariant extracted during the pre-operation process. The value corresponding to the last 4 bytes of data of the hash value is modulo the information hiding capacity C1 of the carrier image. The obtained value is the starting position of information embedding.
[0082] (2) Construct carrier data. First, extract carrier data from the carrier image. Divide the carrier data into two segments from the starting position of the embedding. Record the segment before the starting position as X1 and the segment after the starting position as X2. Attach X1 to X2 to obtain the constructed carrier data.
[0083] (3) Using the embedded header hiding method E3 set by the system, the first u+1 bytes of the data to be embedded are embedded into the constructed carrier data, wherein the embedded header hiding method E3 set by the system is the embedded header hiding method E3 used in the pre-operation to calculate the starting embedding position.
[0084] (4) Use the information hiding method E2 randomly selected during the pre-operation process to calculate the image's hiding capacity based on E2. If the amount of data to be embedded does not exceed the hiding capacity, embed the remaining content of the data to be embedded into the position after the header information already embedded in the constructed carrier data to obtain the dense carrier data. If the amount of data to be embedded exceeds the hiding capacity, return an error message and terminate the current process.
[0085] (5) Reconstruct the dense carrier data, perform the inverse operation of carrier construction, separate the dense carrier data corresponding to X1 and X2 during carrier construction from the dense carrier data, and denot them as Y1 and Y2. Attach Y1 after Y2 to obtain the reconstructed carrier data, and write the reconstructed carrier data back to the corresponding position of the carrier image to generate the dense carrier image.
[0086] 6. Data Extraction and Decryption
[0087] The data extraction, decryption, and parsing process is the reverse of data encryption and embedding operations. First, ciphertext data is extracted from the encrypted carrier image. Then, the ciphertext data is decrypted to obtain plaintext data. Finally, the hidden data is parsed from the plaintext data. The data extraction employs a phased extraction strategy, as detailed below:
[0088] (1) Reconstruct the dense carrier data, as follows:
[0089] ①Calculate the information hiding capacity C2 of the image containing the cryptic carrier under the embedded information header hiding method E3 set by the system.
[0090] ② Extract the carrier invariant from the dense carrier image, use the SM3 algorithm to calculate the hash value of the carrier invariant, take the value corresponding to the last 4 bytes of data of the hash value and modulo the information hiding capacity C2 of the dense carrier image, and the obtained value is the starting position of information embedding.
[0091] ③ Extract the dense carrier data from the dense carrier image, divide the dense carrier data into two segments from the starting position of the embedding, denote the segment before the starting position as Z1 and the segment after the starting position as Z2, and stitch Z1 after Z2 to obtain the reconstructed dense carrier data.
[0092] (2) Identification of images containing dense carriers
[0093] ① Using the data extraction method corresponding to the embedded information header hiding method E3 set by the system, extract the u+1 bytes of data from the header of the reconstructed cryptic carrier data;
[0094] ② Separate the first u bytes from the extracted u+1 bytes of data as carrier data. Use the matrix coding-based information hiding method E1, which is set by the developers for the system to generate featureless marker information, to extract 4 bytes of data from the u bytes of carrier data. If the extracted data content is the same as the fixed marker information set by the system, it means that the image is a system-generated encrypted carrier image, and the subsequent data extraction and decryption process can continue; otherwise, it means that the image is not a system-generated encrypted carrier image, and an error message is returned and the current process is terminated.
[0095] ③ Separate the last byte of data from the extracted u+1 bytes, parse the byte, and obtain the information hiding method E2' used for data embedding and the password identifier of the encrypted carrier diagram. The high 7 bits of the byte are the information hiding method identifier, and the lowest bit is the password identifier. If the password algorithm identifier is 1, the password correctness verification operation is performed; if the password algorithm identifier is 0, the process jumps to the data extraction and decryption process.
[0096] (3) Password verification
[0097] ① Calculate the hash value of the user-input password using the SM3 algorithm. The specific calculation method for the hash value is SM3(password), where SM3(·) is the hash algorithm issued by the State Cryptography Administration.
[0098] ② Using the information extraction method corresponding to the information hiding method E2' used in data embedding, continue to extract 32 bytes of data from the encrypted carrier data. If the hash value of the password calculated by the SM3 algorithm is the same, it means that the password entered by the user is correct, and the data extraction and decryption operation can continue; otherwise, it means that the password entered by the user is incorrect, return an error message and terminate the current process.
[0099] (4) Data extraction and decryption
[0100] ① Using the information extraction method corresponding to the information hiding method E2' used in data embedding, continue to extract 4 bytes of data from the data containing the cryptic carrier to obtain the number of embedded data bytes L;
[0101] ② Using the information extraction method corresponding to the information hiding method E2' used in data embedding, continue to extract L bytes of data from the encrypted carrier data to obtain encrypted data;
[0102] ③ Extract the encrypted header and ciphertext data from the encrypted data, parse the encrypted header to obtain the cryptographic algorithm identifier and message authentication code, and decrypt the extracted ciphertext data using the corresponding decryption algorithm based on the cryptographic algorithm identifier to obtain the plaintext data, which corresponds to the data to be encrypted when hidden;
[0103] ④ Based on the cryptographic algorithm identifier, use the corresponding hash algorithm to calculate the hash value of the plaintext data obtained by decrypting the ciphertext data. If the hash value is the same as the message authentication code extracted from the encrypted information header, it means that the hidden data extraction and decryption are successful, and the plaintext data parsing operation continues; otherwise, it means that the information is destroyed or extraction and decryption have failed, and an error message is returned and the current process is terminated.
[0104] ⑤ Extract the file header and hidden data from the decrypted plaintext data, parse the file header to obtain information such as file type, file name length and file name, and parse the hidden data based on the file header information and return it to the user.
[0105] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present invention can be implemented using various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0106] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can 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, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0107] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0108] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0109] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0110] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for data encryption and concealment, characterized by: The application relates to a method for hiding data in an image, and belongs to the field of information hiding. According to the data to be hidden, encrypted data is obtained; wherein the encrypted data is obtained by splicing a file information header and the data to be hidden; The encrypted data is encrypted to obtain ciphertext data; According to the ciphertext data, encrypted data is obtained; wherein the encrypted data is obtained by splicing an encryption information header and the ciphertext data; An embedding information header is obtained, and the embedding information header and the encrypted data are spliced to obtain data to be embedded; The data to be embedded is embedded into a carrier image to obtain a carrier image containing the ciphertext.
2. The data encryption hiding method of claim 1, wherein: The encrypted data is obtained by splicing a file information header and the data to be hidden, wherein the file information header contains a file identification bit and file length value information; when the data to be hidden is a file, the file information header further contains a file name field.
3. The data encryption hiding method of claim 1, wherein: The encrypted data is encrypted to obtain ciphertext data, comprising, An encryption key is obtained, and the encrypted data is encrypted by using a preset encryption algorithm to obtain ciphertext data; wherein the encryption key is a hash value of a string obtained by splicing a user password, non-feature mark information and carrier invariable quantity, or the encryption key is a hash value of a string obtained by splicing a fixed key, non-feature mark information and carrier invariable quantity.
4. The data encryption hiding method of claim 1, wherein: The encrypted data is obtained by splicing an encryption information header and the ciphertext data, wherein the encryption information header contains a password algorithm identification and encrypted data hash value.
5. The data encryption hiding method of claim 1, wherein: The embedding information header is obtained, comprising, The embedding information header contains non-feature mark information, a second information hiding method, a password identification, and encrypted data length information; wherein when the user sets a password, the embedding information header further contains a password hash value.
6. The data encryption hiding method of claim 3 or 5, wherein: The generation method of the non-feature mark information is, According to a first information hiding method, a u-byte random number is obtained as one-time carrier data, u is the carrier length required for hiding 4-byte fixed mark information by using the first information hiding method; wherein the fixed mark information is used to judge whether the image is a carrier image containing the ciphertext during decryption; The fixed mark information is embedded into the one-time carrier data by using the first information hiding method to obtain u-byte non-feature mark information.
7. The data encryption hiding method of claim 1, wherein: The data to be embedded is embedded into the carrier image to obtain a carrier image containing the ciphertext, comprising, According to a carrier invariable quantity and a hiding capacity of the carrier image, a starting embedding position of the data to be embedded is obtained; Carrier data is extracted from the carrier image, the carrier data is obtained by splicing a first segment and a second segment, the first segment is carrier data before the starting embedding position, and the second segment is carrier data after the starting embedding position; the first segment is spliced after the second segment to form constructed carrier data; The first u+1 bytes of the data to be embedded are embedded into the constructed carrier data, u is the carrier length required for hiding 4-byte fixed mark information; wherein the fixed mark information is used to judge whether the image is a carrier image containing the ciphertext during decryption; The amount of the data to be embedded is compared with the hiding capacity; when the amount of the data to be embedded does not exceed the hiding capacity, the remaining content of the data to be embedded is continuously embedded into the carrier data to obtain carrier data containing the ciphertext. According to the secret-containing carrier data, secret-containing carrier data corresponding to the first segment and the second segment are obtained respectively, and the secret-containing carrier data corresponding to the second segment and the secret-containing carrier data corresponding to the first segment are spliced in sequence to obtain reconstructed carrier data; The reconstructed carrier data is written to the corresponding position of the carrier image to obtain a secret-containing carrier image.
8. The data encryption hiding method of claim 7, wherein: According to the carrier invariant and the hiding capacity of the carrier image, a starting embedding position of the data to be embedded is obtained, including According to the carrier image and the third information hiding method, the hiding capacity of the carrier image is obtained; The hash value of the carrier invariant is obtained by extracting the carrier invariant from the carrier image; The starting embedding position of the data to be embedded is obtained by taking the modulus of the value of the hiding capacity with the value corresponding to the last 4 bytes of the hash value of the carrier invariant.
9. A data extraction and decryption method characterized by: Including, The secret-containing carrier data is extracted from the secret-containing carrier image, and the embedding starting position obtained according to the carrier invariant is reconstructed; The number of bytes of the embedded data is extracted from the secret-containing carrier data, and the data of the number of bytes is the encrypted data; According to the encrypted data, the password algorithm identifier is extracted from the encryption information header, and the ciphertext data is obtained; According to the password algorithm identifier, the ciphertext data is decrypted to obtain the ciphertext data; According to the ciphertext data, the file information header and the hidden data are obtained; According to the file information header, the hidden data is parsed to obtain the decrypted data.
Citation Information
Patent Citations
Method for hiding private information of U disk
CN101908361A
Method for inserting and extracting hidden information based on English PDF document
CN103530574A
Self-adaptive multi-mode information hiding method and self-adaptive multi-mode information hiding device
CN110634096A
Picture encryption and decryption method and system and readable storage medium
CN117544733A
Apparatus for embedding secret information to compressed image data, apparatus for extracting the secret information, secret data rewriting apparatus, decryption apparatus, restoration apparatus, and secret data embedding coding apparatus
JP2006253755A