CN112508145B - Electronic seal generation and verification method and device, electronic equipment and storage medium - Google Patents

Electronic seal generation and verification method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112508145B
CN112508145B CN202011490636.0A CN202011490636A CN112508145B CN 112508145 B CN112508145 B CN 112508145B CN 202011490636 A CN202011490636 A CN 202011490636A CN 112508145 B CN112508145 B CN 112508145B
Authority
CN
China
Prior art keywords
seal
electronic
dimensional code
record
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011490636.0A
Other languages
Chinese (zh)
Other versions
CN112508145A (en
Inventor
孔晶晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202011490636.0A priority Critical patent/CN112508145B/en
Publication of CN112508145A publication Critical patent/CN112508145A/en
Application granted granted Critical
Publication of CN112508145B publication Critical patent/CN112508145B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/33User authentication using certificates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/36User authentication by graphic or iconic representation
    • 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/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Collating Specific Patterns (AREA)

Abstract

The invention relates to a data security technology, and discloses an electronic seal generation and verification method, which comprises the following steps: generating an original seal image and seal record of an electronic file by using a preset electronic seal system, storing the seal record in the electronic seal system, generating a two-dimensional code corresponding to the electronic file, adding the two-dimensional code into the original seal image to obtain a standard seal image, converting the standard seal image into a gray image, analyzing two-dimensional code information in the gray image, searching the seal record in the electronic seal system by using the two-dimensional code information, and comparing the two-dimensional code information with the seal record to obtain an electronic seal verification result. In addition, the invention also relates to a blockchain technology, and the seal record can be stored in a node of the blockchain. The invention also provides an electronic seal generating and verifying device, electronic equipment and a computer readable storage medium. The invention can solve the problem of lower identification accuracy of the electronic seal.

Description

Electronic seal generation and verification method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data security technologies, and in particular, to a method and apparatus for generating and verifying an electronic seal, an electronic device, and a computer readable storage medium.
Background
At present, the electronic seal is fully used in various large fields, the traditional physical seal is simulated by a digital technology, and the management and use modes of the electronic seal accord with the use habit of the traditional physical seal. The electronic seal overcomes many defects of the traditional seal, has better safety, and the electronic seal is convenient to seal in different places, compared with the traditional seal, the electronic seal is convenient to seal, saves time and labor, greatly saves office cost and improves office efficiency.
In the printing process of an electronic file with an electronic seal, the authenticity of the seal is generally difficult to distinguish due to the influence of printing quality of printed paper or a printer, and the electronic seal is influenced by factors such as image processing, image deviation during printing, light rays, angles, pixels and the like during shooting, so that hidden data for identifying the seal is difficult to identify when the electronic seal is truly identified, and therefore the authenticity of the seal is difficult to distinguish.
Disclosure of Invention
The invention provides a method and a device for generating and verifying an electronic seal and a computer readable storage medium, and mainly aims to solve the problem of low identification accuracy of the electronic seal.
In order to achieve the above object, the present invention provides a method for generating and verifying an electronic seal, including:
generating an original seal image of an electronic file by using a preset electronic seal system, generating a seal record, and storing the seal record in the electronic seal system;
generating a two-dimensional code corresponding to the electronic file, and adding the two-dimensional code into the original seal image to obtain a standard seal image;
converting the standard seal image into a gray image, and analyzing two-dimensional code information in the gray image;
searching a corresponding seal record in the electronic seal system by utilizing the two-dimensional code information;
and comparing the two-dimensional code information with the information recorded by the seal to obtain an electronic seal verification result.
Optionally, the generating the original seal image of the electronic file by using the preset electronic seal system and generating the seal record includes:
extracting file information in the electronic file, and generating a unique identifier of the file information by using the preset electronic seal system;
generating the original seal image and seal information corresponding to the original seal image by utilizing the unique mark;
and summarizing the file information and the stamping information to obtain the seal record.
Optionally, the generating the two-dimensional code corresponding to the electronic file and adding the two-dimensional code to the original seal image to obtain a standard seal image includes:
acquiring unique identifiers of the seal record and the file information, and encoding the unique identifiers of the seal record and the file information according to a preset two-dimensional code rule to generate the two-dimensional code;
and adding the two-dimensional code into the original seal image according to a preset arrangement rule to obtain the standard seal image.
Optionally, the converting the standard seal image into a gray image includes:
traversing all pixel points in the standard seal image, calculating the gray value of each pixel point, and carrying out iterative processing according to the gray value to obtain a target threshold;
and setting the pixel point with the gray value larger than the target threshold value as white, and setting the pixel point with the gray value smaller than the target threshold value as black, so as to obtain the gray image.
Optionally, the calculating the gray value of each pixel point, performing iterative processing according to the gray value to obtain a target threshold value, includes:
step A: calculating gray value G of each pixel point i (i=1,2,3…n);
And (B) step (B): according to the gray value G i Calculating the average gray value T of all pixel points 0 And with said T 0 As a threshold value;
step C: determining a pixel point with a gray value larger than or equal to the threshold value as a foreground, determining a pixel point with a gray value smaller than the threshold value as a background, and calculating an average gray value G of the foreground f Average gray value G of the background b And according to the average gray value G of the foreground f And average gray value G of background b Updating the threshold to T k
Step D: repeating said step C until said threshold value T k And when the change no longer occurs, obtaining a target threshold value.
Optionally, the searching the corresponding seal record in the electronic seal system by using the two-dimensional code information includes:
extracting a unique identifier in the two-dimensional code information, and searching a corresponding seal record from the electronic seal system by utilizing the unique identifier;
if the corresponding seal record cannot be found, judging that the seal verification fails;
and if the corresponding seal record is found, extracting the seal record.
Optionally, the step of comparing the two-dimensional code information with the information recorded by the seal to obtain an electronic seal verification result includes:
judging that the seal verification fails when the seal record in the two-dimensional code information is inconsistent with the extracted data in the seal record;
and judging that the seal verification is successful when the seal record in the two-dimensional code information is consistent with the extracted data in the seal record.
In order to solve the above problems, the present invention further provides an electronic seal generating and verifying device, the device comprising:
the electronic seal generation module is used for generating an original seal image of an electronic file by using a preset electronic seal system, generating a seal record and storing the seal record in the electronic seal system;
the two-dimensional code generation module is used for generating a two-dimensional code corresponding to the electronic file, and adding the two-dimensional code into the original seal image to obtain a standard seal image;
the two-dimensional code analysis module is used for converting the standard seal image into a gray image and analyzing two-dimensional code information in the gray image;
the seal record searching module is used for searching a corresponding seal record in the electronic seal system by utilizing the two-dimensional code information;
and the electronic seal verification module is used for obtaining an electronic seal verification result by comparing the two-dimensional code information with the information recorded by the seal.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
a memory storing at least one instruction; and
And the processor executes the instructions stored in the memory to realize the electronic seal generation and verification method.
In order to solve the above-mentioned problems, the present invention further provides a computer readable storage medium having at least one instruction stored therein, the at least one instruction being executed by a processor in an electronic device to implement the above-mentioned electronic seal generation and verification method.
The method and the device generate the two-dimensional code corresponding to the electronic file, and add the two-dimensional code into the original seal image, so that the original seal image is directly identified to be changed into the two-dimensional code, and the two-dimensional code has certain error correction capability, so that even if the two-dimensional code is partially damaged, the identification can be better performed. And the standard seal image is converted into the gray image, so that the influence of factors such as shooting light rays and pixels on the image can be reduced, the two-dimensional code in the gray image is identified, and the identification accuracy can be improved. Therefore, the method, the device, the electronic equipment and the computer readable storage medium for generating and verifying the electronic seal can solve the problem of low identification accuracy of the electronic seal.
Drawings
FIG. 1 is a flow chart of a method for generating and verifying an electronic seal according to an embodiment of the present invention;
FIG. 2 is a detailed flow chart of one of the steps shown in FIG. 1;
FIG. 3 is a detailed flow chart of another step of FIG. 1;
fig. 4 is a schematic diagram of a preset two-dimensional code arrangement rule;
FIG. 5 is a detailed flow chart of another step of FIG. 1;
FIG. 6 is a detailed flow chart of another step of FIG. 1;
FIG. 7 is a functional block diagram of an electronic seal generating and verifying device according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device for implementing the electronic seal generating and verifying method according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides an electronic seal generation and verification method. The execution subject of the electronic seal generation and verification method includes, but is not limited to, at least one of a server, a terminal, and the like, which can be configured to execute the method provided by the embodiment of the application. In other words, the electronic seal generation and verification method may be performed by software or hardware installed in a terminal device or a server device, where the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, a flow chart of a method for generating and verifying an electronic seal according to an embodiment of the invention is shown. In this embodiment, the electronic seal generating and verifying method includes:
s1, generating an original seal image of an electronic file by using a preset electronic seal system, generating a seal record, and storing the seal record in the electronic seal system.
In the embodiment of the present invention, the electronic file may be a file that needs to be stamped to be effective in each field, for example: government documents of government authorities, case documents of hospitals and loan document sets of banks. The preset electronic seal system (also called as electronic signature system) is composed of a digital certificate authentication system (public security PKI/CA system), an electronic seal management system, an electronic signature authentication system and client electronic signature software. In the embodiment of the invention, the electronic signature of the electronic file is executed mainly by the client electronic signature software.
Preferably, referring to fig. 2, the generating an original seal image of an electronic file by using a preset electronic seal system and generating a seal record includes:
s10, extracting file information in the electronic file, and generating a unique identifier of the file information by using the preset electronic seal system;
s11, generating the original seal image and seal information corresponding to the original seal image by utilizing the unique mark;
and S12, summarizing the file information and the stamping information to obtain the seal record.
Wherein the file information includes: file content, file digests, etc. The unique identifier is generated by the electronic seal system and can be a character string, a number and the like. The stamping information comprises: serial number of seal, date of seal, person of seal, place of seal, etc.
Furthermore, the original seal image can be subjected to uniqueness verification through the unique identification and the seal record.
S2, generating a two-dimensional code corresponding to the electronic file, and adding the two-dimensional code into the original seal image to obtain a standard seal image.
Preferably, the two-dimensional code is a two-dimensional code (2-dimensional bar code), which is a graph of recording data symbol information, wherein the graph is distributed on a plane (in a two-dimensional direction) according to a certain rule by using a certain specific geometric figure, and the graph records the data symbol information alternately in black and white, and a plurality of geometric shapes corresponding to binary are used for representing literal numerical information. Compared with the traditional one-dimensional code, the two-dimensional code can only express information in one direction (generally horizontal direction), and the two-dimensional code can store information in both horizontal and vertical directions, so that the application field of the two-dimensional code is much wider.
Preferably, referring to fig. 3, the S2 includes:
s20, acquiring unique identifiers of the seal record and the file information, and encoding the unique identifiers of the seal record and the file information according to a preset two-dimensional code rule to generate the two-dimensional code;
s21, adding the two-dimensional code into the original seal image according to a preset arrangement rule to obtain the standard seal image.
The preset two-dimensional Code rule may be a currently disclosed two-dimensional Code rule such as PDF417 two-dimensional bar Code, datamatrix two-dimensional bar Code, QR Code, code 49, code 16K, code one, etc. The preset arrangement rule can be arranged and adjusted according to the actually used electronic seal, as shown in fig. 4, for the electronic seal with less middle area, the two-dimensional code can be added to one side of the seal, and for the electronic seal with more middle area, the two-dimensional code can be directly added to the inside of the seal.
Further, in the embodiment of the invention, the unique identifier of the seal record and the file information is stored by using the two-dimensional code, and the seal record can be correctly restored to be processed even if the two-dimensional code is partially damaged because the two-dimensional code has a certain error correction capability. Meanwhile, the two-dimensional code has larger storable information capacity, and can store Chinese characters, numbers, pictures and other information better.
S3, converting the standard seal image into a gray image, and analyzing two-dimensional code information in the gray image.
When the embodiment of the invention is used for verifying the electronic seal, the standard seal image is firstly subjected to binarization processing to obtain a gray image.
Due to the influence of equipment, environment and the like, when the two-dimensional code in the standard seal image is directly identified to verify the electronic seal, the phenomenon of lower decoding efficiency can occur. According to the embodiment of the invention, the binarization processing is carried out on the standard seal image, so that the influence of factors such as environment, equipment and the like on the decoding efficiency of the two-dimensional code can be reduced.
The binarization processing means that the gray value of a point on the standard seal image is converted into 0 or 255, namely the whole image shows obvious black-white effect. The gray values of 256 brightness levels in the standard seal image are converted into gray images which can still reflect the whole and partial characteristics of the image through proper threshold selection. The standard seal image can also be obtained by photographing through mobile equipment such as a mobile phone. The two-dimensional code information comprises file information, unique identification of the file information, seal information and the like.
Preferably, referring to fig. 5, the converting the standard seal image into a gray image includes:
s30, traversing all pixel points in the standard seal image, calculating the gray value of each pixel point, and carrying out iterative processing according to the gray value to obtain a target threshold;
and S31, setting the pixel point with the gray value larger than the target threshold value as white, and setting the pixel point with the gray value smaller than the target threshold value as black, so as to obtain the gray image.
Further, the calculating the gray value of each pixel point, performing iterative processing according to the gray value to obtain a target threshold value, including:
step A: calculating gray value G of each pixel point i
Figure BDA0002839536480000071
Figure BDA0002839536480000072
And (B) step (B): according to the gray value G i Calculating the average gray value T of all pixel points 0
Figure BDA0002839536480000073
And with said T 0 As a threshold value;
step C: determining a pixel point with a gray value larger than or equal to the threshold value as a foreground, determining a pixel point with a gray value smaller than the threshold value as a background, and calculating an average gray value G of the foreground f Average gray value G of the background b And according to the average gray value G of the foreground f And average gray value G of background b Updating the threshold to T k
Figure BDA0002839536480000074
Step D: repeating said step C until said threshold value T k No longer occursAnd when the target threshold value is changed, obtaining the target threshold value.
RGB (red, green, blue, three primary color mode) is used to represent brightness, for a total of 256 levels, numbered 0, 1, 2. RGB (red, green and blue) min Is the minimum value of RGB in pixel points and RGB max G is the maximum value of RGB in the pixel point max For the maximum gray value, G, in the pixel point min Is the minimum gray value in the pixel point.
And S4, searching a corresponding seal record in the electronic seal system by utilizing the two-dimensional code information.
Preferably, referring to fig. 6, the searching the corresponding seal record in the electronic seal system by using the two-dimensional code information includes:
s40, extracting a unique identifier in the two-dimensional code information, and searching a corresponding seal record from the electronic seal system by utilizing the unique identifier;
if the corresponding seal record cannot be found, S41 is executed, and the seal verification failure is judged;
and if the corresponding seal record is found, executing S42, and extracting the seal record.
Further, in the embodiment of the present invention, the verification method may be adjusted according to actual service requirements, for example, the corresponding stamp record may be searched from the electronic stamp system by extracting the stamping serial number in the two-dimensional code information.
S5, comparing the two-dimensional code information with the information recorded by the seal to obtain an electronic seal verification result.
Preferably, the step of comparing the two-dimensional code information with the information recorded by the seal to obtain an electronic seal verification result includes:
judging that the seal verification fails when the seal record in the two-dimensional code information is inconsistent with the extracted data in the seal record;
and judging that the seal verification is successful when the seal record in the two-dimensional code information is consistent with the extracted data in the seal record.
Further, in the embodiment of the present invention, the above verification method may be adjusted according to actual service requirements, for example, only whether part of the file information (such as a file abstract) in the two-dimensional code information and part of the file information (such as a file abstract) in the seal record are consistent is compared, and the overall verification speed may be improved by reducing the number of comparison information.
According to the method, the two-dimensional code is generated according to the electronic file, and the two-dimensional code is added into the original seal image, so that the original seal image is directly identified to be the two-dimensional code, and the two-dimensional code has certain error correction capability, so that even if the two-dimensional code is partially damaged, the identification can be better performed. And the standard seal image is converted into the gray image, so that the influence of factors such as shooting light rays and pixels on the image can be reduced, the two-dimensional code in the gray image is identified, and the identification accuracy can be improved. Therefore, the embodiment of the invention can solve the problem of low identification accuracy of the electronic seal.
Fig. 7 is a functional block diagram of an electronic seal generating and verifying device according to an embodiment of the present invention.
The electronic seal generating and verifying apparatus 100 of the present invention may be mounted in an electronic device. According to the implemented functions, the electronic seal generating and verifying device 100 may include an electronic seal generating module 101, a two-dimensional code generating module 102, a two-dimensional code analyzing module 103, a seal record searching module 104, and an electronic seal verifying module 105. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the electronic seal generating module 101 is configured to generate an original seal image of an electronic file by using a preset electronic seal system, generate a seal record, and store the seal record in the electronic seal system.
In the embodiment of the present invention, the electronic file may be a file that needs to be stamped to be effective in each field, for example: government documents of government authorities, case documents of hospitals and loan document sets of banks. The preset electronic seal system (also called as electronic signature system) is composed of a digital certificate authentication system (public security PKI/CA system), an electronic seal management system, an electronic signature authentication system and client electronic signature software. In the embodiment of the invention, the electronic signature of the electronic file is executed mainly by the client electronic signature software.
Preferably, the electronic seal generating module 101 obtains an original seal image by the following operations, and generates a seal record:
extracting file information in the electronic file, and generating a unique identifier of the file information by using the preset electronic seal system;
generating the original seal image and seal information corresponding to the original seal image by utilizing the unique mark;
and summarizing the file information and the stamping information to obtain the seal record.
Wherein the file information includes: file content, file digests, etc. The unique identifier is generated by the electronic seal system and can be a character string, a number and the like. The stamping information comprises: serial number of seal, date of seal, person of seal, place of seal, etc.
Furthermore, the original seal image can be subjected to uniqueness verification through the unique identification and the seal record.
The two-dimension code generating module 102 is configured to generate a two-dimension code corresponding to the electronic file, and add the two-dimension code to the original seal image to obtain a standard seal image.
Preferably, the two-dimensional code is a two-dimensional code (2-dimensional bar code), which is a graph of recording data symbol information, wherein the graph is distributed on a plane (in a two-dimensional direction) according to a certain rule by using a certain specific geometric figure, and the graph records the data symbol information alternately in black and white, and a plurality of geometric shapes corresponding to binary are used for representing literal numerical information. Compared with the traditional one-dimensional code, the two-dimensional code can only express information in one direction (generally horizontal direction), and the two-dimensional code can store information in both horizontal and vertical directions, so that the application field of the two-dimensional code is much wider.
Preferably, the two-dimensional code generating module 102 obtains the standard seal image by:
acquiring unique identifiers of the seal record and the file information, and encoding the unique identifiers of the seal record and the file information according to a preset two-dimensional code rule to generate the two-dimensional code;
and adding the two-dimensional code into the original seal image according to a preset arrangement rule to obtain the standard seal image.
The preset two-dimensional Code rule may be a currently disclosed two-dimensional Code rule such as PDF417 two-dimensional bar Code, datamatrix two-dimensional bar Code, QR Code, code 49, code 16K, code one, etc. The preset arrangement rules can be arranged and adjusted according to the electronic seal in actual use, two-dimension codes can be added to one side of the seal for the electronic seal with fewer middle areas, and two-dimension codes can be directly added to the inside of the seal for the electronic seal with more middle areas.
Further, in the embodiment of the invention, the unique identifier of the seal record and the file information is stored by using the two-dimensional code, and the seal record can be correctly restored to be processed even if the two-dimensional code is partially damaged because the two-dimensional code has a certain error correction capability. Meanwhile, the two-dimensional code has larger storable information capacity, and can store Chinese characters, numbers, pictures and other information better.
The two-dimensional code analysis module 103 is configured to convert the standard seal image into a gray image, and analyze two-dimensional code information in the gray image.
When the embodiment of the invention is used for verifying the electronic seal, the standard seal image is firstly subjected to binarization processing to obtain a gray image.
Due to the influence of equipment, environment and the like, when the two-dimensional code in the standard seal image is directly identified to verify the electronic seal, the phenomenon of lower decoding efficiency can occur. According to the embodiment of the invention, the binarization processing is carried out on the standard seal image, so that the influence of factors such as environment, equipment and the like on the decoding efficiency of the two-dimensional code can be reduced.
The binarization processing means that the gray value of a point on the standard seal image is converted into 0 or 255, namely the whole image shows obvious black-white effect. The gray values of 256 brightness levels in the standard seal image are converted into gray images which can still reflect the whole and partial characteristics of the image through proper threshold selection. The standard seal image can also be obtained by photographing through mobile equipment such as a mobile phone. The two-dimensional code information comprises file information, unique identification of the file information, seal information and the like.
Preferably, the two-dimensional code analysis module 103 converts the standard seal image into a gray image by:
traversing all pixel points in the standard seal image, calculating the gray value of each pixel point, and carrying out iterative processing according to the gray value to obtain a target threshold;
and setting the pixel point with the gray value larger than the target threshold value as white, and setting the pixel point with the gray value smaller than the target threshold value as black, so as to obtain the gray image.
Further, the two-dimensional code parsing module 103 obtains the target threshold value by:
step A: calculating gray value G of each pixel point i
Figure BDA0002839536480000111
Figure BDA0002839536480000112
And (B) step (B): according to the gray value G i Calculating the average gray value T of all pixel points 0
Figure BDA0002839536480000113
And with said T 0 As a threshold value;
step C: determining a pixel point with a gray value larger than or equal to the threshold value as a foreground, determining a pixel point with a gray value smaller than the threshold value as a background, and calculating an average gray value G of the foreground f Average gray value G of the background b And according to the average gray value G of the foreground f And average gray value G of background b Updating the threshold to T k
Figure BDA0002839536480000114
Step D: repeating said step C until said threshold value T k And when the change no longer occurs, obtaining a target threshold value.
RGB (red, green, blue, three primary color mode) is used to represent brightness, for a total of 256 levels, numbered 0, 1, 2. RGB (red, green and blue) min Is the minimum value of RGB in pixel points and RGB max G is the maximum value of RGB in the pixel point max For the maximum gray value, G, in the pixel point min Is the minimum gray value in the pixel point.
The seal record searching module 104 is configured to search a corresponding seal record in the electronic seal system by using the two-dimensional code information.
Preferably, the stamp record searching module 104 searches the electronic stamp system for the corresponding stamp record by:
extracting a unique identifier in the two-dimensional code information, and searching a corresponding seal record from the electronic seal system by utilizing the unique identifier;
if the corresponding seal record cannot be found, judging that the seal verification fails;
and if the corresponding seal record is found, extracting the seal record.
Further, in the embodiment of the present invention, the verification method may be adjusted according to actual service requirements, for example, the corresponding stamp record may be searched from the electronic stamp system by extracting the stamping serial number in the two-dimensional code information.
The electronic seal verification module 105 is configured to obtain an electronic seal verification result by comparing the two-dimensional code information with the seal recorded information.
Preferably, the electronic seal verification module 105 obtains an electronic seal verification result by:
judging that the seal verification fails when the seal record in the two-dimensional code information is inconsistent with the extracted data in the seal record;
and judging that the seal verification is successful when the seal record in the two-dimensional code information is consistent with the extracted data in the seal record.
Further, in the embodiment of the present invention, the above verification method may be adjusted according to actual service requirements, for example, only whether part of the file information (such as a file abstract) in the two-dimensional code information and part of the file information (such as a file abstract) in the seal record are consistent is compared, and the overall verification speed may be improved by reducing the number of comparison information.
Fig. 8 is a schematic structural diagram of an electronic device for implementing an electronic seal generating and verifying method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as an electronic stamp generation and verification program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may in other embodiments also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes of the electronic stamp generating and verifying program 12, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device 1 and processes data by running or executing programs or modules (e.g., electronic stamp generation and verification programs, etc.) stored in the memory 11, and calling data stored in the memory 11.
The bus may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
Fig. 8 shows only an electronic device with components, and it will be appreciated by a person skilled in the art that the structure shown in fig. 8 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or may be arranged in different components.
For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
Further, the electronic device 1 may also comprise a network interface, optionally the network interface may comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the electronic device 1 and other electronic devices.
The electronic device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The electronic stamp generating and verifying program 12 stored in the memory 11 of the electronic device 1 is a combination of a plurality of instructions, which when executed in the processor 10, can implement:
generating an original seal image of an electronic file by using a preset electronic seal system, generating a seal record, and storing the seal record in the electronic seal system;
generating a two-dimensional code corresponding to the electronic file, and adding the two-dimensional code into the original seal image to obtain a standard seal image;
converting the standard seal image into a gray image, and analyzing two-dimensional code information in the gray image;
searching a corresponding seal record in the electronic seal system by utilizing the two-dimensional code information;
and comparing the two-dimensional code information with the information recorded by the seal to obtain an electronic seal verification result.
Specifically, the specific implementation method of the above instruction by the processor 10 may refer to descriptions of related steps in the corresponding embodiments of fig. 1 to 6, which are not repeated herein.
Further, the modules/units integrated in the electronic device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. The computer readable storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present invention also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
generating an original seal image of an electronic file by using a preset electronic seal system, generating a seal record, and storing the seal record in the electronic seal system;
generating a two-dimensional code corresponding to the electronic file, and adding the two-dimensional code into the original seal image to obtain a standard seal image;
converting the standard seal image into a gray image, and analyzing two-dimensional code information in the gray image;
searching a corresponding seal record in the electronic seal system by utilizing the two-dimensional code information;
and comparing the two-dimensional code information with the information recorded by the seal to obtain an electronic seal verification result.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (7)

1. An electronic seal generation and verification method, the method comprising:
extracting file information in an electronic file, generating a unique identifier of the file information by using a preset electronic seal system, generating an original seal image by using the unique identifier, and sealing information corresponding to the original seal image, summarizing the file information and the sealing information to obtain a seal record, and storing the seal record in the electronic seal system;
generating a two-dimensional code corresponding to the electronic file by utilizing the seal record and the unique identification of the file information, and adding the two-dimensional code into the original seal image to obtain a standard seal image;
traversing all pixel points in the standard seal image, calculating the gray value of each pixel point, and carrying out iterative processing according to the gray value to obtain a target threshold value, wherein the method comprises the following steps: step A: calculating the gray value Gi, i=1, 2,3 … n of each pixel, step B: calculating an average gray value T0 of all pixel points according to the gray value Gi, and taking the T0 as a threshold value, and step C: determining a pixel point with a gray value larger than or equal to the threshold value as a foreground, determining a pixel point with a gray value smaller than the threshold value as a background, calculating an average gray value Gf of the foreground and an average gray value Gb of the background, and updating the threshold value to Tk according to the average gray value Gf of the foreground and the average gray value Gb of the background, wherein the step D: repeating the step C until the threshold Tk is not changed any more, and obtaining a target threshold;
setting the pixel point with the gray value larger than the target threshold value as white, setting the pixel point with the gray value smaller than the target threshold value as black, obtaining a gray image, and analyzing two-dimensional code information in the gray image;
searching a corresponding seal record in the electronic seal system by utilizing the two-dimensional code information;
and comparing the two-dimensional code information with the information recorded by the seal, or comparing whether part of file information in the two-dimensional code information is consistent with part of file information in the seal record, so as to obtain an electronic seal verification result.
2. The method for generating and verifying an electronic seal according to claim 1, wherein generating the two-dimensional code corresponding to the electronic file using the seal record and the unique identifier of the file information, and adding the two-dimensional code to the original seal image, and obtaining a standard seal image, comprises:
acquiring unique identifiers of the seal record and the file information, and encoding the unique identifiers of the seal record and the file information according to a preset two-dimensional code rule to generate the two-dimensional code;
and adding the two-dimensional code into the original seal image according to a preset arrangement rule to obtain the standard seal image.
3. The method for generating and verifying an electronic seal according to claim 2, wherein the step of searching the corresponding seal record in the electronic seal system by using the two-dimensional code information comprises the steps of:
extracting a unique identifier in the two-dimensional code information, and searching a corresponding seal record from the electronic seal system by utilizing the unique identifier;
if the corresponding seal record cannot be found, judging that the seal verification fails;
and if the corresponding seal record is found, extracting the seal record.
4. The method for generating and verifying an electronic seal according to claim 3, wherein the step of obtaining the verification result of the electronic seal by comparing the two-dimensional code information with the information recorded by the seal comprises the steps of:
judging that the seal verification fails when the seal record in the two-dimensional code information is inconsistent with the extracted data in the seal record;
and judging that the seal verification is successful when the seal record in the two-dimensional code information is consistent with the extracted data in the seal record.
5. An electronic seal generation and verification device, the device comprising:
the electronic seal generation module is used for extracting file information in an electronic file, generating a unique identifier of the file information by using a preset electronic seal system, generating an original seal image by using the unique identifier, and summarizing the file information and the seal information corresponding to the original seal image to obtain a seal record, and storing the seal record in the electronic seal system;
the two-dimensional code generation module is used for generating a two-dimensional code corresponding to the electronic file, and adding the two-dimensional code into the original seal image to obtain a standard seal image;
the two-dimensional code analysis module is used for traversing all pixel points in the standard seal image, calculating the gray value of each pixel point, carrying out iterative processing according to the gray value to obtain a target threshold value, and comprises the following steps: step A: calculating the gray value Gi, i=1, 2,3 … n of each pixel, step B: calculating an average gray value T0 of all pixel points according to the gray value Gi, and taking the T0 as a threshold value, and step C: determining a pixel point with a gray value larger than or equal to the threshold value as a foreground, determining a pixel point with a gray value smaller than the threshold value as a background, calculating an average gray value Gf of the foreground and an average gray value Gb of the background, and updating the threshold value to Tk according to the average gray value Gf of the foreground and the average gray value Gb of the background, wherein the step D: repeating the step C until the threshold Tk is not changed any more, and obtaining a target threshold; setting the pixel point with the gray value larger than the target threshold value as white, setting the pixel point with the gray value smaller than the target threshold value as black, obtaining a gray image, and analyzing two-dimensional code information in the gray image;
the seal record searching module is used for searching a corresponding seal record in the electronic seal system by utilizing the two-dimensional code information;
and the electronic seal verification module is used for obtaining an electronic seal verification result by comparing the two-dimensional code information with the information recorded by the seal or comparing whether part of file information in the two-dimensional code information is consistent with part of file information in the seal record.
6. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the electronic seal generation and verification method of any one of claims 1 to 4.
7. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the electronic seal generation and verification method according to any one of claims 1 to 4.
CN202011490636.0A 2020-12-16 2020-12-16 Electronic seal generation and verification method and device, electronic equipment and storage medium Active CN112508145B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011490636.0A CN112508145B (en) 2020-12-16 2020-12-16 Electronic seal generation and verification method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011490636.0A CN112508145B (en) 2020-12-16 2020-12-16 Electronic seal generation and verification method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112508145A CN112508145A (en) 2021-03-16
CN112508145B true CN112508145B (en) 2023-05-23

Family

ID=74972957

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011490636.0A Active CN112508145B (en) 2020-12-16 2020-12-16 Electronic seal generation and verification method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112508145B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113378537A (en) * 2021-06-28 2021-09-10 平安信托有限责任公司 Block chain-based electronic seal generation method, device, equipment and storage medium
CN113962348A (en) * 2021-11-15 2022-01-21 公安部第三研究所 Electronic seal identification code and generation and verification method thereof
CN114943063B (en) * 2022-03-04 2023-04-07 杭州京胜航星科技有限公司 Electronic seal generation and recognition system based on Internet
CN117112513B (en) * 2023-10-19 2023-12-29 北京点聚信息技术有限公司 Intelligent storage method for dynamic key of electronic seal

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110533049A (en) * 2018-05-23 2019-12-03 富士通株式会社 The method and apparatus for extracting seal image

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1213592C (en) * 2001-07-31 2005-08-03 佳能株式会社 Adaptive two-valued image processing method and equipment
US10248825B2 (en) * 2014-08-29 2019-04-02 Hewlett-Packard Development Company, L.P. Image processing
CN105718820A (en) * 2015-04-22 2016-06-29 浙江省东阳第三建筑工程有限公司 Anti-fake electronic seal system
CN107194301A (en) * 2016-03-15 2017-09-22 中兴通讯股份有限公司 A kind of recognition methods of Quick Response Code and device
CN107538927A (en) * 2017-10-26 2018-01-05 周绍华 Anti-counterfeit method for stamp and Intelligent anti-counterfeit seal
CN110084331A (en) * 2018-01-26 2019-08-02 武汉矽感科技有限公司 A kind of method, apparatus and system managing E-seal
CN109447561A (en) * 2018-08-20 2019-03-08 东莞市惠峰商业有限公司 A kind of anti-counterfeit method for stamp and equipment
CN111754538B (en) * 2019-06-29 2022-07-29 浙江大学 Threshold segmentation method for USB surface defect detection
CN111859439A (en) * 2020-08-06 2020-10-30 江苏华邦网络科技有限公司 Electronic contract processing method and device and electronic equipment

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110533049A (en) * 2018-05-23 2019-12-03 富士通株式会社 The method and apparatus for extracting seal image

Also Published As

Publication number Publication date
CN112508145A (en) 2021-03-16

Similar Documents

Publication Publication Date Title
CN112508145B (en) Electronic seal generation and verification method and device, electronic equipment and storage medium
US11349666B2 (en) Electronically signing and distributing identification data as a service that provides proof of identity, integrity, validity and origin of data for non-repudiation and ID validation methods
USRE44982E1 (en) Mixed code, and method and apparatus for generating the same
CN112861648B (en) Character recognition method, character recognition device, electronic equipment and storage medium
CN112699775A (en) Certificate identification method, device and equipment based on deep learning and storage medium
CN112102402B (en) Flash light spot position identification method and device, electronic equipment and storage medium
CN112668575B (en) Key information extraction method and device, electronic equipment and storage medium
US20210110447A1 (en) Partial Perceptual Image Hashing for Invoice Deconstruction
CN113489704A (en) Sensitive data identification method and device based on flow, electronic equipment and medium
CN112507923A (en) Certificate copying detection method and device, electronic equipment and medium
CN114881698A (en) Advertisement compliance auditing method and device, electronic equipment and storage medium
CN112560855B (en) Image information extraction method and device, electronic equipment and storage medium
CN112528984A (en) Image information extraction method, device, electronic equipment and storage medium
CN116029777A (en) Anti-counterfeiting bill generation method, device, equipment and medium
CN113536782B (en) Sensitive word recognition method and device, electronic equipment and storage medium
CN113177543B (en) Certificate identification method, device, equipment and storage medium
CN112861649B (en) Fingerprint signature generation method and device, electronic equipment and computer storage medium
CN114120347A (en) Form verification method and device, electronic equipment and storage medium
CN112183520A (en) Intelligent data information processing method and device, electronic equipment and storage medium
CN113610934A (en) Image brightness adjusting method, device, equipment and storage medium
JP4958868B2 (en) Document feature extraction apparatus and method
CN112541899A (en) Incomplete certificate detection method and device, electronic equipment and computer storage medium
CN110751110A (en) Identity image information verification method, device, equipment and storage medium
CN113627297B (en) Image recognition method, device, equipment and medium
CN114926831A (en) Text-based recognition method and device, electronic equipment and readable storage medium

Legal Events

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