Screen watermark embedding and extracting method
By using blind watermark technology and transparent layered window technology on mobile devices to embed encrypted watermarks on screenshots, the problem that traditional digital information security technology cannot prevent screenshots and videos on mobile devices is solved, and the high security and concealment of information is achieved. Ensures traceability and tamper resistance of information.
Patent Information
- Application Number
- CN202411388373.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2024-11-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional digital information security technology cannot effectively prevent screenshots and video recording operations on mobile terminals, and it is difficult to ensure their security after being cracked. Traditional digital watermarking technology also cannot effectively prevent these threats.
The blind watermark technology is used to dynamically embed watermark information on the screen of the user equipment, generate watermark information through encryption algorithms and key management, and use transparent layered window technology to embed watermarks in the main window of the application, and combine DLL injection technology to ensure the concealment of the watermark. and tamper-resistant, realizing the traceability of watermarks.
It realizes the real-time embedding and extraction of watermarks without modifying the original file, improving the security and concealment of information, enhancing the resistance to attack and tracking capabilities, and effectively preventing information leakage and tracking the responsible person or device.
Smart Images

Figure CN118890527A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of digital information security, and in particular relates to a method for embedding and extracting a screen watermark. Background Art
[0002] With the popularization of digital office scenes and the convenience of information transmission, digital information security issues have become increasingly prominent. Illegal users often use screenshot tools and screen recording software on terminal PCs or mobile devices to illegally spread important digital information, so it is crucial to adopt effective digital information security technology to prevent or trace information leakage.
[0003] Traditional digital information security technology is mainly based on cryptography theory. In practical applications, files are usually encrypted into ciphertext through encryption algorithms such as AES (Advanced Encryption Standard) and DES (Data Encryption Standard) in symmetric encryption algorithms and RSA in asymmetric encryption algorithms, so that unauthorized users cannot open ciphertext files in a normal way. However, this method has certain disadvantages. On the one hand, encrypting files into ciphertext often arouses strong curiosity of illegal users, and they may invest more energy in trying to crack the ciphertext. On the other hand, once the ciphertext file is cracked, the file cannot be effectively prevented from being circulated, and its security is difficult to guarantee. Moreover, with the rapid improvement of computer processing power, the traditional method of increasing the system security level by continuously increasing the key length has become increasingly unsafe. Nowadays, the powerful computing power of computers has made it increasingly difficult to crack the key. In addition, this traditional digital information security technology cannot effectively prevent operations such as screenshots and video recordings on mobile terminals. In the era of mobile Internet, more and more people use mobile devices to process and transmit information, and the screenshot and video recording functions on mobile devices can be easily used by illegal users, posing a serious threat to digital information security.
[0004] Traditional digital watermarking technology can subtly embed watermark information in multimedia files such as audio, images, and videos through digital watermarking algorithms. This embedding method is very subtle and not easily detected by ordinary people. Even after careful observation, it is difficult to find the hidden watermark information. At the same time, since digital watermarking technology usually uses more complex algorithms and encryption methods, it is not easy to be easily attacked or removed by malicious attackers. Therefore, digital watermarking technology has been more widely used in multimedia copyright protection. Common digital watermarking algorithms include watermarking algorithms based on spatial domain, watermarking algorithms based on transform domain, and watermarking algorithms based on deep learning. Among them, the spatial domain digital watermarking algorithm directly superimposes watermark information on the space of multimedia signals. Generally, digital watermarks are added by changing the grayscale value of the image, and the data in the carrier is replaced by the watermark signal. The transform domain digital watermarking algorithm first converts the multimedia signal from the spatial domain to the transform domain, such as the discrete cosine transform (DCT) domain, discrete Fourier transform (DFT) domain or discrete wavelet transform (DWT) domain, then embeds the watermark information in the coefficients of the transform domain, and finally converts the signal back to the spatial domain through inverse transformation. The digital watermarking technology based on deep learning uses the powerful learning and representation capabilities of deep neural networks to automatically learn the characteristics of multimedia data, such as using convolutional neural networks (CNN) to extract features from images, and then embedding watermark information into these features to achieve more robust watermark embedding. However, traditional digital watermarking technology is also unable to effectively prevent operations such as screenshots and video recordings on mobile devices.
[0005] In order to deal with illegal screenshots and video recordings, screen watermarking technology came into being. The core of screen watermarking technology is to dynamically superimpose a watermark on the screen of the user's device. The watermark can contain identification data such as user ID, device information, and timestamp. When a user attempts to obtain screen content through screenshots, screen recording, etc., the watermark will be directly embedded in the generated image or video. This allows the watermark content to be traced back to the responsible person or device once the information is leaked, achieving a strong protection effect. In addition, screen watermarking technology can also embed watermarks without modifying the original file. In particular, blind watermarking technology can maintain concealment without affecting user operations, thereby reducing the user's perception of the watermark. This technology is not only widely used in enterprise data protection and digital copyright protection, but also has high value in preventing the leakage of confidential information. Summary of the invention
[0006] The present invention provides a method for embedding and extracting a screen watermark, which encrypts user plaintext information, embeds the ciphertext information into an application main window or a transparent layered window using a blind watermarking technique, and loads the watermark logic into a target process using a variety of injection techniques, thereby ensuring the concealment, tamper resistance and traceability of the watermark; a method for generating and embedding watermark information based on encryption algorithms and key management, the application of transparent layered window technology, a mechanism for extracting and decrypting blind watermark information, and a technical implementation for tracing and injecting watermarks into a target process, thereby solving the problems raised in the above-mentioned background technology.
[0007] To achieve the above object, the present invention provides the following technical solutions: A method for embedding and extracting a screen watermark comprises the following steps: S1: Generate watermark information string: collect basic user information, combine it into a plaintext string, encrypt it to get ciphertext information; combine the ciphertext information into the first type of watermark information string according to the predefined format; then add the position information containing the fixed string constant value to form the second type of watermark information string; S2: Select DLL injection technology to inject two types of watermark information strings into the target application process; S3: Get the main window of the application process; S4: Create a transparent layered window; S5: drawing watermark information on the transparent layer; S6: blind watermark extraction; S7: Decryption of the first type of watermark information: obtain the key and algorithm, decrypt to obtain the plaintext data, verify and store; S8: blind watermark embedding; S9: Decryption of the second type of watermark information: obtain the starting position of the watermark information, extract the encrypted information in sequence, perform decryption operations, and verify the data.
[0008] Preferably, the first type of watermark information character string in S1 uses a field of fixed length or uses a specific separator to connect various parts.
[0009] Preferably, the injection operation performed in S2 is specifically as follows: selecting remote thread injection, opening the target process, and obtaining its handle; allocating memory, allocating a piece of memory in the address space of the target process, writing the DLL path, obtaining the function address, and creating a remote thread.
[0010] Preferably, S3 specifically operates as follows: Install Hook: install a hook in the injected DLL file; intercept window messages: listen to specific window messages in the hook callback function; obtain the main window handle; save the handle: save it to a global variable or a suitable data structure, and install the hook to choose to install a global hook or a thread-level hook.
[0011] Preferably, drawing the watermark information on the transparent layer in S5 is specifically as follows: Set the brush format: choose a color that contrasts with the background, select a readable font type, add shadows and stroke effects; Dynamically draw watermarks: Draw the watermark at a specific angle and update the watermark content regularly.
[0012] Preferably, the specific steps of S6 are: adjusting the watermark transparency to a low value, separating the image color channels, and extracting the least significant bit of each channel; and setting the alpha transparency of the window through the SetLayeredWindowAttributes function, or using a semi-transparent brush when drawing.
[0013] Preferably, the blind watermark extraction in S6 also includes enhancing the extracted bit plane image, using image similarity and clarity evaluation algorithms to evaluate the extraction results, and finally extracting the watermark information.
[0014] Preferably, the specific steps of S8 are: obtaining bitmap data, selecting specific pixels of the bitmap, embedding the information of watermark type 2 into the least significant bit of the pixel; and selecting the LSB embedding method to embed the three channels of RGB respectively.
[0015] Compared with the prior art, the present invention has the following beneficial effects: 1. Real-time embedding without modifying the file: The biggest feature of screen watermarking technology is that the watermark is embedded at the screen layer without modifying the structure or content of the original file. Regardless of whether the file is encrypted or a multimedia file, the watermark can be directly applied to the display layer and updated at any time.
[0016] 2. Information security: (1) Encrypted watermark information: Encrypt watermark information (including user ID, device information, timestamp, and custom information) through encryption algorithms to ensure the security of watermark information. Even if the watermark is extracted, its content cannot be directly read or tampered with, which improves the overall anti-attack and information protection level. (2) Multi-level watermark design: Two types of watermark information structures are used. The first type of watermark contains encrypted information, and the second type of watermark embeds it in a more complex format, further increasing the concealment and security of the watermark.
[0017] 3. Concealment and user unawareness: (1) Transparent layered window: Create a transparent layered window and set the watermark to low transparency so that it is difficult to detect under normal circumstances. When using the software normally, users will hardly notice the existence of the watermark, ensuring a good user experience. (2) Blind watermark technology: embed the watermark information into the bitmap through the LSB (least significant bit) embedding method, making the watermark information almost invisible in files generated by operations such as screenshots or screen recordings, but it can still be extracted through specific algorithms. This method further enhances the concealment of the watermark.
[0018] 4. Diversity and adaptability: (1) It can adapt to a variety of application processes. By matching the properties, MD5 values, digital signatures and other information of the target process, the system can adapt to different target application processes and flexibly inject watermarks. This provides a guarantee for the versatility and scalability of the watermark system.
[0019] 5. Easy to detect and track: (1) Information tracking and tracing. The watermark content contains key data such as user ID, device information, and timestamp. Combined with the extraction and decryption functions of blind watermarks, the source of information leakage can be traced. This is especially important for application scenarios such as accountability and evidence collection, and improves the traceability of information management. (2) Multiple watermark extraction methods. The system supports watermark extraction through different channels and bit plane extraction algorithms (such as LSB algorithm), and uses image similarity and clarity analysis to select the best extraction result to ensure the accuracy and reliability of the extracted watermark.
[0020] 6. Anti-tampering: (1) Complex embedding method: the watermark information is embedded in the least significant bit of the bitmap. At the same time, the transparent watermark layer is closely integrated with the main window, making it much more difficult to tamper with or remove the watermark, ensuring the long-term effectiveness of the watermark. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 The present invention is a flow chart for generating watermark information.
[0022] Figure 2 The screen watermark design flow chart of the present invention. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] See also Figure 1-Figure 2 The present invention provides a method for embedding and extracting a screen watermark, comprising the following steps: S1: Generate watermark information string Generate plain text information: First, collect basic user information, including user ID, device information (such as device model, operating system version, unique device identifier, etc.), timestamp, and any custom information. This information can be obtained through system APIs or preset parameters. Combine this information into a plain text string in a specific format (such as JSON, XML, or custom delimiters) to ensure a clear data structure for subsequent processing; Generate ciphertext information: Select the appropriate encryption algorithm type index value, key index value, and corresponding key from the database or configuration file. Common encryption algorithms include AES, DES, RSA, etc. Symmetric or asymmetric encryption can be selected according to needs. Use the selected encryption algorithm and key to encrypt the previously generated plaintext information to obtain ciphertext information. During the encryption process, attention should be paid to data integrity and security. It may be necessary to add an initialization vector (IV) or use a specific encryption mode (such as CBC, CFB, etc.).
[0025] Generate watermark: The first type of watermark information string is recorded as watermark 1: the encryption algorithm type index value, key index value, ciphertext information length value and ciphertext information are combined into a new watermark information string according to a predefined format; The second type of watermark information string is recorded as watermark 2: based on watermark 1, position information containing fixed string constant values is added. This position information can be used to accurately locate the embedding position of the watermark in the image or video. The position information is combined with the information of watermark 1 to form a new watermark information string, which is ready to be embedded in the target media.
[0026] S2: Inject two types of watermark information strings into the target application process Determine the target process: Use system APIs (such as EnumProcesses, GetModuleFileNameEx) to obtain a list of currently running processes and detailed information about each process, including the process name, executable file path, file attributes (size, version, etc.), file MD5 value, and digital signature certificate serial number. Filter out the target processes that need to be controlled based on preset policies (such as process name matching, file signature verification, etc.) to ensure that non-target applications are not affected; Choose the appropriate injection technology: Choose the most suitable DLL injection technology according to the characteristics and operating environment of the target application. Common injection methods include: remote thread injection, creating a remote thread in the target process and executing LoadLibrary to load the DLL; APC injection, queuing the DLL loading code into the asynchronous procedure call queue of the target process; reflection injection, not using the DLL file on the disk, directly injecting the DLL image into the target process memory; input method injection, registry injection, Detours injection: select according to specific needs and environment. Prepare the DLL file containing the watermark processing logic to ensure its compatibility and stability; Perform the injection operation.
[0027] S3: Use Hook technology to obtain the main window of the application process Install Hook: In the injected DLL file, use the SetWindowsHookEx / SetWindowLongPtr function to install the hook; Intercept window messages: In the hook callback function, listen to specific window messages, such as WM_CREATE (window creation), WM_PAINT (window painting), WM_SIZE (window size change), etc. Get the main window handle: Get the main window handle of the target application by analyzing the intercepted message. For example, when a WM_CREATE message is received, the CREATESTRUCT structure can be extracted from the lParam parameter, which contains the window handle; Save handle: Save the acquired main window handle to a global variable or a suitable data structure for subsequent watermark drawing.
[0028] S4: Creating a transparent layered window Determine the layer properties: Window size, keep it consistent with the main window size of the target application, or cover a specific area as required. Position positioning, synchronize the transparent window with the main window position, and handle window movement, maximization, minimization and other events when necessary. Transparency setting, select an appropriate transparency value (alpha value) to ensure the visibility and non-intrusiveness of the watermark; Create a layer window: Use the CreateWindowEx function to create a window, set the extended styles WS_EX_LAYERED (to make the window have layered attributes) and WS_EX_TRANSPARENT (to make the window mouse events transparent); set the window style to WS_POPUP to make the window borderless and not displayed in the taskbar; after the window is created, use the SetLayeredWindowAttributes or UpdateLayeredWindow function to set the window's transparency attribute; Drawing initialization: Use GDI+ to initialize the drawing environment and create a Graphics object for subsequent watermark drawing; load the required fonts, colors and other resources to prepare the drawing content; Synchronize window status: listen to the main window's events (such as moving, resizing, minimizing, etc.), and synchronously adjust the transparent window's position and size; you can use the SetWindowPos function or process the WM_WINDOWPOSCHANGED message to ensure that the transparent window always covers the main window.
[0029] S5: Draw watermark information on the transparent layer.
[0030] S6: Implement blind watermark function (transparency adjustment) Adjust watermark transparency: Set the overall transparency of the transparent layered window to a lower value; Blind watermark extraction: Image acquisition, obtain the image containing the watermark, which can be the result of screenshot or screen recording. Channel separation, separate the RGB color channels of the image and analyze the pixel data of each channel separately; bit plane extraction, extract the least significant bit (LSB) of each color channel, and it may be necessary to extract multiple bit planes to obtain the best effect.
[0031] S7: Decryption of the first type of watermark information Decrypt watermark content: parse the encrypted information, and read the encryption algorithm type index value, key index value and ciphertext length from the extracted watermark information; Get the key and algorithm: According to the index value, get the corresponding encryption algorithm and key from the encryption algorithm type and key database; Perform decryption operation: use the obtained encryption algorithm and key to decrypt the ciphertext information; Obtain plaintext data: After decryption, obtain plaintext data containing user ID, device information, timestamp, and custom information; Verification and storage: Verify the integrity and correctness of the decrypted data, using a checksum or digital signature. Record the decrypted information for subsequent tracing or analysis.
[0032] S8: Implementing blind watermarking function (bitmap modification) Blind watermark embedding: Get bitmap data, get the currently displayed bitmap data from the drawing context of the main window, or directly process the image file. LSB embedding method: Select specific pixels of the bitmap and embed the information of watermark 2 into the least significant bit of the pixel.
[0033] S9: Decryption of the second type of watermark information Get the starting position of the watermark information: first perform image acquisition to obtain the image containing the watermark, then perform a sliding window search, use the position information string length value in watermark 2 as the length of the sliding window, and traverse the image pixel data. Match a fixed string: In each sliding window, parse the watermark information according to the LSB extraction algorithm, and find the position information containing the fixed string constant value. Determine the starting coordinates: When the extracted data matches the fixed string constant value, record the coordinates of the window as the starting position of the watermark information; Extract the encrypted information in sequence: starting from the starting position, extract the encryption algorithm type, key index, ciphertext length and ciphertext information in sequence according to the predetermined format and length. Pay attention to the data boundary: ensure that the image data range is not exceeded during the extraction process to prevent data reading errors; Decrypt watermark content: Get the key and algorithm, query the corresponding encryption algorithm and key from the database according to the extracted encryption algorithm type value and key index. Perform decryption operation, use the corresponding encryption algorithm and key to decrypt the ciphertext information and restore the original plaintext data. Data verification, verify the decrypted plaintext data to ensure the integrity and correctness of the information.
[0034] As a further embodiment, the watermark information string of watermark 1 in S1 uses a fixed-length field or a specific separator to connect the various parts. The purpose of this step is to carry enough information in the watermark to support subsequent decryption and verification.
[0035] As a further embodiment, the injection operation performed in S2 is specifically as follows: select remote thread injection, open the target process, use the OpenProcess function to open the target process with sufficient permissions, and obtain its handle; allocate memory, use the VirtualAllocEx function to allocate a piece of memory in the address space of the target process for storing the DLL path or injection code; write the DLL path, use the WriteProcessMemory function to write the DLL path to the memory allocated by the target process. Get the function address, use GetProcAddress to get the address of the LoadLibraryA function in the current process, which is the same in all processes because the system DLL (such as kernel32.dll) is loaded to the same address in all processes. Create a remote thread: Use the CreateRemoteThread function to create a remote thread in the target process, the thread entry function is LoadLibraryA, and the parameter is the memory address of the DLL path. In this way, the target process will execute LoadLibraryA to load the specified DLL.
[0036] As a further embodiment, the installation of the hook in S3 selects to install a global hook or a thread-level hook, and common hook types include: WH_CALLWNDPROC: monitors messages sent to the target thread message queue. WH_GETMESSAGE: monitors messages taken out of the message queue.
[0037] As a further embodiment, drawing the watermark information on the transparent layer in S5 is specifically: Set the brush format: Color selection: Choose a color that has a proper contrast with the background to avoid being too conspicuous or completely invisible. You can use semi-transparent colors (set alpha value) to reduce the sense of presence. Font settings: Choose a readable font type and set a suitable font size, which can be adjusted according to the window size and resolution. Text effects: You can add effects such as shadows and strokes to improve the readability of the watermark.
[0038] Dynamically draw watermarks: position and angle, draw the watermark at a specific angle (such as 45 degrees) or draw it repeatedly in a tiled manner to cover the entire window area. Content update, if necessary, regularly update the watermark content, such as adding dynamic information (timestamp, etc.) to prevent screenshot tampering. Drawing method, use the DrawString method of the Graphics object to draw the watermark text at the specified position. Performance optimization, reduce the number of drawing times to avoid taking up too much CPU resources. Pause drawing when it is not necessary (such as when the window is minimized or covered) to improve application performance.
[0039] As a further embodiment, in S6, the alpha transparency of the window is set through the SetLayeredWindowAttributes function, or a semi-transparent brush is used when drawing, so that the watermark is difficult to be detected by the naked eye.
[0040] As a further embodiment, the blind watermark extraction in S6 also includes image processing, which performs enhancement processing on the extracted bit plane image, such as binarization and filtering, to improve the visibility of the watermark. Algorithm evaluation, using image similarity and clarity evaluation algorithms, evaluates the extraction results, and selects a better watermark extraction scheme after evaluation through different bit plane image enhancement processing schemes such as binarization and filtering. Finally, the watermark information is extracted.
[0041] As a further embodiment, the LSB embedding method in S8 selects to embed the three channels of RGB separately, preferably embeds only the blue channel, embeds the strategy, designs the order and position of embedding, and may adopt a pseudo-random sequence or a specific algorithm to improve the security and concealment of the watermark. Process color overflow, and ensure that the color value will not overflow (exceed the range of 0-255) when modifying the pixel value. The pixel value can be detected and adjusted before embedding.
[0042] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for embedding and extracting a screen watermark, characterized in that: The method comprises the following steps: S1: generating a watermark information string: collecting basic user information, combining it into a plaintext string, and encrypting it to obtain ciphertext information; combining the ciphertext information into a first type of watermark information string according to a predefined format; and then adding position information containing a fixed string constant value to form a new second type of watermark information string; S2: Select DLL injection technology to inject two types of watermark information strings into the target application process; S3: Get the main window of the application process; S4: Create a transparent layered window; S5: drawing watermark information on the transparent layer; S6: blind watermark extraction; S7: Decryption of the first type of watermark information: obtain the key and algorithm, decrypt to obtain the plaintext data, verify and store; S8: blind watermark embedding; S9: Decryption of the second type of watermark information: obtain the starting position of the watermark information, extract the encrypted information in sequence, perform decryption operations, and verify the data.
2. A method for embedding and extracting a screen watermark according to claim 1, characterized in that: The first type of watermark information character string in S1 uses a fixed-length field or a specific separator to connect the various parts.
3. A method for embedding and extracting a screen watermark according to claim 1, characterized in that: The injection operation performed in S2 is as follows: select remote thread injection, open the target process, and obtain its handle; Allocate memory Allocate a block of memory in the address space of the target process, write the DLL path, get the function address, and create a remote thread.
4. A method for embedding and extracting a screen watermark according to claim 1, characterized in that: The specific operations of S3 are as follows: Install Hook: install the hook in the injected DLL file; intercept window messages: listen to specific window messages in the hook callback function; get the main window handle; save the handle: save it to a global variable or a suitable data structure, and install the hook to choose to install a global hook or a thread-level hook.
5. A method for embedding and extracting a screen watermark according to claim 1, characterized in that: In S5, the watermark information is drawn on the transparent layer as follows: Set the brush format: choose a color that contrasts with the background, select a readable font type, add shadows and stroke effects; Dynamically draw watermarks: Draw the watermark at a specific angle and update the watermark content regularly.
6. A method for embedding and extracting a screen watermark according to claim 1, characterized in that: The specific steps of S6 are: adjust the watermark transparency to a low value, separate the image color channels, and extract the least significant bit of each channel; and set the alpha transparency of the window through the SetLayeredWindowAttributes function, or use a semi-transparent brush when drawing.
7. A method for embedding and extracting a screen watermark according to claim 1, characterized in that: The blind watermark extraction in S6 also includes enhancing the extracted bit plane image, using image similarity and clarity evaluation algorithms to evaluate the extraction results, and finally extracting the watermark information.
8. A method for embedding and extracting a screen watermark according to claim 1, characterized in that: The specific steps of S8 are: obtaining bitmap data, selecting specific pixels of the bitmap, embedding the information of watermark type 2 into the least significant bit of the pixel; and selecting the LSB embedding method to embed the three channels of RGB respectively.
Citation Information
Patent Citations
Watermark embedding method as well as extraction method and apparatus
CN105989253A
Watermark adding method and device
CN111382399A
Method and device for generating blind watermark, medium and equipment
CN112434267A
Blind watermark encryption implementation method based on screenshot information protection
CN115270084A
Method for adding and extracting screenshot blind watermark in memory
CN117132442A
