CN112149062A - Electronic seal generating method, device and system based on watermark and storage medium - Google Patents

Electronic seal generating method, device and system based on watermark and storage medium Download PDF

Info

Publication number
CN112149062A
CN112149062A CN201910562236.7A CN201910562236A CN112149062A CN 112149062 A CN112149062 A CN 112149062A CN 201910562236 A CN201910562236 A CN 201910562236A CN 112149062 A CN112149062 A CN 112149062A
Authority
CN
China
Prior art keywords
matrix
watermark
preset
sub
band
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
CN201910562236.7A
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 Telecom Wanwei Information Technology Co Ltd
Original Assignee
China Telecom Wanwei Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Wanwei Information Technology Co Ltd filed Critical China Telecom Wanwei Information Technology Co Ltd
Priority to CN201910562236.7A priority Critical patent/CN112149062A/en
Publication of CN112149062A publication Critical patent/CN112149062A/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/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • 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
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses an electronic seal generating method, device and system based on watermarks and a storage medium, which are used for improving the safety of electronic seals. The method comprises the following steps: acquiring an original file and a secret key; performing MD5 calculation on the original file to obtain a 128-bit hexadecimal character string; converting a 128-bit hexadecimal character string into a 16 x 16 original watermark matrix; scrambling the original watermark matrix to obtain a scrambled watermark matrix; performing primary wavelet decomposition on a preset red component of an original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands; singular value decomposition is carried out on a first sub-band positioned at the upper left corner in the four sub-bands to obtain a first singular matrix S; obtaining a second singular matrix S' containing the watermark based on a preset formula; singular value decomposition is carried out on the second singular matrix S 'to obtain a third singular matrix S' and a target sub-band is obtained; and performing inverse discrete wavelet transform on the target sub-band to obtain a synthesized red component, and generating an electronic seal image containing a watermark.

Description

Electronic seal generating method, device and system based on watermark and storage medium
Technical Field
The present invention relates to the field of image processing, and in particular, to a method, an apparatus, a system, and a storage medium for generating an electronic seal based on a watermark.
Background
Computer networks are the primary media for information transfer and distribution, providing applications and services. With the rapid development of computer network technology and multimedia information processing technology, people are facilitated and exposed to more and more serious security problems, and the protection of network information, especially the increasingly greater protection of business information and government information on the network, has attracted high attention. Forgery and falsification of certificates are easy now because most anti-counterfeiting printed matters are not protected by corresponding information technology, so that the anti-counterfeiting technology is not high, and lawless persons can imitate a large number of counterfeit certificates to carry out illegal activities. In order to cope with the increasingly serious information security problem, a new research direction has emerged in the information security field in recent years: digital watermarking and information hiding are adopted by people as the technologies for preventing illegal counterfeiting and image security authentication.
The electronic seal realizes the digital signature with strong technical performance by a familiar signature stamping mode, the traditional electronic seal adopts Least Significant Bit (LSB) algorithm to generate the electronic seal, the method is simple and easy to implement, but the LSB algorithm uses pixel bits with unimportant images, so the robustness of the algorithm is poor, and the watermark information is easily damaged by various signal processing operations, such as sharpening, filtering, geometric deformation and the like.
Disclosure of Invention
The invention provides an electronic seal generating method, device and system based on watermarks and a storage medium, which are used for preventing an electronic seal from being damaged, improving the safety of the electronic seal and enhancing the copyright protection and integrity protection of data.
A first aspect of an embodiment of the present invention provides a method for generating an electronic seal based on a watermark, including: acquiring an original file and a secret key, wherein the original file is a file needing to be covered with an electronic seal, and the secret key is used for encrypting the electronic seal of the original file; performing MD5 calculation on the original file to obtain a 128-bit hexadecimal character string; converting the 128-bit hexadecimal character string into a 128-bit binary character string, splicing two sections of same binary character strings and converting the two sections of same binary character strings into a 16 x 16 original watermark matrix; scrambling the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix; performing primary wavelet decomposition on a preset red component of an original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are sequenced in a clockwise manner; performing singular value decomposition on the first sub-band positioned at the upper left corner of the four sub-bands to obtain a first singular matrix S, a first orthogonal matrix U and a second orthogonal matrix V; embedding the scrambled watermark matrix into the first singular matrix S based on a preset formula to obtain a second singular matrix S' containing a watermark; performing singular value decomposition on the second singular matrix S ' to obtain a third singular matrix S ', and combining the third singular matrix S ' with the first orthogonal matrix U and the second orthogonal matrix V to obtain a target subband; and performing inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combining the synthesized red component with a preset green component and a preset blue component to generate the electronic seal image containing the watermark.
Optionally, in a first implementation manner of the first aspect of the embodiment of the present invention, the scrambling the original watermark matrix by using a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix includes: acquiring the size of the original watermark matrix W as M multiplied by N, wherein M, N is an integer; determining iteration times m of the preset m sequence; and scrambling the original watermark matrix W for m times according to a standard Zigzag algorithm, the preset m sequence and the iteration times m to obtain a scrambled watermark matrix W'.
Optionally, in a second implementation manner of the first aspect of the embodiment of the present invention, scrambling the original watermark matrix W m times according to the standard Zigzag algorithm, the preset m-sequence, and the iteration number m to obtain a scrambled watermark matrix W' includes: scanning an original watermark matrix W according to a preset scanning sequence R of Zigzag to obtain a one-dimensional array A with the length of M multiplied by N; calling a preset m sequence to reorder the one-dimensional array A to obtain a new one-dimensional array A'; restoring the new one-dimensional array A' into an MxN matrix according to a preset scanning sequence R to obtain a first transition matrix with the size of MxN, wherein the preset scanning sequence R is opposite to the scanning sequence of the preset scanning sequence R; scanning the first transition matrix according to the preset scanning sequence R to obtain a one-dimensional array A' with the length of M multiplied by N; calling the preset m sequence to reorder the one-dimensional array A 'to obtain a new one-dimensional array A'; restoring the new one-dimensional array A' into an MXN matrix according to the preset scanning sequence r to obtain a second transition matrix with the size of MXN; and scrambling the second transition matrix m-2 times based on the preset scanning sequence R and the preset scanning sequence R to obtain the scrambled watermark matrix W'.
Optionally, in a third implementation manner of the first aspect of the embodiment of the present invention, the embedding the scrambled watermark matrix into the first singular matrix S based on a preset formula to obtain a second singular matrix S' including a watermark includes: obtaining preset watermark embedding strength parameter
Figure BDA0002108589380000031
Calling preset formulas
Figure BDA0002108589380000032
And embedding the scrambled watermark matrix W 'into the first singular matrix S to obtain a second singular matrix S' containing the watermark.
A second aspect of an embodiment of the present invention provides an electronic seal generating apparatus based on a watermark, including: the electronic seal encryption device comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring an original file and a secret key, the original file is a file needing to be covered with an electronic seal, and the secret key is used for encrypting the electronic seal of the original file; the calculation unit is used for performing MD5 calculation on the original file to obtain a 128-bit hexadecimal character string; a conversion unit, configured to convert the 128-bit hexadecimal character string into a 128-bit binary character string, splice two identical binary character strings, and convert the two identical binary character strings into a 16 × 16 original watermark matrix; the scrambling unit is used for scrambling the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix; the first decomposition unit is used for performing one-level wavelet decomposition on a preset red component of an original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are ordered in a clockwise manner; the second decomposition unit is used for performing singular value decomposition on the first sub-band positioned at the upper left corner in the four sub-bands to obtain a first singular matrix S, a first orthogonal matrix U and a second orthogonal matrix V; the embedding unit is used for embedding the scrambled watermark matrix into the first singular matrix S based on a preset formula to obtain a second singular matrix S' containing a watermark; a decomposition synthesis unit, configured to perform singular value decomposition on the second singular matrix S' to obtain a third singular matrix S ″ and combine the third singular matrix S ″ with the first orthogonal matrix U and the second orthogonal matrix V to obtain a target subband; and the synthesis unit is used for performing inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combining the synthesized red component with a preset green component and a preset blue component to generate the electronic seal image containing the watermark.
Optionally, in a first implementation manner of the second aspect of the embodiment of the present invention, the scrambling unit includes: an obtaining module, configured to obtain that a size of the original watermark matrix W is mxn, where M, N is an integer; the determining module is used for determining the iteration times m of the preset m sequence; and the scrambling module is used for scrambling the original watermark matrix W for m times according to a standard Zigzag algorithm, the preset m sequence and the iteration times m to obtain a scrambled watermark matrix W'.
Optionally, in a second implementation manner of the second aspect of the embodiment of the present invention, the scrambling module is specifically configured to: scanning an original watermark matrix W according to a preset scanning sequence R of Zigzag to obtain a one-dimensional array A with the length of M multiplied by N; calling a preset m sequence to reorder the one-dimensional array A to obtain a new one-dimensional array A'; restoring the new one-dimensional array A' into an MxN matrix according to a preset scanning sequence R to obtain a first transition matrix with the size of MxN, wherein the preset scanning sequence R is opposite to the scanning sequence of the preset scanning sequence R; scanning the first transition matrix according to the preset scanning sequence R to obtain a one-dimensional array A' with the length of M multiplied by N; calling the preset m sequence to reorder the one-dimensional array A 'to obtain a new one-dimensional array A'; restoring the new one-dimensional array A' into an MXN matrix according to the preset scanning sequence r to obtain a second transition matrix with the size of MXN; and scrambling the second transition matrix m-2 times based on the preset scanning sequence R and the preset scanning sequence R to obtain the scrambled watermark matrix W'.
Optionally, in a third implementation manner of the second aspect of the embodiment of the present invention, the embedding unit is specifically configured to: obtaining preset watermark embedding strength parameter
Figure BDA0002108589380000041
Calling preset formulas
Figure BDA0002108589380000042
And embedding the scrambled watermark matrix W 'into the first singular matrix S to obtain a second singular matrix S' containing the watermark.
A third aspect of the embodiments of the present invention provides an electronic seal generation system based on a watermark, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the electronic seal generation method based on a watermark according to any one of the above embodiments when executing the computer program.
A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, including instructions, which when executed on a computer, cause the computer to perform the steps of the method for generating an electronic seal based on a watermark according to any one of the above embodiments.
In the technical scheme provided by the embodiment of the invention, an original file and a secret key are obtained, wherein the original file is a file which needs to be covered with an electronic seal, and the secret key is used for encrypting the electronic seal of the original file; performing MD5 calculation on the original file to obtain a 128-bit hexadecimal character string; converting the 128-bit hexadecimal character string into a 128-bit binary character string, splicing two sections of same binary character strings and converting the two sections of same binary character strings into a 16 x 16 original watermark matrix; scrambling the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix; performing primary wavelet decomposition on a preset red component of an original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are sequenced in a clockwise manner; performing singular value decomposition on the first sub-band positioned at the upper left corner of the four sub-bands to obtain a first singular matrix S, a first orthogonal matrix U and a second orthogonal matrix V; embedding the scrambled watermark matrix into the first singular matrix S based on a preset formula to obtain a second singular matrix S' containing a watermark; performing singular value decomposition on the second singular matrix S ' to obtain a third singular matrix S ', and combining the third singular matrix S ' with the first orthogonal matrix U and the second orthogonal matrix V to obtain a target subband; and performing inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combining the synthesized red component with a preset green component and a preset blue component to generate the electronic seal image containing the watermark. The embodiment of the invention avoids the electronic seal from being damaged, improves the safety of the electronic seal, and enhances the copyright protection and integrity protection of data.
Drawings
Fig. 1 is a schematic diagram of an embodiment of a method for generating an electronic seal based on a watermark according to an embodiment of the present invention;
fig. 2 is a schematic diagram of another embodiment of a method for generating an electronic seal based on a watermark in an embodiment of the present invention;
FIG. 3 is a schematic diagram of an embodiment of an electronic seal generating apparatus based on a watermark according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of another embodiment of an electronic seal generating apparatus based on a watermark in an embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of an electronic seal generation system based on a watermark in the embodiment of the present invention.
Detailed Description
The invention provides an electronic seal generating method, device and system based on watermarks and a storage medium, which are used for preventing an electronic seal from being damaged, improving the safety of the electronic seal and enhancing the copyright protection and integrity protection of data.
In order to make the technical field of the invention better understand the scheme of the invention, the embodiment of the invention will be described in conjunction with the attached drawings in the embodiment of the invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, a flowchart of a method for generating an electronic seal based on a watermark according to an embodiment of the present invention specifically includes:
101. and acquiring an original file and a secret key, wherein the original file is a file needing to be covered with the electronic seal, and the secret key is used for encrypting the electronic seal of the original file.
The server acquires an original file and a secret key, wherein the original file is a file needing to be covered with the electronic seal, and the secret key is used for encrypting the electronic seal of the original file. The electronic seal is a digital signature using a common signature stamping method. The electronic seal information generated by the secret key has the advantage of high confidentiality, and the information security is improved.
It should be noted that before the original file and the key are obtained, authentication is required, and the original file and the key can be obtained only after the authentication is passed.
It is to be understood that the executing subject of the present invention may be an electronic seal generating apparatus based on a watermark, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
102. The MD5 calculation is performed on the original file to obtain a 128-bit hexadecimal character string.
The server performs MD5 calculation on the original file to obtain a 128-bit hexadecimal character string. For the electronic seal, because the integrity of the transmitted text is to be ensured, the MD5 value of the text is used as the watermark information in the embodiment. The principle of the MD5 algorithm in this embodiment is: the processing objects are grouped according to the length of 512 bits of the byte (less than 512, the first bit is filled with 1, and the rest is filled with 0 completely), each group is divided into 16 32-bit subgroups, after a series of processing, the results with the length of 432 bits are output, and the output results are cascaded to form a 128-bit hash value. The specific calculation steps are as follows: the first step is as follows: the information padding is performed first, so that the length of the bytes is 448 as a result of the remainder of 512, that is, the length is N × 512+448, where N is an integer. Because the length of the processing object of MD5 must be a multiple of 512 bits, the specific filling method is: the first bit is filled with 1, and the rest is filled with 0. The second step is that: the information byte length obtained after the first step of processing is N × 512+448, which is not a multiple of 512, so that a group of 64-bit binary numbers representing the information before padding is added after the information. The resulting information length is a multiple of 512. The third step: the initialized registers a and B are 0x01234567 and 0x89abcdef, C is 0xfedbc 98 and D is 0x76543210, and the initialized register contents are stored in four variables of a, B, C and D. If the message has M sets of 512-bit data, the calculation process loops through M rounds, 4 times each. Before calculation, four basic bitwise arithmetic functions are defined:
F(x,y,z)=(x and y)or(not(x)and z)
G(x,y,z)=(x and z)or(y and not(z))
H(x,y,z)=x xor y xor z
I(x,y,z)=y xor(x or not(z))
wherein "and" represents "and", "or" represents "or", "xor" represents "exclusive or", and "not" represents "not". Next, define the four-wheel transformation function in the main loop:
f(a,b,c,d,mi,s,tj) Denotes a ═ b + ((a + (f (b, c, d) + mi+tj))<<s)
g(a,b,c,d,mi,s,tj) Denotes a ═ b + ((a + (g (b, c, d) + mi+tj))<<s)
h(a,b,c,d,mi,s,tj) Denotes a ═ b + ((a + (h (b, c, d) + mi+tj))<<s)
i(a,b,c,d,mi,s,tj) Denotes a ═ b + ((a + (i (b, c, d) + mi+tj))<<s)
Since 16 subgroups of 32 bit length are to be separated from each 512 bit length packet, m is usediGroup number representing subgroup, value range [0,15 ]]。tj=int(232X abs (sin (j)) j is in the value range of [1, 64%]Int denotes rounding, abs denotes absolute value, j is number of radians,<<s represents a left shift by s bits. The fourth step: and each group is used for making a cycle, each cycle is respectively used for four-wheel operation according to the four-wheel transformation function, and the values of a, b, c and d in the wheel are calculated in each round of operation. The fifth step: wait for all packets to go toAfter four steps of operation, the digital fingerprint of 128 bits is obtained by cascading A, B, C, D from low to high.
103. And converting the 128-bit hexadecimal character string into a 128-bit binary character string, splicing two identical binary character strings and converting the spliced two identical binary character strings into a 16-by-16 original watermark matrix.
The server converts the 128-bit hexadecimal character string into a 128-bit binary character string, splices two identical binary character strings and converts the spliced two identical binary character strings into a 16 x 16 original watermark matrix.
Since the generation method proposed in this embodiment is based on pictures, and the current MD5 value is a 128-bit long hexadecimal string, it is necessary to transform the MD5 value to adapt to the preset watermark scrambling algorithm of the algorithm, i.e. to expand the 128-bit MD5 binary number to 256 bits, and the expansion method is to splice two identical 128-bit MD5 values and then transform the two identical 128-bit MD5 values into a 16 × 16 matrix.
104. And scrambling the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix.
And the server scrambles the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix. Specifically, the server obtains an original watermark matrix W with a size of mxn, wherein M, N is an integer; the server determines the iteration times m of a preset m sequence; and the server scrambles the original watermark matrix W for m times according to a standard Zigzag algorithm, a preset m sequence and the iteration times m to obtain a scrambled watermark matrix W'.
The method comprises the following steps that a server scrambles an original watermark matrix W for m times according to a standard Zigzag algorithm, a preset m sequence and iteration times m to obtain a scrambled watermark matrix W', and comprises the following steps: the server scans an original watermark matrix W according to a preset scanning sequence R of Zigzag to obtain a one-dimensional array A with the length of M multiplied by N; the server calls a preset m sequence to reorder the one-dimensional array A to obtain a new one-dimensional array A'; the server restores the new one-dimensional array A' into an MxN matrix according to a preset scanning sequence R to obtain a first transition matrix with the size of MxN, wherein the scanning sequence of the preset scanning sequence R is opposite to that of the preset scanning sequence R; the server scans the first transition matrix according to a preset scanning sequence R to obtain a one-dimensional array A' with the length of M multiplied by N; the server calls a preset m sequence to reorder the one-dimensional array A 'to obtain a new one-dimensional array A'; the server restores the new one-dimensional array A' into an MXN matrix according to a preset scanning sequence r to obtain a second transition matrix with the size of MXN; and the server scrambles the second transition matrix m-2 times based on the preset scanning sequence R and the preset scanning sequence R to obtain a scrambled watermark matrix W'.
It should be noted that the m-sequence is generated by a linear feedback shift register, which is composed of exclusive-or, and gates, and the length of the m-sequence is determined by the number of the registers. The characteristic equation for the m-sequence is:
Figure BDA0002108589380000081
thereby solving for the m-sequence of feedback registers. For example, when n is 3, the characteristic equation is f (x) 1+ x3From this equation, b can be known0=b1=b3(1 denotes on), x of the next round1X equal to the previous wheel1And x3Is (1,0,0), the next states are (1,1,0), (1,1,1), (0,1,1), (1,0,1, 1), (0,1,0) (0,0,1) and k is 2n-1-7 binary numbers. Where the non-repeating number is used as an address to scramble the one-dimensional pixel group obtained by Zigzag scanning. The array is further divided into m subgroups, each group being of length m sequences of length k, and then each subgroup is ordered according to m sequences. Assume that the 4 th element in the subgroup is first bit, the 6 th element is second bit, and so on, sorted according to the table above. If the last subgroup length a occurs, which is smaller than k, then the numbers larger than a in the m-sequence are removed. The sorting formula is as follows:
Ai(j)=Wi(mseq(j))j=1,2,3,Λ,2n-1i=1,2,3,Λ,m
wherein A is a one-dimensional array obtained after the Zigzag algorithm scanning, Wi is a scrambled watermark, and mesq is an m sequence.
105. And performing primary wavelet decomposition on the preset red component of the original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are ordered in a clockwise manner.
The server carries out primary wavelet decomposition on the preset red component of the original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are sequenced in a clockwise mode.
It should be noted that the discrete wavelet can be expressed as:
Figure BDA0002108589380000091
wherein, b0Is a sampling time interval;
so that the discrete wavelet transform can be expressed as
Figure BDA0002108589380000092
The inverse transform of the discrete wavelet may be represented as
Figure BDA0002108589380000093
Where c is a constant independent of the signal, i.e.
Figure BDA0002108589380000094
C in (1)ψ
106. And performing singular value decomposition on a first sub-band positioned at the upper left corner of the four sub-bands to obtain a first singular matrix, a first orthogonal matrix and a second orthogonal matrix.
The server carries out singular value decomposition on a first sub-band positioned at the upper left corner of the four sub-bands to obtain a first singular matrix S, a first orthogonal matrix U and a second orthogonal matrix V.
Let M be an M × n order matrix in which the elements all belong to the real or complex domain. There is one decomposition:
M=USVT
wherein U is an m × m order matrix and S is a semi-positive definite m × n order diagonal matrix; vTThe transposed matrix, which is a V, is an n-th order matrix. Such a decomposition is called singular value decomposition of M. The elements on the diagonal of S are the singular values of M, and in order to uniquely determine S by M, the singular values are arranged from large to small.
Figure BDA0002108589380000095
λmIs a singular value of the matrix M, and λ1>λ2>L>λm-1>λmThe number of singular values is equal to the rank of the matrix M.
107. And embedding the scrambled watermark matrix into the first singular matrix based on a preset formula to obtain a second singular matrix containing the watermark.
The server embeds the scrambled watermark matrix into the first singular matrix S based on a preset formula to obtain a second singular matrix S' containing the watermark. Specifically, the server obtains a preset watermark embedding strength parameter
Figure BDA0002108589380000101
Server calling preset formula
Figure BDA0002108589380000102
And embedding the scrambled watermark matrix W 'into the first singular matrix S to obtain a second singular matrix S' containing the watermark.
108. And performing singular value decomposition on the second singular matrix to obtain a third singular matrix, and combining the third singular matrix with the first orthogonal matrix and the second orthogonal matrix to obtain the target subband.
And the server carries out singular value decomposition on the second singular matrix S ' to obtain a third singular matrix S ', and combines the third singular matrix S ' with the first orthogonal matrix U and the second orthogonal matrix V to obtain the target subband.
109. And performing inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combining the synthesized red component with the preset green component and the preset blue component to generate the electronic seal image containing the watermark.
And the server performs inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combines the synthesized red component with the preset green component and the preset blue component to generate the electronic seal image containing the watermark.
It should be noted that the total amount of data of the electronic stamp image after discrete wavelet transform is the same as the data information amount of the original electronic stamp image, but the characteristics of the generated wavelet image are different from the original electronic stamp image: the energy of the electronic stamp image is mainly concentrated in the low frequency part (first sub-band), while the energy of the horizontal part (second sub-band), diagonal part (third sub-band) and vertical part (fourth sub-band) is less. The low frequency part contains the basic information of the image, called the luminance part; the vertical, horizontal and diagonal portions contain mainly high frequency information, called detail portions. The DWT transform embedding watermark position that is commonly used at present is chosen in the low frequency sub-band part because the low frequency sub-band LL is more robust. The low-frequency coefficient of the discrete wavelet decomposition is at the upper left corner, and the main energy of the image is concentrated on the coefficient at the upper left corner no matter the discrete wavelet decomposition is one-level, two-level or N-level.
The embodiment of the invention avoids the electronic seal from being damaged, improves the safety of the electronic seal, and enhances the copyright protection and integrity protection of data.
Referring to fig. 2, another flowchart of a method for generating an electronic seal based on a watermark according to an embodiment of the present invention specifically includes:
201. and acquiring an original file and a secret key, wherein the original file is a file needing to be covered with the electronic seal, and the secret key is used for encrypting the electronic seal of the original file.
The server acquires an original file and a secret key, wherein the original file is a file needing to be covered with the electronic seal, and the secret key is used for encrypting the electronic seal of the original file. The electronic seal is a digital signature using a common signature stamping method. The electronic seal information generated by the secret key has the advantage of high confidentiality, and the information security is improved.
It should be noted that before the original file and the key are obtained, authentication is required, and the original file and the key can be obtained only after the authentication is passed.
It is to be understood that the executing subject of the present invention may be an electronic seal generating apparatus based on a watermark, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
202. The MD5 calculation is performed on the original file to obtain a 128-bit hexadecimal character string.
The server performs MD5 calculation on the original file to obtain a 128-bit hexadecimal character string. For the electronic seal, because the integrity of the transmitted text is to be ensured, the MD5 value of the text is used as the watermark information in the embodiment. The principle of the MD5 algorithm in this embodiment is: the processing objects are grouped according to the length of 512 bits of the byte (less than 512, the first bit is filled with 1, and the rest is filled with 0 completely), each group is divided into 16 32-bit subgroups, after a series of processing, the results with the length of 432 bits are output, and the output results are cascaded to form a 128-bit hash value. The specific calculation steps are as follows: the first step is as follows: the information padding is performed first, so that the length of the bytes is 448 as a result of the remainder of 512, that is, the length is N × 512+448, where N is an integer. Because the length of the processing object of MD5 must be a multiple of 512 bits, the specific filling method is: the first bit is filled with 1, and the rest is filled with 0. The second step is that: the information byte length obtained after the first step of processing is N × 512+448, which is not a multiple of 512, so that a group of 64-bit binary numbers representing the information before padding is added after the information. The resulting information length is a multiple of 512. The third step: the initialized registers a and B are 0x01234567 and 0x89abcdef, C is 0xfedbc 98 and D is 0x76543210, and the initialized register contents are stored in four variables of a, B, C and D. If the message has M sets of 512-bit data, the calculation process loops through M rounds, 4 times each. Before calculation, four basic bitwise arithmetic functions are defined:
F(x,y,z)=(x and y)or(not(x)and z)
G(x,y,z)=(x and z)or(y and not(z))
H(x,y,z)=x xor y xor z
I(x,y,z)=y xor(x or not(z))
wherein "and" represents "and", "or" represents "or", "xor" represents "exclusive or", and "not" represents "not". Next, define the four-wheel transformation function in the main loop:
f(a,b,c,d,mi,s,tj) Denotes a ═ b + ((a + (f (b, c, d) + mi+tj))<<s)
g(a,b,c,d,mi,s,tj) Denotes a ═ b + ((a + (g (b, c, d) + mi+tj))<<s)
h(a,b,c,d,mi,s,tj) Denotes a ═ b + ((a + (h (b, c, d) + mi+tj))<<s)
i(a,b,c,d,mi,s,tj) Denotes a ═ b + ((a + (i (b, c, d) + mi+tj))<<s)
Since 16 subgroups of 32 bit length are to be separated from each 512 bit length packet, m is usediGroup number representing subgroup, value range [0,15 ]]。tj=int(232X abs (sin (j)) j is in the value range of [1, 64%]Int denotes rounding, abs denotes absolute value, j is number of radians,<<s represents a left shift by s bits. The fourth step: and each group is used for making a cycle, each cycle is respectively used for four-wheel operation according to the four-wheel transformation function, and the values of a, b, c and d in the wheel are calculated in each round of operation. The fifth step: after all packets have undergone the fourth operation, the 128-bit digital fingerprint is obtained by cascading A, B, C, D from low to high.
203. And converting the 128-bit hexadecimal character string into a 128-bit binary character string, splicing two identical binary character strings and converting the spliced two identical binary character strings into a 16-by-16 original watermark matrix.
The server converts the 128-bit hexadecimal character string into a 128-bit binary character string, splices two identical binary character strings and converts the spliced two identical binary character strings into a 16 x 16 original watermark matrix.
Since the generation method proposed in this embodiment is based on pictures, and the current MD5 value is a 128-bit long hexadecimal string, it is necessary to transform the MD5 value to adapt to the preset watermark scrambling algorithm of the algorithm, i.e. to expand the 128-bit MD5 binary number to 256 bits, and the expansion method is to splice two identical 128-bit MD5 values and then transform the two identical 128-bit MD5 values into a 16 × 16 matrix.
204. And scrambling the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix.
And the server scrambles the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix. Specifically, the server obtains an original watermark matrix W with a size of mxn, wherein M, N is an integer; the server determines the iteration times m of a preset m sequence; and the server scrambles the original watermark matrix W for m times according to a standard Zigzag algorithm, a preset m sequence and the iteration times m to obtain a scrambled watermark matrix W'.
The method comprises the following steps that a server scrambles an original watermark matrix W for m times according to a standard Zigzag algorithm, a preset m sequence and iteration times m to obtain a scrambled watermark matrix W', and comprises the following steps: the server scans an original watermark matrix W according to a preset scanning sequence R of Zigzag to obtain a one-dimensional array A with the length of M multiplied by N; the server calls a preset m sequence to reorder the one-dimensional array A to obtain a new one-dimensional array A'; the server restores the new one-dimensional array A' into an MxN matrix according to a preset scanning sequence R to obtain a first transition matrix with the size of MxN, wherein the scanning sequence of the preset scanning sequence R is opposite to that of the preset scanning sequence R; the server scans the first transition matrix according to a preset scanning sequence R to obtain a one-dimensional array A' with the length of M multiplied by N; the server calls a preset m sequence to reorder the one-dimensional array A 'to obtain a new one-dimensional array A'; the server restores the new one-dimensional array A' into an MXN matrix according to a preset scanning sequence r to obtain a second transition matrix with the size of MXN; and the server scrambles the second transition matrix m-2 times based on the preset scanning sequence R and the preset scanning sequence R to obtain a scrambled watermark matrix W'.
It should be noted that the m-sequence is generated by a linear feedback shift register consisting of "The exclusive-OR gate, and the exclusive-OR gate, and the exclusive-OR gate. The characteristic equation for the m-sequence is:
Figure BDA0002108589380000131
thereby solving for the m-sequence of feedback registers. For example, when n is 3, the characteristic equation is f (x) 1+ x3From this equation, b can be known0=b1=b3(1 denotes on), x of the next round1X equal to the previous wheel1And x3Is (1,0,0), the next states are (1,1,0), (1,1,1), (0,1,1), (1,0,1, 1), (0,1,0) (0,0,1) and k is 2n-1-7 binary numbers. Where the non-repeating number is used as an address to scramble the one-dimensional pixel group obtained by Zigzag scanning. The array is further divided into m subgroups, each group being of length m sequences of length k, and then each subgroup is ordered according to m sequences. Assume that the 4 th element in the subgroup is first bit, the 6 th element is second bit, and so on, sorted according to the table above. If the last subgroup length a occurs, which is smaller than k, then the numbers larger than a in the m-sequence are removed. The sorting formula is as follows:
Ai(j)=Wi(mseq(j))j=1,2,3,Λ,2n-1i=1,2,3,Λ,m
wherein A is a one-dimensional array obtained after the Zigzag algorithm scanning, Wi is a scrambled watermark, and mesq is an m sequence.
205. And performing primary wavelet decomposition on the preset red component of the original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are ordered in a clockwise manner.
The server carries out primary wavelet decomposition on the preset red component of the original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are sequenced in a clockwise mode.
It should be noted that the discrete wavelet can be expressed as:
Figure BDA0002108589380000132
wherein, b0Is a sampling time interval;
so that the discrete wavelet transform can be expressed as
Figure BDA0002108589380000133
The inverse transform of the discrete wavelet may be represented as
Figure BDA0002108589380000134
Where c is a constant independent of the signal, i.e.
Figure BDA0002108589380000135
C in (1)ψ
206. And performing singular value decomposition on a first sub-band positioned at the upper left corner of the four sub-bands to obtain a first singular matrix, a first orthogonal matrix and a second orthogonal matrix.
The server carries out singular value decomposition on a first sub-band positioned at the upper left corner of the four sub-bands to obtain a first singular matrix S, a first orthogonal matrix U and a second orthogonal matrix V.
Let M be an M × n order matrix in which the elements all belong to the real or complex domain. There is one decomposition:
M=USVT
wherein U is an m × m order matrix and S is a semi-positive definite m × n order diagonal matrix; vTThe transposed matrix, which is a V, is an n-th order matrix. Such a decomposition is called singular value decomposition of M. The elements on the diagonal of S are the singular values of M, and in order to uniquely determine S by M, the singular values are arranged from large to small.
Figure BDA0002108589380000141
λmIs a singular value of the matrix M, and λ1>λ2>L>λm-1>λmThe number of singular values is equal to the rank of the matrix M.
207. And acquiring a preset watermark embedding strength parameter.
The server obtains preset watermark embedding strength parameters
Figure BDA0002108589380000142
Wherein the content of the first and second substances,
Figure BDA0002108589380000143
the smaller the watermark is, the more invisible the watermark is, but the robustness is poor, and the capability of resisting attack is poor;
Figure BDA0002108589380000144
the larger the watermark is, the stronger the watermark is embedded into the carrier information, the better the robustness is, the strong attack resistance is, but the invisibility is deteriorated. To balance the contradiction between robustness and invisibility, in the present embodiment, selection is made
Figure BDA0002108589380000145
Is 0.01.
208. Calling preset formula and watermark embedding strength parameter
Figure BDA0002108589380000146
And embedding the scrambled watermark matrix W' into the first singular matrix to obtain a second singular matrix containing the watermark.
Server calling preset formula and watermark embedding strength parameter
Figure BDA0002108589380000147
And embedding the scrambled watermark matrix W 'into the first singular matrix S to obtain a second singular matrix S' containing the watermark. Specifically, the server calls a preset formula
Figure BDA0002108589380000148
And embedding the scrambled watermark matrix W 'into the first singular matrix S to obtain a second singular matrix S' containing the watermark.
209. And performing singular value decomposition on the second singular matrix to obtain a third singular matrix, and combining the third singular matrix with the first orthogonal matrix and the second orthogonal matrix to obtain the target subband.
And the server carries out singular value decomposition on the second singular matrix S ' to obtain a third singular matrix S ', and combines the third singular matrix S ' with the first orthogonal matrix U and the second orthogonal matrix V to obtain the target subband.
210. And performing inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combining the synthesized red component with the preset green component and the preset blue component to generate the electronic seal image containing the watermark.
And the server performs inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combines the synthesized red component with the preset green component and the preset blue component to generate the electronic seal image containing the watermark.
It should be noted that the total amount of data of the electronic stamp image after discrete wavelet transform is the same as the data information amount of the original electronic stamp image, but the characteristics of the generated wavelet image are different from the original electronic stamp image: the energy of the electronic stamp image is mainly concentrated in the low frequency part (first sub-band), while the energy of the horizontal part (second sub-band), diagonal part (third sub-band) and vertical part (fourth sub-band) is less. The low frequency part contains the basic information of the image, called the luminance part; the vertical, horizontal and diagonal portions contain mainly high frequency information, called detail portions. The DWT transform embedding watermark position that is commonly used at present is chosen in the low frequency sub-band part because the low frequency sub-band LL is more robust. The low-frequency coefficient of the discrete wavelet decomposition is at the upper left corner, and the main energy of the image is concentrated on the coefficient at the upper left corner no matter the discrete wavelet decomposition is one-level, two-level or N-level.
The embodiment of the invention avoids the electronic seal from being damaged, improves the safety of the electronic seal, and enhances the copyright protection and integrity protection of data.
In the above description of the electronic seal generating method based on the watermark in the embodiment of the present invention, the following description of the electronic seal generating device based on the watermark in the embodiment of the present invention refers to fig. 3, and an embodiment of the electronic seal generating device based on the watermark in the embodiment of the present invention includes:
an obtaining unit 301, configured to obtain an original file and a secret key, where the original file is a file that needs to be covered with an electronic seal, and the secret key is used to encrypt the electronic seal of the original file;
a calculating unit 302, configured to perform MD5 calculation on the original file to obtain a 128-bit hexadecimal character string;
a converting unit 303, configured to convert the 128-bit hexadecimal character string into a 128-bit binary character string, splice two identical binary character strings, and convert the two identical binary character strings into a 16 × 16 original watermark matrix;
a scrambling unit 304, configured to scramble the original watermark matrix by using a preset algorithm and a preset m-sequence to obtain a scrambled watermark matrix;
a first decomposition unit 305, configured to perform first-level wavelet decomposition on a preset red component of an original electronic seal image through a discrete wavelet transform algorithm, so as to generate four sub-bands, where the four sub-bands include a first sub-band, a second sub-band, a third sub-band, and a fourth sub-band that are ordered in a clockwise manner;
a second decomposition unit 306, configured to perform singular value decomposition on the first subband located at the upper left corner of the four subbands to obtain a first singular matrix S, a first orthogonal matrix U, and a second orthogonal matrix V;
an embedding unit 307, configured to embed the scrambled watermark matrix into the first singular matrix S based on a preset formula, to obtain a second singular matrix S' containing a watermark;
a decomposition and synthesis unit 308, configured to perform singular value decomposition on the second singular matrix S' to obtain a third singular matrix S ″ and combine the third singular matrix S ″ with the first orthogonal matrix U and the second orthogonal matrix V to obtain a target subband;
and a synthesis unit 309, configured to perform inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band, and the fourth sub-band to obtain a synthesized red component, and combine the synthesized red component with a preset green component and a preset blue component to generate an electronic seal image with a watermark.
The embodiment of the invention avoids the electronic seal from being damaged, improves the safety of the electronic seal, and enhances the copyright protection and integrity protection of data.
Referring to fig. 4, another embodiment of the electronic seal generating apparatus based on watermark according to the embodiment of the present invention includes:
an obtaining unit 301, configured to obtain an original file and a secret key, where the original file is a file that needs to be covered with an electronic seal, and the secret key is used to encrypt the electronic seal of the original file;
a calculating unit 302, configured to perform MD5 calculation on the original file to obtain a 128-bit hexadecimal character string;
a converting unit 303, configured to convert the 128-bit hexadecimal character string into a 128-bit binary character string, splice two identical binary character strings, and convert the two identical binary character strings into a 16 × 16 original watermark matrix;
a scrambling unit 304, configured to scramble the original watermark matrix by using a preset algorithm and a preset m-sequence to obtain a scrambled watermark matrix;
a first decomposition unit 305, configured to perform first-level wavelet decomposition on a preset red component of an original electronic seal image through a discrete wavelet transform algorithm, so as to generate four sub-bands, where the four sub-bands include a first sub-band, a second sub-band, a third sub-band, and a fourth sub-band that are ordered in a clockwise manner;
a second decomposition unit 306, configured to perform singular value decomposition on the first subband located at the upper left corner of the four subbands to obtain a first singular matrix S, a first orthogonal matrix U, and a second orthogonal matrix V;
an embedding unit 307, configured to embed the scrambled watermark matrix into the first singular matrix S based on a preset formula, to obtain a second singular matrix S' containing a watermark;
a decomposition and synthesis unit 308, configured to perform singular value decomposition on the second singular matrix S' to obtain a third singular matrix S ″ and combine the third singular matrix S ″ with the first orthogonal matrix U and the second orthogonal matrix V to obtain a target subband;
and a synthesis unit 309, configured to perform inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band, and the fourth sub-band to obtain a synthesized red component, and combine the synthesized red component with a preset green component and a preset blue component to generate an electronic seal image with a watermark.
Optionally, the scrambling unit 304 includes:
an obtaining module 3041, configured to obtain the size of the original watermark matrix W as M × N, where M, N is an integer;
a determining module 3042, configured to determine an iteration number m of the preset m sequence;
and a scrambling module 3043, configured to scramble the original watermark matrix W m times according to a standard Zigzag algorithm, the preset m-sequence, and the iteration number m, to obtain a scrambled watermark matrix W'.
Optionally, the scrambling module 3043 is specifically configured to: scanning an original watermark matrix W according to a preset scanning sequence R of Zigzag to obtain a one-dimensional array A with the length of M multiplied by N; calling a preset m sequence to reorder the one-dimensional array A to obtain a new one-dimensional array A'; restoring the new one-dimensional array A' into an MxN matrix according to a preset scanning sequence R to obtain a first transition matrix with the size of MxN, wherein the preset scanning sequence R is opposite to the scanning sequence of the preset scanning sequence R; scanning the first transition matrix according to the preset scanning sequence R to obtain a one-dimensional array A' with the length of M multiplied by N; calling the preset m sequence to reorder the one-dimensional array A 'to obtain a new one-dimensional array A'; restoring the new one-dimensional array A' into an MXN matrix according to the preset scanning sequence r to obtain a second transition matrix with the size of MXN; and scrambling the second transition matrix m-2 times based on the preset scanning sequence R and the preset scanning sequence R to obtain the scrambled watermark matrix W'.
Optionally, the embedding unit 307 is specifically configured to:
obtaining preset watermark embedding strength parameter
Figure BDA0002108589380000171
Calling preset formulas
Figure BDA0002108589380000181
And embedding the scrambled watermark matrix W 'into the first singular matrix S to obtain a second singular matrix S' containing the watermark.
The embodiment of the invention avoids the electronic seal from being damaged, improves the safety of the electronic seal, and enhances the copyright protection and integrity protection of data.
Fig. 3 to 4 describe the electronic seal generating apparatus based on watermark in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the electronic seal generating system based on watermark in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 5 is a schematic structural diagram of an electronic seal generating system based on a watermark according to an embodiment of the present invention, where the electronic seal generating system 500 based on a watermark includes a memory 501, a processor 502, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the watermark-based electronic seal generating method according to any embodiment is implemented. Watermark-based electronic seal generation system 500 may also include a communication interface 503.
When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, optical fiber, twisted pair) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a server, a data center, etc., that is integrated with one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., compact disk), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
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, may be located in one place, or may be 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, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. 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 Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for generating an electronic seal based on a watermark is characterized by comprising the following steps:
acquiring an original file and a secret key, wherein the original file is a file needing to be covered with an electronic seal, and the secret key is used for encrypting the electronic seal of the original file;
performing MD5 calculation on the original file to obtain a 128-bit hexadecimal character string;
converting the 128-bit hexadecimal character string into a 128-bit binary character string, splicing two sections of same binary character strings and converting the two sections of same binary character strings into a 16 x 16 original watermark matrix;
scrambling the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix;
performing primary wavelet decomposition on a preset red component of an original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are sequenced in a clockwise manner;
performing singular value decomposition on the first sub-band positioned at the upper left corner of the four sub-bands to obtain a first singular matrix S, a first orthogonal matrix U and a second orthogonal matrix V;
embedding the scrambled watermark matrix into the first singular matrix S based on a preset formula to obtain a second singular matrix S' containing a watermark;
performing singular value decomposition on the second singular matrix S ' to obtain a third singular matrix S ', and combining the third singular matrix S ' with the first orthogonal matrix U and the second orthogonal matrix V to obtain a target subband;
and performing inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combining the synthesized red component with a preset green component and a preset blue component to generate the electronic seal image containing the watermark.
2. The method for generating an electronic seal based on a watermark according to claim 1, wherein the scrambling of the original watermark matrix by using a preset algorithm and a preset m-sequence to obtain a scrambled watermark matrix comprises:
acquiring the size of the original watermark matrix W as M multiplied by N, wherein M, N is an integer;
determining iteration times m of the preset m sequence;
and scrambling the original watermark matrix W for m times according to a standard Zigzag algorithm, the preset m sequence and the iteration times m to obtain a scrambled watermark matrix W'.
3. The method for generating an electronic stamp based on a watermark according to claim 2, wherein the scrambling the original watermark matrix W m times according to a standard Zigzag algorithm, the preset m-sequence and the iteration number m to obtain a scrambled watermark matrix W' comprises:
scanning an original watermark matrix W according to a preset scanning sequence R of Zigzag to obtain a one-dimensional array A with the length of M multiplied by N;
calling a preset m sequence to reorder the one-dimensional array A to obtain a new one-dimensional array A';
restoring the new one-dimensional array A' into an MxN matrix according to a preset scanning sequence R to obtain a first transition matrix with the size of MxN, wherein the preset scanning sequence R is opposite to the scanning sequence of the preset scanning sequence R;
scanning the first transition matrix according to the preset scanning sequence R to obtain a one-dimensional array A' with the length of M multiplied by N;
calling the preset m sequence to reorder the one-dimensional array A 'to obtain a new one-dimensional array A';
restoring the new one-dimensional array A' into an MXN matrix according to the preset scanning sequence r to obtain a second transition matrix with the size of MXN;
and scrambling the second transition matrix m-2 times based on the preset scanning sequence R and the preset scanning sequence R to obtain the scrambled watermark matrix W'.
4. The method for generating an electronic seal based on a watermark according to claim 2, wherein the embedding the scrambled watermark matrix into the first singular matrix S based on a preset formula to obtain a second singular matrix S' containing a watermark comprises:
obtaining preset watermark embedding strength parameter
Figure FDA0002108589370000021
Calling preset formulas
Figure FDA0002108589370000022
And embedding the scrambled watermark matrix W 'into the first singular matrix S to obtain a second singular matrix S' containing the watermark.
5. An electronic seal generating apparatus based on watermark, comprising:
the electronic seal encryption device comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring an original file and a secret key, the original file is a file needing to be covered with an electronic seal, and the secret key is used for encrypting the electronic seal of the original file;
the calculation unit is used for performing MD5 calculation on the original file to obtain a 128-bit hexadecimal character string;
a conversion unit, configured to convert the 128-bit hexadecimal character string into a 128-bit binary character string, splice two identical binary character strings, and convert the two identical binary character strings into a 16 × 16 original watermark matrix;
the scrambling unit is used for scrambling the original watermark matrix by adopting a preset algorithm and a preset m sequence to obtain a scrambled watermark matrix;
the first decomposition unit is used for performing one-level wavelet decomposition on a preset red component of an original electronic seal image through a discrete wavelet transform algorithm to generate four sub-bands, wherein the four sub-bands comprise a first sub-band, a second sub-band, a third sub-band and a fourth sub-band which are ordered in a clockwise manner;
the second decomposition unit is used for performing singular value decomposition on the first sub-band positioned at the upper left corner in the four sub-bands to obtain a first singular matrix S, a first orthogonal matrix U and a second orthogonal matrix V;
the embedding unit is used for embedding the scrambled watermark matrix into the first singular matrix S based on a preset formula to obtain a second singular matrix S' containing a watermark;
a decomposition synthesis unit, configured to perform singular value decomposition on the second singular matrix S' to obtain a third singular matrix S ″ and combine the third singular matrix S ″ with the first orthogonal matrix U and the second orthogonal matrix V to obtain a target subband;
and the synthesis unit is used for performing inverse discrete wavelet transform on the target sub-band, the second sub-band, the third sub-band and the fourth sub-band to obtain a synthesized red component, and combining the synthesized red component with a preset green component and a preset blue component to generate the electronic seal image containing the watermark.
6. The watermark-based electronic seal generation apparatus according to claim 5, wherein the scrambling unit includes:
an obtaining module, configured to obtain that a size of the original watermark matrix W is mxn, where M, N is an integer;
the determining module is used for determining the iteration times m of the preset m sequence;
and the scrambling module is used for scrambling the original watermark matrix W for m times according to a standard Zigzag algorithm, the preset m sequence and the iteration times m to obtain a scrambled watermark matrix W'.
7. The watermark-based electronic seal generation apparatus according to claim 6, wherein the scrambling module is specifically configured to:
scanning an original watermark matrix W according to a preset scanning sequence R of Zigzag to obtain a one-dimensional array A with the length of M multiplied by N;
calling a preset m sequence to reorder the one-dimensional array A to obtain a new one-dimensional array A';
restoring the new one-dimensional array A' into an MxN matrix according to a preset scanning sequence R to obtain a first transition matrix with the size of MxN, wherein the preset scanning sequence R is opposite to the scanning sequence of the preset scanning sequence R;
scanning the first transition matrix according to the preset scanning sequence R to obtain a one-dimensional array A' with the length of M multiplied by N;
calling the preset m sequence to reorder the one-dimensional array A 'to obtain a new one-dimensional array A';
restoring the new one-dimensional array A' into an MXN matrix according to the preset scanning sequence r to obtain a second transition matrix with the size of MXN;
and scrambling the second transition matrix m-2 times based on the preset scanning sequence R and the preset scanning sequence R to obtain the scrambled watermark matrix W'.
8. The watermark-based electronic seal generation apparatus according to claim 6, wherein the embedding unit is specifically configured to:
obtaining preset watermark embedding strength parameter
Figure FDA0002108589370000041
Calling preset formulas
Figure FDA0002108589370000042
And embedding the scrambled watermark matrix W 'into the first singular matrix S to obtain a second singular matrix S' containing the watermark.
9. A watermark-based electronic seal generation system, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the watermark-based electronic seal generation method according to any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method of generating an electronic seal based on a watermark according to any one of claims 1 to 4.
CN201910562236.7A 2019-06-26 2019-06-26 Electronic seal generating method, device and system based on watermark and storage medium Pending CN112149062A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910562236.7A CN112149062A (en) 2019-06-26 2019-06-26 Electronic seal generating method, device and system based on watermark and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910562236.7A CN112149062A (en) 2019-06-26 2019-06-26 Electronic seal generating method, device and system based on watermark and storage medium

Publications (1)

Publication Number Publication Date
CN112149062A true CN112149062A (en) 2020-12-29

Family

ID=73869972

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910562236.7A Pending CN112149062A (en) 2019-06-26 2019-06-26 Electronic seal generating method, device and system based on watermark and storage medium

Country Status (1)

Country Link
CN (1) CN112149062A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113129197A (en) * 2021-04-08 2021-07-16 陕西科技大学 Digital watermark algorithm for solving false positive problem based on two-stage singular value decomposition
CN116522300A (en) * 2023-07-04 2023-08-01 北京点聚信息技术有限公司 Intelligent management system for electronic seal

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1725244A (en) * 2005-07-19 2006-01-25 电子科技大学 Generating and vertification method for electronic seal based on vulnerable water mark
US20120163652A1 (en) * 2009-09-03 2012-06-28 Zte Corporation Method and System for Embedding and Extracting Image Digital Watermark
US20120215811A1 (en) * 2011-02-17 2012-08-23 Media Mark Technologies Limited Method and apparatus for monitoring the distribution of electronic files
CN104156906A (en) * 2013-05-13 2014-11-19 国家电网公司 Digital image processing method and device
CN104794676A (en) * 2015-04-28 2015-07-22 东南大学 Highly-confidential anti-print digital image watermarking scan method
CN105303512A (en) * 2015-09-18 2016-02-03 安徽大学 Video dual watermark method based on SVD and QR codes
CN105335924A (en) * 2015-11-18 2016-02-17 曲阜师范大学 Wavelet domain color image watermark encryption algorithm based on differential evolution
CN107770407A (en) * 2017-11-01 2018-03-06 湖北工程学院 The image encryption method and device of joint zero watermarking insertion
CN108564519A (en) * 2017-12-22 2018-09-21 重庆邮电大学 A kind of Watermarking for Color Images method based on different transform domain
CN109829269A (en) * 2018-12-26 2019-05-31 平安科技(深圳)有限公司 Method, apparatus and system based on E-seal authenticating electronic documents

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1725244A (en) * 2005-07-19 2006-01-25 电子科技大学 Generating and vertification method for electronic seal based on vulnerable water mark
US20120163652A1 (en) * 2009-09-03 2012-06-28 Zte Corporation Method and System for Embedding and Extracting Image Digital Watermark
US20120215811A1 (en) * 2011-02-17 2012-08-23 Media Mark Technologies Limited Method and apparatus for monitoring the distribution of electronic files
CN104156906A (en) * 2013-05-13 2014-11-19 国家电网公司 Digital image processing method and device
CN104794676A (en) * 2015-04-28 2015-07-22 东南大学 Highly-confidential anti-print digital image watermarking scan method
CN105303512A (en) * 2015-09-18 2016-02-03 安徽大学 Video dual watermark method based on SVD and QR codes
CN105335924A (en) * 2015-11-18 2016-02-17 曲阜师范大学 Wavelet domain color image watermark encryption algorithm based on differential evolution
CN107770407A (en) * 2017-11-01 2018-03-06 湖北工程学院 The image encryption method and device of joint zero watermarking insertion
CN108564519A (en) * 2017-12-22 2018-09-21 重庆邮电大学 A kind of Watermarking for Color Images method based on different transform domain
CN109829269A (en) * 2018-12-26 2019-05-31 平安科技(深圳)有限公司 Method, apparatus and system based on E-seal authenticating electronic documents

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张进: "数字水印在电子印章中的应用", 《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113129197A (en) * 2021-04-08 2021-07-16 陕西科技大学 Digital watermark algorithm for solving false positive problem based on two-stage singular value decomposition
CN113129197B (en) * 2021-04-08 2024-01-12 陕西科技大学 Digital watermarking algorithm for solving false positive problem based on two-stage singular value decomposition
CN116522300A (en) * 2023-07-04 2023-08-01 北京点聚信息技术有限公司 Intelligent management system for electronic seal
CN116522300B (en) * 2023-07-04 2023-09-08 北京点聚信息技术有限公司 Intelligent management system for electronic seal

Similar Documents

Publication Publication Date Title
US8670560B2 (en) Encryption method
Lee et al. Digital image sharing by diverse image media
KR20070042511A (en) Systems and methods for digital content security
Bharti et al. A new approach of data hiding in images using cryptography and steganography
Baba et al. Watermarking of digital images in frequency domain
CN112149062A (en) Electronic seal generating method, device and system based on watermark and storage medium
Alturki et al. A novel approach for increasing security and data embedding capacity in images for data hiding applications
Yaseen et al. Image steganography based on hybrid edge detector to hide encrypted image using vernam algorithm
Al-Bahadili A secure block permutation image steganography algorithm
Hegde et al. Design and Implementation of Image Steganography by using LSB Replacement Algorithm and Pseudo Random Encoding Technique
Schlauweg et al. Quantization-based semi-fragile public-key watermarking for secure image authentication
Wazery et al. A hybrid technique based on RSA and data hiding for securing handwritten signature
Al-Husainy et al. Full Capacity Image Steganography Using Seven-Segment Display Pattern as Secret Key.
Sharma et al. A Review of Image Steganography Techniques: Development Trends to Enhance Performance.
Gupta et al. Improvisation of security in image steganography using DWT, huffman encoding & RC4 based LSB embedding
Negrat et al. Variable length encoding in multiple frequency domain steganography
Al-Rawi et al. Image authentication using stochastic diffusion
Venugopala et al. Evaluation of video watermarking algorithms on mobile device
CN115277972B (en) Image information hiding method based on cryptographic algorithm
CN113822786B (en) Invisible digital image watermarking processing method and device with strong robustness
Amsden et al. Analysis of Facebook steganographic capabilities
Al-Sewadi et al. Improved processing speed for text watermarking algorithm in color images
Devi A Secure Image Steganography Using LSB Technique and Random Pseudo Random Encoding Technique
Lyu et al. Hybrid Color Image Steganography Method Used for Copyright Protection and Content Authentication.
Gupta et al. Integrating steganography using genetic algorithm and visual cryptography for robust encryption in computer forensics

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20201229

RJ01 Rejection of invention patent application after publication