Time watermark verification method and device and computer program product
By introducing time interfaces at the C/C++ and assembly language levels and a multi-source time synchronization strategy, combined with multi-interface cross-validation, the risk of time forgery is detected and handled, thus solving the problem of time watermark tampering and improving the credibility and security of watermark images.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUIHAI GALAXY (CHENGDU) TECHNOLOGY CO LTD
- Filing Date
- 2025-11-28
- Publication Date
- 2026-05-01
AI Technical Summary
Malicious attackers may forge time watermarks by tampering with time information, causing the time watermark to become distorted and reducing the credibility of the watermark image.
By introducing time interfaces at the C/C++ and assembly language levels, combined with multi-source time synchronization strategies and multi-interface cross-verification, a reliable system startup time can be obtained. The difference between the absolute time of the generated time watermark and the usage time can be compared to detect the risk of time forgery and perform risk handling.
It improves the authenticity and credibility of time watermarks, enhances the security of time watermark images, and reduces the difficulty of cracking time interfaces.
Smart Images

Figure CN121967606A_ABST
Abstract
Description
Verification methods, devices, and computer programs for time watermarks Technical Field
[0001] This application relates to the field of information security technology, and in particular to verification methods, devices and computer program products related to time watermarking. Background Technology
[0002] Watermark camera apps are mobile applications that automatically add various information watermarks to photos when they are taken. They are widely used in scenarios such as work recording, daily check-ins, and content creation. Watermark types can include time watermarks, latitude and longitude watermarks, and location watermarks. Among them, the authenticity of the time watermark is the core element in ensuring the credibility of the generation time of the captured content. However, malicious attackers may tamper with time information in various ways, such as modifying the time interface return value to forge time data, making it difficult to guarantee the authenticity of the generated time, distorting the time watermark, and ultimately reducing the credibility of the watermarked image. Summary of the Invention
[0003] This application provides a method, apparatus, and computer program product for verifying time watermarks, which can detect the risk of time forgery and ensure the authenticity of time watermark data.
[0004] This application provides the following solution: According to a first aspect, a time watermark verification method is provided, applied to a client. The method includes: pre-obtaining a trusted first absolute time; calling a time interface to obtain a system monotonic time to obtain a first relative time; using the first absolute time and the first relative time to determine and store a system startup time; responding to an event triggering the generation of a watermark for a target image, calling a time interface to obtain a system monotonic time to obtain a second relative time, and obtaining the pre-stored system startup time; using the second relative time and the system startup time to determine a second absolute time; detecting the existence of a time forgery risk by comparing the second absolute time with the time used to generate the time watermark; and performing risk handling in response to the existence of a time forgery risk; wherein the time interface includes at least one of a C / C++ language layer time interface and an assembly language layer time interface.
[0005] According to a second aspect, a time watermark verification device is provided, disposed on a client side. The device includes: a time acquisition unit configured to pre-acquire a trusted first absolute time and call a time interface to obtain a system monotonic time to obtain a first relative time, wherein the time interface includes at least one of a C / C++ language layer time interface and an assembly language layer time interface; a time determination unit configured to determine and store a system startup time using the first absolute time and the first relative time; the time acquisition unit is further configured to, in response to an event triggering the generation of a watermark for a target image, call the time interface to obtain a system monotonic time to obtain a second relative time and acquire the pre-stored system startup time; the time determination unit is further configured to determine a second absolute time using the second relative time and the system startup time; a risk detection unit configured to detect the existence of a time forgery risk by comparing the second absolute time with the time used to generate the time watermark; and a risk processing unit configured to perform risk processing in response to the existence of a time forgery risk.
[0006] According to a third aspect, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps of any of the methods described in the first aspect.
[0007] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application provides a method for verifying the authenticity of a time watermark, introducing at least one of a C / C++ language layer time interface and an assembly language layer time interface to obtain time data, increasing the difficulty of cracking the time interface, and determining whether there is a risk of time forgery by detecting the difference between the second absolute time and the time used to generate the data watermark. If there is a risk of time forgery, risk processing is performed. This method can better guarantee the authenticity of the time watermark and improve the credibility of the watermark image. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 is a system architecture diagram applicable to the embodiments of this application.
[0010] Figure 2 is a flowchart of the time watermark verification method executed by the client according to an embodiment of this application.
[0011] Figure 3 is a flowchart of a method for determining the startup time of a storage system according to an embodiment of this application.
[0012] Figure 4 is a flowchart of another method for storage system startup time provided in an embodiment of this application.
[0013] Figure 5 is a flowchart of the process of obtaining the system monotonic time by the client provided in the embodiment of this application.
[0014] Figure 6 is a schematic diagram of the time watermark provided in the embodiment of this application.
[0015] Figure 7 is a schematic block diagram of a verification device for setting a time watermark on the client side according to an embodiment of this application.
[0016] Figure 8 is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0018] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0019] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0020] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0021] To facilitate understanding of this application, the system architecture on which this application is based is first described. Figure 1 illustrates an exemplary system architecture to which embodiments of this application can be applied. As shown in Figure 1, this system architecture may include a client and a server.
[0022] The server and client are the two main components of an application service. The server, using a server as its primary hardware infrastructure, may include one or more software service modules. In this embodiment, it is mainly responsible for responding to business requests, key requests, and sending the first absolute time to the client, forming a collaborative front-end and back-end with the client.
[0023] The user terminal where the client resides can include, but is not limited to, smart mobile terminals, wearable devices, and PCs (Personal Computers). Smart mobile devices can include devices such as mobile phones, tablets, PDAs (Personal Digital Assistants), and connected car terminals. Wearable devices can include devices such as smartwatches, smart glasses, smart bracelets, VR (Virtual Reality) devices, AR (Augmented Reality) devices, and mixed reality devices (i.e., devices that support both virtual and augmented reality), etc.
[0024] The client can be an application located on the user's terminal, or it can be a plugin or software development kit (SDK) or other functional unit set in the application.
[0025] A server can be a standalone server, a server cluster, or a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a hosting product within the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Servers (VPS) services, such as high management difficulty and weak service scalability.
[0026] It should be understood that the server and client shown in Figure 1 are merely illustrative. Depending on the implementation requirements, there can be any number of servers and clients.
[0027] Figure 2 is a flowchart of the time watermark verification method provided in the embodiment of this application. This method can be executed by the client in the system shown in Figure 1. As shown in Figure 2, the method may include the following steps: Step 201: Pre-obtain a reliable first absolute time, call the time interface to obtain the system monotonic time to obtain a first relative time, and use the first absolute time and the first relative time to determine and store the system startup time.
[0028] Step 202: In response to the event that triggers the generation of a watermark for the target image, the time interface is called to obtain the system monotonic time to obtain the second relative time, and the pre-stored system startup time is obtained.
[0029] Step 203: Determine the second absolute time using the second relative time and the system startup time.
[0030] Step 204: Detect the risk of time forgery by comparing the second absolute time with the time used to generate the time watermark.
[0031] Step 205: In response to the risk of time falsification, perform risk handling.
[0032] As can be seen from the above process, this application provides a method for verifying the authenticity of a time watermark. It introduces at least one of a C / C++ language layer time interface and an assembly language layer time interface to obtain time data, which increases the difficulty of cracking the time interface. After pre-determining and storing a reliable system startup time, in response to the event of generating a watermark for the target image, it uses the system monotonic time obtained by the time interface and the pre-stored system startup time to obtain a second absolute time. By detecting the difference between the second absolute time and the time used to generate the data watermark, it determines whether there is a risk of time forgery. If there is a risk of time forgery, risk processing is performed. This method can better guarantee the authenticity of the time watermark and improve the credibility of the watermark image.
[0033] The following describes in detail each step of the above process and the effects that can be further produced, with reference to the embodiments. It should be noted that the terms "first" and "second" involved in this disclosure do not have limitations in terms of size, order, or quantity, but are only used to distinguish them in name. For example, "first key" and "second key" are used to distinguish two different keys.
[0034] First, the above step 201, namely "pre-obtaining a reliable first absolute time, calling the time interface to obtain the system monotonic time to obtain the first relative time, and using the first absolute time and the first relative time to determine and store the system startup time", will be described in detail with reference to the embodiments.
[0035] As one possible approach, as shown in Figure 3, the client can store the system startup time through the following steps S31~S33: S31: Pre-obtain a trusted first absolute time.
[0036] In this embodiment, the first absolute time is the guarantee of the authenticity of the system startup time, therefore it is necessary to ensure that the first absolute time is reliable. The first absolute time can be the standard UTC (Coordinated Universal Time) time synchronized by the server, the time synchronized by GPS (Global Positioning System), or the system wall time that is restricted to use, such as the system wall time that is only used when the device has "automatic date and time set" enabled and can connect to the Internet. The system wall time is the actual time that has passed in the real world as represented by the computer system, which is the time displayed on the clock that we see every day.
[0037] For example, when the first absolute time is standard UTC time, the client can obtain the standard UTC time from the server in advance through a dedicated time synchronization interface. The standard UTC time source can be obtained by the server through a national time service center. The dedicated time synchronization interface uses a secure communication connection to communicate securely with the server. The communication connection between the client and the server can be, but is not limited to, at least one of the following: HTTPS (Hypertext Transfer Protocol Secure), MQTT (Message Queuing Telemetry Transport), QUIC (Quick UDP Internet Connections), etc.
[0038] For example, a client can first send a time request to the server and obtain a reliable first absolute time. However, if the network is unavailable and the client fails to obtain the first absolute time from the server, it can obtain the first absolute time from the GPS module of its device. If the client also fails to obtain the first absolute time from the GPS module, it will then obtain the time displayed on the system wall as the first absolute time. This priority-based multi-source time synchronization strategy ensures successful acquisition of the first absolute time under various conditions.
[0039] For example, the client can first establish multiple communication connections with the aforementioned server and receive multiple encrypted time information messages returned by the server through these connections. This time information may include UTC time, time obtained from other time centers, etc. Then, the client uses a dynamic key to decrypt the encrypted time information, obtaining multiple time messages and their corresponding signatures. These signatures are then used to verify the corresponding time messages. Finally, the verified time messages are used to determine the first absolute time. It should be noted that if the time information received by multiple communication connections can be successfully decrypted, each time message and its corresponding signature match, and the time information received by multiple communication connections meets the consistency requirement, then a reliable first absolute time can be obtained using the multiple time messages. This method of receiving time information through multiple communication connections improves the security of time information transmission. Furthermore, verifying the signatures of multiple encrypted time messages separately can effectively identify whether the encrypted time information has been tampered with.
[0040] S32: Call the time interface to obtain the system monotonic time to get the first relative time.
[0041] The system monotonic time is the accumulated runtime of the client's terminal since the most recent system startup. It is a relative time, and therefore referred to as the first relative time in this embodiment. The client can obtain the system monotonic time of its terminal by calling the time interface, and use it as the first relative time.
[0042] In this embodiment, the time interface may include at least one of a C / C++ language layer time interface and an assembly language layer time interface, thereby ensuring that the time interface is not easily cracked. It may further include a Java layer time interface. For a detailed description of the time interface, please refer to the following embodiment for step 202.
[0043] S33: Determine and store the system startup time using the first absolute time and the first relative time mentioned above.
[0044] The system startup time can be determined by using the difference between the first absolute time and the first relative time. For example, the system startup time Boot_Time can be determined using the following formula: Boot_Time = Server_Time - Elapsed_Time.
[0045] Where Server_Time is the first absolute time, and Elapsed_Time is the system monotonic time, i.e., the first relative time.
[0046] In this embodiment of the application, the verification of the time watermark depends on the authenticity and security of the system startup time. In order to ensure the security of the system startup time, the system startup time can be encrypted and stored, and / or stored in a secure storage space.
[0047] As one possible approach, as shown in Figure 4, to improve the security of the storage system startup time, the client can perform the following steps S41~S43. Storage system startup time: S41: Obtain the first key and the encrypted second key from the secure storage space.
[0048] In this embodiment, to prevent key leakage, the first key and the encrypted second key can be pre-stored in a secure storage space, and the client then retrieves the first key and the encrypted second key from the secure storage space. The first key can be a key for an asymmetric encryption algorithm (e.g., RSA-2048). The second key can be a key for a symmetric encryption algorithm (e.g., AES-256) used to encrypt the system startup time. To further ensure the security of the second key, it can be pre-encrypted using the first key and then stored.
[0049] Secure storage space can be the storage space corresponding to KeyStore (Security Key Management Service), or it can be the storage space corresponding to TEE (Trusted Execution Environment) / StrongBox (Secure Storage Vault).
[0050] S42: Use the first key to decrypt the encrypted second key to obtain the second key.
[0051] After obtaining the first key and the encrypted second key, the client can use the first key to decrypt the encrypted second key and obtain the second key.
[0052] S43: Encrypt the system startup time using the second key and store the encrypted system startup time.
[0053] This hybrid encrypted storage method can effectively ensure the storage security during system startup.
[0054] In this embodiment of the application, in order to ensure the authenticity of the obtained system monotonic time, the system monotonic time can be obtained through multiple time interfaces and cross-validated. As shown in Figure 5, to ensure that the obtained system monotonic time is true, the client can call the time interface to obtain the system monotonic time through the following steps S51~S52: S51: Call at least two of the time interfaces among the Java layer time interface, C / C++ language layer time interface and assembly language layer time interface to obtain at least two system monotonic times.
[0055] Generally speaking, compared to the Java layer time interface, the C / C++ language layer time interface and the assembly language layer time interface are more difficult to crack and tamper with, and the obtained system monotonic time is more reliable.
[0056] S52: Compare the consistency of the monotonic times of at least two systems. If the consistency requirement is met, the system monotonic time is obtained; otherwise, the risk of time forgery is determined.
[0057] In this embodiment, the consistency requirement can be that when cross-validating system monotonic data from multiple time interfaces, the error between the system monotonic times corresponding to any two time interfaces does not exceed an error threshold. For example, the error threshold can be set to 20-30 milliseconds, or it can be set to other values, depending on the specific scenario requirements.
[0058] If the client detects that the error between the system monotonic times corresponding to any two time interfaces exceeds the error threshold, it determines that there is a risk of time spoofing. If the client does not detect that the error between the system monotonic times corresponding to any two time interfaces exceeds the error threshold, it uses the system monotonic time obtained from the time interface with the highest credibility as the client's system monotonic time. Alternatively, the client's system monotonic time can be obtained by weighted averaging of the system monotonic times corresponding to different time interfaces based on their credibility.
[0059] This multi-time interface system monotonic time cross-validation method can effectively identify whether the time interface has been tampered with and whether there is a risk of forgery in the system monotonic time. When there is a risk of forgery, the client performs risk processing, which can better ensure the authenticity of the time watermark.
[0060] It should be noted that in any scenario such as client initialization, terminal device initialization, and storage space initialization, since the stored system startup time has been lost or expired, the client usually needs to re-execute the above steps S31~S33 to generate and store the system startup time.
[0061] Furthermore, to periodically calibrate the system startup time, the client can also periodically execute the above steps S31~S33 to update the stored system startup time.
[0062] The following describes in detail step 202, namely, "in response to the event of generating a watermark for the target image, calling the time interface to obtain the system monotonic time to obtain the second relative time, and obtaining the pre-stored system startup time," with reference to the embodiments.
[0063] In this embodiment, the target image involved in this application can be an image captured in real time by a watermark camera application. The time interface can include at least one of a C / C++ language layer time interface and an assembly language layer time interface. The second relative time, i.e., the system monotonic time, can be the accumulated runtime of the client terminal since the most recent system startup. The system startup time can be the time of the most recent system startup of the client terminal.
[0064] Generally, when photographers use watermarked cameras to take real-time photos, they usually add watermarks to the target images, one type being time watermarks, to increase the credibility of the captured content. Traditionally, the user client typically calls a Java-level time interface to obtain time data. This Java-level time interface refers to the time acquisition logic written in Java and running on the Java Virtual Machine. Because the bytecode generated after editing the Java layer is semi-structured, with clearly defined classes, methods, and variable names, hooking the Java layer is relatively easy. Crackers can easily decompile it to obtain near-original Java code and replace the time returned by this interface.
[0065] To increase the difficulty of cracking, this application introduces at least one of a C / C++ language layer time interface and an assembly language layer time interface. The C / C++ language layer time interface refers to time acquisition logic written in C / C++ and compiled into native machine code. The assembly language layer time interface refers to time acquisition logic written in assembly language and compiled into native machine code. Because it is directly compiled into machine code, decompilation tools can only reconstruct it as assembly language. It lacks logical interfaces of classes and methods and requires native hooking techniques, making it highly difficult to crack.
[0066] One feasible method for detecting whether the C / C++ language layer time interface or the assembly language layer time interface has been hooked involves the client performing system library verification and dynamic library integrity verification. System library verification checks whether the libc.so running in memory is consistent with the libc.so program segment on the system hard drive, and whether it has been tampered with. If they are consistent, the code execution environment is trustworthy. Dynamic library integrity verification matches the CRC32 signature of the dynamic library containing the C / C++ language layer time interface or the assembly language layer time interface code in memory with the signature used when compiling the dynamic library. If the match is successful, the time interface has not been hooked. Specifically, after compiling the C / C++ language layer timing interface code or the assembly language layer timing interface code into a dynamic library, the content of the program segments in the dynamic library remains unchanged; it is fixed at the moment of generation. To detect the possibility of hooking, the system calculates the signature of the program segments in the dynamic library during generation. When the app runs, it verifies in real time whether the signature of the program segments in the dynamic library in memory is the same as that at the time of generation. If they are different, meaning the program segments have been modified and do not match the signature, then it can be considered that the C / C++ language layer timing interface or the assembly language layer timing interface has been hooked. In addition, obfuscation and encryption can be added when generating the code for the dynamic library.
[0067] In this application embodiment, in addition to using at least one of the C / C++ language layer time interface and the assembly language layer time interface to obtain time data, the Java layer time interface can also be called to obtain time data.
[0068] The following describes step 203, namely "determining the second absolute time using the second relative time and the system startup time", in detail with reference to the embodiments.
[0069] In this embodiment, the second absolute time can be the time when the target image is triggered to generate a watermark. Generally, the client can superimpose the aforementioned second relative time onto the system startup time, and use the superimposed result as the second absolute time.
[0070] For example, the second absolute time Current_Time can be determined using the following formula: Current_Time = Boot_Time + Elapsed_Time.
[0071] Here, 'Elapsed_Time' represents the second relative time.
[0072] To further ensure the authenticity of the second relative time, the timestamp of the business response obtained from the server can be used to verify it. While determining the second absolute time, the client can exchange business data with the server. The business response returned by the server usually carries a timestamp, which can be compared with the second absolute time to detect any risk of time forgery.
[0073] For example, to ensure the acquisition of authentic business response timestamps, the client first receives multiple timestamps of business responses sent from the server through multiple communication connections established with the server. Then, it selects a timestamp from these timestamps that can be compared with the second absolute time. Specifically, the client can cross-validate the timestamps of multiple business responses. If the verification passes, one of the average, median, or most significant timestamps can be used as the timestamp for comparison with the second absolute time. If the verification fails, an exception is handled, and information about the potentially compromised business interface is reported. This multi-business interface timestamp cross-validation method effectively identifies whether a business interface has been tampered with, allowing the client to take corresponding action. It should be noted that even if a single interface is tampered with, the overall system remains secure.
[0074] The client can detect the risk of time forgery by comparing the second absolute time with the timestamp of the business response. If the client detects that the difference between the second absolute time and the timestamp of the business response exceeds an absolute time difference threshold, the second absolute time is considered to be at risk of forgery. If the client does not detect that the difference between the second absolute time and the timestamp of the business response exceeds the absolute time difference threshold, the second absolute time is considered not to be at risk of forgery. The absolute time difference threshold can be a pre-set threshold for a certain duration. This method of time verification using the timestamp of the business response can effectively detect the risk of forgery of the second absolute time.
[0075] The following describes in detail step 204, namely, "detecting the risk of time forgery by comparing the second absolute time with the time used to generate the time watermark," with reference to the embodiments.
[0076] Generally, the Java watermark generation interface can receive the second absolute time output by the time interface for generating a time watermark.
[0077] As one possible approach, to verify whether the Java watermark generation interface has a risk of time forgery, the client can compare the difference between the second absolute time and the time used to generate the watermark. If the difference exceeds the absolute time difference threshold, it can be considered that the time used to generate the watermark has a risk of forgery; if the difference exceeds the absolute time difference threshold, it can be considered that the time used to generate the watermark does not have a risk of forgery.
[0078] Furthermore, to effectively identify the risk of time forgery during the time watermark generation process, the client can also perform at least one of the following verification processes: First, during the time watermark generation process for the aforementioned target image, the client can verify the signature corresponding to the second absolute time. Specifically, the client can verify the matching between the time used to generate the time watermark and the signature corresponding to the second absolute time. If the signature verification fails, the client performs risk handling, such as prohibiting the generation of time watermarks for the aforementioned target image.
[0079] The second method involves the client using the second absolute time to verify the time displayed in the text view component during the generation of the time watermark for the target image. Specifically, the client can match the second absolute time with the time displayed in the text view component. If the verification fails, the client will perform risk handling.
[0080] The third method involves the client using character recognition technology to identify the time contained in the watermark and then verifying the identified time using the second absolute time mentioned above. Specifically, the client can match and verify the second absolute time with the time contained in the watermark identified by character recognition. If the verification fails, the client will perform risk handling.
[0081] The fourth method involves verifying the trustworthiness of the aforementioned client. If verification fails, the client will perform risk handling. The trustworthiness of the aforementioned client can be determined based on at least one of the following: the client's network environment, the number of times the device on which the client is located has been restarted, the number of times the application cache has been cleared, the number of times the system time automatic setting has been turned off, and the number of times a time spoofing risk has been detected.
[0082] It should be noted that the client's trustworthiness can be generated based on a trustworthiness calculation model. The basic parameters of this model can include initial trustworthiness, a trustworthiness threshold, and a penalty for each violation. For example, the initial trustworthiness threshold can be set to 100, the trustworthiness threshold to 80, and the penalty for each violation to 10. Conditions for trustworthiness decrease can include starting in a network-free environment, disabling automatic system time settings, device restart, or application cache clearing. Each time a trustworthiness condition is met, the client's trustworthiness decreases according to the trustworthiness decrease rules. These rules can include a maximum decrease per restart cycle, a maximum decrease per cache clearing cycle, and a further decrease only after a network connection is established and a violation occurs again. Additionally, the trustworthiness calculation model can include a trustworthiness recovery strategy, which may include: restoring trustworthiness to 100 if there are no suspected cheating attempts for 7 consecutive days; restoring partial trustworthiness upon successful network connection and time synchronization; and gradually restoring trustworthiness upon recognition of normal usage patterns.
[0083] By verifying whether the second absolute time has been tampered with during the time watermark generation process, and by taking corresponding risk handling measures when the data is tampered with, the client can avoid generating time watermarks based on forged times, thus better ensuring the authenticity of time watermark data and improving the security of watermark image generation.
[0084] Furthermore, once all the above verification processes pass, the client can generate an anti-counterfeiting code watermark for the target image based on the aforementioned time watermark.
[0085] As one feasible approach, after all the above verification processes pass, the client can first generate an anti-counterfeiting code for the target image, and then add the anti-counterfeiting code to the time watermark of the target image to obtain the anti-counterfeiting watermark. The time watermark of the target image, as shown in Figure 6, includes the time corresponding to the captured content.
[0086] The client adds the anti-counterfeiting code corresponding to the target image to the corresponding time watermark, which can better guarantee the authenticity of the target image and improve its credibility.
[0087] The following describes step 205, namely "responding to the existence of time forgery risk, perform risk processing", in detail with reference to the embodiments.
[0088] For example, the risk handling described above can include at least one of the following: error reporting, crashes, user authentication, reinstalling the client's installation package, disabling service functions, and logging exceptions. Error reporting can manifest as displaying an error message window. Crashes can prevent the client from functioning properly. User authentication can force users to log in for authentication, thereby tracking abnormal user accounts. Disabling service functions can disable the function of generating watermarks for images. Other risk handling methods are also possible, but they are not listed here. Through these risk handling mechanisms, the client can better ensure the authenticity of the time watermark, thus improving the client's security.
[0089] In summary, to reduce the risk of time watermark forgery, the client adds C / C++ and assembly language layer time interfaces in addition to the Java language layer time interface. Based on this, three risk verification strategies are mainly used to verify the existence of time forgery risk. These three risk verification strategies include verifying the environment in which the code runs to ensure that the code runs in a trusted environment (e.g., system library verification, dynamic library integrity verification), executing a time verification mechanism when the code running environment is trusted (e.g., using the timestamps of multiple business responses and a second absolute time for time verification), and performing time forgery risk verification when compositing the photographed watermark onto the image. As a result, the authenticity of the time watermark can be better guaranteed, and the credibility of the watermark image can be improved.
[0090] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0091] According to another embodiment, a time watermark verification device is provided. Figure 7 shows a schematic block diagram of the time watermark verification device according to one embodiment, which is disposed in the client of the architecture shown in Figure 1. As shown in Figure 7, the device 700 includes: a time acquisition unit 701, a time determination unit 702, a risk detection unit 703, and a risk processing unit 704. The main functions of each component are as follows: Time acquisition unit 701 is configured to pre-acquire a reliable first absolute time and call a time interface to obtain the system monotonic time to obtain a first relative time; the time interface includes at least one of a C / C++ language layer time interface and an assembly language layer time interface. Time determination unit 702 is configured to determine and store the system startup time using the first absolute time and the first relative time. The time acquisition unit 701 is further configured to, in response to an event triggering the generation of a watermark for a target image, call the time interface to obtain the system monotonic time to obtain a second relative time and acquire the pre-stored system startup time. The time determination unit 702 is further configured to determine a second absolute time using the second relative time and the system startup time. Risk detection unit 703 is configured to detect the existence of time forgery risk by comparing the second absolute time with the time used to generate the time watermark. Risk processing unit 704 is configured to perform risk processing in response to the existence of time forgery risk.
[0092] As one possible implementation method, when acquiring a reliable first absolute time, the time acquisition unit 701 is specifically configured to request and acquire a reliable first absolute time from the server; if it fails to acquire the first absolute time from the server, it acquires the first absolute time from the GPS module of the device where the client is located; if it fails to acquire the first absolute time from the GPS module, it acquires the time on the system wall as the first absolute time.
[0093] As one possible implementation method, when the time acquisition unit 701 obtains a trusted first absolute time from the server, it is specifically configured to receive multiple encrypted time information returned by the server through multiple communication connections established with the server. The time information includes UTC time and time obtained from other time centers; decrypt the encrypted time information using a dynamic key to obtain multiple time information and their corresponding signatures; verify the corresponding time information using the signatures; and determine the first absolute time using the verified time information.
[0094] As one possible implementation method, the time determination unit 702 is specifically configured to obtain a first key and an encrypted second key from the secure storage space when the storage system starts up; decrypt the encrypted second key using the first key to obtain the second key; encrypt the system startup time using the second key, and store the encrypted system startup time.
[0095] As one possible implementation method, when the time acquisition unit 701 calls the time interface to obtain the system monotonic time, it is specifically configured to call at least two of the following time interfaces: the Java layer time interface, the C / C++ language layer time interface, and the assembly language layer time interface to obtain at least two system monotonic times; compare the consistency of the above at least two system monotonic times, and if the consistency requirement is met, the system monotonic time is obtained; otherwise, it is determined that there is a risk of time forgery.
[0096] Furthermore, the time acquisition unit 701 is also configured to acquire the timestamp of the business response sent by the server to the client at the same time as the second absolute time is determined; the risk detection unit 703 is also configured to compare the second absolute time with the timestamp of the business response to detect whether there is a risk of time forgery.
[0097] As one possible implementation method, when the time acquisition unit 701 acquires the timestamp of the service response sent by the server to the client, it is specifically configured to receive the timestamps of multiple service responses sent by the server to the client through multiple communication connections established with the server; and determine the timestamp used for comparison with the second absolute time from the timestamps of the multiple service responses.
[0098] Furthermore, the risk detection unit 703 is also configured to verify the signature corresponding to the second absolute time during the process of generating a time watermark for the target image, and to perform risk processing in response to a signature verification failure; during the process of generating a time watermark for the target image, to verify the time displayed by the text view component using the second absolute time, and to perform risk processing if the verification fails; to identify the time contained in the time watermark using character recognition technology, and to verify the identified time using the second absolute time, and to perform risk processing if the verification fails; and to verify the trustworthiness of the client, and to perform risk processing if the verification fails. The trustworthiness of the client is determined based on at least one of the following: the client's network environment, the number of times the device where the client is located has been restarted, the number of times the application cache has been cleared, the number of times the system time automatic setting has been turned off, and the number of times a time forgery risk has been detected.
[0099] Furthermore, the risk detection unit 703 is also configured to generate an anti-counterfeiting code watermark for the target image in response to the above-mentioned time watermark if at least one of the above-mentioned verification processes are verified to be successful.
[0100] As one possible approach, the aforementioned risk handling includes at least one of the following: error reporting, crashes, user authentication, client reinstallation, re-determining and storing the system startup time, prohibiting the generation of time watermarks for the target images, and logging exceptions.
[0101] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0102] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0103] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
[0104] And an electronic device comprising: one or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.
[0105] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
[0106] Figure 8 illustrates the architecture of an electronic device, which may include a processor 810, a video display adapter 811, a disk drive 812, an input / output interface 813, a network interface 814, and a memory 820. The processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, and memory 820 can communicate with each other via a communication bus 830.
[0107] The processor 810 can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs and implement the technical solution provided in this application.
[0108] The memory 820 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 820 can store the operating system 821 for controlling the operation of the electronic device 800, and the basic input / output system (BIOS) 822 for controlling the low-level operations of the electronic device 800. Additionally, it can store a web browser 823, a data storage management system 824, and a time watermark verification device 700, etc. The aforementioned time watermark verification device 700 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when the technical solution provided in this application is implemented through software or firmware, the relevant program code is stored in the memory 820 and is called and executed by the processor 810.
[0109] The input / output interface 813 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0110] Network interface 814 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0111] Bus 830 includes a pathway for transmitting information between various components of the device, such as processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, and memory 820.
[0112] It should be noted that although the above-described device only shows the processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, memory 820, bus 830, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.
[0113] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer program product. This computer program product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0114] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for verifying time watermarks, applied to a client-side application, characterized in that, The method includes: obtaining a trusted first absolute time in advance; calling a time interface to obtain the system monotonic time to obtain a first relative time; and using the first absolute time and the first relative time to determine and store the system startup time; the method further includes: in response to an event triggering the generation of a watermark for a target image, calling a time interface to obtain the system monotonic time to obtain a second relative time, and obtaining the pre-stored system startup time; using the second relative time and the system startup time to determine a second absolute time; comparing the second absolute time with the time used to generate the time watermark to detect the existence of time forgery risk; and performing risk handling in response to the existence of time forgery risk; wherein the time interface includes at least one of a C / C++ language layer time interface and an assembly language layer time interface.
2. The method according to claim 1, characterized in that, The process of obtaining a reliable first absolute time includes: requesting and obtaining a reliable first absolute time from the server; if the first absolute time cannot be obtained from the server, obtaining the first absolute time from the GPS module of the device where the client is located; if the first absolute time cannot be obtained from the GPS module, obtaining the time displayed on the system wall as the first absolute time.
3. The method according to claim 2, characterized in that, The step of obtaining a trusted first absolute time from the server includes: receiving multiple encrypted time information returned by the server through multiple communication connections established with the server, wherein the time information includes UTC time and time obtained from other time centers; decrypting the encrypted time information using a dynamic key to obtain multiple time information and their corresponding signatures; verifying the corresponding time information using the signatures; and determining the first absolute time using the verified time information.
4. The method according to claim 1, characterized in that, The system startup time includes: obtaining a first key and an encrypted second key from a secure storage space; decrypting the encrypted second key using the first key to obtain the second key; encrypting the system startup time using the second key, and storing the encrypted system startup time.
5. The method according to claim 1, characterized in that, The process of obtaining the system monotonic time by calling the time interface includes: calling at least two of the following time interfaces: the Java layer time interface, the C / C++ language layer time interface, and the assembly language layer time interface, to obtain at least two system monotonic times; comparing the consistency of the at least two system monotonic times; if the consistency requirement is met, the system monotonic time is obtained; otherwise, it is determined that there is a risk of time forgery.
6. The method according to claim 1, characterized in that, The method further includes: simultaneously determining the second absolute time, obtaining the timestamp of the business response sent by the server to the client; comparing the second absolute time with the timestamp of the business response to detect whether there is a risk of time forgery.
7. The method according to claim 6, characterized in that, The process of obtaining the timestamp of the service response sent by the server to the client includes: receiving the timestamps of multiple service responses sent by the server to the client through multiple communication connections established with the server; and determining a timestamp from the multiple service response timestamps for comparison with the second absolute time.
8. The method according to claim 1, characterized in that, The method further includes at least one of the following verification processes: during the process of generating a time watermark for the target image, verifying the signature corresponding to the second absolute time, and performing risk processing in response to the failure of signature verification. During the process of generating a time watermark for the target image, the time displayed by the text view component is verified using the second absolute time. If the verification fails, risk handling is performed. The time contained in the time watermark is identified using character recognition technology, and the identified time is verified using the second absolute time. If the verification fails, risk handling is performed. The client's trustworthiness is verified. If the verification fails, risk handling is performed. The client's trustworthiness is determined based on at least one of the following: the client's network environment, the number of times the device where the client is located has been restarted, the number of times the application cache has been cleared, the number of times the system time automatic setting has been turned off, and the number of times a time spoofing risk has been detected.
9. The method according to claim 8, characterized in that, The method further includes: in response to the at least one verification process passing verification, generating an anti-counterfeiting code watermark for the target image based on the time watermark.
10. The method according to any one of claims 1 to 9, characterized in that, The risk handling includes at least one of the following: error reporting, crash, user authentication, client reinstallation, resetting and storing the system startup time, prohibiting the generation of time watermarks for the target image, and logging abnormalities.
11. A time-based watermark verification device, installed on a client-side device, characterized in that, The apparatus includes: a time acquisition unit configured to pre-acquire a trusted first absolute time and call a time interface to acquire a system monotonic time to obtain a first relative time, the time interface including at least one of a C / C++ language layer time interface and an assembly language layer time interface; a time determination unit configured to determine and store a system startup time using the first absolute time and the first relative time; the time acquisition unit is further configured to, in response to an event triggering the generation of a watermark for a target image, call the time interface to acquire a system monotonic time to obtain a second relative time and acquire the pre-stored system startup time; the time determination unit is further configured to determine a second absolute time using the second relative time and the system startup time; a risk detection unit configured to detect the existence of a time forgery risk by comparing the second absolute time with the time used to generate the time watermark; and a risk processing unit configured to perform risk processing in response to the existence of a time forgery risk.
12. An electronic device, characterized in that, include: One or more processors; And a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method according to any one of claims 1 to 10.
13. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 10.