CN115248924A - Two-dimensional code processing method and device, electronic equipment and storage medium - Google Patents

Two-dimensional code processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115248924A
CN115248924A CN202110462309.2A CN202110462309A CN115248924A CN 115248924 A CN115248924 A CN 115248924A CN 202110462309 A CN202110462309 A CN 202110462309A CN 115248924 A CN115248924 A CN 115248924A
Authority
CN
China
Prior art keywords
dimensional code
data
image
processing
encryption algorithm
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.)
Pending
Application number
CN202110462309.2A
Other languages
Chinese (zh)
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.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software 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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110462309.2A priority Critical patent/CN115248924A/en
Publication of CN115248924A publication Critical patent/CN115248924A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K17/00Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations
    • G06K17/0022Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations arrangements or provisious for transferring data to distant stations, e.g. from a sensing device
    • G06K17/0025Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations arrangements or provisious for transferring data to distant stations, e.g. from a sensing device the arrangement consisting of a wireless interrogation device in combination with a device for optically marking the record carrier

Abstract

The embodiment of the application discloses a two-dimensional code processing method, a two-dimensional code processing device, electronic equipment and a storage medium, wherein the method comprises the following steps: responding to the acquired two-dimensional code encoding request, and acquiring data to be encoded; serializing and compressing the data to be coded to obtain compressed data; encrypting the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm; and carrying out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image. By carrying out serialization and compression processing on the data to be coded, the data accommodation capacity and transmission capacity can be improved; in addition, the symmetric encryption algorithm and the asymmetric encryption algorithm are combined to encrypt the compressed data, so that the encryption speed and the encryption safety can be further improved.

Description

Two-dimensional code processing method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of information security, and relates to but is not limited to a two-dimensional code processing method, a two-dimensional code processing device, electronic equipment and a storage medium.
Background
Two-dimensional code technology begins to appear in the eighties of the twentieth century, and is a new technology integrating information acquisition, storage, processing, coding and identification, and can code and store a lot of information, for example: characters, sound, animation, websites, fingerprints and the like, and the two-dimensional code has a wide coding range, strong information containing capability, high error correction, confidentiality and reliability, and is well developed in the fields of industry, commerce, medical treatment, national defense, traffic, logistics, warehouse storage and the like. The QR (Quick Response Code) is popular with many developers due to its characteristics of fast reading speed, low development cost, high identification accuracy, etc.
In the related art, in a two-dimensional code generation method, a preset codebook is used for generating a character string, and the character string is used for generating a two-dimensional code image, so that the process of generating a two-dimensional code is complex, the time consumption is long, and the waste of resources is easily caused; in another two-dimensional code generation method, a first network terminal automatically blocks original data to obtain block data; encrypting each block data, respectively converting the encrypted block data into corresponding two-dimensional code pictures, and displaying each two-dimensional code picture to obtain a combined two-dimensional code picture; the second network terminal scans the combined two-dimensional code, decrypts the acquired combined two-dimensional code picture and splits the combined two-dimensional code picture into corresponding two-dimensional code pictures, analyzes the two-dimensional code pictures obtained by splitting to obtain corresponding block data, merges all the block data to obtain completely merged original data, and stores the completely merged original data, namely the block and splicing identification of the two-dimensional code under the isolation of an internal network and an external network, but does not fully consider the capacity of the two-dimensional code.
Disclosure of Invention
In view of this, embodiments of the present application provide a two-dimensional code processing method and apparatus, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present application provides a two-dimensional code processing method, where the method includes: responding to the obtained two-dimensional code coding request, and obtaining data to be coded; serializing and compressing the data to be coded to obtain compressed data; encrypting the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm; and carrying out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image.
In a second aspect, an embodiment of the present application provides a two-dimensional code processing method, where the method includes: responding to the acquired two-dimensional code identification request, and acquiring a two-dimensional code image; performing two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data; decrypting the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using the asymmetric encryption algorithm; and decompressing and deserializing the compressed data to obtain the data to be coded.
In a third aspect, an embodiment of the present application provides a two-dimensional code processing apparatus, including: the acquisition module is used for responding to the acquired two-dimensional code coding request and acquiring the data to be coded; the compression module is used for carrying out serialization and compression processing on the data to be coded to obtain compressed data; the encryption module is used for encrypting the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm; and the coding module is used for carrying out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image.
In a fourth aspect, an embodiment of the present application provides a two-dimensional code processing apparatus, including: the acquisition module is used for responding to the acquired two-dimensional code identification request and acquiring a two-dimensional code image; the decoding module is used for carrying out two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data; the decryption module is used for decrypting the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using the asymmetric encryption algorithm; and the decompression module is used for decompressing and deserializing the compressed data to obtain the data to be encoded.
In a fifth aspect, an embodiment of the present application provides an electronic device, which includes a memory and a processor, where the memory stores a computer program that is executable on the processor, and the processor implements the steps in the two-dimensional code processing method according to any one of the first aspect and the second aspect of the embodiment when executing the program.
In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps in the two-dimensional code processing method according to any one of the first aspect and the second aspect of the embodiment of the present application.
In the embodiment of the application, by carrying out serialization and compression processing on the data to be coded, as the serialization processing and the compression processing both relate to the compression of the data to be coded, the data accommodation amount and the transmission amount can be increased; in addition, the compressed data is encrypted by combining the symmetric encryption algorithm and the asymmetric encryption algorithm, and the encryption speed and the encryption security can be further improved because the encryption speed of the symmetric encryption algorithm is higher and the encryption security of the asymmetric encryption algorithm is higher.
Drawings
Fig. 1 is a schematic flowchart of a two-dimensional code processing method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another two-dimensional code processing method according to the embodiment of the present application;
fig. 3 is a schematic flowchart of an encryption and decryption method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another two-dimensional code processing method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of another two-dimensional code processing method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a two-dimensional code processing apparatus according to an embodiment of the present application;
fig. 7 is a schematic diagram of a structure of another two-dimensional code processing apparatus according to an embodiment of the present application;
fig. 8 is a hardware entity diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solution of the present application is further elaborated below with reference to the drawings and the embodiments.
Fig. 1 is a schematic flowchart of a two-dimensional code processing method according to an embodiment of the present application, and as shown in fig. 1, the method may be applied to an encoding device, and the method includes:
step 102: responding to the obtained two-dimensional code coding request, and obtaining data to be coded;
the encoding device may be a device capable of encoding the acquired data to be encoded to generate a two-dimensional code image, and the encoding device may be a cloud server or a client; the data to be encoded may include at least one of a file and a file address; the file address is the address of the file; the data to be coded can be a file or a file address, so that the diversity of the data to be coded is improved; under the condition that the data volume of the file is large, only the file address can be coded into the two-dimensional code image, so that the generation efficiency of the two-dimensional code image can be improved; the file comprises file information; the file address includes address information, and the file type of the file may be Excel (table), TXT (text Format), PDF (Portable Document Format), and the like.
Step 104: serializing and compressing the data to be coded to obtain compressed data;
firstly, information such as numbers or characters can be extracted from data to be encoded, and the information such as the numbers or the characters is converted into binary data;
secondly, as the data which can be contained by the two-dimensional code is limited, in order to contain more data, the data needs to be serialized; serialization corresponds to formatting; data need to be communicated among networks, a data structure or an object is coded, then the transmission among the networks is a serialization process, and the decoding is an deserialization process;
in addition, since the amount of data that can be stored in the two-dimensional code image is limited, it is necessary to compress the formatted (i.e., serialized) data in order to increase the data capacity of the image, which makes it possible to transmit the data using the two-dimensional code image. Under the condition that the cloud server performs the two-dimensional code encoding operation on the data to be encoded, after receiving the file or the data to be encoded, the cloud server can serialize the data, and then compress the serialized data by adopting a compression algorithm.
Step 106: encrypting the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
the symmetric encryption algorithm refers to an encryption algorithm using the same key for encryption and decryption, in the symmetric encryption algorithm, an encryption key can be derived from a decryption key, and a decryption key can also be derived from the encryption key, but in most symmetric encryption algorithms, the encryption key and the decryption key are the same. The symmetric Encryption algorithm may be AES (Advanced Encryption Standard), DES (Data Encryption Standard, united states Data Encryption Standard), blowfish Encryption algorithm, etc.
Asymmetric encryption algorithms require two keys: the public key (public key for short) and the private key (private key for short) are a pair, if the public key is used for encrypting data, only the corresponding private key can be decrypted, and the algorithm is called as an asymmetric encryption algorithm because the encryption and the decryption are two different keys. The asymmetric encryption algorithm may be an RSA algorithm, an ECC (Elliptic curve cryptography), an ElGamal encryption algorithm, or the like.
In one embodiment, when encrypting compressed data, first, an RSA algorithm may be used to encrypt an initial encryption key of an AES algorithm to generate a target encryption key; secondly, the AES algorithm can encrypt the compressed data by using the target encryption key to obtain encrypted data; the compressed data is plaintext, and the encrypted data is ciphertext.
Step 108: and carrying out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image.
Wherein the encrypted data can be used for generating a two-dimensional code image; the two-dimensional code encoding process can comprise the steps of data analysis, data encoding, error correction encoding, final information construction, module arrangement in a matrix, mask, format and version information addition and the like; the data analysis step may include the substeps of determining the type of character to be encoded, selecting the required level of error correction, and selecting the version; the data encoding step may include the substeps of converting the character data into a bit stream, dividing the bit stream into one codeword per 8 bits, and filling the remaining number of data codewords; the error correction coding step may include sub-steps of dividing the codeword sequence into blocks, generating error correction codewords by blocks, placing error correction codes behind the data codewords, and the like; the step of constructing the final information may include the substeps of constructing a final sequence of block information, adding the remaining bits, etc.; the masking step may include sub-steps of masking operation, evaluating the result, and selecting a mask number; the adding format and version information step may include the substeps of generating version information and generating format information.
In the embodiment of the application, the data to be coded are serialized and compressed, and both serialization and compression relate to compression of the data to be coded, so that the data accommodation capacity and transmission capacity can be improved; in addition, the compressed data is encrypted by combining the symmetric encryption algorithm and the asymmetric encryption algorithm, and the encryption speed and the encryption security can be further improved because the encryption speed of the symmetric encryption algorithm is higher and the encryption security of the asymmetric encryption algorithm is higher.
The embodiment of the application further provides a two-dimensional code processing method, which includes:
step S202: the coding equipment extracts the data to be coded from the two-dimension code coding request;
wherein the encoding device may be a cloud server; the cloud server can receive a two-dimensional code encoding request sent by equipment sending the two-dimensional code encoding request; the device for sending the two-dimension code coding request can be a terminal device provided with a client; the client can receive data to be encoded uploaded by a user, and when the client detects that the client is networked, the data to be encoded is packaged in the two-dimensional code encoding request and is sent to the cloud server.
Step S204: the coding equipment carries out serialization and compression processing on the data to be coded to obtain compressed data;
step S206: the coding equipment encrypts the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S208: the coding equipment carries out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image;
step S210: and the coding equipment sends the two-dimension code image to equipment sending the two-dimension code coding request.
In the embodiment of the application, a client installed on a terminal device detects whether the client is networked or not after receiving data to be encoded uploaded by a user, and encapsulates the data to be encoded in a two-dimensional code encoding request to be sent to a cloud server under the condition of detecting the networking of the client, so that the cloud server can encode the data to be encoded to obtain a two-dimensional code image and receive the two-dimensional code image sent by the cloud server; the two-dimension code is processed and deployed on the cloud server, high availability is automatically achieved through the service hosted on the cloud server, calculation is distributed on a large number of distributed computers through the internet, taking is convenient, cost is low, and flexibility is high.
The embodiment of the application further provides a two-dimensional code processing method, which includes:
step S302: a client installed on a terminal device stores data to be coded uploaded by a first user to a preset storage space;
wherein the first user may be an administrator.
Step S304: the client side responds to a two-dimensional code encoding instruction triggered by a second user to the data to be encoded, and extracts the data to be encoded from the preset storage space;
the second user may be the same as the first user or different from the first user.
Step S306: under the condition that the client detects that the client is not networked, serializing and compressing the data to be coded to obtain compressed data;
step S308: the client encrypts the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S310: and the client carries out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image.
In the embodiment of the application, the client detects whether the client is networked or not, and under the condition that the client is not networked, the coding processing of the two-dimensional code is deployed on the client, so that the consumption of a cloud server is reduced, the flock effect is avoided, and the coding efficiency of the data to be coded is improved.
The embodiment of the present application further provides a two-dimensional code processing method, where the method includes:
step S402: a client installed on a terminal device stores data to be coded uploaded by a first user to a preset storage space;
wherein the first user may be an administrator.
Step S404: the client side responds to a two-dimensional code encoding instruction triggered by a second user to the data to be encoded, and extracts the data to be encoded from the preset storage space;
the second user may be the same as the first user or different from the first user.
Step S406: the client carries out serialization and compression processing on the data to be coded to obtain compressed data;
step S408: the client encrypts the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S410: and the client carries out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image.
In the embodiment of the application, the client can directly dispose the coding processing of the two-dimensional code on the client without detecting whether the client is networked, so that the consumption of a cloud server is reduced, the flock effect is avoided, and the coding efficiency of the data to be coded can be further improved due to the fact that whether the client is networked or not is omitted.
Fig. 2 is a schematic flowchart of another two-dimensional code processing method according to an embodiment of the present application, and as shown in fig. 2, the method may be applied to a decoding device, and the method includes:
step 202: the decoding equipment responds to the acquired two-dimensional code identification request to acquire a two-dimensional code image;
the decoding device may be a device capable of decoding the acquired two-dimensional code image to generate data to be encoded, and the decoding device may be a cloud server or a client.
Step 204: the decoding equipment performs two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data;
the two-dimensional code decoding processing can comprise the steps of image preprocessing, positioning position detection graphics, positioning correction graphics, perspective transformation, decoding, error correction and the like; the image preprocessing step can comprise the substeps of graying, denoising, distortion correction, binarization and the like; the step of positioning the position detection image may include searching for features of the position detection image 1; the step of localizing the corrected image may comprise estimating a lower right corner corrector from the 3 position-finding images, the images being localized by similar localization position-finding images; the perspective transformation step comprises the steps of obtaining a homography matrix according to the 3 positioning central points, the corrector central point and the coordinates of 4 ideal points, and obtaining a standard square image through perspective transformation; in the decoding and error correction step, decoding and comparing the two-dimensional code version information, the format information, the data and the error correction code, converting the data area into bit streams of 0 and 1, and checking and correcting the bit streams by using an error correction algorithm, such as Reed-Solomon (Reed-Solomon) algorithm; and after the two-dimension code coding format is judged, decoding is carried out, so that second encrypted data contained in the second two-dimension code can be obtained.
Step 206: the decoding equipment decrypts the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
step 208: and the decoding equipment decompresses and deserializes the compressed data to obtain the data to be encoded.
In the embodiment of the application, the data to be encoded is obtained by performing decoding processing, decryption processing, decompression processing and deserialization processing on the two-dimensional code image, so that the decoding speed and the decoding accuracy of the two-dimensional code image can be improved.
The embodiment of the application further provides a two-dimensional code processing method, which includes:
step S502: the decoding equipment acquires a two-dimensional code image based on the two-dimensional code identification request;
wherein the decoding device may be a cloud server; the cloud server can receive a two-dimensional code identification request sent by equipment sending the two-dimensional code identification request; the device sending the two-dimension code identification request can be a terminal device provided with a client; the client can receive the two-dimension code image uploaded by the user, responds to the two-dimension code identification instruction triggered by the user, acquires the identification of the two-dimension code image to be decoded, and encapsulates the identification of the two-dimension code image in the two-dimension code identification request and sends the two-dimension code image to the cloud server under the condition that the client detects networking of the client.
Step S504: the decoding equipment performs two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data;
step S506: the decoding equipment decrypts the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using the asymmetric encryption algorithm;
step S508: the decoding equipment decompresses and deserializes the compressed data to obtain data to be encoded;
step S510: and the decoding equipment sends the data to be coded to equipment sending the two-dimensional code identification request.
In the embodiment of the application, after receiving a two-dimensional code image uploaded by a user, a client installed on a terminal device responds to a two-dimensional code identification instruction triggered by the user to acquire an identifier of the two-dimensional code image to be decoded, detects whether the client is networked or not, and encapsulates the identifier of the two-dimensional code image in a two-dimensional code identification request to be sent to a cloud server under the condition that the client detects that the client is networked, so that the cloud server decodes the two-dimensional code image to obtain data to be encoded, and receives the data to be encoded sent by the cloud server; the two-dimension code image recognition processing is deployed on the cloud server, high availability is automatically achieved through the service hosted on the cloud server, the calculation is distributed on a large number of distributed computers through the internet, the taking is convenient, the cost is low, and the flexibility is high.
The embodiment of the application further provides a two-dimensional code processing method, which includes:
step S602: a client installed on the terminal equipment responds to a two-dimensional code identification instruction triggered by the user to acquire an identifier of a two-dimensional code image to be decoded;
step S604: the client side obtains a two-dimensional code image based on the identification of the two-dimensional code image to be decoded when detecting that the client side is not networked;
step S606: the client performs two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data;
step S608: the client decrypts the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using the asymmetric encryption algorithm;
step S610: and the client decompresses and deserializes the compressed data to obtain the data to be encoded.
In the embodiment of the application, the client detects whether the client is networked or not, and deploys the decoding processing of the two-dimensional code on the client when detecting that the client is not networked, so that the consumption of a cloud server is reduced, the flock effect is avoided, and the decoding efficiency of the two-dimensional code image is improved.
The embodiment of the application further provides a two-dimensional code processing method, which includes:
step S702: a client installed on the terminal equipment responds to the two-dimensional code identification instruction triggered by the user to acquire the identification of the two-dimensional code image to be decoded;
step S704: the client acquires a two-dimensional code image based on the identifier of the two-dimensional code image to be decoded;
step S706: the client performs two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data;
step S708: the client decrypts the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using the asymmetric encryption algorithm;
step S710: and the client decompresses and deserializes the compressed data to obtain the data to be encoded.
In the embodiment of the application, the client can directly deploy the decoding processing of the two-dimensional code on the client without detecting whether the client is networked or not, so that the consumption of a cloud server is reduced, the flock effect is avoided, and the decoding efficiency of the two-dimensional code image is improved.
The embodiment of the application further provides a two-dimensional code processing method, which can be applied to a cloud server or a client, and the method comprises the following steps:
step S802: responding to the acquired two-dimensional code encoding request, and acquiring first data to be encoded;
step S804: serializing the first data to be encoded by using a buffer storage Protocol (PB);
the data serialization tool may include PB (Protocol Buffer), XML (Extensible Markup Language), and JSON (JavaScript Object Notation); under the condition of transmitting the same data, protocol Buffers are a light and efficient structured data storage format, can be used for structured data serialization, and are very suitable for being used as a data storage or RPC (Remote Procedure Call) data exchange format. The method can be used for language-independent, platform-independent and extensible serialization structure data formats in the fields of communication protocols, data storage and the like. The compression ratio of the PB compression format of the structured data serialization and the other two formats is shown in table 1, and it can be seen from table 1 that PB can be reduced to smaller data transfer amount in bytes (byte).
TABLE 1 data Format
Data format type Size (byte)
XML format (compression) 3800
JSON format (compression) 2759
Protocol Buffer format 1154
Step S806: compressing the first data to be encoded after the serialization processing by using a preset compression algorithm to obtain first compressed data;
the preset compression algorithm may be a Huffman compression algorithm (Huffman compression), an LZW compression algorithm (Lempel-Ziv-Welch Encoding, string table compression), a Run Length Encoding (RLE), or the like.
Step S808: encrypting the first compressed data by using a symmetric encryption algorithm and a first target encryption key to obtain first encrypted data; the first target encryption key is obtained by encrypting a first initial encryption key of a symmetric encryption algorithm by using an asymmetric encryption algorithm;
the symmetric encryption algorithm can be an AES algorithm, the AES algorithm can comprise an AES encryption algorithm and an AES decryption algorithm, the asymmetric encryption algorithm can be an RSA algorithm, and the RSA algorithm can comprise an RSA encryption algorithm and an RSA decryption algorithm; the AES encryption algorithm and the RSA encryption algorithm are used for an encryption process; the AES decryption algorithm and the RSA decryption algorithm are used for the decryption process.
Fig. 3 is a schematic flowchart of an encryption and decryption method according to an embodiment of the present application, and referring to fig. 3, the first compressed data may be a plaintext 302, and first, an RSA encryption algorithm 304 in an asymmetric encryption algorithm may be used to encrypt a first initial encryption key 306, so as to obtain a first target encryption key 308; secondly, the AES encryption algorithm 310 in the symmetric encryption algorithm may be used to encrypt the first compressed data, that is, the plaintext 302, using the first target encryption key 308, so as to obtain a ciphertext 312, where the ciphertext 312 is the first encrypted data.
Step S810: performing two-dimensional code encoding processing on the first encrypted data by using a bar code image processing library ZXing to obtain a first two-dimensional code image;
where ZXing is an open-source, 1-dimensional or 2D barcode image processing library implemented in Java in a variety of formats, which contains ports for linking to other languages. ZXing can realize that a Create QRBitmp. CreateQRCodeBitmap method is called to generate a two-dimensional code image; the scanning and decoding of the two-dimensional code can be completed by using a built-in camera of the user terminal or a camera on the cloud server.
In the embodiment of the application, the first encrypted data are subjected to two-dimensional code coding processing through ZXing to obtain a first two-dimensional code image, and the generated two-dimensional code image is more vivid and accurate due to the fact that ZXing documents are more comprehensive.
Step S812: responding to the acquired two-dimensional code identification request, and acquiring a second two-dimensional code image;
the second two-dimensional code image and the first two-dimensional code image may be the same or different.
Step S814: performing two-dimensional code decoding processing on the second two-dimensional code image to obtain second encrypted data;
the completion of scanning and decoding of the second two-dimensional code image using the camera may be realized by using the decoding class of ZXing in which the two-dimensional code encoding processing is performed on the first encrypted data in step S810.
Step S816: decrypting the second encrypted data by using a symmetric encryption algorithm and a decryption key to obtain second compressed data; the decryption key is obtained by decrypting a second initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
in one embodiment, when decrypting the second encrypted data, referring to fig. 3, the second encrypted data may be the ciphertext 312, and first, the RSA decryption algorithm 314 in the asymmetric encryption algorithm may be used to decrypt the second initial encryption key 316 of the symmetric encryption algorithm, so as to obtain the decryption key 318; secondly, the AES decryption algorithm 320 in the symmetric encryption algorithm may be used to decrypt the ciphertext 312 using the decryption key 318, so as to obtain a plaintext 322, where the plaintext 322 is the second compressed data.
Assuming that the first two-dimensional code image and the second two-dimensional code image are the same, the first encrypted data and the second encrypted data may be the same, the second initial encryption key may be the same as the first initial encryption key, and the decryption key may be the same as the first target encryption key.
Step S818: and decompressing and deserializing the second compressed data to obtain second data to be encoded.
The second compressed data may be decompressed by using the compression algorithm used in compressing the first data to be encoded in step S806, so as to obtain decompressed data; then, deserializing the decompressed data by using the serialization tool used for serializing the first data to be encoded in step S804 to obtain second data to be encoded, where the second data to be encoded is similar to the first data to be encoded and includes at least one of a file and a file address; the file address is the address of the file; and under the condition that the second data to be encoded is a file address, a user can inquire a corresponding file according to the file address under the condition that the second two-dimensional code image is decoded to obtain the file address.
The embodiment of the application further provides a two-dimensional code processing method, which can be applied to a cloud server or a client, and the method comprises the following steps:
step S902: responding to the acquired two-dimensional code encoding request, and acquiring first data to be encoded;
step S904: serializing and compressing the first data to be encoded to obtain first compressed data;
step S906: encrypting the first compressed data by using a symmetric encryption algorithm and a first target encryption key to obtain first encrypted data; the first target encryption key is obtained by encrypting a first initial encryption key of a symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S908: carrying out two-dimensional code encoding processing on the first encrypted data to obtain a first two-dimensional code image;
step S910: responding to the acquired two-dimensional code identification request, and acquiring a second two-dimensional code image;
step S912: performing graying processing, histogram equalization processing, image smoothing processing, filtering and denoising processing and image binarization processing on the second two-dimensional code image to obtain a preprocessed second two-dimensional code image;
the extracted second two-dimensional code image often has distortion of different degrees, and even the image which looks complete and clear has distortion. In order to obtain a relatively ideal image processing result, the second two-dimensional code image to be recognized needs to be preprocessed, and the preprocessing process may include steps of image graying, histogram equalization, image smoothing, filtering denoising, image binarization and the like.
The gray-scale image can be obtained by performing image graying on a color image (namely, an RGB (Red/Green/Blue) image), and the gray-scale image only contains brightness information and does not contain color information, so that the calculation amount is reduced conveniently. Reasonable graying plays an important role in extracting information in an image and processing the image subsequently.
And processing the image by using a histogram equalization method to enhance the image. The gray scale distribution of most natural images is in a narrow interval, so that the images cannot be clearly identified, the images are subjected to nonlinear stretching by adopting histogram equalization, the gray scale distribution of the images is more uniform or the distance is enlarged, and the images obtained by the method are clearer and easier to identify. The formula for calculating the gray histogram is shown in the following formula (1), where k represents the gray value at the k-th level, N represents the total number of pixels in the whole image, and p (k) represents the probability distribution of the gray value at the k-th level, where
Figure BDA0003042811060000111
n k The number of pixel points representing the grayscale value of the k-th level.
Figure BDA0003042811060000112
The transmitted image may be subjected to various interferences due to poor instructions of a transmission channel and a sampling system in a transmission process, the image may also have some fine burrs, the burrs are caused by noise distributed in a high-frequency part, and image smoothing is to eliminate the noise in the image by using the property of the noise to solve the interference information. There are many filtering algorithms, wherein the median filtering algorithm can better eliminate salt-pepper noise, and a gaussian filter is a convolution operation, so that the method is very effective in inhibiting noise which obeys normal distribution, and can keep the overall gray characteristic of an image.
When the image is subjected to binarization operation, a proper threshold value can be selected, the gray values of pixel points in the image are set to be 0 and 255, the whole image is changed into the effect of only black and white, the operation is convenient for extracting image information, and the identification degree of the image is increased. The image can be binarized by using a maximum inter-class variance method, which is a self-adaptive global threshold segmentation method, and the threshold can be obtained according to the statistical characteristics of the whole image.
Step S914: decoding the preprocessed second two-dimensional code image to obtain second encrypted data;
step S916: decrypting the second encrypted data by using a symmetric encryption algorithm and a decryption key to obtain second compressed data; the decryption key is obtained by decrypting a second initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S918: and decompressing and deserializing the second compressed data to obtain second data to be encoded.
In the embodiment of the application, the two-dimensional code image is subjected to image graying before the two-dimensional code image is identified, so that the calculation amount can be reduced; histogram equalization is carried out on the two-dimensional code image, so that the two-dimensional code image is clearer and is easy to identify; the two-dimensional code image is subjected to image smoothing and filtering denoising, and the recognition accuracy of the two-dimensional code image can be improved through denoising; the image binaryzation is carried out on the two-dimensional code image, so that the image information in the two-dimensional code image can be conveniently extracted, and the identification accuracy of the two-dimensional code image is improved.
The embodiment of the present application further provides a two-dimensional code processing method, where the method includes:
step S1002: a first client installed on a terminal device stores first data to be encoded uploaded by a first user to a preset storage space;
wherein the first user may be an administrator.
Step S1004: the first client responds to a two-dimensional code coding instruction triggered by a second user to the first data to be coded, extracts the data to be coded from the preset storage space, and detects whether the first client is networked or not;
the second user may be the same as the first user or different from the first user.
Step S1006: under the condition of networking of the first client, the first client packages the first data to be encoded in a two-dimensional code encoding request and sends the two-dimensional code encoding request to the cloud server;
step S1008: the cloud server receives a two-dimensional code coding request sent by a first client; extracting first data to be encoded from the two-dimensional code encoding request;
the two-dimensional code encoding request can be sent to a cloud server by a first client installed on the terminal device; the two-dimensional code encoding request can carry first data to be encoded, and the first data to be encoded can be extracted from the two-dimensional code encoding request.
Step S1010: the cloud server serializes and compresses the first data to be encoded to obtain first compressed data;
step S1012: the cloud server encrypts the first compressed data by using a symmetric encryption algorithm and a first target encryption key to obtain first encrypted data; the first target encryption key is obtained by encrypting a first initial encryption key of a symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S1014: the cloud server carries out two-dimensional code coding processing on the first encrypted data to obtain a first two-dimensional code image;
step S1016: the cloud server sends the first two-dimensional code image to the first client;
the cloud server can return the first two-dimensional code image to the first client after processing the first to-be-encoded data to obtain the first two-dimensional code image.
Step S1018: the second client responds to a two-dimensional code recognition instruction triggered by a second user on the second two-dimensional code image, obtains the identifier of the two-dimensional code image to be decoded, and detects whether the second client is networked or not;
the second user may be a common user, and the second client may be the same as the first client or different from the first client.
Step S1020: the second client encapsulates the identifier of the second two-dimensional code image in a two-dimensional code identification request and sends the two-dimensional code identification request to the cloud server under the condition of networking of the second client;
step S1022: the cloud server receives a two-dimensional code identification request sent by a second client; acquiring a second two-dimension code image based on the two-dimension code identification request;
the two-dimension code identification request can be sent to a cloud server by a second client installed on the terminal; the two-dimensional code encoding request may carry an identifier of the two-dimensional code image, and the two-dimensional code image corresponding to the identifier of the two-dimensional code image may be acquired and determined as the second two-dimensional code image.
Step S1024: the cloud server performs two-dimensional code decoding processing on the second two-dimensional code image to obtain second encrypted data;
step S1026: the cloud server decrypts the second encrypted data by using a symmetric encryption algorithm and a decryption key to obtain second compressed data; the decryption key is obtained by decrypting a second initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S1028: the cloud server decompresses and deserializes the second compressed data to obtain second data to be encoded;
step S1030: and the cloud server sends the second data to be encoded to the second client.
After the cloud server processes the second two-dimensional code image to obtain second data to be encoded, the cloud server may return the second data to be encoded to the second client.
The first client and the second client may be the same client or different clients.
In the embodiment of the application, the encoding and decoding processing of the two-dimensional code is deployed on the cloud server, the high availability is automatically realized through the service hosted on the cloud server, the calculation is distributed on a large number of distributed computers through the internet, the taking is convenient, the cost is low, and the flexibility is high.
The embodiment of the application further provides a two-dimensional code processing method, which includes:
step S1102: a client installed on a terminal device stores first data to be encoded uploaded by a first user to a preset storage space;
step S1104: the client responds to a two-dimensional code coding instruction triggered by a second user to the first data to be coded, extracts the data to be coded from the preset storage space, and detects whether the client is networked or not;
the second user may be the same as or different from the first user. The two-dimensional code encoding instruction can be triggered based on the uploading operation of the first data to be encoded by a user.
It is easy to understand that under the condition that the client is networked, the first data to be encoded can be packaged in the two-dimensional code encoding request and sent to the cloud server, so that the cloud server can obtain the first data to be encoded based on the two-dimensional code encoding request, and perform serialization and compression processing, encryption processing and two-dimensional code encoding processing on the first data to be encoded to obtain the first two-dimensional code image.
Step S1106: the client carries out serialization and compression processing on the first data to be encoded under the condition that the client is not networked to obtain first compressed data;
step S1108: the client encrypts the first compressed data by using a symmetric encryption algorithm and a first target encryption key to obtain first encrypted data; the first target encryption key is obtained by encrypting a first initial encryption key of a symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S1110: the client carries out two-dimensional code coding processing on the first encrypted data to obtain a first two-dimensional code image;
step S1112: the client responds to the two-dimension code identification instruction triggered by the user and detects whether the client is networked or not;
step S1114: under the condition that the client is not networked, acquiring the identifier of the two-dimensional code image to be decoded based on the two-dimensional code identification instruction;
the two-dimensional code recognition instruction may also be referred to as a two-dimensional code decoding instruction, and the two-dimensional code recognition instruction may be triggered based on a scanning operation of a user on the second two-dimensional code image and may be determined as an identifier of the second two-dimensional code according to the second two-dimensional code image.
It is easy to understand that, under the condition that the client is networked, the identifier of the second two-dimensional code image can be encapsulated in the two-dimensional code identification request and sent to the cloud server, so that the cloud server can obtain the second two-dimensional code image based on the identifier of the two-dimensional code image to be decoded carried in the two-dimensional code identification request, and perform two-dimensional code decoding processing, decryption processing, decompression and deserialization processing on the second two-dimensional code image to obtain second data to be encoded.
Step S1116: the client acquires a second two-dimensional code image based on the identifier of the two-dimensional code image to be decoded;
the client acquires the two-dimensional code image corresponding to the identifier of the two-dimensional code image according to the identifier of the two-dimensional code image, and determines the two-dimensional code image as a second two-dimensional code image.
Step S1118: the client performs two-dimensional code decoding processing on the second two-dimensional code image to obtain second encrypted data;
step S1120: the client decrypts the second encrypted data by using a symmetric encryption algorithm and a decryption key to obtain second compressed data; the decryption key is obtained by decrypting a second initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S1122: the client decompresses and deserializes the second compressed data to obtain second data to be encoded;
in the embodiment of the application, whether the client is networked or not is detected, and the encoding and decoding processing of the two-dimensional code is deployed on the client under the condition that the client is not networked, so that the consumption of a cloud server is reduced, the flock effect is avoided, and the recognition efficiency of the two-dimensional code is improved.
The embodiment of the present application further provides a two-dimensional code processing method, where the method includes:
step S1202: a client installed on a terminal device stores first data to be encoded uploaded by a first user to a preset storage space;
step S1204: the client side responds to a two-dimensional code encoding instruction triggered by a second user to the first data to be encoded, and extracts the first data to be encoded from the preset storage space;
wherein the first user and the second user may be the same or different.
Step S1206: the client carries out serialization and compression processing on the first data to be encoded to obtain first compressed data;
step S1208: the client encrypts the first compressed data by using a symmetric encryption algorithm and a first target encryption key to obtain first encrypted data; the first target encryption key is obtained by encrypting a first initial encryption key of a symmetric encryption algorithm by using an asymmetric encryption algorithm;
step 1210: the client carries out two-dimensional code coding processing on the first encrypted data to obtain a first two-dimensional code image;
step S1212: the client responds to the two-dimension code identification instruction triggered by the user, and the identification of the two-dimension code image to be decoded is obtained based on the two-dimension code identification instruction;
step S1214: the client acquires a second two-dimensional code image based on the identifier of the two-dimensional code image to be decoded;
step S1216: the client performs two-dimensional code decoding processing on the second two-dimensional code image to obtain second encrypted data;
step S1218: the client decrypts the second encrypted data by using a symmetric encryption algorithm and a decryption key to obtain second compressed data; the decryption key is obtained by decrypting a second initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
step S1220: and the client decompresses and deserializes the second compressed data to obtain second data to be encoded.
In the embodiment of the application, the encoding and decoding processing of the two-dimensional code is deployed on the client, so that the consumption of a cloud server is reduced, the flock effect is avoided, and the recognition efficiency of the two-dimensional code is improved.
Fig. 4 is a diagram of another two-dimensional code processing method according to an embodiment of the present application, which is applied to a two-dimensional code processing system, where the two-dimensional code processing system includes a client and a cloud server, and the method includes:
step 402: a first user uploads first data to be encoded to a first client;
the first data to be encoded can be a file or data, and the data can be a file address; the first user can upload the first data to be encoded to the first client by using an uploading function; the two-dimension code encoding request can carry first data to be encoded; the first user may be an administrator.
Step 404: the first client sends the first data to be encoded to the cloud server;
step 406: the cloud server encodes the first data to be encoded;
the cloud server performs two-dimensional code encoding operation on the first data to be encoded to obtain a first two-dimensional code image;
wherein, the two-dimensional code encoding operation may include the following steps 4061 to 4064:
step 4061: the cloud server acquires binary data;
information such as numbers or characters can be extracted from the uploaded file and/or the address of the file (namely the first data to be encoded), and the information such as the numbers or the characters can be converted into binary data.
Step 4062: the cloud server formats and compresses the data;
the data formatting is data serialization, and the process of performing serialization and compression processing on the data may refer to the description in step 104, step 804, and step 806, and is not described herein again.
Step 4063: the cloud server encrypts the data;
the process of encrypting the data may refer to the descriptions in step 106 and step S808, and is not described herein again.
Step 4064: the cloud server encodes the data to generate an image;
the process of encoding the data may refer to the descriptions in step 108 and step S810, and is not described herein again.
In another embodiment, the first client can also perform the two-dimensional code encoding operation on the first data to be encoded locally without sending the first data to be encoded to the cloud server for the two-dimensional code encoding operation; in another embodiment, the client can also detect whether the client is networked, and in the networking case, the first data to be encoded is sent to the cloud server, and the cloud server performs two-dimensional code encoding operation, and in the non-networking case, the client performs two-dimensional code encoding operation.
Step 408: the cloud server returns the two-dimensional code image obtained by encoding to the first client;
step 410: the second client uploads the image;
a second user can log in a second client to identify a second two-dimensional code image, wherein the second user can be a common user; the first client and the second client may be the same or different.
Step 412: the second client detects whether the second client is networked or not, if not, the step 414 is executed; if yes, go to step 416;
when detecting an image identification request of a user, the second client detects whether a local network is connected, namely, whether the second client is connected with the cloud server is detected; if the second client is in a networking environment, namely the second client is communicated with the cloud server, the second client sends the second two-dimensional code image to the cloud server for analysis; and if the second client is in an offline environment without networking, namely the second client is not communicated with the cloud server, offline analysis is carried out on the second client.
Step 414: the second client decodes the second two-dimensional code image;
decoding the second two-dimensional code image at a second client to obtain second data to be coded;
the two-dimensional code decoding operation in step 414 may include steps 4141 to 4144 of:
step 4141: performing image preprocessing on the second two-dimensional code image; the image preprocessing process may include image graying 41411, image smoothing 41412, filtering denoising 41413 and image binarization 41414, and it should be noted that the image preprocessing process may further include histogram equalization; the image preprocessing process can be referred to the description in step S912, and is not described herein again.
Step 4142: performing image recognition on the preprocessed second two-dimensional code image; in the image recognition process, the description of the two-dimensional code decoding processing process in step S814 may be referred to, and second encrypted data may be obtained after the image recognition is performed on the second two-dimensional code image; and will not be described in detail herein.
Step 4143: decrypting the identified second encrypted data; the process of decrypting the data may refer to the description in step S816, and the second compressed data may be obtained after the second encrypted data is decrypted; and will not be described in detail herein.
Step 4144: decompressing and deserializing the decrypted second compressed data; the process of decompressing and deserializing the data may refer to the description in step S818, and the second data to be encoded may be obtained after decompressing and deserializing the second compressed data; and will not be described in detail herein.
Step 416: the cloud server decodes the second two-dimensional code image;
the cloud server can perform two-dimensional code decoding operation on the second two-dimensional code image to obtain second data to be encoded; the step of performing the decoding operation on the cloud server is the same as the step of performing the decoding operation on the second client, see step 4141 to step 4144, and the two-dimensional code decoding operation performed on the cloud server may also include image preprocessing, recognizing the preprocessed image, decrypting the recognized data, and decompressing and deserializing the decrypted data, which is not described herein again.
Step 418: the cloud server returns the second data to be coded obtained by decoding to the second client;
the second data to be encoded may include a file or a data set, where the data set may be a file address, and the second data to be encoded may be sent to a second client.
Fig. 5 is a diagram of another two-dimensional code processing method according to an embodiment of the present application, which is applied to a two-dimensional code processing system, where the two-dimensional code processing system includes a client and a cloud server, and referring to fig. 5, the method includes:
step 502: the administrator uploads a test case file on the client;
step 504: the client sends the test case file to a cloud server;
step 506: the cloud server encodes the test case file;
the cloud server can perform two-dimensional code encoding operation on the test case file to obtain an encoded two-dimensional code image;
step 508: the cloud server returns the coded two-dimensional code image to the client;
step 510: the administrator shares the two-dimensional code image to other users;
wherein, the other users may include user 1, user 2, user 3, user X, and the like.
Step 512: each user of other users logs in the client;
step 514: each user identifies the two-dimensional code image;
step 516: the client detects whether the client is networked, if not, step 518 is executed, and if yes, step 522 is executed;
when detecting a two-dimensional code identification request of a user for a two-dimensional code image, a client detects whether networking is performed, namely whether the client is communicated with a cloud server, if not, the client is in an offline mode, and if so, the client is in an online mode.
Step 518: the client decodes the two-dimensional code to obtain a test case file;
step 520: a user downloads a test case file;
each user sending the two-dimensional code image identification request can download the test case file;
step 522: the client sends the two-dimensional code image to a cloud server;
step 524: the cloud server decodes the two-dimensional code;
the cloud server can perform two-dimensional code decoding operation to obtain a test case file;
step 526: the cloud server returns the decoded test case file to the client;
step 528: a user downloads a test case file;
and each user sending the two-dimensional code image identification request can download the test case file.
In the embodiment of the application, the online mode and the offline mode are adopted, and an administrator can put the shared test case data file or the file address of the shared test case data file into an image according to actual requirements and transmit the image to other users. The user obtains the shared two-dimensional code, logs in the client to click and download shared information, the shared information is a shared test case data file, and the server acquires the file or a file address through identifying the image, so that information transmission is achieved. If the mode is the offline mode, the image recognition function can be put on the client side to be executed, and if the mode is the online mode, the recognition can be carried out through the cloud service. According to the embodiment of the application, the images are processed and identified, and the images are combined with an encryption technology, so that a safe, stable and reliable transmission environment is provided by means of cloud service. The consumption of the server is reduced, the flock effect is avoided, and the recognition speed is improved.
With the development of artificial intelligence and the continuous improvement of computer vision, image recognition is gradually taken up as one branch of the artificial intelligence, and the work and the life of people are influenced by the image recognition. Modern life is more and more informationized, and the expression forms of information are more diversified. Two-dimensional code technology begins to appear in the eighties of the twentieth century, is a new technology integrating information acquisition, storage, processing, coding and identification, and can code and store a lot of information, for example: characters, sound, animation, websites, fingerprints and the like, and the two-dimensional code has a wide coding range, strong information containing capability, high error correction, confidentiality and reliability, and is well developed in the fields of industry, commerce, medical treatment, national defense, traffic, logistics, warehouse storage and the like. The QR (Quick Response Code) is popular with many developers due to its characteristics of fast reading speed, low development cost, and high recognition accuracy. With the gradual maturity of cloud computing, the tendency of hosting services to the cloud is also high, and a cloud server is a network-based high-availability computing mode, and has high security, better performance and reliability and lower cost.
Firstly, in the related art, only the blocking and splicing identification of the two-dimensional code under the isolation of the internal network and the external network are performed, but the security of the two-dimensional code, the stability of the service and the user experience of the encoding and decoding operation are not fully considered. Secondly, in the related art, the security and capacity of the user using the two-dimensional code are not sufficiently considered, and a specific application is not provided. Moreover, in the related art, when the two-dimensional code image is generated, the process is complex, and the safety is not high enough.
According to the embodiment of the application, a client (for example, a mobile phone application terminal) is used for calling the encoding and decoding and encryption and decryption functions of an image (two-dimensional code) to realize data transmission, data can be compressed in the process, for example, in test case review in the early stage of testing, and the test case is put into the image to perform information sharing and transmission.
In an embodiment, the encryption of the data in the embodiment of the present application may be implemented by combining AES and RSA algorithms, that is, the encryption speed is guaranteed, and the security of data transmission is also guaranteed.
In one embodiment, the back-end service can be deployed on a cloud server to automatically realize high availability of the hosted service, and the computing is distributed on a large number of distributed computers through the internet, so that the method is convenient to take and use, low in cost and high in flexibility.
In one embodiment, the method can be divided into an online mode and an offline mode, the image coding and decoding and the image encryption and decoding are carried out at the cloud server when the cloud server is connected with the network, the image encryption and decoding and the image coding and decoding can be carried out at the client in the offline mode without the network, the consumption of the server is reduced, the flock effect is avoided, and the identification speed is increased.
In one embodiment, the embodiment of the application provides an image-based data transmission method, which can be applied to data transmission at a mobile phone end or a Web (World Wide Web) end through a two-dimensional code, and realizes the functions of generating and identifying images through hosting of a cloud server by relying on a digital image processing technology and an encryption technology. On one hand, the safety of data transmission and the feasibility of user identification are ensured; on the other hand, an off-line mode and an on-line mode are provided, the use convenience is ensured when no network connection exists, the method can also be applied to data exchange in an internal and external network physical isolation environment, and a new practice is provided for two-dimensional code data transmission.
In one embodiment, the purpose of the embodiment of the application is to mainly apply an image recognition technology and an encryption technology to the encoding and decoding process of a two-dimensional code. The data transmission process firstly needs to encode the data, the file is formatted and compressed after the file data is obtained in the encoding process, then the data is encrypted, the data encryption is mainly realized through two algorithms of AES and RSA, and finally a two-dimensional code image is generated and returned to a client for use. The decoding process carries out preprocessing and identification on the image, then carries out operations of decryption, decompression and deserialization, and finally obtains data information in the image and returns the data information to the client.
In one embodiment, the data transmission method is provided based on a digital image processing technology and an encryption technology, encryption and decryption of images are achieved by means of cloud services, compression processing is performed on the data, transmission quantity is improved, transmission efficiency is guaranteed, an online implementation mode and an offline implementation mode are provided from the perspective of users, and the data transmission mode based on the images is more meaningful.
In one embodiment, in the embodiment of the application, the two-dimensional code image is compressed and serialized, and is combined with an encryption technology, so that the safety of information transmission is ensured, and the accommodating capacity is increased. The server side is hosted to the cloud server, so that the application is more stable and efficient, and meanwhile, the cost is saved. The application of a client is provided by combining an off-line mode and an on-line mode, and the experience of a user is enriched. By combining the encryption technology with the image recognition technology, the security of the transmission medium is ensured. Instead of deploying services on machines (physical machines) in a general manner, the cloud services are utilized to build self-application. A new safe mode is provided for information sharing, and a new practice is provided for application of the two-dimensional code.
Based on the foregoing embodiments, an embodiment of the present application provides a two-dimensional code processing apparatus, which includes modules that can be implemented by a processor in an electronic device; of course, the implementation can also be realized through a specific logic circuit; in the implementation process, the processor may be a Central Processing Unit (CPU), a Microprocessor Unit (MPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), or the like.
Fig. 6 is a schematic structural diagram of a two-dimensional code processing apparatus according to an embodiment of the present application, and as shown in fig. 6, the apparatus 600 includes an obtaining module 601, a compressing module 602, an encrypting module 603, and an encoding module 604, where:
an obtaining module 601, configured to obtain to-be-coded data in response to an obtained two-dimensional code coding request;
a compression module 602, configured to perform serialization and compression processing on the data to be encoded to obtain compressed data;
an encryption module 603, configured to encrypt the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of a symmetric encryption algorithm by using the asymmetric encryption algorithm;
the encoding module 604 is configured to perform two-dimensional code encoding processing on the encrypted data to obtain a two-dimensional code image.
In an embodiment, the obtaining module 601 is configured to extract data to be encoded from a two-dimensional code encoding request; the device further comprises: and the sending unit is used for sending the two-dimension code image to equipment for sending the two-dimension code coding request.
In an embodiment, the two-dimension code encoding request is a two-dimension code encoding instruction, and the obtaining module 601 includes: the storage unit is used for storing the data to be coded uploaded by the user to a preset storage space; the extracting unit is used for responding to a two-dimensional code encoding instruction triggered by a user to the data to be encoded, and extracting the data to be encoded from the preset storage space; and the sending unit is used for encapsulating the data to be encoded in the two-dimensional code encoding request and sending the two-dimensional code encoding request to the cloud server under the condition of detecting the networking of the sending unit.
Fig. 7 is a schematic diagram of a composition structure of another two-dimensional code processing apparatus according to an embodiment of the present application, and as shown in fig. 7, the apparatus 700 includes an obtaining module 701, a decoding module 702, a decrypting module 703 and a decompressing module 704, where:
an obtaining module 701, configured to obtain a two-dimensional code image in response to an obtained two-dimensional code identification request;
a decoding module 702, configured to perform two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data;
a decryption module 703, configured to decrypt the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
the decompression module 704 is configured to decompress and deserialize the compressed data to obtain data to be encoded.
In one embodiment, the obtaining module 701 is configured to obtain a two-dimensional code image based on the two-dimensional code identification request; the device further comprises: and the sending module is used for sending the data to be coded to the equipment for sending the two-dimensional code identification request.
In an embodiment, the two-dimensional code identification request is a two-dimensional code identification instruction, and the obtaining module 701 includes: the first acquisition unit is used for responding to a two-dimensional code identification instruction triggered by the user and acquiring the identifier of a two-dimensional code image to be decoded; the second acquisition unit is used for acquiring the two-dimensional code image based on the identifier of the two-dimensional code image to be decoded under the condition that the second acquisition unit detects that the second acquisition unit is not networked; and the sending unit is used for encapsulating the identifier of the two-dimensional code image to be decoded in the two-dimensional code identification request and sending the two-dimensional code image to the cloud server under the condition of detecting the self networking.
In one embodiment, the decoding module 702 comprises: the preprocessing unit is used for carrying out graying processing, histogram equalization processing, image smoothing processing, filtering and denoising processing and image binarization processing on the two-dimensional code image to obtain a preprocessed two-dimensional code image; and the decoding unit is used for decoding the preprocessed two-dimensional code image to obtain encrypted data.
It should be noted that, in the embodiment of the present application, if the two-dimensional code processing method is implemented in the form of a software functional module and is sold or used as an independent product, the two-dimensional code processing method may also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially implemented or a part contributing to the related art may be embodied in the form of a software product stored in a storage medium, and including a plurality of instructions for enabling an electronic device (which may be a mobile phone, a tablet computer, a desktop computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensing device, etc.) to execute all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a magnetic disk, or an optical disk. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
The above description of the apparatus embodiments, similar to the above description of the method embodiments, has similar beneficial effects as the method embodiments. For technical details not disclosed in the embodiments of the apparatus of the present application, reference is made to the description of the embodiments of the method of the present application for understanding.
Correspondingly, an embodiment of the present application provides an electronic device, fig. 8 is a schematic diagram of a hardware entity of the electronic device according to the embodiment of the present application, and as shown in fig. 8, the hardware entity of the electronic device 800 includes: the two-dimensional code processing method comprises a memory 801 and a processor 802, wherein the memory 801 stores a computer program capable of running on the processor 802, and the processor 802 executes the computer program to realize the steps of the two-dimensional code processing method of the embodiment.
The Memory 801 is configured to store instructions and applications executable by the processor 802, and may also buffer data (e.g., image data, audio data, voice communication data, and video communication data) to be processed or already processed by the processor 802 and modules in the electronic device 800, and may be implemented by a FLASH Memory (FLASH) or a Random Access Memory (RAM).
Correspondingly, the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps in the two-dimensional code processing method provided in the foregoing embodiments.
It is to be noted here that: the above description of the storage medium and device embodiments, like the description of the method embodiments above, has similar advantageous effects as the device embodiments. For technical details not disclosed in the embodiments of the storage medium and method of the present application, reference is made to the description of the embodiments of the apparatus of the present application for understanding.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in the various embodiments of the present application, the sequence numbers of the above-mentioned processes do not imply any order of execution, and the order of execution of the processes should be determined by their functions and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation 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 may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one of 8230, and" comprising 8230does not exclude the presence of additional like elements in a process, method, article, or apparatus comprising the element.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units; can be located in one place or distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment. In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps of implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer-readable storage medium, and when executed, executes the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as a removable Memory device, a Read Only Memory (ROM), a magnetic disk, or an optical disk. Alternatively, the integrated unit described above may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially implemented or a part contributing to the related art may be embodied in the form of a software product stored in a storage medium, and including a plurality of instructions for enabling a computer device (which may be a mobile phone, a tablet computer, a desktop computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensing device, etc.) to execute all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a removable storage device, a ROM, a magnetic or optical disk, or other various media that can store program code.
The methods disclosed in the several method embodiments provided in the present application may be combined arbitrarily without conflict to obtain new method embodiments. The features disclosed in the several product embodiments presented in this application can be combined arbitrarily, without conflict, to arrive at new product embodiments. The features disclosed in the several method or apparatus embodiments provided herein may be combined in any combination to arrive at a new method or apparatus embodiment without conflict.
The above description is only for the embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. A two-dimension code processing method is applied to coding equipment, and the method comprises the following steps:
responding to the obtained two-dimensional code coding request, and obtaining data to be coded;
serializing and compressing the data to be coded to obtain compressed data;
encrypting the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of a symmetric encryption algorithm by using the asymmetric encryption algorithm;
and carrying out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image.
2. The method according to claim 1, wherein the obtaining of the data to be encoded in response to the obtained two-dimensional code encoding request includes:
extracting data to be encoded from the two-dimensional code encoding request;
after the two-dimensional code encoding processing is performed on the encrypted data to obtain a two-dimensional code image, the method further includes: and sending the two-dimension code image to equipment sending the two-dimension code coding request.
3. The method according to claim 1, wherein the two-dimensional code encoding request is a two-dimensional code encoding instruction, and the acquiring data to be encoded in response to the acquired two-dimensional code encoding request includes:
storing data to be coded uploaded by a user to a preset storage space;
responding to a two-dimensional code encoding instruction triggered by a user to the data to be encoded, and extracting the data to be encoded from the preset storage space;
and under the condition that self networking is detected, packaging the data to be coded in the two-dimensional code coding request and sending the two-dimensional code coding request to a cloud server.
4. A two-dimensional code processing method is applied to a decoding device, and comprises the following steps:
responding to the acquired two-dimension code identification request, and acquiring a two-dimension code image;
performing two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data;
decrypting the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
and carrying out decompression and deserialization on the compressed data to obtain the data to be encoded.
5. The method according to claim 4, wherein the acquiring a two-dimensional code image in response to the acquired two-dimensional code identification request comprises:
acquiring a two-dimension code image based on the two-dimension code identification request;
after the decompressing and deserializing the compressed data to obtain the data to be encoded, the method further includes: and sending the data to be coded to equipment sending the two-dimensional code identification request.
6. The method according to claim 4, wherein the two-dimensional code recognition request is a two-dimensional code recognition instruction, and the acquiring a two-dimensional code image in response to the acquired two-dimensional code recognition request comprises:
responding to a two-dimensional code identification instruction triggered by the user, and acquiring an identifier of a two-dimensional code image to be decoded;
under the condition that the two-dimensional code image is not networked, acquiring the two-dimensional code image based on the identifier of the two-dimensional code image to be decoded;
and under the condition that the self networking is detected, encapsulating the identification of the two-dimensional code image to be decoded in the two-dimensional code identification request and sending the two-dimensional code image to a cloud server.
7. The method according to any one of claims 4 to 6, wherein the performing two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data includes:
carrying out graying processing, histogram equalization processing, image smoothing processing, filtering and denoising processing and image binarization processing on the two-dimensional code image to obtain a preprocessed two-dimensional code image;
and decoding the preprocessed two-dimensional code image to obtain the encrypted data.
8. A two-dimensional code processing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for responding to the acquired two-dimensional code coding request and acquiring data to be coded;
the compression module is used for carrying out serialization and compression processing on the data to be coded to obtain compressed data;
the encryption module is used for encrypting the compressed data by using a symmetric encryption algorithm and a target encryption key to obtain encrypted data; the target encryption key is obtained by encrypting an initial encryption key of the symmetric encryption algorithm by using an asymmetric encryption algorithm;
and the coding module is used for carrying out two-dimensional code coding processing on the encrypted data to obtain a two-dimensional code image.
9. The two-dimensional code processing apparatus is characterized in that the apparatus comprises:
the acquisition module is used for responding to the acquired two-dimensional code identification request and acquiring a two-dimensional code image;
the decoding module is used for carrying out two-dimensional code decoding processing on the two-dimensional code image to obtain encrypted data;
the decryption module is used for decrypting the encrypted data by using a symmetric encryption algorithm and a decryption key to obtain compressed data; the decryption key is obtained by decrypting an initial encryption key of the symmetric encryption algorithm by using the asymmetric encryption algorithm;
and the decompression module is used for decompressing and deserializing the compressed data to obtain the data to be encoded.
10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program operable on the processor, and wherein the processor implements the steps of the two-dimensional code processing method according to any one of claims 1 to 7 when executing the program.
11. A computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps in the two-dimensional code processing method according to any one of claims 1 to 7.
CN202110462309.2A 2021-04-27 2021-04-27 Two-dimensional code processing method and device, electronic equipment and storage medium Pending CN115248924A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110462309.2A CN115248924A (en) 2021-04-27 2021-04-27 Two-dimensional code processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110462309.2A CN115248924A (en) 2021-04-27 2021-04-27 Two-dimensional code processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115248924A true CN115248924A (en) 2022-10-28

Family

ID=83697260

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110462309.2A Pending CN115248924A (en) 2021-04-27 2021-04-27 Two-dimensional code processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115248924A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115758434A (en) * 2023-01-06 2023-03-07 深圳奥联信息安全技术有限公司 Data high-efficiency coding encryption method
CN115906898A (en) * 2023-02-23 2023-04-04 青岛创新奇智科技集团股份有限公司 Method and device for decoding DataMatrix code

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115758434A (en) * 2023-01-06 2023-03-07 深圳奥联信息安全技术有限公司 Data high-efficiency coding encryption method
CN115758434B (en) * 2023-01-06 2023-05-12 深圳奥联信息安全技术有限公司 Efficient coding and encrypting method for data
CN115906898A (en) * 2023-02-23 2023-04-04 青岛创新奇智科技集团股份有限公司 Method and device for decoding DataMatrix code

Similar Documents

Publication Publication Date Title
US11902559B2 (en) Detection of video tampering
JP6608436B2 (en) Encoder, decoder and method using partial data encryption
CN112600665B (en) Hidden communication method, device and system based on block chain and encryption technology
CN115248924A (en) Two-dimensional code processing method and device, electronic equipment and storage medium
Zhang et al. Harnessing the hybrid cloud for secure big image data service
US20210288946A1 (en) Methods and apparatuses for oblivious transfer using trusted environment
Pudi et al. Secure and lightweight compressive sensing using stream cipher
CN112491832B (en) File transmission method and device
Pizzolante et al. A secure low complexity approach for compression and transmission of 3-D medical images
Liu et al. Joint data hiding and compression scheme based on modified BTC and image inpainting
JP7143973B2 (en) Secret data concealment method, program for implementing same, and secret data communication system
CN107948038A (en) A kind of LAN interoperability methods
Abas et al. Increasing data storage of coloured QR code using compress, multiplexing and multilayered technique
Cao et al. Separable reversible data hiding in encrypted VQ-encoded images
Vidhya et al. Evaluation and performance analysis of Chinese remainder theorem and its application to lossless image compression
Deshmukh et al. Hash based least significant bit technique for video steganography
US10320559B2 (en) Network communication encoder using key pattern encryption
CN116156072A (en) Steganographic image generation method, steganographic information extraction method and related devices
Abed A proposed encoding and hiding text in an image by using fractal image compression
Banerjee et al. A secure high-capacity video steganography using bit plane slicing through (7, 4) hamming code
EP3985989A1 (en) Detection of modification of an item of content
Duda et al. Image-like 2d barcodes using generalizations of the Kuznetsov–Tsybakov problem
Chow et al. Covert QR codes: How to hide in the crowd
KR101957812B1 (en) Method for performing encoding and decoding in use of feature space in artificial intelligence image analysis and apparatus using the same
Gupta et al. Video Steganography Using Discrete Wavelet Transform and Artificial Intelligence

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