Reservation code verification method and system for embedded water control terminal
The reservation code verification method, which combines bit-level compression and SM4 encryption (a national cryptographic algorithm), solves the resource-constrained problem of embedded water control terminals, achieves efficient and secure reservation code verification, and improves system performance and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-03-27
AI Technical Summary
Embedded water control terminals, with limited storage space and computing power, struggle to perform reservation code verification efficiently and securely, resulting in slow response times or failure to complete verification tasks.
A bit-level compressed reservation code structure is adopted, which is encrypted using the national cryptographic algorithm SM4 and decrypted by the ESAM module. Combined with ring cache management for validity verification, the security and fast verification of the reservation code are ensured.
It improves the system performance and response speed of the embedded water control terminal, prevents the reservation code from being stolen or tampered with, reduces computing and storage overhead, and prevents replay attacks and illegal reservations.
Smart Images

Figure CN121098519B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of water control terminal management, in particular, to a reservation code verification method and system for an embedded water control terminal. BACKGROUND
[0002] Embedded water control terminals are widely used in multi-node water control scenarios such as campuses and bath centers. In the scenario of remotely controlling and managing water flow, reservation codes play a crucial role as a key technology for reserving and verifying water flow control. However, many embedded devices face the challenge of limited resources in terms of storage space, computing power, and communication.
[0003] For example, embedded water control terminals usually use small memories (e.g., 64KB SRAM) and processors, which makes it difficult for complex verification algorithms to be executed locally on the device, especially when encryption and large data verification are involved, which can result in slow response speed and insufficient performance of the device, or even failure to complete the verification task. SUMMARY
[0004] To address the above background problems, the embodiments described herein provide a reservation code verification method and system for an embedded water control terminal, a computing device, and a computer readable storage medium storing a computer program, which can efficiently and securely implement reservation code verification on a resource-limited embedded water control terminal without relying on high-performance edge servers, significantly improving system performance and response speed.
[0005] According to a first aspect of the present disclosure, a reservation code verification method for an embedded water control terminal is provided, comprising: generating a reservation code based on a user's reservation request for the water control terminal, performing bit-level compression on the structure of the reservation code and generating a corresponding signature digest; encrypting the reservation code and its signature digest based on the SM4 national cryptographic algorithm to generate a ciphertext reservation code; receiving the ciphertext reservation code, decrypting the ciphertext reservation code based on an ESAM module to obtain the plaintext of the reservation code and its digest; and verifying the validity of the reservation code based on the successfully verified signature digest and the reservation time quantization value stored in the local ring buffer.
[0006] In some embodiments of the present disclosure, generating a reservation code based on a user's reservation request for the water control terminal, and performing bit-level compression on the structure of the reservation code and generating a corresponding signature digest comprises: generating a reservation code based on a user's reservation request for the water control terminal, the reservation code being uniquely bound to the device ID of the water control terminal requested by the user; compressing the reservation code into a 64-bit field structure, the 64-bit field structure including a 14-bit device domain, a 20-bit reservation time quantization value, a 14-bit usage time, an 8-bit permission policy, and an 8-bit random factor; and generating a 32-bit signature digest for the compressed reservation code using the SipHash-2-4 algorithm.
[0007] In some embodiments of the present disclosure, the device domain is used to identify the water control terminal, if the value of the device domain is all 0, it means that there is no device restriction, if the highest bit of the device domain is 1, it means that it needs to be forced to verify; the reservation time quantization value represents the quantization value of the reservation time distance from the reference time in units of 10 minutes.
[0008] In some embodiments of the present disclosure, receiving the ciphertext reservation code, decrypting the ciphertext reservation code based on the ESAM module to obtain the plaintext of the reservation code and its digest includes: decrypting the ciphertext reservation code based on the built-in key of the ESAM module to obtain the plaintext of the reservation code and its digest, and verifying the digest; judging whether the verification number of the reservation code exceeds the maximum verification number, if it exceeds the maximum verification number, locking the device for a preset time.
[0009] In some embodiments of the present disclosure, for the received plaintext of the reservation code and its digest, verifying the validity of the reservation code according to the successfully verified signature digest and the reservation time quantization value stored in the local ring buffer includes: checking whether the length of the reservation code conforms to the preset length, if not, directly rejecting the reservation code, if so, checking whether the device ID in the reservation code is consistent with the device ID of the current water control terminal, if not, rejecting the reservation; generating a signature digest for the new reservation code through the SipHash-2-4 hash algorithm, checking whether the signature digest of the new reservation code exists in the local ring buffer, if it exists, rejecting the reservation, otherwise saving the generated digest in the local ring buffer; comparing the reservation time quantization value of the new reservation code with the maximum reservation time quantization value, if the reservation time quantization value of the new reservation code is less than or equal to the maximum reservation time quantization value, rejecting the reservation, otherwise allowing the reservation, and updating the locally stored maximum reservation time quantization value; calculating the difference between the reservation time point and the local time of the current device according to the reference time point of the current device and the reservation time quantization value, judging whether the difference is within the allowed time window range, if the difference is not within the range, rejecting the reservation.
[0010] In some embodiments of the present disclosure, the local ring buffer is used to save the signature digest of the recently successfully verified reservation code and the maximum reservation time quantization value, if there is a new digest to be added to the buffer and the buffer is full, the earliest added digest is removed according to the LRU strategy.
[0011] In some embodiments of the present disclosure, the water control terminal pre-allocates a static memory pool, and uses a constant stack to store data that does not need to be modified in the reservation code parsing and verification process.
[0012] According to a second aspect of the present disclosure, a reservation code verification system of an embedded water control terminal is provided, comprising a water control terminal and a reservation platform, the reservation platform being configured to generate a reservation code based on a reservation request of a user to the water control terminal, to perform bit-level compression on a structure of the reservation code and to generate a corresponding signature digest; to encrypt the reservation code and the signature digest based on a national encryption algorithm SM4 to generate a ciphertext reservation code; and the water control terminal being configured to receive the ciphertext reservation code, to decrypt the ciphertext reservation code based on an ESAM module to obtain a plaintext of the reservation code and the digest, and to verify validity of the reservation code based on a successfully verified signature digest and a reservation time quantization value stored in a local ring buffer.
[0013] According to a third aspect of the present disclosure, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements steps of the reservation code verification method of the embedded water control terminal when executing the program.
[0014] According to a fourth aspect of the present disclosure, a computer readable storage medium storing a computer program is provided, wherein the computer program implements steps of the reservation code verification method of the embedded water control terminal according to the first aspect of the present disclosure when executed by a processor.
[0015] The reservation code verification method and system of the embedded water control terminal according to the embodiments of the present disclosure can effectively avoid reservation code theft or tampering and improve data security by encrypting the reservation code and the signature digest using the national encryption algorithm SM4; unnecessary calculation and storage overheads are reduced by performing bit-level compression on the reservation code structure and ring buffer management, validity verification can be quickly performed, and replay attacks or illegal reservations are avoided. The present solution is applicable to embedded devices, especially in real-time verification scenarios that require high efficiency and security. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below, and it should be known that the drawings described below only relate to some embodiments of the present disclosure, rather than limiting the present disclosure, wherein:
[0017] Figure 1 An exemplary flowchart of the reservation code verification method of the embedded water control terminal according to the embodiments of the present disclosure is shown;
[0018] Figure 2 A structural block diagram of the reservation code verification system of the embedded water control terminal according to the embodiments of the present disclosure is shown;
[0019] Figure 3 is a schematic block diagram of a computing device according to the embodiments of the present disclosure.
[0020] It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION
[0021] In order to make the purposes, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without any inventive effort also belong to the scope of protection of the present disclosure.
[0022] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this present subject matter belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the specification and relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
[0023] The embodiments of the present disclosure propose a high-efficiency and low-resource-occupancy reservation code verification method for resource-limited embedded water control terminals (such as 64KB SRAM MCUs). Figure 1 An exemplary flowchart of a reservation code verification method of an embedded water control terminal according to an embodiment of the present disclosure is shown. Refer to Figure 1 As shown, at Figure 1 At step S102, a reservation code is generated based on a user's reservation request for the water control terminal, the structure of the reservation code is bit-level compressed, and a corresponding signature digest is generated.
[0024] When a user reserves the use of a water control terminal, the user can log in to a water control system reservation platform through a WeChat mini program, select a water control terminal to apply for reservation, and the reservation platform generates a reservation code according to the user's reservation information and preset rules. The reservation code is uniquely bound to the device ID of the user's requested water control terminal and contains information such as a timestamp, a device ID, a validity period, etc. Through one-to-one binding of the device and the reservation code, it is ensured that each device can only use the reservation code bound to it, and even if the encrypted reservation code is intercepted, it cannot be used on other devices, further ensuring the security of the system.
[0025] In order to reduce storage occupancy and communication overhead, according to one embodiment of the present disclosure, the reservation code is compressed into a 64-bit field structure, which includes a 14-bit device domain, a 20-bit reservation time quantization value, a 14-bit use time, an 8-bit permission policy, and an 8-bit random factor.
[0026] Among them, the 14-bit device domain is used to identify the water control terminal. If the device domain is all 0, it means there is no device restriction. If the highest bit is 1, it means the device needs to be forced to match the local device address verification. The reservation time quantization value represents the quantization value of the reservation time distance from the reference time in units of 10 minutes. For example, if the reference time is January 1, 2023 0:00:00, then January 1, 2023 0:10 corresponds to a reservation time quantization value of 1, January 1, 2023 0:20 corresponds to a reservation time quantization value of 2, and so on. In this way, the reservation in the entire time period can be represented by a smaller number. The use time represents the validity period or use time length of the reservation code, with a unit of seconds. The permission policy represents the platform rules or permission policy related to the reservation. Through this field, the operation permission that can be performed by different users or devices can be flexibly controlled. The random factor is maintained by the server and is used to increase the randomness and security of the reservation code. Each time a new reservation code is generated, the random factor will be incremented, and when it reaches the maximum value, it will be reset to 0, which can effectively prevent repeated reservation codes from being abused. The above fields are compressed into a 64-bit container using bit-packed (bit-packed) and serialized into a byte sequence.
[0027] A 32-bit signature digest is generated using the SipHash-2-4 algorithm for the compressed reservation code. Since the reservation code contains a random factor, the signature digest generated each time will be different, so even if it is the same reservation code, the encryption result will also change dynamically, which effectively improves the security of preventing replay attacks. Only the water control terminal has the same key, which can regenerate the same digest and verify the validity of the reservation code.
[0028] Then in step S104, the reservation code and its signature digest are encrypted based on the SM4 national algorithm to generate a ciphertext reservation code.
[0029] Among them, SM4 is a symmetric encryption algorithm that uses a 128-bit key length and a 128-bit block length, and achieves encryption through 32 rounds of nonlinear iteration to ensure that data is not leaked or tampered with during transmission. The final ciphertext reservation code consists of 64-bit compressed data and 32-bit authentication digest, totaling 12 bytes. In the CAN protocol, it can be split into 2 frames of data for transmission, greatly improving communication efficiency and reducing bandwidth consumption.
[0030] In step S106, the ciphertext reservation code is received, and the ciphertext reservation code is decrypted based on the ESAM module to obtain the plaintext reservation code and its digest.
[0031] After the water control terminal obtains the ciphertext reservation code, the water control terminal can decrypt the ciphertext reservation code by using the built-in key of the ESAM module (security module) to obtain the original plaintext reservation code and its digest, and verify the digest to ensure that the signature digest is consistent with the original data, thereby preventing forgery and tampering. It is judged whether the number of verification of the reservation code exceeds the maximum number of verification. If the number of verification exceeds the maximum number of verification, the device is locked for a preset time. For example, if the verification of the reservation code of a certain device fails more than 5 times, the device will be locked for a period of time to prevent brute force attack.
[0032] Finally, in step S108, for the received plaintext reservation code and its digest, the validity of the reservation code is verified according to the successfully verified signature digest and the reservation time quantization value stored in the local ring buffer.
[0033] According to one embodiment of the present disclosure, when verifying the reservation code, a coarse-to-fine verification strategy is adopted. First, a simple and fast verification (such as length verification) is performed. If it passes, a more detailed signature verification is performed.
[0034] Specifically, it is checked whether the length of the reservation code conforms to the preset length. If not, the reservation code is directly rejected. If yes, it is checked whether the device ID in the reservation code is consistent with the device ID of the current water control terminal. If not, the reservation is rejected. Subsequently, a signature digest is generated for the new reservation code by using the SipHash-2-4 hash algorithm. It is checked whether the signature digest of the new reservation code already exists in the local ring buffer. If yes, it means that it is a repeated reservation code, and the reservation is rejected. Otherwise, the generated digest is saved in the local ring buffer.
[0035] Subsequently, the reservation time quantization value of the new reservation code is compared with the maximum reservation time quantization value. If the reservation time quantization value of the new reservation code is less than or equal to the maximum reservation time quantization value, the reservation is rejected. Otherwise, the reservation is allowed, and the locally stored maximum reservation time quantization value is updated. According to the reference time point of the current device and the reservation time quantization value, the difference between the reservation time point and the local time of the current device is calculated. It is judged whether the difference is within the allowed time window range. If the difference is not within the range, the reservation is rejected.
[0036] In order to optimize memory usage, the water control terminal pre-allocates a static memory pool and uses a constant stack to store data that does not need to be modified during the reservation code parsing and verification process. This memory structure design can effectively reduce memory fragmentation and improve system stability. The local ring buffer is used to save the signature digest and maximum reservation time quantization value of the recently verified successful reservation code. If a new digest needs to be added to the cache and the cache is full, the earliest added digest is removed according to the LRU strategy. Using constant stack control stack peak can ensure that the memory does not exceed the preset stack size limit (64KB), preventing runtime memory peaks from causing system instability. The entire process does not require dynamic memory management, but rather manages memory through a pre-defined static memory pool, avoiding the overhead of malloc / free and memory fragmentation issues, reducing memory allocation and release delays, and improving program execution efficiency.
[0037] Figure 2 A structural block diagram of a reservation code verification system of an embedded water control terminal according to an embodiment of the present disclosure is shown. Referring to Figure 2 As shown, the reservation code verification system of the embedded water control terminal includes a water control terminal and a reservation platform, wherein the reservation platform is configured to generate a reservation code based on a user's reservation request for the water control terminal, compress the structure of the reservation code at the bit level and generate a corresponding signature digest; encrypt the reservation code and its signature digest based on the SM4 national encryption algorithm to generate a ciphertext reservation code; the water control terminal is configured to receive the ciphertext reservation code, decrypt the ciphertext reservation code based on the ESAM module, and obtain the plaintext of the reservation code and its digest; for the received plaintext of the reservation code and its digest, verify the validity of the reservation code according to the successfully verified signature digest and reservation time quantization value stored in the local ring buffer.
[0038] Specifically, the reservation platform can generate a reservation code according to a user's reservation request for the water control terminal, and the reservation code is uniquely bound to the device ID of the water control terminal requested by the user; compress the reservation code into a 64-bit field structure, which includes a 14-bit device domain, a 20-bit reservation time quantization value, a 14-bit usage time, an 8-bit permission policy, and an 8-bit random factor; wherein the device domain is used to identify the water control terminal, and if the value of the device domain is all 0, it means there is no device restriction, and if the highest bit of the device domain is 1, it means it needs to be verified forcibly; the reservation time quantization value represents the quantization value of the reservation time from the reference time in units of 10 minutes. The SipHash-2-4 algorithm is used to generate a 32-bit signature digest for the compressed reservation code.
[0039] The water control terminal can decrypt the ciphertext reservation code based on the built-in key of the ESAM module, obtain the plaintext of the reservation code and its digest, and verify the digest; determine whether the verification number of the reservation code exceeds the maximum verification number, and if the maximum verification number is exceeded, lock the device for a preset time. Check whether the length of the reservation code meets the preset length, if not, directly reject the reservation code, if it meets, check whether the device ID in the reservation code is consistent with the device ID of the current water control terminal, if not consistent, reject the reservation; generate a signature digest for the new reservation code through the SipHash-2-4 hash algorithm, check whether the signature digest of the new reservation code exists in the local ring buffer, if it exists, reject the reservation, otherwise save the generated digest in the local ring buffer; compare the reservation time quantization value of the new reservation code with the maximum reservation time quantization value, if the reservation time quantization value of the new reservation code is less than or equal to the maximum reservation time quantization value, reject the reservation, otherwise allow the reservation and update the locally stored maximum reservation time quantization value; calculate the difference between the reservation time point and the local time of the current device according to the reference time point of the current device and the reservation time quantization value, and determine whether the difference is within the allowed time window range, if the difference is not within the range, reject the reservation.
[0040] In summary, according to the reservation code verification and system of the embedded water control terminal of the embodiments of the present disclosure, by using the national secret algorithm SM4 to encrypt the reservation code and its signature digest, the reservation code can be effectively prevented from being stolen or tampered with, and the security of the data is improved; by performing bit-level compression and ring buffer management on the reservation code structure, unnecessary calculation and storage overhead are reduced, effective verification can be quickly performed, and replay attacks or illegal reservations are avoided. The present scheme is suitable for embedded devices, especially in real-time verification scenarios that require high efficiency and security.
[0041] Figure 3 is a schematic block diagram of a computing device according to an embodiment of the present disclosure. As shown in Figure 3 , the computing device 300 can include a processor 310 and a memory 320 storing a computer program. When the computer program is executed by the processor 310, the computing device 300 can perform the steps of the method 100 as shown in Figure 1 .
[0042] In embodiments of the present disclosure, the processor 310 can be, for example, a central processing unit (CPU), a microprocessor, a digital signal processor (DSP), a processor based on a multi-core processor architecture, etc. The memory 320 can be any type of memory implemented using data storage technology, including but not limited to random access memory, read-only memory, semiconductor-based memory, flash memory, disk storage, etc.
[0043] Further, in embodiments of the present disclosure, the computing device 300 can also include an input device 330, such as a keyboard, mouse, etc. Additionally, the computing device 300 can also include an output device 340, such as a display, etc.
[0044] In other embodiments of the present disclosure, a computer readable storage medium storing a computer program is also provided, wherein the computer program can implement the method as Figure 1 The steps of the pre-booking code verification method of the embedded water control terminal are shown. For example, the processor implements the following steps when executing the computer program:
[0045] Step S102: generating a pre-booking code based on the user's pre-booking request for the water control terminal, performing bit-level compression on the structure of the pre-booking code, and generating a corresponding signature digest;
[0046] Step S104: encrypting the pre-booking code and its signature digest based on the SM4 algorithm to generate a ciphertext pre-booking code;
[0047] Step S106: receiving the ciphertext pre-booking code, decrypting the ciphertext pre-booking code based on the ESAM module, and obtaining the plaintext pre-booking code and its digest;
[0048] Step S108: for the received plaintext pre-booking code and its digest, verifying the validity of the pre-booking code according to the successfully verified signature digest and pre-booking time quantization value stored in the local ring buffer.
[0049] From the above description, it can be known that by using the SM4 algorithm to encrypt the pre-booking code and its signature digest, the present application can effectively avoid the pre-booking code from being stolen or tampered with, and improve the security of the data; by performing bit-level compression on the structure of the pre-booking code and ring buffer management, unnecessary calculation and storage overhead are reduced, and the validity verification can be quickly performed, avoiding replay attacks or illegal pre-booking. The present scheme is suitable for embedded devices, especially in real-time verification scenarios that require high efficiency and security.
[0050] The computer software can be coded using any suitable machine code or computer language that can be subject to well-nigh any combination of instructions, data structures, or code snippets that can be read, compiled, or executed by a computer, processing unit, or other processing component. Those of ordinary skill in the art will appreciate that the computer software can be designed using any number of suitable platforms, interfaces, codes, languages, or programming techniques, including, for example, Java, C++, C#, or the like. In a further alternative, the computer software can be coded using a scripting language such as, for example, JavaScript, VBScript, ECMAScript, or the like. In yet a further alternative, the computer software can be coded using a programming language together with a virtual machine, such as, for example, Java® together with the Java Virtual Machine. In yet a further alternative, the computer software can be coded using a programming language together with an interpreter, such as, for example, Python® together with the Python interpreter. In yet a further alternative, the computer software can be coded using a programming language together with a compiler, such as, for example, Visual Basic® together with the Visual Basic compiler. In yet a further alternative, the computer software can be coded using a programming language together with a translator, such as, for example, COBOL® together with the COBOL translator. In yet a further alternative, the computer software can be coded using a programming language together with a combination of the above technologies.
[0051] The singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. Thus, when a singular form is used, it is intended to include the plural form, and vice versa. Similarly, the terms "comprises," "comprising," "includes," "including," and the like can be used herein. These terms are intended to mean that the named element(s) is included, but not to the exclusion of any other element(s) that can be added. Likewise, the term "comprising" is used throughout to mean including, among other things, but not necessarily limited to, the terms "consisting of" and "consisting essentially of." It is further noted that the claims can be drafted to exclude any element that is not specifically recited in the claims.
[0052] Further aspects and ranges of adaptability become apparent from the description provided herein. It should be understood that the various aspects of the application can be practiced alone or in combination with one or more other aspects. It should also be understood that the description and specific examples herein are intended to be illustrative only and are not intended to limit the scope of the application.
[0053] While several embodiments of the present disclosure have been described and illustrated, it will be apparent to those skilled in the art that many more embodiments can be made without deviating from the spirit and scope of the present disclosure. The present disclosure is not intended to be limited to the embodiments chosen for illustration, but rather, the scope of the present disclosure should be commensurate with the disclosure of the claims that follow.
Claims
1. A method for verifying a reservation code of an embedded water control terminal, characterized by, The application comprises the following steps: generating a reservation code based on the user's reservation request to the water control terminal, compressing the structure of the reservation code at the bit level and generating a corresponding signature digest, wherein the steps include: generating a reservation code based on the user's reservation request to the water control terminal, the reservation code being uniquely bound to the device ID of the water control terminal requested by the user; compressing the reservation code into a 64-bit field structure, the 64-bit field structure including a 14-bit device domain, a 20-bit reservation time quantization value, a 14-bit use time, an 8-bit permission policy and an 8-bit random factor; using the SipHash-2-4 algorithm to generate a 32-bit signature digest for the compressed reservation code; encrypting the reservation code and its signature digest based on the SM4 algorithm to generate a ciphertext reservation code; receiving the ciphertext reservation code, decrypting the ciphertext reservation code based on the ESAM module to obtain the plaintext of the reservation code and its digest; verifying the validity of the reservation code based on the successfully verified signature digest and the reservation time quantization value stored in the local ring buffer, wherein the steps include: checking whether the length of the reservation code meets the preset length, directly rejecting the reservation code if it does not meet the preset length, checking whether the device ID in the reservation code is consistent with the device ID of the current water control terminal if it meets the preset length, rejecting the reservation if it is not consistent, generating a signature digest for the new reservation code by the SipHash-2-4 hash algorithm, checking whether the signature digest of the new reservation code exists in the local ring buffer, rejecting the reservation if it exists, otherwise saving the generated digest in the local ring buffer, comparing the reservation time quantization value of the new reservation code with the maximum reservation time quantization value, rejecting the reservation if the reservation time quantization value of the new reservation code is less than or equal to the maximum reservation time quantization value, otherwise allowing the reservation and updating the locally stored maximum reservation time quantization value, calculating the difference between the reservation time point and the local time of the current device based on the reference time point of the current device and the reservation time quantization value, and judging whether the difference is within the allowed time window range, rejecting the reservation if the difference is not within the range.
2. The method of claim 1, wherein the embedded water control terminal reservation code verification method is characterized by, The device domain is used to identify the water control terminal, and if the value of the device domain is all 0, it means that there is no device restriction, and if the highest bit of the device domain is 1, it means that forced verification is required; the reservation time quantization value represents the quantization value of the reservation time from the reference time in units of 10 minutes.
3. The method of claim 1, wherein the embedded water control terminal is a prepayment meter. The step of receiving the ciphertext reservation code and decrypting the ciphertext reservation code based on the ESAM module to obtain the plaintext of the reservation code and its digest comprises the following steps: decrypting the ciphertext reservation code based on the built-in key of the ESAM module to obtain the plaintext of the reservation code and its digest, and verifying the digest; judging whether the number of reservation code verifications exceeds the maximum verification number, and locking the device for a preset time if the number of verification exceeds the maximum verification number.
4. The method of claim 1, wherein the embedded water control terminal is a pre- subscription code verification method. The local ring buffer is used to save the signature digest of the recently successfully verified reservation code and the maximum reservation time quantization value, and if a new digest needs to be added to the buffer and the buffer is full, the earliest added digest is removed according to the LRU strategy.
5. The method of claim 1, wherein the embedded water control terminal is a pre- subscription code verification method. The water control terminal pre-allocates a static memory pool, and uses a constant stack to store data that does not need to be modified in the reservation code analysis and verification process.
6. A pre-booking code verification system for an embedded water control terminal, characterized in that, The water control terminal and a reservation platform are included, the reservation platform is used for generating a reservation code based on a reservation request of a user to the water control terminal, performing bit-level compression on a structure of the reservation code and generating a corresponding signature digest; performing encryption on the reservation code and the signature digest based on a national encryption algorithm SM4 to generate a ciphertext reservation code; the water control terminal is used for receiving the ciphertext reservation code, performing decryption on the ciphertext reservation code based on an ESAM module to obtain a plaintext of the reservation code and a digest thereof; and for the received plaintext of the reservation code and the digest thereof, verifying validity of the reservation code according to a successfully verified signature digest and a reservation time quantization value stored in a local ring buffer.
7. A computing device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, The processor implements the steps of the reservation code verification method of the embedded water control terminal according to any one of claims 1 to 5 when executing the program.
8. A computer readable storage medium storing a computer program, characterized in that, The computer program implements the steps of the reservation code verification method of the embedded water control terminal according to any one of claims 1 to 5 when executed by the processor.
Citation Information
Patent Citations
Service processing method and apparatus
CN105721413A
Control method, system and device of reservation code water outlet type water control machine
CN115761989A