Encrypted image attachment restoration method and device, storage medium and electronic equipment

By using a block decryption mechanism and generating keys with preset characters or account information, complete offline and batch restoration of WeChat image attachments is achieved, solving the problem that WeChat image attachments cannot be viewed offline and improving convenience and efficiency.

CN120881040APending Publication Date: 2025-10-31SUZHOU LONGXIN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511033521.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-25
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

In existing technologies, instant messaging software under Windows, such as WeChat, encrypts the storage of image attachments, making them impossible to view offline and requiring viewing only one image at a time, which lacks convenience and efficiency.

Method used

By using a block decryption mechanism, candidate decryption keys are generated using preset characters or account information. The target decryption key is accurately matched to decrypt the second character sequence. The XOR decryption key is derived based on the account information to process the third character sequence, thereby achieving complete offline and batch restoration of image attachments.

Benefits of technology

It enables completely offline and batch viewing of image attachments, improving the convenience and efficiency of image attachment viewing. Users can process a large number of target image attachments to be decrypted at once without a client or network environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120881040A_ABST
    Figure CN120881040A_ABST
Patent Text Reader

Abstract

The invention discloses an encrypted image attachment restoration method and device, a storage medium and electronic equipment, and the method comprises the steps: determining a to-be-decrypted target image attachment, and reading a first character sequence, a second character sequence and a third character sequence from the target image attachment; determining a target decryption key for the target image attachment in the candidate decryption keys based on the first character sequence; the candidate decryption key is obtained by encrypting account information corresponding to a preset character or a target image attachment; decrypting the second character sequence based on the target decryption key to obtain a first image fragment; decrypting the third character sequence by using the XOR decryption key to obtain a second image fragment; the XOR decryption key is determined based on the account information; and determining a restoration result of the target image attachment based on the first image fragment and the second image fragment. According to the method and the device, complete offline and batch checking of the image attachment is realized, and the convenience of checking the image attachment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data decryption technology, and specifically to a method, apparatus, storage medium, and electronic device for restoring encrypted image attachments. Background Technology

[0002] On Windows systems, instant messaging software such as WeChat encrypts and stores chat image attachments as .dat files. Viewing such attachments requires an online login and relies on the software client's built-in function, and can only be done one image at a time. Summary of the Invention

[0003] This application provides a method, apparatus, storage medium, and electronic device for restoring encrypted image attachments, which can achieve completely offline and batch viewing of image attachments, thereby improving the convenience of viewing image attachments.

[0004] According to a first aspect of this application, a method for restoring encrypted image attachments is provided, the method comprising:

[0005] Identify the target image attachment to be decrypted, and read the first character sequence, the second character sequence, and the third character sequence from the target image attachment;

[0006] Based on the first character sequence, a target decryption key is determined for the target image attachment from the candidate decryption keys; wherein, the candidate decryption key is obtained by encrypting preset characters or account information corresponding to the target image attachment;

[0007] The second character sequence is decrypted based on the target decryption key to obtain the first image fragment;

[0008] The third character sequence is decrypted using an XOR decryption key to obtain a second image fragment; wherein the XOR decryption key is determined based on the account information.

[0009] Based on the first image fragment and the second image fragment, the restoration result of the target image attachment is determined.

[0010] According to a second aspect of this application, an apparatus for restoring encrypted image attachments is provided, the apparatus comprising:

[0011] A character sequence reading module is used to determine the target image attachment to be decrypted, and to read the first character sequence, the second character sequence, and the third character sequence from the target image attachment;

[0012] The decryption key determination module is used to determine a target decryption key for the target image attachment from candidate decryption keys based on the first character sequence; wherein the candidate decryption key is obtained by encrypting preset characters or account information corresponding to the target image attachment;

[0013] The first fragment determination module is used to decrypt the second character sequence based on the target decryption key to obtain the first image fragment;

[0014] The second fragment determination module is used to decrypt the third character sequence using an XOR decryption key to obtain a second image fragment; wherein the XOR decryption key is determined based on the account information;

[0015] The restoration result determination module is used to determine the restoration result of the target image attachment based on the first image fragment and the second image fragment.

[0016] According to a third aspect of the present invention, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the encrypted image attachment restoration method as described in embodiments of this application.

[0017] According to a fourth aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the encrypted image attachment restoration method as described in the embodiments of the present application.

[0018] According to a fifth aspect of this application, an embodiment of this application provides a computer program product, including a computer program that, when executed by a processor, implements the encrypted image attachment restoration method as described in the embodiment of this application.

[0019] This technical solution effectively overcomes the access restrictions on image attachments in instant messaging software such as WeChat through a block decryption mechanism, enabling completely offline, batch viewing of image attachments and improving the convenience of image attachment viewing. By generating candidate decryption keys using preset characters or account information, and accurately matching and locating the target decryption key based on the first character sequence, it achieves autonomous decryption of the second character sequence; simultaneously, it derives an XOR decryption key based on account information to independently process the third character sequence. This dual-channel decryption ensures the integrity restoration of fragmented data, allowing users to batch process a large number of target image attachments to be decrypted at once, without the need for a client or network, greatly improving the efficiency and operational freedom of image viewing.

[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart of the encrypted image attachment restoration method provided in Embodiment 1;

[0023] Figure 2 This is a flowchart of the encrypted image attachment restoration method provided in Embodiment 2;

[0024] Figure 3 This is a schematic diagram of the encrypted image attachment restoration device provided in Embodiment 3 of this application;

[0025] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of this application. Detailed Implementation

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," "target," and "candidate," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] Example 1

[0029] Figure 1 This is a flowchart of the encrypted image attachment restoration method provided in Embodiment 1. This embodiment is applicable to the restoration of .dat format image attachments in WeChat 4.0 and above in Windows systems. The method is executed by the encrypted image attachment restoration model, which can be executed by the encrypted image attachment restoration device. The encrypted image attachment restoration device is implemented in hardware and / or software and can be integrated into the electronic device running this system.

[0030] like Figure 1 As shown, the method includes:

[0031] S110. Determine the target image attachment to be decrypted, and read the first character sequence, the second character sequence, and the third character sequence from the target image attachment.

[0032] S120. Based on the first character sequence, determine a target decryption key for the target image attachment from the candidate decryption keys; wherein, the candidate decryption key is obtained by encrypting preset characters or account information corresponding to the target image attachment.

[0033] S130. Decrypt the second character sequence based on the target decryption key to obtain the first image fragment.

[0034] S140. The third character sequence is decrypted using an XOR decryption key to obtain a second image fragment; wherein the XOR decryption key is determined based on the account information.

[0035] S150. Based on the first image fragment and the second image fragment, determine the restoration result of the target image attachment.

[0036] The target image attachment is an encrypted image attachment that cannot be directly viewed and requires decryption. Optionally, the target image attachment is in .dat format. The encryption method used for the target image attachment is related to the instant messaging software version. As the instant messaging software version iterates, the encryption method of the target image attachment may change. For example, when WeChat on Windows was upgraded to version 4.0.0.26, the encryption method of the target image attachment changed. When WeChat on Windows was upgraded to version 4.0.3.43, the encryption method of the target image attachment changed again.

[0037] Optionally, a hexadecimal tool can be used to open the target image attachment and read the characters from it. The first, second, and third character sequences constitute the entire character content of the target image attachment, dividing it into three parts. The first character sequence is at the beginning of the target image attachment, the third character sequence is at the end, and the second character sequence is between the first and third character sequences. The sequence lengths of the first, second, and third character sequences are determined based on the actual situation and are not limited here.

[0038] The first character sequence includes an encryption method identifier, while the second and third character sequences are the main body appended to the target image. The first character sequence is used to determine the target decryption key for the target image appendix from the candidate decryption keys. The target decryption key is a partial decryption key for decrypting the target image appendix. The target decryption key is used to decrypt the second character sequence in the target image appendix. The third character sequence of the target image appendix is ​​decrypted using the XOR decryption key.

[0039] The target decryption key is generated from candidate decryption keys, which are obtained by encrypting preset characters or account information corresponding to the target image attachment. Whether the target decryption key is obtained by encrypting preset characters or by encrypting account information corresponding to the target image attachment depends on the encryption method of the target image attachment.

[0040] The preset characters are determined based on actual business needs, and their specific content is not limited here. Optionally, the preset character is the character 0. The account holder to which the target image attachment belongs can be distinguished based on the account information corresponding to the target image attachment. Optionally, the account information corresponding to the target image attachment includes: a public account and an internal identifier. The public account refers to a unique identifier number that users can query. The internal identifier is a unique identifier number assigned to the user within the instant messaging software. In the case where the target image attachment is a WeChat chat image attachment, the public account can be a WeChat ID, such as wxid_xxxxxx. The internal identifier is WeChat uin (userinformation).

[0041] The first image fragment and the second image fragment together constitute the decryption result of the target image attachment. Based on the first image fragment and the second image fragment, the reconstruction result of the target image attachment can be determined.

[0042] The first image fragment is obtained by decrypting the second character sequence using the target decryption key, and the second image fragment is obtained by decrypting the third character sequence using the XOR decryption key. The XOR decryption key is determined based on account information. The XOR decryption key is another part of the decryption key; the XOR decryption key and the target decryption key together constitute the decryption key for the target image attachment.

[0043] This technical solution effectively overcomes the access restrictions on image attachments in instant messaging software such as WeChat through a block decryption mechanism, enabling completely offline, batch viewing of image attachments and improving the convenience of image attachment viewing. By generating candidate decryption keys using preset characters or account information, and accurately matching and locating the target decryption key based on the first character sequence, it achieves autonomous decryption of the second character sequence; simultaneously, it derives an XOR decryption key based on account information to independently process the third character sequence. This dual-channel decryption ensures the integrity restoration of fragmented data, allowing users to batch process a large number of target image attachments to be decrypted at once, without the need for a client or network, greatly improving the efficiency and operational freedom of image viewing.

[0044] In an optional embodiment, reading the first character sequence, the second character sequence, and the third character sequence from the target image attachment includes: reading a character sequence of a first length from the starting position of the target image attachment to obtain the first character sequence; reading a character sequence of a second length from the ending position of the first character sequence in the target image attachment to obtain the second character sequence; and determining the remaining character sequence in the target image attachment other than the first character sequence and the second character sequence as the third character sequence.

[0045] The first character sequence has a length of one, and it is located at the beginning of the target image attachment. The first character sequence starts from the beginning position of the target image attachment. The third character sequence has a length of three, and it is located at the end of the target image attachment. The second character sequence has a length of two, and it is located between the first and third character sequences. The second character sequence starts from the end position of the first character sequence.

[0046] The first, second, and third lengths are determined based on actual business needs and are not limited here. Optionally, the first length is 15 bytes and the second length is 1040 bytes. In a specific embodiment, 15 bytes are read from the beginning of the target image attachment as the first character sequence. Then, starting from the 16th byte of the target image attachment, 1040 bytes are read as the second character sequence. Finally, the remaining character sequence in the target image attachment, excluding the first and second character sequences, is determined as the third character sequence. The number of bytes in the remaining character sequence is the third length.

[0047] The above technical solution provides a practical character segmentation scheme for dividing target image attachments into three character sequences. This provides data support for subsequently determining the target decryption key used to decrypt the second character sequence based on the first character sequence, and for decrypting the third character sequence using the XOR decryption key.

[0048] In an optional embodiment, determining the restoration result of the target image attachment based on the first image fragment and the second image fragment includes: sequentially writing the first image fragment and the second image fragment to a specified storage location to obtain a proprietary format image; and performing format transcoding on the proprietary format image to obtain the restoration result of the target image attachment.

[0049] Optionally, after decrypting the second character sequence using the target decryption key to obtain the first image fragment, the first image fragment is first written to a specified storage location. The specified storage location is determined by the user as needed and is a different storage location from the original storage location. For example, it could be a newly created file.

[0050] After decrypting the third character sequence using the XOR decryption key to obtain the second image fragment, the second image fragment is then appended to the designated storage location where the first image fragment is located, resulting in a proprietary format image. A proprietary format image refers to an image in a format specific to instant messaging software. The proprietary format is related to the software type of the instant messaging software and refers to an image format specific to that software. For example, in the case of WeChat, the proprietary format is wxgf. In other words, the proprietary format image is in wxgf format.

[0051] Proprietary format images also do not support direct viewing. The proprietary format image is transcoded to restore its original format, resulting in the restored image attachment. The restored result is an image with its original format that can be viewed directly. Optionally, the specific original formats are determined based on the actual situation and are not limited here. Examples of original formats include: JPG, JPEG, GIF, and PNG.

[0052] The aforementioned technical solution includes a fragment reassembly stage and a transcoding stage. The fragment reassembly stage focuses solely on the sequential integration of data blocks, while the transcoding stage specifically addresses format compatibility issues. This decoupling significantly reduces system complexity, allowing each stage to employ optimized technical solutions. The fragment reassembly stage directly writes the first and second image fragments sequentially to a designated storage location to generate a proprietary format image. This not only ensures a strict correspondence between the physical order and logical structure of the fragment data, avoiding the misalignment risks that may arise from dynamic splicing, but also significantly improves the controllability and stability of the processing by writing to a fixed storage location. Transcoding, as the final stage, eliminates format inconsistencies or compatibility conflicts that may result from fragment-by-fragment transcoding, providing technical support for high-quality image restoration.

[0053] Example 2

[0054] Figure 2 This is a flowchart of the encrypted image attachment restoration method provided in Embodiment 2. This embodiment is a further optimization based on the above embodiments.

[0055] like Figure 2 As shown, the method includes:

[0056] S210. Determine the target image attachment to be decrypted, and read the first character sequence, the second character sequence, and the third character sequence from the target image attachment.

[0057] S220. If the first character sequence includes a first preset content, then the first decryption key among the candidate decryption keys is determined as the target decryption key for the target image attachment; wherein, the first decryption key is obtained by encrypting the account information corresponding to the target image attachment.

[0058] The first preset content serves as a data reference for determining whether the target image attachment uses the first encryption method. The first preset content is related to the actual encryption method, but is not limited here. For example, when WeChat on Windows is upgraded to version 4.0.0.26, using the first encryption method to encrypt chat image attachments, the resulting target image attachment will include "\x07\x08\x56\x31\x08\x07". Accordingly, the first preset content is set to "\x07\x08\x56\x31\x08\x07". When the first character sequence of the target image attachment includes the first preset content, the first decryption key from the candidate decryption keys is determined as the target decryption key for the target image attachment. The second decryption key is obtained by encrypting the account information corresponding to the target image attachment.

[0059] S230. If the first character sequence includes a second preset content, then the second decryption key in the candidate decryption keys is determined as the target decryption key for the target image attachment; wherein the second decryption key is obtained by encrypting the preset characters.

[0060] The second preset content serves as a data reference for determining whether the target image attachment uses the second encryption method. The second preset content is related to the actual encryption method, but is not limited here. For example, when WeChat on a Windows system is upgraded to version 4.0.3.43, and the second encryption method is used to encrypt chat image attachments, the resulting target image attachment will include "\x07\x08\x56\x32\x08\x07". Correspondingly, the second preset content is set to "\x07\x08\x56\x32\x08\x07".

[0061] When the first character sequence of the target image attachment includes the second preset content, the second decryption key from the candidate decryption keys is determined as the target decryption key for the target image attachment. The second decryption key is obtained by encrypting the preset characters.

[0062] The target image attachment can be one or at least two. The number of target image attachments is determined based on the actual situation and is not limited here. When there are at least two target image attachments, due to software version updates, the encryption methods used for different target image attachments may differ. Consequently, the target decryption keys applicable to different target image attachments belonging to the same account may differ.

[0063] S240. Decrypt the second character sequence based on the target decryption key to obtain the first image fragment.

[0064] S250. The third character sequence is decrypted using an XOR decryption key to obtain a second image fragment; wherein the XOR decryption key is determined based on the account information.

[0065] S260. Based on the first image fragment and the second image fragment, determine the restoration result of the target image attachment.

[0066] This application provides a practical target decryption key determination scheme. Through a content-driven key selection mechanism, it significantly improves the accuracy and efficiency of image attachment decryption while ensuring security. The encryption method is dynamically distinguished by detecting whether the first character sequence contains a first or second preset content. By placing key selection before the decryption operation, the target decryption key can be locked through rapid comparison of preset content, greatly reducing the risk of decryption failure or data corruption due to key misuse, and providing a highly reliable and secure access foundation for subsequent image restoration processes.

[0067] In an optional embodiment, the first decryption key is determined as follows: the public account and internal identifier in the account information are concatenated to obtain a concatenated character sequence; the concatenated character sequence is encrypted using a preset encryption algorithm to obtain a first encrypted sequence; a first character segment of a set length is extracted from the beginning position of the first encrypted sequence, and the first character segment is determined as the first decryption key.

[0068] The public account and internal identifier are used to determine the first decryption key. The public account is a unique identifier that the user can find. The internal identifier is a unique identifier assigned to the user within the instant messaging software. When the target image attachment is a WeChat chat image attachment, the public account can be a WeChat ID, such as wxid_xxxxxx. The internal identifier is WeChat uin (userinformation).

[0069] Optionally, the public account and internal identifier in the account information can be concatenated in the order of public account first and internal identifier last to obtain a concatenated character sequence. For example, concatenating WeChat ID and WeChat uin in the order of WeChat ID first and WeChat uin last will result in the concatenated character sequence "2233321221wxid_sjdns2ss".

[0070] The preset encryption algorithm is used to encrypt the concatenated character sequence. The specific type of the preset encryption algorithm is determined according to actual business needs and is not limited here. Optionally, the preset encryption algorithm is MD5 (Message DigestAlgorithm 5), which is a widely used cryptographic hash function.

[0071] The first encrypted sequence is obtained by encrypting the concatenated character sequence using a preset encryption algorithm. The first decryption key is the first character fragment extracted from the beginning of the first encrypted sequence. The length of the first character fragment is a preset length. The specific value of the preset length is determined based on the key length required for decryption and is not limited here. For example, encrypting the concatenated character sequence "2233321221wxid_sjdns2ss" using MD5 results in an encrypted character sequence with a length of 32 bytes. A first character fragment with a length of 16 bytes is extracted from the beginning of the encrypted character sequence and used as the first decryption key.

[0072] The above technical solution provides a practical scheme for determining the first decryption key, and provides data support for using the first decryption key as the target decryption key to decrypt the second character sequence.

[0073] In an optional embodiment, the second decryption key is determined as follows: the preset characters are encrypted using a preset encryption algorithm to obtain a second character sequence; a second character segment of a set length is extracted from the beginning position of the second character sequence, and the second character segment is determined as the second decryption key.

[0074] The preset character is used to generate the second decryption key. The specific content of the preset character is not limited here and is determined according to actual business needs. Optionally, the preset character is the character 0. The preset encryption algorithm used to determine the second character sequence is the same as that used to determine the first character sequence. Optionally, the preset encryption algorithm used to determine the second character sequence is MD5. For example, the character 0 is encrypted using MD5, resulting in an encrypted character sequence with a sequence length of 32 bytes. A second character segment with a length of 16 characters is extracted from the beginning of the encrypted character sequence as the second decryption key.

[0075] The above technical solution provides a practical method for determining the second decryption key, and provides data support for using the second decryption key as the target decryption key to decrypt the second character sequence.

[0076] In an optional embodiment, the XOR decryption key is the result of taking the remainder of the first value using the internal identifier in the account information.

[0077] The XOR decryption key is used to decrypt the third character sequence in the target image attachment. The first value is determined according to the actual situation and is not limited here. Optionally, the first value is 256. The internal identifier in the account information is WeChat uin. In a specific embodiment, WeChat uin is modulo 256, and the result is used as the XOR decryption key.

[0078] The above technical solution provides a practical method for determining the XOR decryption key, providing data support for subsequently using the XOR decryption key to decrypt the third character sequence.

[0079] Example 3

[0080] Figure 3 This is a schematic diagram of the encrypted image attachment restoration device provided in Embodiment 3 of this application. This embodiment can be applied to the restoration of .dat format image attachments in WeChat 4.0 and above in Windows systems. The device is implemented by software and / or hardware and can be integrated into electronic devices such as smart terminals.

[0081] like Figure 3 As shown, the encrypted image attachment restoration device 300 may include:

[0082] The character sequence reading module 310 is used to determine the target image attachment to be decrypted, and read the first character sequence, the second character sequence, and the third character sequence from the target image attachment;

[0083] The decryption key determination module 320 is used to determine a target decryption key for the target image attachment from candidate decryption keys based on the first character sequence; wherein the candidate decryption key is obtained by encrypting preset characters or account information corresponding to the target image attachment;

[0084] The first fragment determination module 330 is used to decrypt the second character sequence based on the target decryption key to obtain the first image fragment;

[0085] The second fragment determination module 340 is used to decrypt the third character sequence using an XOR decryption key to obtain a second image fragment; wherein the XOR decryption key is determined based on the account information;

[0086] The restoration result determination module 350 is used to determine the restoration result of the target image attachment based on the first image fragment and the second image fragment.

[0087] This technical solution effectively overcomes the access restrictions on image attachments in instant messaging software such as WeChat through a block decryption mechanism, enabling completely offline, batch viewing of image attachments and improving the convenience of image attachment viewing. By generating candidate decryption keys using preset characters or account information, and accurately matching and locating the target decryption key based on the first character sequence, it achieves autonomous decryption of the second character sequence; simultaneously, it derives an XOR decryption key based on account information to independently process the third character sequence. This dual-channel decryption ensures the integrity restoration of fragmented data, allowing users to batch process a large number of target image attachments to be decrypted at once, without the need for a client or network, greatly improving the efficiency and operational freedom of image viewing.

[0088] Optionally, the decryption key determination module 320 includes: a first key determination submodule, configured to determine the first decryption key among the candidate decryption keys as the target decryption key for the target image attachment if the first character sequence includes first preset content; wherein the first decryption key is obtained by encrypting the account information corresponding to the target image attachment; and a second key determination submodule, configured to determine the second decryption key among the candidate decryption keys as the target decryption key for the target image attachment if the first character sequence includes second preset content; wherein the second decryption key is obtained by encrypting the preset characters.

[0089] Optionally, the character sequence reading module 310 includes: a first sequence determination submodule, configured to read a character sequence of a first length from the starting position of the target image attachment to obtain the first character sequence; a second sequence determination submodule, configured to read a character sequence of a second length from the ending position of the first character sequence in the target image attachment to obtain the second character sequence; and a third sequence determination submodule, configured to determine the remaining character sequence in the target image attachment other than the first character sequence and the second character sequence as the third character sequence.

[0090] Optionally, the first decryption key is determined as follows: the public account and internal identifier in the account information are concatenated to obtain a concatenated character sequence; the concatenated character sequence is encrypted using a preset encryption algorithm to obtain a first encrypted sequence; a first character segment of a set length is extracted from the beginning position of the first encrypted sequence, and the first character segment is determined as the first decryption key.

[0091] Optionally, the second decryption key is determined as follows: the preset characters are encrypted using a preset encryption algorithm to obtain a second character sequence; a second character segment of a set length is extracted from the beginning of the second character sequence, and the second character segment is determined as the second decryption key.

[0092] Optionally, the XOR decryption key is the result obtained by taking the remainder of the first value using the internal identifier in the account information.

[0093] Optionally, the restoration result determination module 350 includes: an image fragment writing submodule, used to sequentially write the first image fragment and the second image fragment to a specified storage location to obtain a proprietary format image; and a restoration result determination submodule, used to perform format transcoding on the proprietary format image to obtain the restoration result of the target image attachment.

[0094] The encrypted image attachment restoration device provided in the embodiments of the invention can execute the encrypted image attachment restoration method provided in any embodiment of this application, and has the corresponding performance modules and beneficial effects for executing the encrypted image attachment restoration method.

[0095] In the technical solution of this application, the user data involved, such as target image attachments, is information and data authorized by the user or fully authorized by all parties. The collection, storage, use, processing, transmission, provision, disclosure and application of related data all comply with the relevant laws, regulations and standards of relevant countries and regions, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse.

[0096] Example 4

[0097] According to embodiments of this application, this application also provides an electronic device, a readable storage medium, and a computer program product.

[0098] Figure 4 A schematic diagram of an electronic device 410, which can be implemented using an embodiment, is shown. The electronic device 410 includes at least one processor 411 and a memory, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., communicatively connected to the at least one processor 411. The memory stores computer programs executable by the at least one processor. The processor 411 can perform various appropriate actions and processes based on the computer program stored in the ROM 412 or loaded from storage unit 418 into the RAM 413. The RAM 413 may also store various programs and data required for the operation of the electronic device 410. The processor 411, ROM 412, and RAM 413 are interconnected via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0099] Multiple components in electronic device 410 are connected to I / O interface 415, including: input unit 416, such as keyboard, mouse, etc.; output unit 417, such as various types of displays, speakers, etc.; storage unit 418, such as disk, optical disk, etc.; and communication unit 419, such as network card, modem, wireless transceiver, etc. Communication unit 419 allows electronic device 410 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0100] Processor 411 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 411 performs the various methods and processes described above, such as the encrypted image attachment restoration method.

[0101] In some embodiments, the encrypted image attachment restoration method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 410 via ROM 412 and / or communication unit 419. When the computer program is loaded into RAM 413 and executed by processor 411, one or more steps of the encrypted image attachment restoration method described above may be performed. Alternatively, in other embodiments, processor 411 may be configured to perform the encrypted image attachment restoration method by any other suitable means (e.g., by means of firmware).

[0102] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0103] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable encrypted image attachment recovery device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0104] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0105] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0106] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as an encrypted image attachment restoration server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0107] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0108] This application also discloses a computer program product, which includes a computer program that, when executed by a processor, implements the encrypted image attachment restoration method provided in any embodiment of this application. This program product shares the same inventive concept as the encrypted image attachment restoration method disclosed in the embodiments of this application, and therefore will not be described in detail here.

[0109] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.

[0110] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for restoring encrypted image attachments, characterized in that, The method includes: Identify the target image attachment to be decrypted, and read the first character sequence, the second character sequence, and the third character sequence from the target image attachment; Based on the first character sequence, a target decryption key is determined for the target image attachment from the candidate decryption keys; wherein, the candidate decryption key is obtained by encrypting preset characters or account information corresponding to the target image attachment; The second character sequence is decrypted based on the target decryption key to obtain the first image fragment; The third character sequence is decrypted using an XOR decryption key to obtain a second image fragment; wherein the XOR decryption key is determined based on the account information. Based on the first image fragment and the second image fragment, the restoration result of the target image attachment is determined.

2. The method according to claim 1, characterized in that, The step of determining the target decryption key for the target image attachment from the candidate decryption keys based on the first character sequence includes: If the first character sequence includes a first preset content, then the first decryption key among the candidate decryption keys is determined as the target decryption key for the target image attachment; wherein, the first decryption key is obtained by encrypting the account information corresponding to the target image attachment; If the first character sequence includes a second preset content, then the second decryption key among the candidate decryption keys is determined as the target decryption key for the target image attachment; wherein the second decryption key is obtained by encrypting the preset characters.

3. The method according to claim 1, characterized in that, The step of reading the first character sequence, the second character sequence, and the third character sequence from the target image attachment includes: The first character sequence is obtained by reading a character sequence of a first length from the starting position of the target image attachment; Starting from the end position of the first character sequence, a second-length character sequence is read from the target image attachment to obtain the second character sequence; The remaining character sequence in the target image attachment, excluding the first and second character sequences, is determined as the third character sequence.

4. The method according to claim 2, characterized in that, The first decryption key is determined in the following way: The public account and internal identifier in the account information are concatenated to obtain a concatenated character sequence; The concatenated character sequence is encrypted using a preset encryption algorithm to obtain a first encrypted sequence; Extract a first character segment of a set length from the beginning of the first encrypted sequence, and determine the first character segment as the first decryption key.

5. The method according to claim 2, characterized in that, The second decryption key is determined in the following way: The preset characters are encrypted using a preset encryption algorithm to obtain a second character sequence; Extract a second character segment of a set length from the beginning of the second character sequence, and use the second character segment as the second decryption key.

6. The method according to claim 1, characterized in that, The XOR decryption key is the result of taking the remainder of the first value using the internal identifier in the account information.

7. The method according to claim 1, characterized in that, The step of determining the restoration result of the target image attachment based on the first image fragment and the second image fragment includes: The first image fragment and the second image fragment are sequentially written to a specified storage location to obtain a proprietary format image. The proprietary format image is transcoded to obtain the restoration result of the target image attachment.

8. A device for restoring encrypted image attachments, characterized in that, The device includes: A character sequence reading module is used to determine the target image attachment to be decrypted, and to read the first character sequence, the second character sequence, and the third character sequence from the target image attachment; The decryption key determination module is used to determine a target decryption key for the target image attachment from candidate decryption keys based on the first character sequence; wherein the candidate decryption key is obtained by encrypting preset characters or account information corresponding to the target image attachment; The first fragment determination module is used to decrypt the second character sequence based on the target decryption key to obtain the first image fragment; The second fragment determination module is used to decrypt the third character sequence using an XOR decryption key to obtain a second image fragment; wherein the XOR decryption key is determined based on the account information; The restoration result determination module is used to determine the restoration result of the target image attachment based on the first image fragment and the second image fragment.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method for restoring encrypted image attachments as described in any one of claims 1-7.

10. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for restoring encrypted image attachments as described in any one of claims 1-7.