Image transmission method, client, server and storage medium
By using MD5 algorithm and obfuscation algorithm in image transmission between clients and servers, images are generated and decrypted, the problem of low image transmission security is solved, and data encryption transmission and tamper protection is realized.
Patent Information
- Application Number
- CN202310963470.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-01
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2043-08-01
AI Technical Summary
In the prior art, the image transmission between the client and the server has a problem of low security, which is easy to be cracked and data is easily tampered with.
The request parameters including the first digest obtained by the MD5 algorithm are obtained through the client, and an interactive request is generated and sent to the server. When the first digest and the second digest are consistent, the server generates the first image according to the request parameters and acquires the second image, and generates the third image based on the obfuscation algorithm. The client decrypts the third image based on the obfuscation algorithm and generates and displays the target image.
The image data is encrypted and transmitted, reducing the risk of being cracked, preventing data from being tampered with, and improving the security of image transmission.
Smart Images

Figure CN119449964A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to an image transmission method, a client, a server and a storage medium. Background Art
[0002] In the related art, when transmitting images between a client and a server, the image is usually encrypted in a segmented encryption manner before being uploaded to the server, and the server stores the encrypted file accordingly. However, when the client downloads an image from the server, it accesses the same encrypted file, and the image stream file returned each time is always the same, making the encrypted file easy to crack, greatly reducing security. Moreover, when the downloaded stream file data is tampered with, it can still be displayed on the client, so there is still a risk that the data is easily tampered with, reducing the security of image transmission. Summary of the invention
[0003] The main purpose of the present invention is to provide an image transmission method, a client, a server and a storage medium, aiming to solve the technical problem of low security in image transmission between the client and the server in the related art.
[0004] To achieve the above object, the present invention adopts the following technical solution:
[0005] In a first aspect, the present invention provides an image transmission method, applied to a client, the method comprising:
[0006] Obtaining request parameters, where the request parameters include a first digest, where the first digest is obtained based on an MD5 algorithm;
[0007] Generate an interactive request according to the request parameters, and send the interactive request to the server, so that when the first digest is consistent with the second digest, the server generates a first image according to the request parameters and obtains a second image, and generates a third image according to the first image and the second image based on an obfuscation algorithm; wherein the second digest is obtained based on the MD5 algorithm and the request parameters;
[0008] Decrypting the third image sent by the server based on an obfuscation algorithm to obtain a decrypted third image;
[0009] A target image is generated according to the decrypted third image and fourth image, and the target image is displayed; wherein the fourth image is obtained according to the request parameters.
[0010] Optionally, in the above-mentioned image transmission method, the step of obtaining request parameters includes:
[0011] Generating a client timestamp according to the current system time of the client;
[0012] Encrypt the user name based on an asymmetric encryption algorithm to obtain an encrypted user name;
[0013] Based on the MD5 algorithm, generate a first digest according to the encrypted username and the client timestamp;
[0014] The client timestamp, the encrypted username, and the first digest are determined as the request parameters.
[0015] Optionally, in the above-mentioned image transmission method, the step of generating a target image according to the decrypted third image and fourth image, and displaying the target image comprises:
[0016] generating a fourth image according to the client timestamp and the combined characters of the user name;
[0017] Comparing the character stream of the decrypted third image with the character stream of the fourth image, deleting identical characters and retaining different characters;
[0018] generating a target image based on the different characters;
[0019] The target image is displayed.
[0020] Optionally, in the above-mentioned image transmission method, the step of displaying the target image includes:
[0021] Decrypting the third image based on an asymmetric encryption algorithm to obtain user name information;
[0022] Comparing the user name information with the user name;
[0023] When the user name information is consistent with the user name, the target image is displayed.
[0024] In a second aspect, the present invention provides an image transmission method, applied to a server, the method comprising:
[0025] Receiving an interaction request sent by a client, where the interaction request is generated by the client according to the acquired request parameters, wherein the request parameters include a first digest, which is obtained by the client based on an MD5 algorithm;
[0026] When the first digest is consistent with the second digest, a first image is generated according to the request parameters, and a second image is acquired; wherein the second digest is obtained based on the MD5 algorithm and the request parameters;
[0027] generating a third image from the first image and the second image based on an obfuscation algorithm;
[0028] The third image is sent to the client, so that the client decrypts the third image based on an obfuscation algorithm to obtain a decrypted third image, generates a target image according to the decrypted third image and a fourth image, and displays the target image; wherein the fourth image is obtained by the client according to the request parameters.
[0029] Optionally, in the above-mentioned image transmission method, the request parameter also includes a client timestamp and an encrypted username;
[0030] Before the step of generating a first image according to the request parameters and acquiring a second image when the first digest is consistent with the second digest, the method further includes:
[0031] Extracting corresponding interaction credential information based on the interaction request, the interaction credential information including a server timestamp and a pre-stored user name;
[0032] Compare the client timestamp with the server timestamp to obtain a time difference;
[0033] When the time difference does not exceed the preset time, decrypting the encrypted username to obtain a decrypted username;
[0034] Comparing the decrypted username with the pre-stored username;
[0035] When the decrypted user name is consistent with the pre-stored user name, the second digest is generated according to the decrypted user name and the client timestamp based on the MD5 algorithm.
[0036] Optionally, in the above-mentioned image transmission method, when the first digest is consistent with the second digest, the step of generating the first image according to the request parameter and acquiring the second image includes:
[0037] When the first digest is consistent with the second digest, generating a first image according to the combined characters of the client timestamp and the decrypted username;
[0038] The pre-stored image of the user is extracted according to the decrypted user name to obtain a second image.
[0039] In a third aspect, the present invention provides a client, including:
[0040] Memory and processor;
[0041] Wherein, the memory stores a computer program, and when the computer program is executed by the processor, the above-mentioned image transmission method is implemented.
[0042] In a fourth aspect, the present invention provides a server, comprising:
[0043] Memory and processor;
[0044] Wherein, the memory stores a computer program, and when the computer program is executed by the processor, the above-mentioned image transmission method is implemented.
[0045] In a fifth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by one or more processors, the image transmission method as described above is implemented.
[0046] The above one or more technical solutions provided by the present invention may have the following advantages or at least achieve the following technical effects:
[0047] The present invention proposes an image transmission method, client, server and storage medium. The client obtains request parameters including a first digest obtained based on the MD5 algorithm, generates an interactive request and sends it to the server; when the first digest is consistent with the second digest obtained based on the MD5 algorithm and the request parameters, the server generates a first image according to the request parameters and obtains a second image, and generates a third image according to the first image and the second image based on an obfuscation algorithm; the client then decrypts the third image sent by the server based on the obfuscation algorithm to obtain the decrypted third image, generates a target image according to the decrypted third image and a fourth image and displays it, thereby achieving the purpose of encrypted transmission of image data; in this method, multiple encryption algorithms such as the MD5 algorithm and the obfuscation algorithm are used for image transmission, and multiple algorithms are mutually verified, which can reduce the risk of being cracked, and can also prevent the packet capture tool from intercepting the request and tampering with the data and simulating access, resulting in incorrect display on the client, thereby achieving the effect of ensuring the security of image transmission and preventing data from being tampered with. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0049] Figure 1 It is a flowchart of the first embodiment of the image transmission method of the present invention;
[0050] Figure 2 It is a flowchart of a second embodiment of the image transmission method of the present invention;
[0051] Figure 3 It is a schematic diagram of the interactive process of the image transmission method of the present invention.
[0052] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all the embodiments. Based on the embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] It should be noted that in the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, the elements defined by the sentence "include..." do not exclude the existence of other identical elements in the process, method, article or system including the element. In the present invention, if there is a description involving "first", "second", etc., the description of "first", "second", etc. is only for descriptive purposes, and cannot be understood as indicating or implying its relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. In addition, the technical solutions of the various embodiments may be combined with each other, but this is based on the fact that ordinary technicians in the field can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0055] Terminology explanation:
[0056] MD5: The full name is MD5 Message-Digest Algorithm, a widely used cryptographic hash function that can generate a 128-bit (16 bytes, 1 byte 8 bits) hash value (commonly represented by 32-bit hexadecimal, for example: 0caa3b23b8da53f9e4e041d95dc8fa2c) to ensure the integrity and consistency of information transmission.
[0057] Data is generally transmitted between the client and the server in JSON or XML format. JSON is a lightweight data exchange format. The current way for the client to obtain the head portrait of the address book person is to submit the picture name, current user token and other information to the server using the post method of the http protocol. After the server verifies the information, it returns JSON data. If the verification fails, it returns a failure message. If the verification succeeds, it returns encrypted picture data. Generally, simple encryption methods such as simple BASE64 encoding and 8bits binary conversion are used. These encryption methods can be cracked using some common algorithms, resulting in the transmission of data that can be easily decrypted. There is a risk of data leakage between the client and the server.
[0058] Analysis of related technologies found that when transmitting images between clients and servers, the images are usually encrypted in a segmented encryption manner before being uploaded to the server, and the server stores the encrypted files accordingly. The problem with this solution is that when the client downloads images from the server, it accesses the same encrypted file, and the image stream file returned each time is always the same, making the encrypted file easy to crack, greatly reducing security. In addition, the encryption method of the encrypted file received each time a download request is also the same, making the encrypted file even easier to crack.
[0059] In addition, the data displayed on the client side is displayed through interface transmission. The packet capture tool can capture the entire data transmission process, and the packet capture tool can tamper with and save the data returned by the server and replace the transmission content. However, the client generally cannot verify whether the encrypted file uploaded to the server is the same as the downloaded stream file. When the downloaded stream file data is tampered with, it can still be displayed on the client side. Therefore, there is still a risk that the data is easily tampered with, which reduces the security of image transmission.
[0060] In view of the technical problem that image transmission between the client and the server in the related art has low security, the present invention provides an image transmission method, and the overall idea is as follows:
[0061] The client obtains request parameters including a first digest obtained based on the MD5 algorithm, generates an interaction request and sends it to the server; when the first digest is consistent with a second digest obtained based on the MD5 algorithm and the request parameters, the server generates a first image according to the request parameters and obtains a second image, and generates a third image according to the first image and the second image based on the obfuscation algorithm; the client then decrypts the third image sent by the server based on the obfuscation algorithm to obtain the decrypted third image, generates a target image according to the decrypted third image and a fourth image, and displays the target image.
[0062] Through the above technical scheme, the purpose of encrypted transmission of image data is achieved; in this method, multiple encryption algorithms such as MD5 algorithm and obfuscation algorithm are used for image transmission. Multiple algorithms verify each other, which can reduce the risk of being cracked. It can also prevent the packet capture tool from intercepting the request and tampering with the data and simulating access, resulting in incorrect display on the client, thereby ensuring the security of image transmission and preventing data from being tampered with.
[0063] The image transmission method, client, server and storage medium provided by the present invention are described in detail below through specific embodiments and implementation modes in conjunction with the accompanying drawings.
[0064] Embodiment 1
[0065] Reference Figure 1 and Figure 3 , a first embodiment of the image transmission method of the present invention is proposed, and the image transmission method is applied to a client.
[0066] The client refers to a terminal device that can achieve network connection, and the client can be a mobile phone, computer, tablet computer, portable computer, embedded industrial computer, etc. In this embodiment, the client is connected to the server network to achieve image transmission.
[0067] Combine the following Figure 1 The process diagram and Figure 3 The interactive process diagram shown in FIG. 1 is used to describe the image transmission method of this embodiment in detail. The method may include the following steps:
[0068] Step S110: Obtain request parameters, where the request parameters include a first digest, which is obtained based on the MD5 algorithm.
[0069] Specifically, the client obtains request parameters, which include a first digest obtained based on the MD5 algorithm and the basic request parameters. The basic request parameters may be parameters such as an identification code indicating the uniqueness of the client identity, a timestamp indicating the uniqueness of the request, and / or user information indicating the current user identity on the client, which are not limited here.
[0070] Specifically, step S110 may include:
[0071] Step S111: Generate a client timestamp according to the current system time of the client;
[0072] Step S112: Encrypt the user name based on an asymmetric encryption algorithm to obtain an encrypted user name;
[0073] Step S113: Generate a first digest based on the encrypted user name and the client timestamp based on the MD5 algorithm;
[0074] Step S114: Determine the client timestamp, the encrypted user name, and the first digest as request parameters.
[0075] Asymmetric encryption algorithms require two keys: a public key and a private key. The public key and the private key are a pair. If the data is encrypted with the public key, it can only be decrypted with the corresponding private key. If the data is encrypted with the private key, it can only be decrypted with the corresponding public key. Because different keys are used for encryption and decryption, it is called asymmetric encryption. Security generally depends on the algorithm and the key. In an asymmetric encryption algorithm, the key system corresponds to two keys. When one of them is disclosed, the other key will not be disclosed synchronously like a symmetric encryption. Therefore, the asymmetric encryption algorithm has higher security. Moreover, the confidentiality of the asymmetric encryption algorithm is good and the algorithm strength is complex, which can further enhance the security of this method.
[0076] In this embodiment, the client generates a client timestamp securityCode according to the current system time, and the timestamp unit can be milliseconds; at the same time, an asymmetric encryption algorithm is used to encrypt the user name of the currently logged-in user on the client to obtain the encrypted user name, namely the encrypted user name legalMark; in order to prevent the request information from being forged, the MD5 algorithm is also used to generate a unique summary of the current request according to the client timestamp securityCode and the encrypted user name legalMark to obtain the first summary sysflag; then, the client can determine the client timestamp securityCode, the encrypted user name legalMark and the first summary sysflag as the main parameters for initiating an interactive request to obtain the request parameters.
[0077] The MD5 encryption algorithm has the characteristics of irreversibility, high discreteness, compressibility (fixed length) and weak collision. Based on the asymmetric encryption algorithm and the MD5 algorithm, the client encrypts the user information and transmits it to the server. At the same time, the first summary is obtained according to the current system time and timestamp. The string of the first summary can be understood as part of the initiated interactive request. The string is irreversible and has high security. Transmission parameters are added to the interactive request, and multiple algorithms are used for mutual verification to prevent it from being cracked.
[0078] Step S120: Generate an interaction request according to the request parameters, and send the interaction request to the server, so that when the first digest is consistent with the second digest, the server generates a first image according to the request parameters and obtains a second image, and generates a third image according to the first image and the second image based on an obfuscation algorithm; wherein the second digest is obtained based on the MD5 algorithm and the request parameters.
[0079] Specifically, after the client obtains the request parameters, it generates an interaction request according to the request parameters and sends the interaction request to the server; after receiving the interaction request, the server can obtain a second digest based on the MD5 algorithm and the request parameters, and then, when the first digest is consistent with the second digest, generate a first image according to the request parameters and obtain a second image, and then generate a third image according to the first image and the second image based on the obfuscation algorithm, and send the third image to the client.
[0080] After the client uploads the image data to the server, the server can verify whether the image data sent by the client is correct. If the data is correct, the server will send the obfuscated image data to the client, thereby achieving the purpose of the client downloading the image data.
[0081] More specifically, based on the request parameters including the client timestamp, the encrypted username and the first digest, the client generates an interaction request and sends the interaction request to the server; after receiving the interaction request, the server can extract the corresponding interaction credential information based on the interaction request, and the interaction credential information can include the server timestamp and the pre-stored username, and then compare the client timestamp with the server timestamp to obtain the time difference, and when the time difference does not exceed the preset time, decrypt the encrypted username to obtain the decrypted username; then compare the decrypted username with the pre-stored username, and when the decrypted username is consistent with the pre-stored username, generate a second digest based on the decrypted username and the client timestamp based on the MD5 algorithm; then when the first digest is consistent with the second digest, generate a first image based on the combined characters of the client timestamp and the decrypted username, and extract the user's pre-stored image based on the decrypted username to obtain the second image; finally, generate a third image based on the first image and the second image based on the obfuscation algorithm, and send the third image to the client.
[0082] In this embodiment, after the client generates an interaction request and sends the interaction request to the server, the server performs the following operations:
[0083] First, the server extracts the corresponding interaction credential information (tokenid information) according to the interaction request. The tokenid information may include a server timestamp and a pre-stored user name. The server timestamp is the current timestamp of the server, and the pre-stored user name is the user information pre-stored on the server. The tokenid information is the unique credential for the interaction between the client and the server, and can be used to query whether the received interaction request is legal.
[0084] Then, the server compares the client timestamp securityCode in the request parameter with the server timestamp in the tokenid information to obtain the time difference, and determines whether the interaction request is legal based on the time difference and the preset time. If the time difference does not exceed the preset time, the interaction request is determined to be legal, and subsequent steps can be performed, such as decrypting the encrypted user name. If the time difference is greater than or equal to the preset time, the interaction request is determined to be illegal, and a prompt message can be directly returned to the client, indicating that the image transmission failed. The preset time can be set according to actual needs, for example, set to 1 minute.
[0085] Secondly, after the server determines that the interactive request is legal, it can use an asymmetric decryption algorithm to decrypt the characters of the encrypted username legalMark in the request parameters to obtain the decrypted username, namely the decrypted username; then compare the decrypted username with the pre-stored username in the tokenid information. If the decrypted username is consistent with the pre-stored username, subsequent steps can be executed, such as generating a second summary. If the decrypted username is inconsistent with the pre-stored username, a prompt message can be directly returned to the client, indicating that the image transmission failed.
[0086] Next, when the decrypted username is consistent with the pre-stored username, a new digest is generated according to the client timestamp securityCode and the decrypted username in the request parameters through the MD5 algorithm to obtain a second digest; then the first digest is compared with the second digest. If the first digest is consistent with the second digest, subsequent steps can be executed, such as generating a first image according to the combined characters of the client timestamp and the decrypted username. If the first digest is inconsistent with the second digest, a prompt message can be directly returned to the client, indicating that the image transmission failed.
[0087] Finally, when the first digest is consistent with the second digest, the server can generate an image in PNG or JPG format using the image open source code according to the client timestamp securityCode in the request parameter and the combined characters of the decrypted username to obtain the first image, and extract the user's pre-stored image such as the user's avatar picture according to the decrypted username to obtain the second image, and then generate a third image based on the first image and the second image based on the obfuscation algorithm, and send the third image to the client. Specifically, the third image is generated based on the first image and the second image based on the obfuscation algorithm, and the third image is sent to the client. Specifically, the IO file stream is used to read the stream file of the first image, and the stream file of the second image is read, and the two stream files are saved as a new file, namely the third image. The new file cannot be opened. If the third image is to be decrypted, the first image must be known to restore the user's pre-stored image such as the user's avatar picture, thereby increasing the security of image transmission.
[0088] In this embodiment, after receiving the interaction request, the server verifies the legality of the interaction request based on the request parameters, namely the client timestamp securityCode, the encrypted user name legalMark and the first summary sysflag, and checks the request parameters. After the parameters are consistent, character conversion is performed according to the request parameters to generate the first image. At the same time, the corresponding personnel head portrait picture is found according to the verified user information, and the second image is obtained. Afterwards, the IO file stream is used to read the stream file of the first image and the stream file of the second image, and the generated file is saved as the third image. The file of the third image cannot be opened directly. Since the amount of information contained in the generated first image is small, the information contained in the synthesized third image will affect the server's memory, CPU, and network speed. At the same time, when generating the third image, an obfuscation algorithm is used to confuse the stream file, which can ensure the transmission security of the third image.
[0089] In this embodiment, the processing on the server only encrypts part of the data, which can effectively reduce the occupation of server resources and time consumption in the process of encrypting and uploading images by the client, and can also effectively reduce the corresponding response time of the client in the process of decrypting the acquired images. On the server, the request parameters are verified separately, including the timestamp, user name, digest generated by MD5 algorithm, etc., and multiple algorithms and multiple verifications are combined. On the basis of preventing the interactive request transmitted by the client to the server from being cracked, it is also possible to prevent the packet capture tool from simulating the interactive request to access the server after intercepting the interactive request; when the interactive request is intercepted by the packet capture tool, the packet capture tool simulates the initiation of the request, and the transmission time will be significantly increased. In this embodiment, on the server, by verifying whether the time difference between the client timestamp securityCode and the server timestamp is within the preset time of 1 minute, it is verified whether the generation time of the request parameter in the interactive request is within 1 minute, and after meeting this condition, other parameters are verified, and the interactive request that is intercepted and then simulated and initiated can be screened out; here, the request time is restricted, and the server directly rejects and returns prompt data after judging that it is illegal, and uses multiple parameters to trust each other before generating the image. If the interactive request is intercepted and the data is tampered with, it can be identified first, so even if the interactive request is intercepted, it will not affect the performance of the server.
[0090] Step S130: decrypt the third image sent by the server based on the obfuscation algorithm to obtain a decrypted third image.
[0091] Specifically, after receiving the third image sent by the server, the client decrypts the third image based on the obfuscation algorithm to obtain the decrypted third image.
[0092] In this embodiment, after the client obtains the encrypted file returned by the server, that is, the third image, it can restore the source file according to the custom obfuscation algorithm to obtain the decrypted third image. Specifically, the third image is decrypted, and the obfuscated data is removed to obtain the target image. The server puts the user information and time information into the stream file at the same time, generates an encrypted file and returns it to the client. The client can save the encrypted stream file accordingly, and after verifying the consistency of the information in the file according to the custom obfuscation algorithm, save it locally, and store it in encrypted form. Through the above process, it is ensured that the downloaded user avatar image is consistent with the interactive request uploaded to the server to prevent tampering. In addition, during the entire life cycle, since the request parameters are different each time, the received encrypted file is also different, which ensures that the transmitted data cannot be tampered with.
[0093] Step S140: Generate a target image according to the decrypted third image and fourth image, and display the target image; wherein the fourth image is obtained according to the request parameters.
[0094] Specifically, while the client obtains the decrypted third image, it can also generate a fourth image according to the request parameters, and then generate a target image according to the decrypted third image and the fourth image, so as to display the target image.
[0095] Specifically, step S140 may include:
[0096] Step S141: generating a fourth image according to the combination of the client timestamp and the user name;
[0097] Step S142: comparing the decrypted character stream of the third image with the character stream of the fourth image, deleting identical characters and retaining different characters;
[0098] Step S143: generating a target image based on different characters;
[0099] Step S144: Display the target image.
[0100] In this embodiment, the client obtains the decrypted third image, and reads the character stream of the decrypted third image and stores it in the memory, which is represented as file one. At the same time, the fourth image can be generated based on the locally stored user name, which can be the unencrypted user name, and the combination of the client timestamp securityCode, and the character stream of the fourth image is read and stored in the memory, which is represented as file two; then the character stream of file one and the character stream of file two are obtained, and the characters are compared. After the same characters are deleted, the remaining different characters can generate a new file, that is, generate the target image. If the target image can be opened, it means that the user's pre-stored image is restored successfully, and the target image is displayed. If the target image cannot be opened, it means that the restoration fails, and the encrypted image obtained by the client, that is, the third image, may not be the user's pre-stored image, and the user's avatar display will fail. Optionally, after the client generates the target image, it can also encrypt and store the target image locally for quick retrieval or loading and display.
[0101] The encrypted image received by the client, i.e. the third image, is different each time, so that others cannot intercept the image, which greatly improves data security. Even if it is intercepted, it is difficult to analyze and crack the encrypted data, thus preventing the transmission data from being tampered with.
[0102] Optionally, step S144 may include:
[0103] Step S144a: decrypting the third image based on an asymmetric encryption algorithm to obtain user name information;
[0104] Step S144b: Compare the user name information with the user name;
[0105] Step S144c: When the user name information is consistent with the user name, the target image is displayed.
[0106] Specifically, the client can also decrypt the third image based on an asymmetric encryption algorithm to obtain the user name information, and only display the target image when the user name information is consistent with the user name, thus achieving double authentication. The entire process is encrypted to ensure that the data is more secure and reliable. The user name stored in the received encrypted image is checked against the user name in the client itself, and the image is displayed only when the check is consistent. In this way, even if the data is tampered with, it will not be displayed on the client, thereby improving the security of the displayed data.
[0107] It should be noted that in this embodiment, the client and the server can use the same asymmetric encryption algorithm. The client can use the public key of the asymmetric encryption algorithm for encryption, and the server can use the private key of the asymmetric encryption algorithm for decryption. After the client receives the third image and performs image restoration, it can also use the same asymmetric encryption algorithm and use the private key of the asymmetric encryption algorithm for decryption.
[0108] In this embodiment, the user name information can be encrypted together with the third image through an asymmetric encryption algorithm when transmitting, which has high security. The client verifies whether the information in the initiated interaction request and the returned encrypted file are consistent. If they are inconsistent, the image is not displayed, and the image is displayed only when they are consistent, which further improves the user's information security. The image transmission method of this embodiment can be specifically applied to the uploading and downloading of personnel portrait images to ensure the interactive security of personnel portrait images.
[0109] The image transmission method provided in this embodiment obtains request parameters including a first digest obtained based on the MD5 algorithm through a client, generates an interactive request and sends it to a server; when the first digest is consistent with the second digest obtained based on the MD5 algorithm and the request parameters, the server generates a first image and obtains a second image according to the request parameters, and generates a third image according to the first image and the second image based on the obfuscation algorithm; the client then decrypts the third image sent by the server based on the obfuscation algorithm to obtain a decrypted third image, generates a target image according to the decrypted third image and a fourth image, and displays it, thereby achieving the purpose of encrypted transmission of image data; in this method, multiple encryption algorithms such as the MD5 algorithm and the obfuscation algorithm are used for image transmission, and multiple algorithms are mutually verified, which can reduce the risk of being cracked, and can also prevent the packet capture tool from intercepting the request, tampering with the data and simulating access, resulting in incorrect display on the client, thereby achieving the effect of ensuring the security of image transmission and preventing data from being tampered with.
[0110] Embodiment 2
[0111] Based on the same inventive concept, Figure 2 and Figure 3 , a second embodiment of the image transmission method of the present invention is proposed, and the image transmission method is applied to a server. A server refers to a network device that can achieve network connection, and the server can be a network device such as a server and a cloud platform.
[0112] In this embodiment, the server is connected to the client network to achieve image transmission.
[0113] Combine the following Figure 2 The process diagram and Figure 3 The interactive process diagram shown in FIG. 1 is used to describe the image transmission method of this embodiment in detail. The method may include the following steps:
[0114] Step S210: receiving an interaction request sent by a client, wherein the interaction request is generated by the client according to the acquired request parameters, wherein the request parameters include a first digest, and the first digest is obtained by the client based on an MD5 algorithm;
[0115] Step S220: when the first digest is consistent with the second digest, generating a first image according to the request parameters, and acquiring a second image; wherein the second digest is obtained based on the MD5 algorithm and the request parameters;
[0116] Step S230: generating a third image according to the first image and the second image based on an obfuscation algorithm;
[0117] Step S240: Send the third image to the client, so that the client decrypts the third image based on the obfuscation algorithm to obtain the decrypted third image, generates a target image based on the decrypted third image and the fourth image, and displays the target image; wherein the fourth image is obtained by the client according to the request parameters.
[0118] Furthermore, the request parameters also include a client timestamp and an encrypted username; before step S220, the method may further include:
[0119] Step S250: extracting corresponding interaction credential information based on the interaction request, wherein the interaction credential information includes a server timestamp and a pre-stored user name;
[0120] Step S260: Compare the client timestamp with the server timestamp to obtain a time difference;
[0121] Step S270: when the time difference does not exceed the preset time, decrypting the encrypted user name to obtain a decrypted user name;
[0122] Step S280: comparing the decrypted username with the pre-stored username;
[0123] Step S290: When the decrypted user name is consistent with the pre-stored user name, the second digest is generated according to the decrypted user name and the client timestamp based on the MD5 algorithm.
[0124] Furthermore, step S220 may include:
[0125] Step S221: when the first digest is consistent with the second digest, generating a first image according to the client timestamp and the combined characters of the decrypted user name;
[0126] Step S222: extracting the pre-stored image of the user according to the decrypted user name to obtain a second image.
[0127] In the image transmission method of this embodiment, the server confuses the character string of the first digest submitted by the client with the request parameters that have passed the authentication, calculates the second digest and returns it to the client together with the user information, and the character stream of the returned third image is encrypted and secure, ensuring that even if the transmitted data is intercepted, it is difficult to restore, thereby ensuring data security.
[0128] It should be noted that for more implementation details in the specific implementation of the above method steps, please refer to the description of the specific implementation in Example 1. The functions that can be achieved in each step of the image transmission method provided in this embodiment and the corresponding technical effects can refer to the description of the specific implementation in the first embodiment of the image transmission method of the present invention. For the sake of brevity of the specification, they will not be repeated here.
[0129] Embodiment 3
[0130] Based on the same inventive concept, this embodiment provides a client, which refers to a terminal device capable of realizing network connection. The client may be a mobile phone, a computer, a tablet computer, a portable computer, an embedded industrial computer, or other terminal devices. The client may include a memory and a processor.
[0131] The memory stores an image transmission program, and when the image transmission program is executed by the processor, the image transmission method described in the first embodiment is implemented.
[0132] It is understood that the client may also include a multimedia component, an input / output (I / O) interface, and a communication component.
[0133] The processor is used to execute all or part of the steps in the image transmission method of the first embodiment. The memory is used to store various types of data, which may include instructions of any application or method in the client, and data related to the application or method.
[0134] The processor can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, and is used to execute all or part of the steps in the image transmission method of the above-mentioned embodiment 1.
[0135] The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0136] The multimedia component may include a screen and an audio component, wherein the screen may be a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, and the microphone is used to receive external audio signals. The received audio signal may be further stored in a memory or sent via a communication component. The audio component also includes at least one speaker for outputting audio signals.
[0137] The I / O interface provides an interface between the processor and other interface modules, and the other interface modules may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons.
[0138] The communication component is used for wired or wireless communication between the terminal device and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or one or a combination of them, so the corresponding communication component may include: Wi-Fi module, Bluetooth module, NFC module.
[0139] Embodiment 4
[0140] Based on the same inventive concept, this embodiment provides a server, which refers to a network device capable of realizing network connection. The server may be a network device such as a server or a cloud platform, and the server may include a memory and a processor;
[0141] The memory stores an image transmission program, and when the image transmission program is executed by the processor, the image transmission method described in the second embodiment is implemented.
[0142] The processor is used to execute all or part of the steps in the image transmission method of the second embodiment. The memory is used to store various types of data, which may include instructions of any application or method in the server, and data related to the application or method.
[0143] The processor can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, and is used to execute all or part of the steps in the image transmission method of the above-mentioned embodiment 2.
[0144] The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0145] It is understandable that the server may also include multimedia components, input / output (I / O) interfaces, and communication components, etc., which will not be described in detail here.
[0146] Embodiment 5
[0147] Based on the same inventive concept, this embodiment provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic memory, a disk, an optical disk, a server, etc., on which a computer program is stored. The computer program can be executed by one or more processors. When the computer program is executed by the processor, all or part of the steps of each embodiment of the image transmission method of the present invention can be implemented.
[0148] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. The above embodiments are only optional embodiments of the present invention and do not limit the patent scope of the present invention. All equivalent structures or equivalent process changes made by using the contents of the present specification and drawings under the inventive concept of the present invention, or directly or indirectly applied in other related technical fields, are included in the patent protection scope of the present invention.
Claims
1. An image transmission method, characterized in that: Applied to a client, the method comprises: Obtaining request parameters, where the request parameters include a first digest, where the first digest is obtained based on an MD5 algorithm; Generate an interactive request according to the request parameters, and send the interactive request to the server, so that when the first digest is consistent with the second digest, the server generates a first image according to the request parameters and obtains a second image, and generates a third image according to the first image and the second image based on an obfuscation algorithm; wherein the second digest is obtained based on the MD5 algorithm and the request parameters; Decrypting the third image sent by the server based on an obfuscation algorithm to obtain a decrypted third image; A target image is generated according to the decrypted third image and fourth image, and the target image is displayed; wherein the fourth image is obtained according to the request parameters.
2. The image transmission method according to claim 1, characterized in that: The step of obtaining request parameters comprises: Generating a client timestamp according to the current system time of the client; Encrypt the user name based on an asymmetric encryption algorithm to obtain an encrypted user name; Based on the MD5 algorithm, generate a first digest according to the encrypted username and the client timestamp; The client timestamp, the encrypted username, and the first digest are determined as the request parameters.
3. The image transmission method according to claim 2, characterized in that: The step of generating a target image according to the decrypted third image and fourth image and displaying the target image comprises: generating a fourth image according to the client timestamp and the combined characters of the user name; Comparing the character stream of the decrypted third image with the character stream of the fourth image, deleting identical characters and retaining different characters; generating a target image based on the different characters; The target image is displayed.
4. The image transmission method according to claim 3, characterized in that: The step of displaying the target image comprises: Decrypting the third image based on an asymmetric encryption algorithm to obtain user name information; Comparing the user name information with the user name; When the user name information is consistent with the user name, the target image is displayed.
5. An image transmission method, characterized in that: Applied to a server, the method comprises: Receiving an interaction request sent by a client, where the interaction request is generated by the client according to the acquired request parameters, wherein the request parameters include a first digest, which is obtained by the client based on an MD5 algorithm; When the first digest is consistent with the second digest, a first image is generated according to the request parameters, and a second image is acquired; wherein the second digest is obtained based on the MD5 algorithm and the request parameters; generating a third image from the first image and the second image based on an obfuscation algorithm; The third image is sent to the client, so that the client decrypts the third image based on an obfuscation algorithm to obtain a decrypted third image, generates a target image according to the decrypted third image and a fourth image, and displays the target image; wherein the fourth image is obtained by the client according to the request parameters.
6. The image transmission method according to claim 5, characterized in that: The request parameters also include a client timestamp and an encrypted username; Before the step of generating a first image according to the request parameters and acquiring a second image when the first digest is consistent with the second digest, the method further includes: Extracting corresponding interaction credential information based on the interaction request, the interaction credential information including a server timestamp and a pre-stored user name; Compare the client timestamp with the server timestamp to obtain a time difference; When the time difference does not exceed the preset time, decrypting the encrypted username to obtain a decrypted username; Comparing the decrypted username with the pre-stored username; When the decrypted user name is consistent with the pre-stored user name, the second digest is generated according to the decrypted user name and the client timestamp based on the MD5 algorithm.
7. The image transmission method according to claim 6, characterized in that: When the first digest is consistent with the second digest, the step of generating the first image according to the request parameter and acquiring the second image comprises: When the first digest is consistent with the second digest, generating a first image according to the combined characters of the client timestamp and the decrypted username; The pre-stored image of the user is extracted according to the decrypted user name to obtain a second image.
8. A client, characterized in that: The client comprises: Memory and processor; Wherein, a computer program is stored in the memory, and when the computer program is executed by the processor, the image transmission method according to any one of claims 1 to 4 is implemented.
9. A server, characterized in that: The server comprises: Memory and processor; Wherein, a computer program is stored in the memory, and when the computer program is executed by the processor, the image transmission method as described in any one of claims 5 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by one or more processors, the image transmission method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data interaction method, client and server
CN102624740A
Data transmission method, device and system, storage medium and electronic device
CN111464496A
Method and device for transmitting anchor image picture in live broadcast interaction
CN114339282A
Picture loading method and device, electronic equipment and storage medium
CN116431948A
File transfer system comprising an upload, storage and download device
EP3614292A1
Cited By
Jewelry transaction data security and privacy protection method based on 5G fusion application
CN120471621A