A picture loading method and device, electronic equipment and storage medium
By including encrypted information in the image loading request and verifying it on the server side, the image address and data file are obtained and decrypted, thus solving the problem of web crawlers obtaining image resources and achieving secure loading of image resources.
Patent Information
- Application Number
- CN202310307808.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-27
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2043-03-27
AI Technical Summary
Web crawlers can easily obtain image resources through URLs or resource requests, leading to data loss during image loading.
The image loading request includes encrypted information. After the server verifies the encryption information, it obtains the encrypted image address and data file, and loads the image by decryption.
It improves the security of image resources, prevents web crawlers from accessing them, and optimizes the user's online experience.
Smart Images

Figure CN116431948B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a picture loading method and device, electronic equipment and storage medium. BACKGROUND
[0002] At present, network crawler programs are increasingly rampant, and pictures are important content resources of websites. In the loading process of the existing picture loading method, a network crawler can easily obtain a source file of a picture resource through a uniform resource locator (URL) or a request resource grabbing mode, thereby causing certain losses. SUMMARY
[0003] Embodiments of the present application provide a picture loading method and device, electronic equipment and storage medium to solve the above problems.
[0004] In a first aspect, the embodiments of the present application provide a picture loading method, comprising: being applied to an electronic device, the electronic device being in communication connection with a server, and comprising:
[0005] When a triggering instruction of picture loading is detected, a picture loading request is sent to the server, and the picture loading request carries encrypted information;
[0006] In a case where the server verifies that the encrypted information is correct, a first picture address corresponding to the picture loading request is obtained;
[0007] According to the first picture address, a first data file is obtained, the first data file being a data file obtained by the server through first encryption processing on a first picture to be loaded;
[0008] According to the first data file, a third picture address is generated, and the first picture is loaded through the third picture address.
[0009] Optionally, in the case where the server verifies that the encrypted information is correct, the first picture address corresponding to the picture loading request is obtained, comprising:
[0010] In the case where the server verifies that the encrypted information is correct, a binary code and a first secret key are obtained, the binary code being obtained by the server through second encryption processing on the first picture address corresponding to the picture loading request;
[0011] The first secret key is subjected to first decryption processing through a first script, and a second secret key is obtained;
[0012] The binary code is subjected to second decryption processing through the second secret key, and the first picture address is obtained.
[0013] Optionally, the first script is a script obtained by code obfuscation compression processing of a programming language JavaScript script.
[0014] Optionally, the generating a third picture address according to the first data file and loading the first picture through the third picture address comprises:
[0015] performing third decryption processing on the first data file to obtain binary data;
[0016] generating a binary large object (blob) file object and the third picture address according to the binary data;
[0017] loading the first picture from the binary large object (blob) file object according to the third picture address.
[0018] Optionally, the performing third decryption processing on the first data file to obtain binary data comprises:
[0019] performing third decryption processing on the first data file through the second secret key to obtain binary data.
[0020] Optionally, the obtaining a first data file according to the first picture address comprises:
[0021] obtaining a first data file corresponding to the first picture address through an application programming interface (API) fetch request or a dynamically created script (script) tag.
[0022] Optionally, after the sending, to the server, of the picture loading request, the method further comprises:
[0023] obtaining a preset picture in a case where the server verifies that the encryption information is incorrect.
[0024] In a second aspect, an embodiment of the present application provides a picture loading apparatus applied to an electronic device, the electronic device being in communication connection with a server, and comprising:
[0025] a request module configured to send, to the server, a picture loading request when a trigger instruction of picture loading is detected, the picture loading request carrying encryption information;
[0026] a first obtaining module configured to obtain a first picture address corresponding to the picture loading request in a case where the server verifies that the encryption information is correct.
[0027] The second obtaining module is configured to obtain a first data file according to the first picture address, wherein the first data file is a data file obtained by performing first encryption processing on a first picture to be loaded by the server.
[0028] The processing module is configured to generate a third picture address according to the first data file, and load the first picture through the third picture address.
[0029] In a third aspect, an embodiment of the present application also provides an electronic device, which comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the computer program implements the steps of the picture loading method when executed by the processor.
[0030] In a fourth aspect, an embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the picture loading method when executed by a processor.
[0031] In the above embodiment of the present application, when a picture loading trigger instruction is detected, a picture loading request is sent to the server, and the picture loading request carries encryption information; in the case that the server verifies that the encryption information is correct, a first picture address corresponding to the picture loading request is obtained, the encryption information carried in the picture loading request can protect the picture resource from being crawled by a crawler, and the security of picture resource loading is improved; and according to the first picture address, a first data file is obtained, wherein the first data file is a data file obtained by performing first encryption processing on a first picture to be loaded by the server, a third picture address is generated according to the first data file, and the first picture is loaded through the third picture address, and the security of picture resource loading is further improved through the first data file after encryption processing. BRIEF DESCRIPTION OF DRAWINGS
[0032] Figure 1 is a picture loading method flowchart in an embodiment of the present application;
[0033] Figure 2 is a picture loading device structure schematic diagram in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0035] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0036] In describing the embodiments of the present invention, some concepts used in the following description will first be explained.
[0037] Web crawler: Also known as a web spider, web robot, web crawler, etc., it is a program or script that automatically retrieves information from the World Wide Web according to certain rules. Other less common names include ant, automatic indexer, simulator, or worm.
[0038] The fetch application programming interface is a web application programming interface (API) that allows the fetching of asynchronous resources. It is used to access and manipulate specific parts of the Hypertext Transfer Protocol (HTTP) pipeline, such as requests and responses.
[0039] The script element: HyperText Markup Language (HTML) elements are used to embed executable code or data; they are typically used to embed or reference JavaScript code.
[0040] blob: A web API interface. A blob object represents an immutable, raw data file-like object. Its data can be read in text or binary format, or it can be converted into a ReadableStream data structure for data manipulation.
[0041] The image loading provided in this application embodiment will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0042] like Figure 1 As shown, this embodiment of the invention provides an image loading method applied to an electronic device, which is communicatively connected to a server. The method specifically includes the following steps:
[0043] Step 101, when detecting the picture loading trigger instruction, sending a picture loading request to the server, the picture loading request carrying encrypted information.
[0044] Specifically, the user can access and obtain various information through an electronic device (such as an application), and present the obtained information to the user through the electronic device interface, wherein the information includes various pictures. When the user opens the electronic device or performs a refresh operation by pulling up or down during use of the electronic device, a picture loading instruction of the electronic device is triggered, that is, a picture loading trigger instruction is sent to the electronic device.
[0045] The electronic device detects whether the picture loading trigger instruction is received, and when the picture loading trigger instruction is detected, that is, when the user opens the browser page. A secret key token is written in HTML, and the electronic device carries the token when sending a picture loading request to the server. The request parameters of the picture loading request are encrypted by the token to obtain encrypted information, thereby preventing crawlers from crawling picture resources according to the picture loading request. The server determines whether the encrypted information is carried in the picture loading request, and if so, determines whether the encrypted information is correct, that is, the request parameters are decrypted according to the token and the password, thereby verifying whether the encrypted information is correct. If the request parameters can be decrypted according to the token and the password, it indicates that the encrypted information is correct, and step 102 is entered; otherwise, if the request parameters cannot be decrypted according to the token and the password, it indicates that the encrypted information is incorrect.
[0046] In addition, the server not only needs to verify whether the encrypted information is correct, but also needs to verify whether the user Internet Protocol (IP) is a prohibited user IP. If the user IP is a prohibited user IP, the picture loading is prohibited. In addition, the request number of the picture loading request of the user can be obtained, and the request number is compared with a preset number. If the request number is greater than the preset number, the picture loading is prohibited. The preset number can be set as needed, and is not limited here.
[0047] Step 102, when the server verifies that the encrypted information is correct, obtaining a first picture address corresponding to the picture loading request.
[0048] Specifically, if the server verifies that the encrypted information is correct, a first picture address corresponding to the picture loading request is obtained, and the first picture address is sent to the electronic device, so that the electronic device obtains the first picture address. The server verifies whether the encrypted information is correct to prevent crawlers from crawling picture resources.
[0049] At step 103, a first data file is obtained according to the first picture address, the first data file being a data file obtained by the server after performing first encryption on the first picture to be loaded.
[0050] Specifically, the electronic device requests the server to obtain the first data file corresponding to the first picture address according to the first picture address, the server obtains the first data file according to the first picture address, and sends the first data file to the electronic device, so that the electronic device obtains the first data file.
[0051] It can be understood that the server pre-stores each of the plurality of pictures in the form of a file after performing first encryption on each of the plurality of pictures, so as to obtain a plurality of data files, wherein the first data file is obtained by performing first encryption on the first picture. Since the first data file is obtained by performing first encryption on the first picture by the server, the picture resource is not easy to be crawled by a crawler, and the security of the picture resource loading is improved.
[0052] It should be noted that the first data file can be a picture or other types of binary data files, or other types of data files, which are not limited herein. The first encryption processing includes obfuscation processing, encryption processing, etc.
[0053] The following example is given: the process of obtaining the first data file by the server after performing first encryption on the first picture can include: converting the first picture into base64 encoding, and then performing obfuscation and encryption on the base64 encoding and generating a file.
[0054] At step 104, a third picture address is generated according to the first data file, and the first picture is loaded through the third picture address.
[0055] Specifically, after obtaining the first data file, the electronic device generates a third picture address according to the first data file, and the first picture can be loaded locally through the third picture address.
[0056] According to the above embodiment of the present application, when a picture loading trigger instruction is detected, a picture loading request is sent to the server, and the picture loading request carries encrypted information; in the case that the server verifies that the encrypted information is correct, a first picture address corresponding to the picture loading request is obtained; the encrypted information carried in the picture loading request can protect the picture resource from being crawled by a crawler, and improve the security of picture resource loading; and according to the first picture address, a first data file is obtained, the first data file is a data file obtained by the server through first encryption processing on a first picture to be loaded, a third picture address is generated according to the first data file, and the first picture is loaded through the third picture address, and the first data file after encryption processing further improves the security of picture resource loading.
[0057] As an optional embodiment, the step 102, in the case that the server verifies that the encrypted information is correct, obtains a first picture address corresponding to the picture loading request, and specifically includes:
[0058] In the case that the server verifies that the encrypted information is correct, a binary code and a first secret key are obtained, the binary code is obtained by the server through second encryption processing on the first picture address corresponding to the picture loading request;
[0059] The first secret key is subjected to first decryption processing through a first script to obtain a second secret key;
[0060] The binary code is subjected to second decryption processing through the second secret key to obtain the first picture address.
[0061] Specifically, if the server verifies that the encrypted information is correct, the server obtains a first picture address corresponding to the picture loading request, and obtains a binary code and a corresponding first secret key through second encryption processing on the first picture address, and sends the binary code and the first secret key to the electronic device, the electronic device obtains a second secret key through first decryption processing of the first secret key through a first script, and obtains the first picture address through second decryption processing of the binary code through the second secret key, that is, the first script parses the binary code to obtain the first picture address.
[0062] It can be understood that the binary code obtained by the first picture address through second encryption processing is regularly updated to prevent being hit by a library.
[0063] The following example: the second encryption processing can include: obfuscation processing, symmetric processing, encryption processing, etc., which are not specifically limited here.
[0064] Further, the first script is a script obtained by code obfuscation compression processing of a programming language JavaScript script.
[0065] Specifically, the browser JavaScript script is compressed by code obfuscation, so as to prevent being cracked.
[0066] As an optional embodiment, the step 104 generates a third picture address according to the first data file, and loads the first picture through the third picture address, specifically including:
[0067] The first data file is subjected to third decryption processing to obtain binary data.
[0068] A binary large object (blob) file object and the third picture address are generated according to the binary data.
[0069] The first picture is loaded from the binary large object (blob) file object according to the third picture address.
[0070] Specifically, after the electronic device obtains the first data file, the first data file is subjected to third decryption processing to obtain binary data, and a binary large object (blob) file object and a corresponding third picture address are generated according to the binary data. The first picture can be loaded from the blob file object through the third picture address. Since the blob file object is a local device file object, the first picture can be loaded from the local device through the third picture address. If it is not the local device, the first picture cannot be loaded. This further protects the picture resource from being crawled by a crawler, and improves the security of picture resource loading.
[0071] It should be noted that the electronic device generates a blob file object and a third picture address by using a blob method on the binary data (such as base64 encoded data). The browser requests the picture resource of the third picture address, that is, the first picture, from the blob file object.
[0072] As an optional embodiment, the step of subjecting the first data file to third decryption processing to obtain binary data specifically includes:
[0073] The first data file is subjected to third decryption processing by using the second secret key to obtain binary data.
[0074] Specifically, after the electronic device obtains the first data file, the first data file is subjected to third decryption processing by using the second secret key to obtain decrypted binary data, such as base64 encoded data.
[0075] As an optional embodiment, the step 103 obtains a first data file according to the first picture address, specifically including:
[0076] The first data file corresponding to the first picture address is obtained by a fetch request of an application programming interface or a dynamically created script tag.
[0077] Specifically, the browser requests the first data file corresponding to the first picture address from the server by a fetch request of an application programming interface or a dynamically created script tag, the server obtains the first data file according to the first picture address, and sends the first data file to the electronic device, since the first data file is an encrypted file, the picture resource is not easy to be crawled by a crawler, and the security of picture resource loading is improved.
[0078] As an optional embodiment, after the step 101 sends the picture loading request to the server, the method further comprises:
[0079] In the case that the server verifies that the encrypted information is incorrect, a preset picture is obtained.
[0080] Specifically, if the server verifies that the encrypted information is incorrect, the server sends the preset picture to the electronic device, the electronic device obtains and displays the preset picture, and in this way, the consequence of data loss caused by directly requesting data is prevented, and the user online experience is improved.
[0081] In summary, in the above embodiment, when the electronic device detects a picture loading trigger instruction, the electronic device sends a picture loading request carrying encrypted information to the server, the encrypted information carried in the picture loading request can protect the picture resource from being crawled by a crawler, and the security of picture resource loading is improved.
[0082] The server verifies the encrypted information, if the encrypted information is incorrect, the server returns a preset picture instead of a first picture, the request from a network crawler can be intercepted, the web crawler is automatically identified, the user online experience is not affected, and the anti-crawling effect is optimized. If the server verifies that the encrypted information is correct, the server returns an encrypted binary code and a first secret key, the electronic device performs first decryption processing on the first secret key through a first script to obtain a second secret key, performs second decryption processing on the binary code through the second secret key to obtain the first picture address, the picture resource is further protected from being crawled by a crawler, and the security of picture resource loading is improved.
[0083] And, the electronic device acquires the first data file obtained after the server encrypts according to the first picture address, further improving the security of picture resource loading. And, the electronic device performs third decryption processing on the first data file to obtain binary data, generates a binary large object (blob) file object and a corresponding third picture address according to the binary data, and the first picture can be loaded from the blob file object through the third picture address, that is, the first picture is loaded from the local through the third picture address, and if it is not local, the first picture cannot be loaded, further protecting the picture resource from being crawled by a crawler, and improving the security of picture resource loading.
[0084] As shown in Figure 2 The embodiment of the application also provides a picture loading device 200 applied to an electronic device in communication connection with a server, and the device specifically comprises:
[0085] A request module 201 is configured to send a picture loading request to the server when detecting a trigger instruction of picture loading, and the picture loading request carries encrypted information.
[0086] A first acquisition module 202 is configured to acquire a first picture address corresponding to the picture loading request when the server verifies that the encrypted information is correct.
[0087] A second acquisition module 203 is configured to acquire a first data file according to the first picture address, wherein the first data file is a data file obtained after the server performs first encryption processing on a first picture to be loaded.
[0088] A processing module 204 is configured to generate a third picture address according to the first data file, and load the first picture through the third picture address.
[0089] When the trigger instruction of picture loading is detected, the picture loading request is sent to the server, and the picture loading request carries encrypted information. When the server verifies that the encrypted information is correct, the first picture address corresponding to the picture loading request is acquired. The encrypted information carried in the picture loading request can protect the picture resource from being crawled by a crawler, and improve the security of picture resource loading. According to the first picture address, the first data file obtained after the server performs first encryption processing on the first picture to be loaded is acquired. According to the first data file, the third picture address is generated, and the first picture is loaded through the third picture address. The first data file obtained after the first encryption processing further improves the security of picture resource loading.
[0090] Optionally, the first acquisition module 202 is specifically configured to:
[0091] In the case that the server verifies that the encrypted information is correct, a binary code and a first secret key are acquired, the binary code being a first picture address corresponding to the picture loading request after being processed by the server through second encryption;
[0092] The first secret key is processed by a first decryption to obtain a second secret key;
[0093] The binary code is processed by the second secret key to obtain the first picture address.
[0094] Optionally, the first script is a script obtained by code obfuscation compression processing of a programming language JavaScript script.
[0095] Optionally, the processing module 204 is specifically configured to:
[0096] The first data file is processed by third decryption to obtain binary data;
[0097] A binary large object (blob) file object and the third picture address are generated according to the binary data;
[0098] The first picture is loaded from the binary large object (blob) file object according to the third picture address.
[0099] Optionally, when the processing module 204 processes the first data file by third decryption to obtain binary data, the processing module 204 is specifically configured to:
[0100] The first data file is processed by third decryption by the second secret key to obtain binary data.
[0101] Optionally, the second acquisition module 203 is specifically configured to:
[0102] A first data file corresponding to the first picture address is acquired by an application programming interface (API) fetch request or a dynamic script (script) tag creation method.
[0103] Optionally, the apparatus further includes:
[0104] A third acquisition module is configured to acquire a preset picture in the case that the server verifies that the encrypted information is incorrect.
[0105] It should be noted that the picture loading apparatus embodiment corresponds to the picture loading method described above, and all implementation manners of the method embodiment are applicable to the apparatus embodiment and can achieve the same technical effects, and thus will not be described in detail.
[0106] In summary, the above-mentioned embodiment of the present application, when the electronic device detects the picture loading trigger instruction, sends the picture loading request carrying the encrypted information to the server, and the encrypted information carried in the picture loading request can protect the picture resources from being crawled by the crawler, thereby improving the security of the picture resource loading.
[0107] The server verifies the encrypted information, and if the encrypted information is incorrect, returns a preset picture instead of the first picture, so that the request from the network crawler can be intercepted, the web crawler is automatically identified, the user's online experience is not affected, and the anti-crawling effect is optimized. If the server verifies that the encrypted information is correct, the server returns the encrypted binary code and the first secret key, the electronic device performs first decryption processing on the first secret key through the first script to obtain a second secret key, performs second decryption processing on the binary code through the second secret key to obtain the first picture address, and the picture resources can be further protected from being crawled by the crawler, thereby improving the security of the picture resource loading.
[0108] In addition, the electronic device acquires the first data file obtained by the server after encryption according to the first picture address, thereby further improving the security of the picture resource loading. In addition, the electronic device performs third decryption processing on the first data file to obtain binary data, generates a binary large object (blob) file object and a corresponding third picture address according to the binary data, and the first picture can be loaded from the blob file object through the third picture address, that is, the first picture is loaded from the local through the third picture address, and if it is not the local, the first picture cannot be loaded, thereby further protecting the picture resources from being crawled by the crawler and improving the security of the picture resource loading.
[0109] Preferably, the embodiment of the present application further provides an electronic device, which comprises a processor, a memory, and a computer program stored on the memory and executable on the processor. The computer program is executed by the processor to implement the processes of the above-mentioned picture loading method embodiment and achieve the same technical effects. To avoid repetition, details are not repeated here.
[0110] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program. The computer program is executed by the processor to implement the processes of the above-mentioned picture loading method embodiment and achieve the same technical effects. To avoid repetition, details are not repeated here. The computer readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0111] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0112] Those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the method described in each embodiment of the present application.
[0113] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative, not restrictive, and those skilled in the art can make many forms under the inspiration of the present application without departing from the purpose of the present application and the scope protected by the claims.
[0114] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solutions. Those skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0115] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0116] In the embodiments of the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described apparatus embodiments are merely schematic. The units as divided can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0117] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.
[0118] In addition, each functional unit in the various embodiments of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.
[0119] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc.
[0120] The above description is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. An image loading method, applied to an electronic device, wherein the electronic device is communicatively connected to a server, characterized in that, include: When an image loading trigger command is detected, an image loading request is sent to the server, and the image loading request carries encrypted information. If the server verifies that the encrypted information is correct, the first image address corresponding to the image loading request is obtained; Based on the first image address, a first data file is obtained. The first data file is a data file obtained by the server after the first image to be loaded has undergone a first encryption process. The first data file is then subjected to a third decryption process to obtain binary data. Generate a binary large object blob file object and a third image address based on the binary data; The first image is loaded from the binary large object blob file object based on the third image address.
2. The method according to claim 1, characterized in that, The step of obtaining the first image address corresponding to the image loading request after the server verifies that the encrypted information is correct includes: If the server verifies that the encrypted information is correct, it obtains a binary code and a first key. The binary code is obtained by the server through a second encryption process on the first image address corresponding to the image loading request. The first key is decrypted using the first script to obtain the second key. The binary code is decrypted using the second key to obtain the address of the first image.
3. The method according to claim 2, characterized in that, The first script is a JavaScript script that has been obfuscated and compressed.
4. The method according to claim 2, characterized in that, The third decryption process of the first data file to obtain binary data includes: The first data file is decrypted using the second key to obtain binary data.
5. The method according to claim 1, characterized in that, The step of obtaining the first data file based on the first image address includes: The first data file corresponding to the first image address is obtained by using an application programming interface (API) fetch request or by dynamically creating a script tag.
6. The method according to claim 1, characterized in that, After sending the image loading request to the server, the method further includes: If the server verifies that the encrypted information is incorrect, a preset image is obtained.
7. An image loading device, applied to an electronic device, the electronic device being communicatively connected to a server, characterized in that, include: The request module is used to send an image loading request to the server when an image loading trigger instruction is detected. The image loading request carries encrypted information. The first acquisition module is used to acquire the first image address corresponding to the image loading request when the server verifies that the encrypted information is correct. The second acquisition module is used to acquire a first data file based on the address of the first image. The first data file is a data file obtained by the server after the first image to be loaded has undergone a first encryption process. The processing module is used to perform a third decryption process on the first data file to obtain binary data; Generate a binary large object blob file object and a third image address based on the binary data; load the first image from the binary large object blob file object based on the third image address.
8. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the image loading method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the image loading method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Address protection strategy in audio playing
CN108400987A