CN116827637B - Canvas-based data encryption transmission method, system, equipment and medium - Google Patents

Canvas-based data encryption transmission method, system, equipment and medium Download PDF

Info

Publication number
CN116827637B
CN116827637B CN202310788554.1A CN202310788554A CN116827637B CN 116827637 B CN116827637 B CN 116827637B CN 202310788554 A CN202310788554 A CN 202310788554A CN 116827637 B CN116827637 B CN 116827637B
Authority
CN
China
Prior art keywords
encryption
canvas
data
program
character
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310788554.1A
Other languages
Chinese (zh)
Other versions
CN116827637A (en
Inventor
高显娟
田原
唐义
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Zhongyi Internet Information Technology Co ltd
Original Assignee
Sichuan Zhongyi Internet Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Zhongyi Internet Information Technology Co ltd filed Critical Sichuan Zhongyi Internet Information Technology Co ltd
Priority to CN202310788554.1A priority Critical patent/CN116827637B/en
Publication of CN116827637A publication Critical patent/CN116827637A/en
Application granted granted Critical
Publication of CN116827637B publication Critical patent/CN116827637B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a canvas-based data encryption transmission method, a canvas-based data encryption transmission system, canvas-based data encryption transmission equipment and canvas-based data encryption transmission media, relates to the technical field of Web security, solves the problem that the association relationship between image data and plaintext data is weak by the existing encryption means, and has the technical scheme key points that: generating an encryption program based on canvas, and deploying the encryption program under a preset site through Web service; when the web end is detected to need to transmit image data and plaintext data, loading the encryption program deployed under a preset site; and encoding the image data and the plaintext data according to the encryption program, encrypting the encoding results of the image data and the plaintext data based on ascll encoding disordered encryption, and then saving the encryption results as character strings and uploading the character strings to an OSS server to obtain URL links containing the encryption results. The invention not only encrypts the image and the plaintext data, but also deeply binds the image and the plaintext data, thereby greatly improving the relevance between the image and the plaintext data and optimizing the query efficiency of the target image.

Description

Canvas-based data encryption transmission method, system, equipment and medium
Technical Field
The invention relates to the technical field of Web security, in particular to a canvas-based data encryption transmission method, a canvas-based data encryption transmission system, canvas-based data encryption transmission equipment and a canvas-based data encryption transmission medium.
Background
At present, the Web terminal uses more encryption data means when exchanging data with a server. However, when the transmission object is an image and carries key information, the existing encryption means can encrypt data locally in the browser and transmit the encrypted data to the server, which can cause the problem of overlarge carrying data.
If the option is to upload the picture and key data separately encrypted, new problems arise. When tracing, the result of uploading cannot be quickly inquired because the picture and the encrypted data are not integral.
Disclosure of Invention
The invention provides a canvas-based data encryption transmission method, a canvas-based data encryption transmission system, canvas-based data encryption equipment and a canvas-based data encryption medium, so that an image and plaintext data are both drawn on one image, then the image is encrypted based on ascll encoding out-of-order encryption, the image and plaintext data are encrypted, the image and plaintext data are deeply bound, the association between the image and the plaintext data is greatly improved, and accordingly query efficiency of a target image is optimized.
The technical aim of the invention is realized by the following technical scheme:
in a first aspect of the present application, a canvas-based data encryption transmission method is provided, applied to a web terminal, the method comprising:
generating an encryption program based on canvas, and deploying the encryption program under a preset site through Web service;
when the web end is detected to need to transmit image data and plaintext data, loading the encryption program deployed under a preset site;
and encoding the image data and the plaintext data according to the encryption program, encrypting the encoding results of the image data and the plaintext data based on ascll encoding disordered encryption, and then saving the encryption results as character strings and uploading the character strings to an OSS server to obtain URL links containing the encryption results.
In one implementation, generating a canvas-based encryption program specifically includes:
writing encryption source codes by using a JavaScript development language, wherein writing the encryption source codes comprises defining a display area, an encryption information area, fonts and sizes of characters and a drawing range of a canvas, defining an encryption function name, and determining a parameter name, an encryption type and a data type of a return result of the encryption function;
and storing the encoded encryption source code as a JavaScript script file with the extension name of js to obtain the encryption program.
In one implementation, the encryption program is loaded to the web side through a JavaScript program.
In one implementation, the encryption program is deployed under a preset site through a Web service. The method specifically comprises the following steps:
deploying the encryption program in a CDN server through a web end, and acquiring a domain name address of the CDN server;
and generating an access address of the encryption program according to the domain name address.
In one implementation, the encoding the image data and the plaintext data according to the encryption program specifically includes:
and loading an encryption program deployed on the CDN server by the JavaScript program according to the access address, transmitting an encryption function name which is pre-exposed when the JavaScript program is called into the image data and the plaintext data, and calling an encryption function corresponding to the encryption function name to encode the plaintext data to obtain an encoding result.
In one implementation scheme, the encoding result of the image data and the plaintext data is encrypted based on ascll encoding out-of-order encryption, and specifically includes:
dividing the base64 character string into a character array formed by single characters;
traversing the characters contained in the character array, when the ascll codes of the characters are odd numbers, executing ascll codes-2 to obtain a first new character, and replacing the ascll codes with the odd numbers according to the first new character; when the ascll code of the character is even, executing ascll code +4 to obtain a second new character, and replacing the ascll code with the even character according to the second new character;
and when the traversal of the character array and the character replacement are completed, the encryption of the image data and the plaintext data is completed, and an encryption result is obtained.
In one implementation, applied to a server, a method includes:
when the request sent by the server is a downloading request in an IP white list of an OSS server, the file server transmits a URL link containing an encryption result;
and calling a decoding rule preset according to the ascll code to decode the URL link to obtain an encrypted character string, redrawing the encrypted character string into a canvas, cutting a picture in a fixed area of the canvas, and identifying the picture based on an OCR (optical character recognition) algorithm to obtain encrypted content attached to the picture.
In a second aspect of the present application, there is provided a canvas-based data encryption transmission system, the system comprising:
the encoding module is used for generating an encryption program based on canvas and deploying the encryption program under a preset site through Web service;
the loading module is used for loading the encryption program deployed under a preset site when the web terminal is detected to need to transmit the image data and the plaintext data;
and the transmission module is used for encoding the image data and the plaintext data according to the encryption program, encrypting the encoding results of the image data and the plaintext data based on ascll encoding disordered encryption, and saving the encryption results as character strings and uploading the character strings to an OSS server to obtain URL links containing the encryption results.
In a third aspect of the present application, there is also provided an electronic device, including:
at least one processor; and
at least one memory communicatively coupled to the processor, wherein,
the memory stores program instructions executable by the processor that invoke the program instructions to perform the canvas-based data encryption transmission method as described in the first aspect of the present application.
In a third aspect of the present application, there is also provided a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the canvas-based data encryption transmission method as described in the first aspect of the present application.
Compared with the prior art, the invention has the following beneficial effects:
1. the invention encodes the image and the plaintext data based on the encryption program generated by the canvas, so that the image and the plaintext data are both drawn on one image, then the image is encrypted based on ascll encoding disordered encryption, the image and the plaintext data are not only encrypted, but also the image and the plaintext data are deeply bound, the relevance between the image and the plaintext data is greatly improved, and the query efficiency of the target image is optimized.
2. According to the invention, as the encrypted data is uploaded to the OSS server, the OSS server adopts an IP white list downloading mechanism, and other people cannot acquire the encrypted data through URL links, so that the safety is ensured.
Drawings
The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention. In the drawings:
fig. 1 shows a flow diagram of a canvas-based data encryption transmission method according to an embodiment of the present invention;
FIG. 2 shows a schematic block diagram of a canvas-based data encryption transmission system provided by an embodiment of the present invention;
fig. 3 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making apparent the objects, technical solutions and advantages of the present invention, the present invention will be further described in detail with reference to the following examples and the accompanying drawings, wherein the exemplary embodiments of the present invention and the descriptions thereof are for illustrating the present invention only and are not to be construed as limiting the present invention.
It is noted that the terms "comprises" or "comprising" when utilized in various embodiments of the present application are indicative of the existence of, and do not limit the addition of, one or more functions, operations or elements of the subject application. Furthermore, as used in various embodiments of the present application, the terms "comprises," "comprising," and their cognate terms are intended to refer to a particular feature, number, step, operation, element, component, or combination of the foregoing, and should not be interpreted as first excluding the existence of or increasing likelihood of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, terms such as "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present invention, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
At present, the Web terminal uses more encryption data means when exchanging data with a server. However, when the transmission object is an image and carries key information, the existing encryption means can encrypt data locally in the browser and transmit the encrypted data to the server, which can cause the problem of overlarge carrying data. If the option is to upload the picture and key data separately encrypted, new problems arise. When tracing, the result of uploading cannot be quickly inquired because the picture and the encrypted data are not integral. Therefore, the embodiment of the application provides a canvas-based data encryption transmission method, which is applied to a web end, and the method is used for coding images and plaintext data based on an encryption program generated by the canvas, so that the images and the plaintext data are drawn on one image, then, the images are encrypted based on ascll coding out-of-order encryption, the images and the plaintext data are encrypted, the images and the plaintext data are deeply bound, the relevance between the images and the plaintext data is greatly improved, and the query efficiency of a target image is optimized.
Technical terms of the present application are described in this embodiment as follows:
the web end, 1, web end login, namely through the way of web login, the present network service mode generally has two kinds: B/S, C/S. 2. The B/S mode is browser (B)/server (S), through which a user accesses a web service provided by the server. web (World Wide Web) is a global wide area network, also known as the world wide web, which is a global, dynamically interactive, cross-platform distributed graphical information system based on hypertext and HTTP. The network service is established on the Internet, a graphical and easily-accessible visual interface is provided for a browser to search and browse information on the Internet, and documents and hyperlinks organize information nodes on the Internet into a mutually-associated network structure.
Canvas (canvas), which is a label newly added in HTML5 for generating an image in real time on a web page, and can manipulate image contents, is basically a bitmap (bitmap) that can be manipulated in JavaScript. Canvas objects represent an HTML Canvas element- < Canvas >. It does not behave as such, but defines an API that supports scripted client drawing operations.
The JavaScript is an interpreted script language, which is a dynamic type, weak type, prototype-based language and built-in support type. Its interpreter is called JavaScript engine, which is a part of the browser, widely used in the scripting language of clients, and is used at the earliest on HTML (an application under standard universal markup language) web pages to add dynamic functions to HTML web pages.
Referring to fig. 1, fig. 1 shows a schematic flow chart of a canvas-based data encryption transmission method according to an embodiment of the present invention, as shown in fig. 1, where the method includes:
s110, generating an encryption program based on canvas, and deploying the encryption program under a preset site through Web service.
In this embodiment, it should be understood that canvas is used as an important tag of HTML5, and allows drawing images through JavaScript, and is supported by all modern browsers after IE9, so that compatibility is ensured, and the canvas can operate normally in the browser. canvas itself does not have a drawing function, but there are various ways of drawing paths, rectangles, circles, characters, and adding images. And drawing the required information into the canvas by using JavaScript, storing the image drawn by the canvas as a Base64 character string format for encryption, and uploading the encrypted character string to an OSS server. As a specific implementation, the encryption program is loaded to the web end through a JavaScript program.
It will be appreciated that the encryption program will draw the user information in a fixed area of the picture.
S120, loading the encryption program deployed under a preset site when detecting that the web end needs to transmit image data and plaintext data.
In this embodiment, the encryption program deployed under the preset site is remotely loaded by using the JavaScript program, and it should be understood that the encryption program is deployed on the preset server for the web terminal to call. The decryption rule is bound with the server side, and local calling is carried out. The algorithm of encryption and decryption rules should be consistent. The decryption rule executes the inverse process of the encryption program, namely, the input ciphertext data is inversely operated according to the ascll coding encryption rule.
S130, encoding the image data and the plaintext data according to the encryption program, encrypting the encoding results of the image data and the plaintext data based on ascll encoding disorder encryption, and then saving the encryption results as character strings and uploading the character strings to an OSS server to obtain URL links containing the encryption results.
In this embodiment, based on the above steps S110 and S120, it is known that based on canvas, user information can be drawn in a fixed area, and a base64 character string is generated after drawing is completed, and the specific manner of generating the base64 character string is as follows: creating a canvas tag in a Web browser, drawing an image, drawing plaintext information in a fixed area of the canvas, and calling a todataURL method of the canvas after drawing is completed to obtain a base64 character string of the canvas. Therefore, further, the base64 character string is encrypted out of order based on ascll coding, so that encryption of a coding result is completed, and finally, the encrypted encryption result is uploaded to an OSS server. Because of the compatibility of canvas, the encryption program is very suitable for processing the operation of encryption and decryption at the browser side.
In one embodiment, generating the canvas-based encryption program specifically includes: writing encryption source codes by using a JavaScript development language, wherein writing the encryption source codes comprises defining a display area, an encryption information area, fonts and sizes of characters and a drawing range of a canvas, defining an encryption function name, and determining a parameter name, an encryption type and a data type of a return result of the encryption function; and storing the encoded encryption source code as a JavaScript script file with the extension name of js to obtain the encryption program.
In this embodiment, the encryption source code is operations to be included in the canvas when drawing the image, including, but not limited to, defining a display area of the canvas, an encryption information area, a font and a size of text, and a drawing range, defining an encryption function name, and determining a parameter name, an encryption type, and a data type of a returned result of the encryption function. Specifically, how to define or set the display area, the encryption information area, the font and size of the text, and the drawing range are well known to those skilled in the art, and this embodiment is not specifically described. Correspondingly, the names of the encryption functions, such as hash functions, SM2, SM4, etc., are defined in the prior art, and accordingly, the parameter names, encryption types and data types of the returned results of the encryption functions in this embodiment, and the written encryption source codes are saved as JavaScript script files with the extension name of js, so as to obtain the encryption program, which is also a well-known technology of those skilled in the art, and redundant description is not made in this embodiment. The parameter name may be img, info. Where img is the URL address of the image and info is the string to be encrypted. And drawing the parameter names img and info on a canvas, and obtaining a Base64 character string of the parameter name after drawing.
In one embodiment, the encryption program is deployed under a preset site through a Web service. The method specifically comprises the following steps: deploying the encryption program in a CDN server through a web end, and acquiring a domain name address of the CDN server; and generating an access address of the encryption program according to the domain name address.
Based on the above embodiment, the encrypted source code written is a JavaScript script file that needs to be saved as an extension name of. Js, so, assuming that the file name is encryptofcanvas. Js, the file is deployed under the CDN server, if the domain name address of the CDN server is fast.
In one embodiment, the encoding the image data and the plaintext data according to the encryption program specifically includes:
and loading an encryption program deployed on the CDN server by the JavaScript program according to the access address, transmitting an encryption function name which is pre-exposed when the JavaScript program is called into the image data and the plaintext data, and calling an encryption function corresponding to the encryption function name to encode the plaintext data to obtain an encoding result.
In one embodiment, encrypting the encoding results of the image data and the plaintext data based on ascll encoding out-of-order encryption specifically includes: dividing the base64 character string into a character array formed by single characters; traversing the characters contained in the character array, when the ascll codes of the characters are odd numbers, executing ascll codes-2 to obtain a first new character, and replacing the ascll codes with the odd numbers according to the first new character; when the ascll code of the character is even, executing ascll code +4 to obtain a second new character, and replacing the ascll code with the even character according to the second new character; and when the traversal of the character array and the character replacement are completed, the encryption of the image data and the plaintext data is completed, and an encryption result is obtained.
In this embodiment, the encryption rule for ascll encoding is set forth:
1. and drawing the image and the plaintext data into a canvas, and storing the drawn image and plaintext data into a character string in a base64 coding format.
2. The character string in the Base64 coding format is divided into character arrays of single characters.
3. Traversing the obtained character array to obtain the ascll coding number of the array.
4. When the character code number is a multiple of 2, the code number +4 is given a new code number, and the original character is replaced by the character represented by the new code number.
5. When the character code number is not a multiple of 2, the code number-2 is given a new code number, and the original character is replaced with the character represented by the new code number.
6. After the traversal is completed, a new character array is obtained, and the character array is restored into a character string.
7. So far, encryption rule elucidation is completed.
For example: assuming that the obtained Base64 string fragment is "7Ezdf8PoI", the result obtained after the encryption by the encryption rule of the above steps 1-7 is "5C to hj < TmG". And uploading the obtained encryption result to an OSS file server to obtain the URL link of the character string.
In this embodiment, the Base64 string is obtained by creating a canvas tag in a Web browser, drawing an image, drawing plaintext information in a fixed area of the canvas, and calling the toDataURL method of the canvas after the drawing is completed to obtain the Base64 string of the canvas. It should be appreciated that Base64 strings need to be out of order based on ascll encoding.
In one embodiment, applied to a server, a method includes: when the request sent by the server is a downloading request in an IP white list of an OSS server, the file server transmits a URL link containing an encryption result; and calling a decoding rule preset according to the ascll code to decode the URL link to obtain an encrypted character string, redrawing the encrypted character string into a canvas, cutting a picture in a fixed area of the canvas, and identifying the picture based on an OCR (optical character recognition) algorithm to obtain encrypted content attached to the picture.
In this embodiment, the OSS server adopts an IP whitelist downloading mechanism, and other people cannot acquire encrypted data through URL links, so that security is further ensured.
Further, when the OSS server receives the request from the server, it obtains a URL link containing the encrypted string.
And the server downloads the URL link to obtain the encrypted character string therein.
And restoring the encrypted character string into a Base64 character string based on a decryption rule of ascll coding.
And saving the obtained base64 character string into a picture, and storing the picture in a server local.
And intercepting user information of the fixed region of the picture. It will be appreciated that the encryption program will draw the user information in a fixed area of the picture.
And the OCR module at the server side obtains the user plaintext information contained in the picture.
It should be noted that, the encryption program deployed in the CDN server should be matched with the decryption algorithm of the server to successfully obtain the image and plaintext information.
In this embodiment, the image and the plaintext data are drawn into a canvas, the result after the drawing is encrypted according to the ascll code, and the encrypted result is uploaded to the OSS server. Because of the compatibility of canvas, the encryption program is very suitable for processing the operation of encryption and decryption at the browser side.
It should be understood that the encryption program is deployed on a preset server for front-end invocation. The decryption rule is bound with the server side, and local calling is carried out. The algorithm of encryption and decryption rules should be consistent. The decryption rule executes the inverse process of the encryption program, namely, the input ciphertext data is inversely operated according to the ascll coding encryption rule.
The decoding rules for ascll coding are set forth:
8. and drawing the image and the plaintext data into a canvas, and storing the drawn image and plaintext data into a character string in a Base64 coding format.
9. The character string in the Base64 coding format is divided into character arrays of single characters.
10. Traversing the obtained character array to obtain the ascll coding number of the array.
11. When the character code number is a multiple of 2, the code number-4 is given a new code number, and the original character is replaced by the character represented by the new code number.
12. When the character code number is not a multiple of 2, the code number +2 is used to obtain a new code number, and the original character is replaced by the character represented by the new code number.
13. After the traversal is completed, a new character array is obtained, and the character array is restored into a character string.
For example: assuming that the obtained encrypted string fragment is "5C-hj < TmG", the result is "7Ezdf8PoI" after decryption by the rule described above.
The present embodiment also provides an exemplary process of data encryption transmission, including encryption at the web side and decryption at the server side:
encryption of web side: an encryption function is defined and the input parameter img, info is received. img is the URL address of the picture, and info is the character string to be encrypted. And drawing the input parameter img and info on a canvas, and acquiring a Base64 character string after drawing. The Base64 string is encrypted based on ascll code (see 1-7 of the above embodiment), and the string is traversed to obtain the encrypted string after completion. Uploading the obtained encrypted character string through an OSS file server to obtain a URL link carrying encrypted data. And returning the file storage path and the plaintext data generated in the encoding process to a function caller to finish decryption calculation.
Server side decryption: a decryption function is defined and the incoming parameter url is received. URL refers to a URL link carrying encrypted data. And downloading the URL link to obtain the encrypted character string. Decrypting the encrypted character string based on an ascll code decryption rule (see 8-13 of the embodiment), traversing the character string, and obtaining the base64 character string after completion. And converting the decrypted base64 character string into a picture, and storing the picture in a server. The OCR module is invoked to identify encrypted content located in a fixed area. And returning the file storage path and the plaintext data generated in the decoding process to a function caller to finish decryption calculation.
Note that OCR (Optical Character Recognition ) refers to a process in which an electronic device (e.g., a scanner or a digital camera) checks characters printed on paper, determines the shape thereof by detecting dark and light patterns, and then translates the shape into computer text by a character recognition method; that is, the technology of converting the characters in the paper document into the image file of black-white lattice by optical mode and converting the characters in the image into the text format by the recognition software for further editing and processing by the word processing software is adopted. How to debug or use auxiliary information to improve recognition accuracy is the most important issue of OCR, and the term ICR (Intelligent Character Recognition) is generated accordingly. The main indexes for measuring the performance of an OCR system are as follows: rejection rate, false recognition rate, recognition speed, user interface friendliness, product stability, usability, feasibility and the like. This is the prior art, and the specific working principle is not described in this embodiment.
Based on the same inventive concept, please refer to fig. 2, fig. 2 shows a schematic block diagram of a canvas-based data encryption transmission system provided by an embodiment of the present invention, as shown in fig. 2, the system includes:
the encoding module 210 is configured to generate an encryption program based on a canvas, and deploy the encryption program under a preset site through a Web service;
the loading module 220 is configured to load the encryption program deployed at a preset site when it is detected that the web end needs to transmit image data and plaintext data;
and the transmission module 230 is configured to encode the image data and the plaintext data according to the encryption program, encrypt the encoding results of the image data and the plaintext data based on ascll encoding out-of-order encryption, and save the encryption results as character strings to upload to an OSS server to obtain URL links including the encryption results.
The canvas-based data encryption transmission system in the embodiment of the present application and the canvas-based data encryption transmission method shown in fig. 1 are based on the invention under the same concept, and by the above detailed description of the canvas-based data encryption transmission method, those skilled in the art can clearly understand the implementation process of the canvas-based data encryption transmission system in the embodiment, so that for the sake of brevity of the description, the description is omitted here.
Accordingly, in the canvas-based data encryption transmission system provided by the embodiment, the image and the plaintext data are encoded based on the encryption program generated by the canvas, so that the image and the plaintext data are both drawn on one image, then, the image is encrypted based on ascll encoding out-of-order encryption, the image and the plaintext data are encrypted, the image and the plaintext data are deeply bound, the relevance between the image and the plaintext data is greatly improved, and accordingly, the query efficiency of the target image is optimized. Furthermore, as the encrypted data is uploaded to the OSS server, the OSS server adopts an IP white list downloading mechanism, and other people cannot acquire the encrypted data through URL links, so that the security is further ensured.
In still another embodiment of the present invention, an electronic device is further provided, and referring to fig. 3, fig. 3 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 300 includes a processor 310, a memory 320, a communication interface 330, and at least one communication bus for connecting the processor 310, the memory 320, and the communication interface 330. Memory 320 includes, but is not limited to, random Access Memory (RAM), read Only Memory (ROM), erasable Programmable Read Only Memory (PROM), or portable read only memory (CD-ROM), and memory 320 is used for associated instructions and data.
The communication interface 330 is used to receive and transmit data. The processor 310 may be one or more CPUs, and in the case where the processor 310 is one CPU, the CPU may be a single core CPU or a multi-core CPU. The processor 310 in the terminal 300 is configured to read one or more programs 321 stored in the memory 320, and perform the following operations: generating an encryption program based on canvas, and deploying the encryption program under a preset site through Web service; when the web end is detected to need to transmit image data and plaintext data, loading the encryption program deployed under a preset site; and encoding the image data and the plaintext data according to the encryption program, encrypting the encoding results of the image data and the plaintext data based on ascll encoding disordered encryption, and then saving the encryption results as character strings and uploading the character strings to an OSS server to obtain URL links containing the encryption results.
It should be noted that, the specific implementation of each operation may be described in the foregoing corresponding description of the method embodiment shown in fig. 1, and the terminal 300 may be used to execute the canvas-based data encryption transmission method of the foregoing method embodiment of the present application, which is not described herein in detail.
In yet another embodiment of the present invention, a computer-readable storage medium is provided, which is a memory device in a computer device, for storing programs and data. It is understood that the computer readable storage medium herein may include both built-in storage media in a computer device and extended storage media supported by the computer device. The computer-readable storage medium provides a storage space storing an operating system of the terminal. Also stored in the memory space are one or more instructions, which may be one or more computer programs (including program code), adapted to be loaded and executed by the processor. The computer readable storage medium herein may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. One or more instructions stored in a computer-readable storage medium may be loaded and executed by a processor to implement the corresponding steps of the canvas-based data encryption transmission method in the above embodiments. It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (10)

1. The canvas-based data encryption transmission method is characterized by being applied to a web end, and comprises the following steps:
generating an encryption program based on canvas, and deploying the encryption program under a preset site through Web service;
when the web end is detected to need to transmit image data and plaintext data, loading the encryption program deployed under a preset site;
and encoding the image data and the plaintext data according to the encryption program, encrypting the encoding results of the image data and the plaintext data based on ascll encoding disordered encryption, and then saving the encryption results as character strings and uploading the character strings to an OSS server to obtain URL links containing the encryption results.
2. The canvas-based data encryption transmission method of claim 1, wherein generating the canvas-based encryption program specifically comprises:
writing encryption source codes by using a JavaScript development language, wherein writing the encryption source codes comprises defining a display area, an encryption information area, fonts and sizes of characters and a drawing range of a canvas, defining an encryption function name, and determining a parameter name, an encryption type and a data type of a return result of the encryption function;
and storing the encoded encryption source code as a JavaScript script file with the extension name of js to obtain the encryption program.
3. The canvas-based data encryption transmission method of claim 1, wherein the encryption program is loaded to the web side through a JavaScript program.
4. The canvas-based data encryption transmission method according to claim 3, wherein the encrypting program is deployed under a preset site through a Web service, specifically comprising:
deploying the encryption program in a CDN server through a web end, and acquiring a domain name address of the CDN server;
and generating an access address of the encryption program according to the domain name address.
5. The canvas based data encryption transmission method of claim 4, wherein the image data and the plaintext data are encoded according to the encryption program, comprising:
and loading an encryption program deployed on the CDN server by the JavaScript program according to the access address, transmitting an encryption function name which is pre-exposed when the JavaScript program is called into the image data and the plaintext data, and calling an encryption function corresponding to the encryption function name to encode the plaintext data to obtain an encoding result.
6. The canvas-based data encryption transmission method according to claim 1, wherein the encoding result of the image data and the plaintext data is encrypted based on ascll encoding out-of-order encryption, specifically comprising:
dividing the base64 character string into a character array formed by single characters;
traversing the characters contained in the character array, when the ascll codes of the characters are odd numbers, executing ascll codes-2 to obtain a first new character, and replacing the ascll codes with the odd numbers according to the first new character; when the ascll code of the character is even, executing ascll code +4 to obtain a second new character, and replacing the ascll code with the even character according to the second new character;
and when the traversal of the character array and the character replacement are completed, the encryption of the image data and the plaintext data is completed, and an encryption result is obtained.
7. The canvas based data encryption transmission method of claim 1, wherein the method comprises:
when the request received by the OSS server is a downloading request in an IP white list of the OSS server, the OSS server transmits a URL link containing an encryption result;
and calling a decoding rule preset according to the ascll code to decode the URL link to obtain an encrypted character string, redrawing the encrypted character string into a canvas, cutting a picture in a fixed area of the canvas, and identifying the picture based on an OCR (optical character recognition) algorithm to obtain encrypted content attached to the picture.
8. A canvas-based data encryption transmission system, the system comprising:
the encoding module is used for generating an encryption program based on canvas and deploying the encryption program under a preset site through Web service;
the loading module is used for loading the encryption program deployed under a preset site when the web terminal is detected to need to transmit the image data and the plaintext data;
and the transmission module is used for encoding the image data and the plaintext data according to the encryption program, encrypting the encoding results of the image data and the plaintext data based on ascll encoding disordered encryption, and saving the encryption results as character strings and uploading the character strings to an OSS server to obtain URL links containing the encryption results.
9. An electronic device, comprising:
at least one processor; and
at least one memory communicatively coupled to the processor, wherein,
the memory stores program instructions executable by the processor, the processor invoking the program instructions capable of performing the canvas-based data encryption transmission method as recited in any one of claims 1 to 7.
10. A computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, wherein the computer program, when executed by a processor, implements the steps of the canvas-based data encryption transmission method as claimed in any one of claims 1 to 7.
CN202310788554.1A 2023-06-29 2023-06-29 Canvas-based data encryption transmission method, system, equipment and medium Active CN116827637B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310788554.1A CN116827637B (en) 2023-06-29 2023-06-29 Canvas-based data encryption transmission method, system, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310788554.1A CN116827637B (en) 2023-06-29 2023-06-29 Canvas-based data encryption transmission method, system, equipment and medium

Publications (2)

Publication Number Publication Date
CN116827637A CN116827637A (en) 2023-09-29
CN116827637B true CN116827637B (en) 2024-03-19

Family

ID=88118072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310788554.1A Active CN116827637B (en) 2023-06-29 2023-06-29 Canvas-based data encryption transmission method, system, equipment and medium

Country Status (1)

Country Link
CN (1) CN116827637B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117456016A (en) * 2023-10-27 2024-01-26 四川中屹互联信息技术有限公司 Canvas-based image block compression and reconstruction method, system and application

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866415A (en) * 2021-02-24 2021-05-28 上海泰宇信息技术股份有限公司 Data backup private cloud storage and downloading method
CN115422561A (en) * 2022-08-18 2022-12-02 北京优锘科技有限公司 Web-end plaintext data interaction security encryption processing method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866415A (en) * 2021-02-24 2021-05-28 上海泰宇信息技术股份有限公司 Data backup private cloud storage and downloading method
CN115422561A (en) * 2022-08-18 2022-12-02 北京优锘科技有限公司 Web-end plaintext data interaction security encryption processing method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于HTML5的图像混沌加密研究与实现;姚远 等;电脑知识与技术;第13卷(第7期);参见正文66-68页 *

Also Published As

Publication number Publication date
CN116827637A (en) 2023-09-29

Similar Documents

Publication Publication Date Title
US9197692B2 (en) Remote application invocation system and method
US9413715B2 (en) URI service system and method
CN102473171A (en) Communicating information about a local machine to a browser application
US20100218077A1 (en) Modifying a markup language document which includes a clickable image
CN116827637B (en) Canvas-based data encryption transmission method, system, equipment and medium
JP2007200311A (en) Method and system for caching web service request and computer program (caching of web service request)
US10389687B2 (en) Secure document transmission
CN110730208A (en) Local device calling method and device, storage medium and device
JP6140904B2 (en) Terminal marking method, terminal marking device, program, and recording medium
US10116726B2 (en) Methods for bundling images and devices thereof
US9319244B2 (en) Methods for emailing labels as portable data files and devices thereof
US10068065B2 (en) Assignment of a machine-readable link to content as a payoff
US10209938B2 (en) Acquisition of linked versions of print content having machine-readable links
CN116382604B (en) Method, system, storage medium and equipment for printing PDF (portable document format) file on webpage
CN113326456B (en) Webpage resource acquisition method, device, equipment, system and storage medium
WO2016074568A1 (en) Method and device for generating barcode, and server
JP6197582B2 (en) Print management apparatus and program
CN113127433A (en) Local file access system, method and device and electronic equipment
JP2006146932A (en) Image server and its operation control method
CN117390332A (en) Static webpage generation method and device, electronic equipment and storage medium
CN117689523A (en) Method for processing collaborative file, file processing server and system
CN117494076A (en) Page data processing method and device, electronic equipment and storage medium
CN112965707A (en) Web multi-application single page generation method, system, computer device and medium
CN114422166A (en) Webpage access method, device, electronic equipment, medium and product
CN114020987A (en) Sample data acquisition method, device, equipment and storage medium based on webpage

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant