A printing authentication method and system for a lottery ticket printer

By introducing a three-level key system and two-way authentication into lottery printers and encrypting the communication process, the problems of data tampering, forgery, and leakage of sensitive information in lottery printers are solved, and the security of lottery data throughout the entire process is achieved.

CN122204440APending Publication Date: 2026-06-12BEIJING INTRADAK SYST TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING INTRADAK SYST TECH
Filing Date
2026-03-13
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing lottery printers pose security risks such as data tampering, lottery ticket counterfeiting, sensitive information leakage, and replay attacks.

Method used

A three-level key system is used to encrypt and authenticate data communication between the host computer and the printer, including the Root CA private key, the device public and private key pair and the dynamic session key. Combined with SM2 public key verification, SM3 hash value encryption and SM4 session key, two-way identity authentication and multi-layer verification are performed.

Benefits of technology

Significantly enhances key security, prevents large-scale forgery risks caused by key leakage, ensures the security of lottery data from generation to printing, prevents data tampering, forgery and replay attacks, and protects sensitive information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122204440A_ABST
    Figure CN122204440A_ABST
Patent Text Reader

Abstract

The application discloses a lottery ticket printer printing authentication method and system, which comprises the following steps: a printer receives first encrypted data generated by an upper computer; the printer performs public key signature verification on the first encrypted data to obtain a public key verification result; after obtaining the public key verification result, the printer generates second encrypted data and sends the second encrypted data to the upper computer; after the upper computer successfully authenticates the second encrypted data, the upper computer generates a symmetric key acquisition instruction and sends the symmetric key acquisition instruction to the printer; the printer generates a symmetric key in response to the key acquisition instruction and sends the symmetric key to the upper computer; the upper computer decrypts the symmetric key to generate a printing instruction and sends the printing instruction to the printer; and the printer prints lottery tickets according to the printing instruction. The scheme significantly improves the security and manageability of the key, effectively prevents large-scale counterfeiting risks caused by key leakage, avoids data tampering, counterfeit lottery tickets, replay attacks and sensitive information leakage, and ensures the safety of the whole process from generation to printing of the lottery ticket data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of lottery data security technology, and in particular to a printing authentication method and system for lottery printers. Background Technology

[0002] Currently, standard thermal printers are widely used as ticket issuing devices in domestic sports lottery and welfare lottery sales terminals. These printers are mostly general-purpose industrial or commercial thermal printing modules. Although they meet basic printing requirements in terms of basic performance, they have many security problems in practical applications, such as the risk of data tampering, the risk of counterfeiting lottery tickets, the leakage of sensitive information, and replay attacks. Summary of the Invention

[0003] In view of the above, the present invention aims to provide a printing authentication method and system for a lottery printer to solve the aforementioned technical problems.

[0004] The technical solution adopted in this invention is as follows:

[0005] This invention provides a printing authentication method for a lottery printer, comprising:

[0006] The printer receives the first encrypted data generated by the host computer.

[0007] The printer performs public key verification on the first encrypted data to obtain the public key verification result.

[0008] After obtaining the public key verification result, the printer generates second encrypted data and sends it to the host computer;

[0009] After the host computer successfully authenticates the second encrypted data, it generates a symmetric key acquisition command and sends it to the printer.

[0010] In response to the key acquisition command, the printer generates a symmetric key and sends it to the host computer.

[0011] The host computer decrypts the data using the symmetric key and generates a print command, which is then sent to the printer.

[0012] The printer prints lottery tickets according to the printing instructions.

[0013] Optionally, the first encrypted data generated by the host computer includes:

[0014] The host computer generates a first plaintext random number of a preset number of bits;

[0015] The first plaintext random number is signed using a private key with a preset sequence number to obtain the first encrypted data.

[0016] Optionally, the printer performs public key verification on the first encrypted data to obtain a public key verification result, including:

[0017] The printer uses a public key with a preset sequence number to verify the first encrypted data received, and obtains the verification result.

[0018] The first encrypted data is compared with the first plaintext random number to obtain the comparison result;

[0019] Based on the signature verification result and the comparison result, the public key verification result is obtained.

[0020] Optionally, after obtaining the public key verification result, the printer generates second encrypted data and sends it to the host computer, including:

[0021] The printer generates a second plaintext random number of preset length.

[0022] The second plaintext random number is encrypted using a public key with a preset sequence number to obtain the second encrypted data, which is then sent to the host computer.

[0023] The second encrypted data includes an encrypted second plaintext random number and a public key verification result.

[0024] Optionally, after the host computer successfully authenticates the second encrypted data, it generates a symmetric key acquisition command and sends it to the printer, including:

[0025] The host computer decrypts the second encrypted data using a private key with a preset sequence number to obtain the decrypted plaintext data;

[0026] The decrypted plaintext data is compared with the second plaintext random number to obtain the decryption comparison result;

[0027] When the decryption comparison results are the same, the host computer generates a symmetric key acquisition command and sends it to the printer.

[0028] Optionally, in response to the key acquisition command, the printer generates a symmetric key and sends it to the host computer, including:

[0029] In response to the key acquisition command, the printer generates a third plaintext random number of a preset number of bits;

[0030] The third plaintext random number is encrypted using a public key with a preset sequence number. After generating a symmetric key and performing the first verification, it is sent to the host computer.

[0031] Optionally, the host computer decrypts the data using the symmetric key, generates a print command, and sends it to the printer, including:

[0032] The host computer performs a second verification on the received symmetric key;

[0033] If the result of the second verification is consistent with the result of the first verification, the symmetric key is decrypted using the private key with the preset sequence number.

[0034] If decryption is successful, the session key is obtained;

[0035] If decryption fails, authentication will be terminated.

[0036] Optionally, generate print instructions and send them to the printer, including:

[0037] After successful decryption, the host computer calculates the printed information using the SM3 hash algorithm to obtain the printed data;

[0038] The print data is encrypted using the session key, and a print command is generated and sent to the printer.

[0039] This invention also provides a printing authentication system for a lottery printer, comprising:

[0040] A printer, and a host computer that is communicatively connected to the printer;

[0041] The host computer generates first encrypted data and sends it to the printer; after successfully authenticating the second encrypted data, it generates a symmetric key acquisition instruction and sends it to the printer; it decrypts the data according to the symmetric key and generates a print instruction, which is then sent to the printer.

[0042] The printer performs public key verification on the first encrypted data to obtain a public key verification result; based on the public key verification result, it generates second encrypted data and sends it to the host computer; in response to the key acquisition instruction, it generates a symmetric key and sends it to the host computer; the printer prints lottery tickets according to the printing instruction.

[0043] The present invention also provides a computing device, comprising: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above.

[0044] The above-described solution of the present invention has at least the following beneficial effects:

[0045] The above-mentioned solution of the present invention includes: a printer receiving first encrypted data generated by a host computer; the printer performing public key verification on the first encrypted data to obtain a public key verification result; after obtaining the public key verification result, the printer generating second encrypted data and sending it to the host computer; after the host computer successfully authenticates the second encrypted data, it generating a symmetric key acquisition instruction and sending it to the printer; the printer responding to the key acquisition instruction generates a symmetric key and sends it to the host computer; the host computer decrypts the data according to the symmetric key, generates a print instruction and sends it to the printer; the printer prints lottery tickets according to the print instruction. The solution of the present invention significantly improves key security and manageability, effectively prevents large-scale forgery risks caused by key leakage, avoids data tampering, lottery ticket forgery, replay attacks, and sensitive information leakage, and ensures the security of lottery data throughout the entire process from generation to printing. Attached Figure Description

[0046] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described below with reference to the accompanying drawings, wherein:

[0047] Figure 1 A flowchart of a lottery printer printing authentication method provided in an embodiment of the present invention. Detailed Implementation

[0048] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0049] This invention proposes an embodiment of a printing authentication method for a lottery printer, specifically, as follows: Figure 1 As shown, it includes:

[0050] Step 11: The printer receives the first encrypted data generated by the host computer;

[0051] Step 12: The printer performs public key verification on the first encrypted data to obtain the public key verification result;

[0052] Step 13: After obtaining the public key verification result, the public key verification result printer generates second encrypted data and sends it to the host computer;

[0053] Step 14: After the host computer successfully authenticates the second encrypted data, it generates a symmetric key acquisition command and sends it to the printer.

[0054] Step 15: In response to the key acquisition command, the printer generates a symmetric key and sends it to the host computer;

[0055] Step 16: The host computer decrypts the data using the symmetric key and generates a print command, which is then sent to the printer.

[0056] Step 17: The printer prints the lottery ticket according to the printing instructions.

[0057] In this embodiment, the terminal devices and printers currently used in the sports lottery industry lack a key mechanism. The terminal and printer rely solely on simple passwords and device ID whitelists for one-way verification, making it impossible to confirm the true identity of the printer or host computer, thus vulnerable to unauthorized access. Printing commands are mostly transmitted in plaintext (such as standard ESC / POS commands), lacking integrity checks or using only simple checksums (such as CRC), making them susceptible to man-in-the-middle tampering, replay attacks, or forgery. Therefore, numerous security issues exist in practical applications.

[0058] Data tampering risk: Unencrypted communication channels are vulnerable to man-in-the-middle (MitM) attacks, where attackers can intercept and tamper with transmitted betting data (such as betting numbers, amounts, and draw dates). The lottery tickets printed by users may differ from the betting information actually submitted to the central system, leading to prize redemption disputes or fraud.

[0059] Risks of counterfeit lottery tickets: Attackers can monitor printer interfaces (such as serial ports, USB, and network) to obtain printing instruction formats, and then forge legitimate lottery ticket printing data. Counterfeit tickets may look identical to real tickets, and if not verified against central system data, they could be used for illegal prize redemption.

[0060] Sensitive information leakage: Sensitive data such as betting information, transaction serial numbers, terminal IDs, and user IDs may be stolen during plaintext transmission. This information could be used to analyze user betting behavior, locate high-value terminals, or even provide information for subsequent attacks.

[0061] Replay attacks: Attackers can record legitimate print commands and send them repeatedly, causing the same lottery ticket to be printed multiple times, creating the risk of duplicate prize redemption. If the system does not perform uniqueness verification on print commands (such as timestamps or serial numbers), this type of attack is difficult to prevent.

[0062] Damage to System Integrity and Credibility: Any incident of lottery tampering or forgery will severely damage the credibility of the sports lottery and undermine public trust in its fairness. It may also lead to legal disputes, regulatory penalties, and damage to brand reputation.

[0063] To address the aforementioned issues, this embodiment employs a three-level key system to encrypt and authenticate data communication between the host computer and the printer (such as a sports lottery terminal or betting station printer).

[0064] In terms of key management, a root CA private key, device public-private key pairs, and session-level dynamic symmetric keys are used. A three-layer structure of "offline root CA + device identity binding + dynamic session key" is introduced. The private key is strictly isolated, cannot be exported, and is managed by the operating system's key protection mechanism.

[0065] Root private key: Strictly guarded by the central server and kept offline, used to issue device public keys. The root private key cannot be exported and is managed by the operating system's key protection mechanism. Issuance here includes both key distribution and authentication. That is, even if the distributed key is illegally cracked, it cannot be used normally without authentication through the root key.

[0066] The SM2 private key is stored only on the host computer, and the SM2 public key is stored only on the printer.

[0067] In terms of device authentication, a two-way identity authentication process based on SM2 is adopted - the terminal uses the device's private key to verify the printer's identity, and the printer uses the public key issued by the Root CA to verify the legitimacy of the host computer.

[0068] In terms of encrypted communication, the communication data (including the original QR code data) is first hashed by SM3 and then encrypted with a dynamic SM4 session key. The data packet contains a symmetric key encrypted with a public key, an SM3 digest, a signature, CRC32, and anti-replay fields (such as serial number / timestamp). The receiving end needs to complete four verifications: decryption, signature verification, hash comparison, and replay detection.

[0069] A key management system significantly enhances key security and manageability, achieving "one key per device" and "one identity per device," facilitating full lifecycle management of devices (registration, revocation, auditing) and effectively preventing large-scale forgery risks caused by key leaks. The authentication process prevents unauthorized terminals and printers from accessing the system, ensuring that only legitimate devices authorized by the sports lottery center can participate in printing, thus blocking "private lotteries" and "printing fraud" at the source. Encrypted communication streams ensure that betting data is tamper-proof, unforgeable, and unreplayable during transmission and printing; even if attackers intercept communications, they cannot forge valid lottery tickets. Simultaneously, performance is considered (encrypting only critical data), adapting to resource-constrained environments with thermal printers. Through the innovative combination of a "three-level key system + two-way identity authentication + national cryptographic algorithm encryption + multi-layer verification," data tampering, lottery forgery, replay attacks, and sensitive information leakage are effectively prevented, ensuring the security of lottery data throughout the entire process from generation to printing.

[0070] In an optional embodiment, the first encrypted data generated by the host computer in step 11 may include:

[0071] Step 111: The host computer generates a first plaintext random number with a preset number of bits;

[0072] Step 112: Sign the first plaintext random number using the private key with the preset sequence number to obtain the first encrypted data.

[0073] In this embodiment, the host computer program calls a secure random number generator to generate a 16-byte (128-bit) unpredictable first plaintext random number; the generated first plaintext random number is digitally signed using the SM2 private key to generate first encrypted data with signature data.

[0074] Next, the first encrypted data will be encapsulated into a data packet according to a predefined format and sent to the printer via the ESC / POS command.

[0075] The format is shown in the table below, Table 1:

[0076]

[0077] In an optional embodiment, step 12 may include:

[0078] Step 121: The printer uses the public key with the preset sequence number to verify the first encrypted data received, and obtains the verification result.

[0079] Step 122: Compare the first encrypted data with the first plaintext random number to obtain the comparison result;

[0080] Step 123: Based on the signature verification result and the comparison result, obtain the public key verification result.

[0081] In this embodiment, after receiving the first encrypted data, the printer parses the data packet according to the agreed format and extracts the random number and signature data.

[0082] Next, the signature data is verified using the SM2 public key to check whether the printer's public key matches the signature data, that is, whether it can be paired with the host computer's private key, and obtain the verification result (0-success; 1-failure). 2-Reasons for public key errors);

[0083] The extracted random number is compared with the first plaintext random number to obtain the comparison result;

[0084] If the signature verification is successful and the comparison results are consistent, then the verification is successful. Otherwise, the verification fails because the public and private keys do not match or the random number may have been tampered with during transmission.

[0085] In an optional embodiment, step 13 may include:

[0086] Step 131: Based on the public key verification result, the printer generates a second plaintext random number of a preset length;

[0087] Step 132: Encrypt the second plaintext random number using the public key with the preset sequence number to obtain the second encrypted data, and send it to the host computer.

[0088] In this embodiment, after the verification in step 12 above is successful, the printer also calls its secure random number generator to generate its own 16-byte second plaintext random number. The printer uses the SM2 public key to encrypt the second plaintext random number. The public key generates a fixed-length (112-byte) ciphertext block to generate second encrypted data. The second encrypted data includes the encrypted second plaintext random number and the public key verification result. The data packet is then assembled according to the predefined response format and sent to the host computer.

[0089] The format is shown in Table 2 below:

[0090]

[0091] In an optional embodiment, step 14 may include:

[0092] Step 141: The host computer decrypts the second encrypted data using the private key with the preset sequence number to obtain the decrypted plaintext data.

[0093] Step 142: Compare the decrypted plaintext data with the second plaintext random number to obtain the decryption comparison result;

[0094] Step 143: When the decryption comparison results are the same, the host computer generates a symmetric key acquisition command and sends it to the printer.

[0095] In this embodiment, after the host computer receives the printer's response data packet, it first parses out the key information: the 16-byte plaintext random number obtained by decryption, the 112-byte ciphertext encrypted by the key, and the public key verification result.

[0096] Compare the decrypted 16-byte plaintext random number with the second plaintext random number. If the decryption comparison result is the same and the public key verification result is successful, it indicates that the printer has the correct public key, the host computer and the printer are successfully authenticated, and the printer is a legally authorized printing device.

[0097] At this point, the host computer sends a symmetric key acquisition command to the printer.

[0098] In an optional embodiment, step 15 may include:

[0099] Step 151: In response to the key acquisition instruction, the printer generates a third plaintext random number of a preset number of bits;

[0100] Step 152: Encrypt the third plaintext random number using the public key with the preset sequence number, generate a symmetric key, perform the first verification, and then send it to the host computer.

[0101] In this embodiment, the two-way SM2 authentication has been successful. The host computer requests a session key from the printer through a new, custom ESC / POS command. After obtaining the symmetric key, the printer generates a 16-byte (128-bit) third plaintext random number, encrypts the 16-bit third plaintext random number using the SM2 public key, performs CRC32 verification, and sends it to the host computer.

[0102] Here, the SM2 encryption algorithm generates a fixed-length ciphertext block of 112 bytes. The printer calculates a CRC32 checksum (4 bytes) on the 112-byte ciphertext, then assembles the data according to a predetermined format and sends the data packet back to the host computer through the ESC / POS command response channel.

[0103] The format is shown in Table 3 below:

[0104]

[0105] In an optional embodiment, step 16 may include:

[0106] Step 161: The host computer performs a second verification on the received symmetric key;

[0107] Step 162: If the result of the second verification is consistent with the result of the first verification, then the symmetric key is decrypted using the private key with the preset sequence number.

[0108] Step 163: If decryption is successful, the session key is obtained;

[0109] Step 164: If decryption fails, terminate the authentication process.

[0110] In this embodiment, after the host computer receives the data packet from the printer, it first parses it according to the agreed format and separates the following:

[0111] The ciphertext consists of 112 bytes, a 4-byte CRC32 checksum, and a key sequence number.

[0112] The host computer uses the same CRC32 algorithm to calculate a 4-byte local checksum on the received 112-byte ciphertext. It then compares the ciphertext with this checksum byte by byte. If they match, it means the 112-byte ciphertext was transmitted without any bit errors and the data is complete, allowing the process to continue. If they don't match, it indicates that data transmission may have been corrupted. As a security measure, the host computer discards the entire data packet without attempting decryption and terminates the connection directly.

[0113] When the comparison results are consistent and the CRC32 check passes, the host computer uses the SM2 private key to decrypt the encrypted data, obtains the symmetric key, and outputs a 16-byte third plaintext random number. This third plaintext random number is used as the session key (SM4 key) for subsequent communication.

[0114] In an optional embodiment, step 16 further includes:

[0115] Step 165: After successful decryption, the host computer calculates the printed information using the SM3 hash algorithm to obtain the printed data;

[0116] Step 166: Encrypt the print data using the session key, generate a print command, and send it to the printer.

[0117] In this embodiment, after the host computer obtains the session key, it prepares the original data to be printed, such as the string that constitutes the PDF417 QR code. This data may include the betting number, amount, serial number, etc.

[0118] The SM3 hash algorithm is invoked to perform a hash operation on the entire string, producing a hash value of fixed length 32 bytes. Furthermore, the generated hash value is encrypted using a session key (SM4 key) to generate ciphertext of the same length as the plaintext, ensuring that the data is not tampered with during transmission and printing.

[0119] The original data and the encrypted hash value are assembled into a complete print instruction package according to a predefined instruction format, and this complete instruction package is sent to the printer through a communication interface (such as USB / serial port).

[0120] In an optional embodiment, in step 17, after receiving the print command, the printer verifies whether the received data is complete, authentic, and from a legitimate host computer.

[0121] The printer decrypts the received data using the shared session key to obtain the original digital fingerprint. The printer then independently performs an SM3 hash on the received raw data portion to obtain a local digital fingerprint, comparing the original digital fingerprint with the local digital fingerprint. If they match, it indicates the data has not been tampered with during transmission and indeed originates from a legitimate host computer possessing the session key; verification is successful, and the printer executes the print job. If they differ, it indicates the data may have been tampered with or a communication error has occurred. The printer will discard the print job and return an error code to the host computer.

[0122] An embodiment of the present invention also provides a printing authentication system for a lottery printer, comprising:

[0123] A printer, and a host computer that is communicatively connected to the printer;

[0124] The host computer generates first encrypted data and sends it to the printer; after successfully authenticating the second encrypted data, it generates a symmetric key acquisition instruction and sends it to the printer; it decrypts the data according to the symmetric key and generates a print instruction, which is then sent to the printer.

[0125] The printer performs public key verification on the first encrypted data to obtain a public key verification result; based on the public key verification result, it generates second encrypted data and sends it to the host computer; in response to the key acquisition instruction, it generates a symmetric key and sends it to the host computer; the printer prints lottery tickets according to the printing instruction.

[0126] Optionally, the printer performs public key verification on the first encrypted data to obtain a public key verification result, including:

[0127] The printer uses a public key with a preset sequence number to verify the first encrypted data received, and obtains the verification result.

[0128] The first encrypted data is compared with the first plaintext random number to obtain the comparison result;

[0129] Based on the signature verification result and the comparison result, the public key verification result is obtained.

[0130] Optionally, after obtaining the public key verification result, the printer generates second encrypted data and sends it to the host computer, including:

[0131] The printer generates a second plaintext random number of preset length.

[0132] The second plaintext random number is encrypted using a public key with a preset sequence number to obtain the second encrypted data, which is then sent to the host computer.

[0133] The second encrypted data includes an encrypted second plaintext random number and a public key verification result.

[0134] Optionally, after the host computer successfully authenticates the second encrypted data, it generates a symmetric key acquisition command and sends it to the printer, including:

[0135] The host computer decrypts the second encrypted data using a private key with a preset sequence number to obtain the decrypted plaintext data;

[0136] The decrypted plaintext data is compared with the second plaintext random number to obtain the decryption comparison result;

[0137] When the decryption comparison results are the same, the host computer generates a symmetric key acquisition command and sends it to the printer.

[0138] Optionally, in response to the key acquisition command, the printer generates a symmetric key and sends it to the host computer, including:

[0139] In response to the key acquisition command, the printer generates a third plaintext random number of a preset number of bits;

[0140] The third plaintext random number is encrypted using a public key with a preset sequence number. After generating a symmetric key and performing the first verification, it is sent to the host computer.

[0141] Optionally, the host computer decrypts the data using the symmetric key, generates a print command, and sends it to the printer, including:

[0142] The host computer performs a second verification on the received symmetric key;

[0143] If the result of the second verification is consistent with the result of the first verification, the symmetric key is decrypted using the private key with the preset sequence number.

[0144] If decryption is successful, the session key is obtained;

[0145] If decryption fails, authentication will be terminated.

[0146] Optionally, generate print instructions and send them to the printer, including:

[0147] After successful decryption, the host computer calculates the printed information using the SM3 hash algorithm to obtain the printed data;

[0148] The print data is encrypted using the session key, and a print command is generated and sent to the printer.

[0149] It should be noted that this system is the system corresponding to the above method. All implementation methods in the above method embodiments are applicable to the embodiments of this system and can achieve the same technical effect.

[0150] An embodiment of the present invention also provides a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described in the above embodiments. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.

[0151] In this embodiment of the invention, a computer-readable storage medium is also provided, storing instructions that, when executed on a computer, cause the computer to perform the method described in the above embodiments. All implementations of the methods described in the above embodiments are applicable to this embodiment and can achieve the same technical effect.

[0152] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0153] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0154] In the embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0155] 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0156] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0157] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0158] Furthermore, it should be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent solutions of the present invention. Moreover, the steps performing the above series of processes can naturally be executed in the order described, but are not necessarily required to be executed in chronological order; some steps can be executed in parallel or independently of each other. Those skilled in the art will understand that all or any step or component of the method and apparatus of the present invention can be implemented in any computing device (including processors, storage media, etc.) or network of computing devices, in hardware, firmware, software, or a combination thereof. This is something that those skilled in the art can achieve by using their basic programming skills after reading the description of the present invention.

[0159] Therefore, the object of the present invention can also be achieved by running a program or a set of programs on any computing device. The computing device can be a known general-purpose device. Therefore, the object of the present invention can also be achieved simply by providing a program product containing program code implementing the method or apparatus. That is, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any known storage medium or any storage medium developed in the future. It should also be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent to the present invention. Furthermore, the steps performing the above series of processes can naturally be performed in the order described, but are not necessarily required to be performed in chronological order. Some steps can be performed in parallel or independently of each other.

[0160] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A printing authentication method for a lottery printer, characterized in that, include: The printer receives the first encrypted data generated by the host computer. The printer performs public key verification on the first encrypted data to obtain the public key verification result. After obtaining the public key verification result, the printer generates second encrypted data and sends it to the host computer; After the host computer successfully authenticates the second encrypted data, it generates a symmetric key acquisition command and sends it to the printer. In response to the key acquisition command, the printer generates a symmetric key and sends it to the host computer. The host computer decrypts the data using the symmetric key and generates a print command, which is then sent to the printer. The printer prints lottery tickets according to the printing instructions.

2. The printing authentication method for a lottery printer according to claim 1, characterized in that, The first encrypted data generated by the host computer includes: The host computer generates a first plaintext random number of a preset number of bits; The first plaintext random number is signed using a private key with a preset sequence number to obtain the first encrypted data.

3. The printing authentication method for a lottery printer according to claim 1, characterized in that, The printer performs public key verification on the first encrypted data to obtain the public key verification result, including: The printer uses a public key with a preset sequence number to verify the first encrypted data received, and obtains the verification result. The first encrypted data is compared with the first plaintext random number to obtain the comparison result; Based on the signature verification result and the comparison result, the public key verification result is obtained.

4. The printing authentication method for a lottery printer according to claim 1, characterized in that, After obtaining the public key verification result, the printer generates second encrypted data and sends it to the host computer, including: Based on the public key verification result, the printer generates a second plaintext random number of preset length; The second plaintext random number is encrypted using a public key with a preset sequence number to obtain the second encrypted data, which is then sent to the host computer. The second encrypted data includes an encrypted second plaintext random number and the public key verification result.

5. The printing authentication method for a lottery printer according to claim 4, characterized in that, After the host computer successfully authenticates the second encrypted data, it generates a symmetric key retrieval command and sends it to the printer, including: The host computer decrypts the second encrypted data using a private key with a preset sequence number to obtain the decrypted plaintext data; The decrypted plaintext data is compared with the second plaintext random number to obtain the decryption comparison result; When the decryption comparison results are the same, the host computer generates a symmetric key acquisition command and sends it to the printer.

6. The printing authentication method for a lottery printer according to claim 1, characterized in that, In response to the key acquisition command, the printer generates a symmetric key and sends it to the host computer, including: In response to the key acquisition command, the printer generates a third plaintext random number of a preset number of bits; The third plaintext random number is encrypted using a public key with a preset sequence number. After generating a symmetric key and performing the first verification, it is sent to the host computer.

7. The printing authentication method for a lottery printer according to claim 1, characterized in that, The host computer decrypts the data using the symmetric key, generates a print command, and sends it to the printer, including: The host computer performs a second verification on the received symmetric key; If the result of the second verification is consistent with the result of the first verification, the symmetric key is decrypted using the private key with the preset sequence number. If decryption is successful, the session key is obtained; If decryption fails, authentication will be terminated.

8. The printing authentication method for a lottery printer according to claim 7, characterized in that, Generate print instructions and send them to the printer, including: After successful decryption, the host computer calculates the printed information using the SM3 hash algorithm to obtain the printed data; The print data is encrypted using the session key, and a print command is generated and sent to the printer.

9. A printing authentication system for a lottery printer, characterized in that, include: A printer, and a host computer that is communicatively connected to the printer; The host computer generates first encrypted data and sends it to the printer; after successfully authenticating the second encrypted data, it generates a symmetric key acquisition instruction and sends it to the printer; it decrypts the data according to the symmetric key and generates a print instruction, which is then sent to the printer. The printer performs public key verification on the first encrypted data to obtain a public key verification result; based on the public key verification result, it generates second encrypted data and sends it to the host computer; in response to the key acquisition instruction, it generates a symmetric key and sends it to the host computer; the printer prints lottery tickets according to the printing instruction.

10. A computing device, characterized in that, include: A processor, a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method as described in any one of claims 1 to 8.