Cam generation, jet printing and verification method, device, terminal and storage medium

By generating card numbers and passwords through a hardware security module and utilizing OCR recognition and comparison technology, the security vulnerabilities in the card password generation and printing process are solved, achieving accuracy and security of the card passwords and improving production efficiency and product quality.

CN120910923BActive Publication Date: 2026-02-06SUZHOU JINHETONG SOFTWARE
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511440339.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-10
Publication Date
2026-02-06
Estimated Expiration
2045-10-10

Smart Images

  • Figure CN120910923B_ABST
    Figure CN120910923B_ABST
Patent Text Reader

Abstract

The application discloses a card code generation, printing and verification method and device, a terminal and a storage medium. The method comprises the following steps: reading an enterprise code and a seed code corresponding to the enterprise code from a hardware security module, wherein each enterprise has a unique enterprise code; generating a card number based on the hardware security module, the enterprise code, the seed code and a preset card number generation algorithm, and generating a card code corresponding to the card number based on the card number and a preset card code generation algorithm; printing the generated card code on a card code area of a card corresponding to the card number through a printing device; performing OCR identification on the card to obtain a card code identification result, and comparing the card code identification result with the card code; and if the comparison result is consistent, covering the card code area and deleting the card code. The method disclosed by the application realizes dynamic generation and verification of the card number and the card code based on the hardware security module, and the card code is not stored after being generated, so that the security of the card code and the product quality are improved, and information leakage is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronic commerce, in particular to a card code generation, printing and verification method and device, a terminal and a storage medium. BACKGROUND

[0002] Card products or electronic tags are widely used in modern commercial activities. As a common form, card coupons play an important role in various promotion and marketing activities. The generation, printing and verification of the unique identification code (card code) on the card coupon are crucial to improving the production efficiency of the card coupon and ensuring product quality. With the increasing frequency and expanding scale of commercial activities, the efficiency of card coupon production and the security of card code are increasingly required. The card code processing link has become a key factor affecting the entire card coupon production process. It not only relates to the production efficiency and cost control of enterprises, but also directly affects the user experience of consumers and the business reputation of enterprises.

[0003] In the field of card coupon production, to solve the problems of card code generation, printing and verification, the conventional means mainly generate card codes based on fixed algorithms and store them in a database. In actual operation, when the card coupon needs to be printed, the card code information is directly called from the database. This method can ensure the production rate of the card coupon to a certain extent, so that the production line can operate efficiently to meet the needs of large-scale production.

[0004] However, the conventional means in the prior art have obvious security defects. The existing card code storage method has certain vulnerability. After generating the card code by a fixed algorithm, the card code is stored together with the card number in the database. Even if the storage is encrypted, the card code still has the possibility of being attacked, resulting in card code leakage. Moreover, the security of the card code generated by this method is not strong enough. The card code stored in the database can be directly seen by calling and querying, which may lead to information leakage. In addition, the process from card code generation to printing is open, and the card number and card code can be easily accessed by the staff of the production line. Moreover, the original card manufacturing process does not include an additional verification process, which may have errors. Once the card code is leaked or incorrect, it may cause serious losses to the enterprise, damage the rights and interests of consumers, and affect the business reputation and normal operation of the enterprise.

[0005] Under such circumstances, how to optimize the generation, printing and verification process of the card code has become a key problem for technical personnel in this field. SUMMARY

[0006] In order to optimize the entire process of card code generation in the existing card coupon manufacturing process, the present application provides a card code generation, printing and verification method, device, terminal and storage medium.

[0007] In a first aspect, the application provides a card code generation, jet printing and verification method, which adopts the technical solution as described below:

[0008] A card code generation, jet printing and verification method based on a hardware security module, the method comprising the following steps:

[0009] Reading an enterprise code and a seed code corresponding to the enterprise code from the hardware security module, each enterprise having a unique enterprise code;

[0010] Generating a card number based on the hardware security module, according to the enterprise code, the seed code and a preset card number generation algorithm, and generating a card code corresponding to the card number in combination with the card number and a preset card code generation algorithm;

[0011] Jet printing the generated card code in a card code area on a card corresponding to the card number by a jet printing device;

[0012] Obtaining a card code recognition result by performing OCR identification on the card, comparing the card code recognition result with the card code and obtaining a comparison result;

[0013] If the comparison result is consistent, covering the card code area and deleting the card code.

[0014] By adopting the above technical solution, the enterprise code and the seed code are read based on the hardware security module, and a card number and a corresponding card code are generated, avoiding the traditional database storage card code mode, and improving the security of the card number and the card code. The card code is jet printed on the card, and OCR identification and comparison are performed, ensuring the accuracy of the card code. After the comparison is consistent, the card code area is covered and the card code is deleted, avoiding the security risks caused by long-term storage.

[0015] Preferably, the card number is generated according to the enterprise code, the seed code and a preset card number generation algorithm, specifically comprising the following steps:

[0016] Reading the enterprise code and the corresponding seed code from the encrypted storage area of the hardware security module, generating a 4-bit random factor by a true random number generator built in the hardware security module, the enterprise code being a 6-digit pure number, the seed code being an 8-digit pure number, and the seed code being unique within the current enterprise;

[0017] Converting the random factor into a first intermediate value by a hardware adder, a hardware multiplier and a modulo operation circuit, the first intermediate value being 2 bits; judging the parity of the enterprise code by a parity detection circuit, selecting a corresponding second intermediate value combination path according to the parity using a multiplexer, and generating a second intermediate value in combination with the first intermediate value and the enterprise code, the second intermediate value being 8 bits;

[0018] a first check code is obtained according to the shift register and the second intermediate value, and a second check code is obtained according to the enterprise code and the seed code;

[0019] The card number is generated according to a preset encoding combination rule in combination with the enterprise code, the seed code, the random factor, the first check code and the second check code, and is stored in the hardware security module.

[0020] According to the technical scheme, the enterprise code is read from the encrypted storage area of the hardware security module, the seed code is called, and the random factor is generated, so that the security and randomness of the data source are ensured; the intermediate value is generated by using the hardware adder, the hardware multiplier, the modulo operation circuit, the parity detection circuit and the multiplexer, so that the efficiency and accuracy of the code generation are improved; the check code is obtained according to the shift register and the intermediate value, the enterprise code and the seed code, so that the reliability of the code is enhanced; finally, the card number is generated according to the rule in combination with various elements, so that the generated card number has higher security, accuracy and reliability.

[0021] Preferably, after the card number is generated, the following steps are further included:

[0022] A preset card number check algorithm is called to verify the card number read from the hardware security module, the card number check algorithm is bound with the card number generation algorithm, the verification process includes that the encoding structure of the card number is identified by the pattern matching circuit of the hardware security module, the generated card number is parsed according to the encoding structure, and the parsed enterprise code, seed code, first check code and second check code are obtained;

[0023] The random factor used to generate the current card number is obtained, the enterprise code and the seed code obtained after parsing are combined, the first verification code and the second verification code are generated according to the card number generation algorithm, when the first verification code is the same as the parsed first check code and the second verification code is the same as the parsed second check code, it is determined that the generated card number is valid, otherwise it is determined that the card number is invalid, and the subsequent card key generation process is terminated.

[0024] According to the technical scheme, after the card number is generated according to the seed code, the enterprise code and the preset card number generation algorithm, a card number check algorithm bound with the card number generation algorithm is called, the encoding structure of the card number is identified and stored by the pattern matching circuit of the hardware security module, and then the card number is verified, so that whether the card number is qualified can be determined, thereby avoiding generating a card key by using an invalid card number, improving the accuracy of the card key generation, terminating the card key generation process of the invalid card number, reducing unnecessary waste of computing resources, and improving the overall efficiency of the system.

[0025] Preferably, the card number corresponding to the card key is generated by combining the card number and the preset card key generation algorithm, and the following steps are specifically included:

[0026] The mode matching circuit of the hardware security module identifies the coding structure of the card number, and stores the identified coding structure into a corresponding security register, the coding structure including the enterprise code, the seed code, and a coupon verification code generated according to the first verification code and the second verification code;

[0027] The card number is summed by a hardware accumulator, and a 1-bit first password verification code is obtained by combining a modulo operation circuit;

[0028] The seed code and the coupon verification code are subjected to an exclusive-OR operation by an exclusive-OR gate array, and a 2-bit second password verification code is generated by combining a modulo operation circuit and a preset first password combination rule on the obtained result;

[0029] The enterprise code, the second password verification code, and the coupon verification code are subjected to a bit shift operation by a bit shift register, and a 3-bit third password verification code is generated by combining a modulo operation circuit and a preset second password combination rule;

[0030] The first password verification code, the second password verification code, and the third password verification code are combined in a preset order by a hardware splicing circuit to obtain a card secret, and the card secret and the corresponding card number are transmitted to an encryption buffer of the printing device through a hardware encryption interface.

[0031] By using the above technical solution, the mode matching circuit of the hardware security module is used to identify and store the card number coding structure, and the hardware circuits such as the hardware accumulator, the exclusive-OR gate array, the bit shift register, and the hardware splicing circuit are used to generate the card secret by combining the modulo operation circuit and the preset rules, thereby improving the efficiency and security of card secret generation. The card secret and the card number are transmitted to the encryption buffer of the printing device through the hardware encryption interface, further ensuring the security of the card secret during transmission.

[0032] Preferably, the card secret printed on the card secret area of the card corresponding to the card number is received by the printing device connected to the hardware security module, and the card secret is printed on the card corresponding to the card number according to a preset printing format, specifically in the card secret area of the card.

[0033] By using the above technical solution, the printing device is connected to the hardware security module, can receive the card secret and the card number transmitted by the hardware security module, and accurately print the card secret in the card secret area of the card according to the preset format, thereby ensuring the accuracy and standardization of the card secret printing position.

[0034] Preferably, the OCR identification of the coupon obtains a card password identification result, and the card password identification result is compared with the card password. Specifically, the steps include the following steps:

[0035] After the jet printing is completed, the image data is obtained by image acquisition of the coupon through a camera device, the image data is subjected to character segmentation, the card password identification result of the coupon is obtained by character recognition using an OCR identification engine, the card password identification result includes a card number and a card password obtained by identification, and the card number and the card password of the card password identification result are compared with the card number and the card password received from the hardware security module through a security comparator of the hardware security module, and a comparison result is obtained.

[0036] By adopting the above technical solution, the card password identification result is obtained by image acquisition, character segmentation and recognition of the coupon after the jet printing is completed, and the card password identification result is compared with the card number and the card password received from the hardware security module by using the security comparator of the hardware security module, so that the card password jet printed on the coupon can be ensured to be accurate and correct, the product quality is improved, and the subsequent processing cost is reduced.

[0037] Preferably, when the comparison result is completely consistent, the comparison passes, a regional full coverage command is triggered to physically cover the card password region, the hardware security module executes a register erasing instruction, and the temporarily stored card password is deleted.

[0038] By adopting the above technical solution, when the card password comparison is consistent, the card password region is physically covered and the temporarily stored card password is deleted, so that the security risk caused by long-term storage of the card password can be avoided, any form of information leakage can be prevented, and the security of the card password is improved.

[0039] In a second aspect, the application provides a card password generation, jet printing and verification device, which adopts the following technical solution:

[0040] A card password generation, jet printing and verification device includes the following modules:

[0041] A data reading module is configured to read an enterprise code and a seed code corresponding to the enterprise code from the hardware security module, and there is only one enterprise code for each enterprise;

[0042] A card password generation module is configured to generate a card number based on the hardware security module, according to the enterprise code, the seed code and a preset card number generation algorithm, and generate a card password corresponding to the card number in combination with the card number and a preset card password generation algorithm;

[0043] A card password jet printing module is configured to jet print the generated card password in a card password region of a card coupon corresponding to the card number;

[0044] The card number verification module is configured to perform OCR identification on the card coupon to obtain a card number identification result, compare the card number identification result with the card number, and obtain a comparison result.

[0045] The card number deletion module is configured to, if the comparison result is consistent, cover the card number area and delete the card number.

[0046] In a third aspect, the present application provides an intelligent terminal, which adopts the technical scheme as follows:

[0047] An intelligent terminal comprises a memory and a processor, the memory stores at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to realize the card number generation, printing and verification method as described above.

[0048] In a fourth aspect, the present application provides a computer readable storage medium, which adopts the technical scheme as follows:

[0049] A computer readable storage medium, the readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to realize the card number generation, printing and verification method as described above.

[0050] In summary, the present application at least includes the following beneficial effects:

[0051] (1) The present application generates card number and card number based on hardware security module, avoids the traditional database storage card number and card number mode, and significantly improves the security of card number;

[0052] (2) The present application performs OCR identification on the card coupon and compares the identification result with the card number, ensures that the card number of each product is accurate, improves the product quality, and reduces the subsequent processing cost;

[0053] (3) In the present application, if the card number comparison result is consistent, the card number area is covered and the card number is deleted, the card number is not stored, any form of information leakage is prevented, and the security of the card number is ensured. BRIEF DESCRIPTION OF DRAWINGS

[0054] Figure 1 is a flow chart of the embodiment of card number generation, printing and verification method;

[0055] Figure 2 is a structural diagram of the embodiment of card number generation, printing and verification device. DETAILED DESCRIPTION

[0056] The application provides a card number generation, printing and verification method and device, a terminal and a storage medium.

[0057] The application mainly adopts a hardware security module to realize dynamic generation and verification of card numbers, so as to improve the security of card numbers and product quality and avoid information leakage. The application will be further described in detail below.

[0058] The card number generation, printing and verification method of the application comprises the steps of data reading, card number generation, card number generation, card number printing, card number verification and card number deletion.

[0059] The steps are sequentially performed in order. First, the seed code and enterprise code are read from the hardware security module. The hardware security module integrates a true random number generator, an encryption engine and a special arithmetic logic unit (ALU).

[0060] Then, the card number and the card number are generated according to the above information, and the card number is printed on the card. Then, the card is identified by OCR and compared with the generated card number. If the comparison is consistent, the card number is overwritten and deleted. This avoids the security risks of traditional database storage of card numbers, significantly improves the security of card numbers, ensures the accuracy of each product card number, improves product quality, and reduces subsequent processing costs. The reason is that the card number is dynamically generated and verified and cleared in time, and the card number is verified twice.

[0061] The embodiments of the card number generation, printing and verification method of the application will be further described in detail below with reference to the accompanying drawings.

[0062] The card number generation, printing and verification method of the application has the flow as shown in Figure 1 The method is based on a hardware security module and comprises the following steps:

[0063] S1, read the enterprise code and the seed code corresponding to the enterprise code from the hardware security module. Each enterprise has a unique enterprise code.

[0064] Specifically, in the above data reading step, the hardware security module is a key component for storing card numbers and enterprise codes.

[0065] The hardware security module can use a chip with high security, such as an encryption chip. Its construction feature is to have powerful encryption function, which can prevent data from being illegally acquired. It is connected with external devices through a specific interface to ensure the security of data transmission. When reading the card number and the enterprise code, the hardware security module will accurately read the data from its storage area according to the preset rules. The enterprise code of each enterprise is unique, which ensures the accuracy and pertinence of the data.

[0066] S2, generating a card number according to the enterprise code, the seed code and a preset card number generation algorithm based on the hardware security module, specifically including the following steps:

[0067] S21, reading the enterprise code and the corresponding seed code from the encrypted storage area of the hardware security module, and generating a 4-bit random factor through the true random number generator built in the hardware security module.

[0068] The true random number generator can adopt a random number generator based on physical phenomena, such as a random number generator based on quantum effects, which has the feature of being able to generate truly random numbers, ensuring the randomness of the random factor.

[0069] The enterprise code is 6 digits, and the seed code is 8 digits. The seed code is unique in the current enterprise.

[0070] S22, converting the random factor into a first intermediate value through a hardware adder, a hardware multiplier and a modulo operation circuit. The first intermediate value is 2 bits.

[0071] In this embodiment, specifically, the 4-bit random factor is converted into 2 bits. First, the first and last digits of the random factor are added, and the result is taken modulo 10 to obtain the first digit of the first intermediate value. Then, the middle two digits of the random factor are multiplied, and the result is taken modulo 10 to obtain the last digit of the first intermediate value.

[0072] Among them, the hardware adder and multiplier are basic operation units in integrated circuits, which can quickly and accurately perform addition and multiplication operations. The modulo operation circuit is used for modulo operation.

[0073] In order to facilitate understanding, the following will take a specific method as an example to illustrate the generation process of the first intermediate value.

[0074] For example, after generating a 4-bit random factor, first extract the first digit and the fourth digit of the random factor. These two numbers are stored in the form of binary in the register of the chip, and are added through the adder circuit inside the chip. The result is also temporarily stored in the register in binary form, and then the result is taken modulo 10. The modulo operation is realized through a specific hardware logic circuit. According to the characteristics of binary numbers, the circuit quickly calculates the remainder after modulo 10, and this remainder is the first digit of the converted 2-bit first intermediate value. For example, if the random factor is 1234, at the hardware level, the binary numbers corresponding to 1 and 4 are added in the adder, and the binary result is stored after the modulo circuit. The first digit 5 corresponding to the binary representation is obtained.

[0075] Then, the second and third digits of the random factor are extracted and stored in the register, and multiplication operation is performed by using the multiplier circuit in the chip. The binary result after multiplication is stored in the register and is subjected to the next step. The result is subjected to modulo 10 operation by using the specially designed modulo hardware logic circuit, and the remainder is the last digit of the converted 2-bit first intermediate value. Taking the random factor 1234 as an example, the binary numbers corresponding to 2 and 3 are multiplied in the multiplier, and the binary product is subjected to modulo operation by the modulo circuit to obtain the binary representation corresponding to the last digit 6.

[0076] The intermediate data in the above operation process is only temporarily stored in the hardware register, and is automatically cleared after the operation is completed.

[0077] In this way, the simplified 2-bit random factor speeds up the data processing speed and improves the system operation efficiency without reducing the security. At the same time, the algorithm is closely combined with the hardware, and the characteristics of the hardware are used to realize fast operation, so that the process is more difficult to be cracked, and the security of the data is enhanced.

[0078] S23, judging the parity of the enterprise code by using the parity detection circuit, selecting the corresponding second intermediate value combination path according to the parity by using the multiplexer, combining the first intermediate value and the enterprise code to generate the second intermediate value, and the second intermediate value is 8 bits.

[0079] The parity detection circuit can be realized by using a logic circuit, which can judge the parity of the binary representation of the enterprise code. The multiplexer is a circuit that can select different input signals according to the control signal, which ensures the correct generation of the second intermediate value.

[0080] In this embodiment, the process of generating the second intermediate value is specifically that, if the enterprise code is odd, the 2-bit first intermediate value is combined into an 8-bit second intermediate value by the multiplexer in the order of "first intermediate value first bit + enterprise code last 3 bits + first intermediate value last bit + enterprise code first 3 bits";

[0081] If the enterprise code is even, the 2-bit first intermediate value is combined into an 8-bit second intermediate value by the multiplexer in the order of "enterprise code first 3 bits + first intermediate value first bit + enterprise code last 3 bits + first intermediate value last bit";

[0082] The above combination process is controlled by the hardware timing circuit, and the combination result is stored in the security register of the HSM.

[0083] S24, obtaining the first check code according to the bit shift register and the second intermediate value, and obtaining the second check code according to the enterprise code and the seed code; the bit shift register can perform shift operation on the data, and the first check code is obtained by shift operation and corresponding operation.

[0084] In the embodiment, the process of generating the first check code is specifically that the second intermediate value is left shifted bit by bit by a bit shift register, the shifted result is summed by a hardware accumulator, and 100 is taken as a modulus of the sum.

[0085] That is, each bit of the 8-bit second intermediate value and the corresponding bit index (1-8) are left shifted by a bit shift register, the shifted result is not input into the accumulator for summation, 100 is taken as a modulus of the summation result, and the 2-bit first check code is generated; if the result is 0, the backup summation circuit is started to add each bit of the 8-bit second intermediate value, the summation result is taken as a modulus of 10, and the 1-bit number obtained is combined with 0 to be the 2-bit first check code.

[0086] In the embodiment, the process of generating the second check code is specifically that the 6-bit enterprise code and the 8-bit seed code are subjected to an exclusive OR operation by a hardware exclusive OR gate array, the exclusive OR result is taken as a modulus of 100, and the 2-bit second check code is generated; if the result is 0, the 4th bit of the seed code is extracted and combined with 0 to be the second check code.

[0087] The first check code and the second check code are combined by a hardware splicing circuit to be the 4-bit card coupon check code checkCode. The generated check code is stored in the secure FIFO queue of the HSM.

[0088] S25, in combination with the enterprise code, the seed code, the random factor, the first check code and the second check code, a card number is generated according to a preset encoding combination rule and stored in the hardware security module.

[0089] Specifically, the enterprise code and the seed code are read from the secure storage area, and the first check code and the second check code are read from the FIFO queue.

[0090] In the embodiment, the 20-bit card number is generated by a hardware data splicing circuit according to the following encoding combination rule: enterprise code (6 bits) + second check code in reverse order (2 bits) + last 4 bits of seed code (4 bits) + first check code in normal order (2 bits) + first 4 bits of seed code (4 bits) + first and last two bits of random factor (2 bits).

[0091] Each enterprise can have different card number generation algorithms, and the above is only an example of one of them. In this process, MD5 and other asymmetric algorithms can also be added to participate in the generation of the 4-bit card coupon verification code.

[0092] The encoding check algorithm is actually the same as the encoding production algorithm. According to the structure of the 20-bit encoding, the corresponding enterprise code, seed code, and check code are parsed, combined with the random factor when the enterprise code is generated, and then the check code is calculated according to the encoding production process. If the results are consistent, the encoding is valid, otherwise it is invalid. The above encoding check process belongs to the check process when the card coupon is decrypted by the card number during use. This will not be repeated here.

[0093] S3, after generating the card number, further comprising a card number verification step.

[0094] S31, calling a preset card number verification algorithm to verify the card number read from the hardware security module, the card number verification algorithm is bound to the card number generation algorithm, that is, the card number verification algorithm is essentially the same as its corresponding card number generation algorithm.

[0095] S32, when the card number to be verified read from the hardware security module is input into the card number verification algorithm, the algorithm will perform a series of operation verification.

[0096] The verification process includes identifying the coding structure of the card number by the pattern matching circuit of the hardware security module, which can be implemented by a state machine circuit, which can accurately identify each component of the card number.

[0097] According to the coding structure, the generated card number is parsed to obtain the parsed enterprise code, seed code, first verification code and second verification code.

[0098] S33, obtain the random factor for generating the current card number from the hardware security module, combine the parsed enterprise code and seed code, and generate the first verification code and the second verification code according to the card number generation algorithm.

[0099] S34, when the first verification code is the same as the parsed first verification code and the second verification code is the same as the parsed second verification code, it is determined that the generated card number is valid, otherwise the card number is invalid, and the subsequent card secret generation process is terminated.

[0100] This step is to determine whether the card number belongs to the valid card number generated by the algorithm authorized by the enterprise. When generating a batch of cards, the card number generation algorithm required for the batch of cards is specified and authorized, and only the card number that meets the requirements of the authorized card number generation algorithm is valid. The purpose is to ensure that only the card number generated in this way can be used for card production in the current card production process, and not any card number can generate card secret, and also to ensure the accuracy and security of the whole process.

[0101] S4, combining the card number and the preset card secret generation algorithm to generate the card secret corresponding to the card number, specifically including the following steps:

[0102] S41, identifying the coding structure of the card number by the pattern matching circuit of the hardware security module, and storing the identified coding structure into the corresponding security register, which is a storage unit with high security to prevent data loss and illegal tampering.

[0103] The coding structure includes enterprise code, seed code and card coupon verification code, which is generated according to the first verification code and the second verification code.

[0104] S42, summing the card number by a hardware accumulator, and obtaining a 1-bit first password check code (msk-a1) by combining a modulo operation circuit.

[0105] Specifically, the 20-bit card number is added bit by bit by using a hardware accumulator, and the addition result is taken modulo 10 by a modulo operation circuit to obtain a 1-bit first password check code, and the result is stored in a temporary register of the HSM.

[0106] S43, second password check code generation: performing XOR operation on the seed code and the coupon check code by an XOR gate array, and generating a 2-bit second password check code (msk-b2) by combining a modulo operation circuit and a preset first password combination rule.

[0107] In this embodiment, the first password combination rule is to sum the adjacent bits of the seed code from left to right by a hardware adder, perform XOR operation with the coupon check code by an XOR gate array, and generate a 2-bit second password check code (msk-b2) by an accumulator and a modulo operation circuit.

[0108] The specific process is to add the adjacent two bits of the 8-bit seed code from left to right by an addition array, and XOR the 4-bit coupon check code from left to right by an XOR array, and then add the sum and the XOR result by an accumulator, and then take modulo 100 by a modulo 100 circuit to output a 2-bit second password check code (msk-b2), if the result is 0, then take the last digit of the enterprise code and 0 to form a 2-bit second password check code (msk-b2).

[0109] S44, third password check code generation: performing bit shift operation on the enterprise code, the second password check code and the coupon check code by a bit shift register, and generating a 3-bit third password check code by combining a modulo operation circuit and a preset second password combination rule.

[0110] In this embodiment, the second password combination rule is to perform left shift operation on the combination of the enterprise code and "second password check code + coupon check code" by a shift register, and output a 3-bit third password check code (msk-c3) by an accumulator and a modulo 1000 circuit, if the result is a 1-digit number, then complete it by referring to the specific bits of the enterprise code and the seed code by a data selector.

[0111] The specific process is to left shift each bit of the combination of the 6-bit enterprise code and "2-bit msk-b2 and 4-bit checkCode" from left to right, add the results and take modulo 1000, if the result is a 1-digit number, then refer to the middle bit (2nd bit) of the enterprise code and the middle bit (4th bit) of the seed code respectively in the first two bits of the result to obtain a 3-bit third password check code msk-c3; finally, a 6-bit card password is obtained.

[0112] S45, combining the first password verification code, the second password verification code and the third password verification code in a preset order to obtain the card password through a hardware splicing circuit, and the hardware splicing circuit can accurately splice different password verification codes together.

[0113] In this embodiment, the splicing order of the card password is (msk-c3) + (msk-a1) + (msk-b2), a total of 6 bits. The card password and the corresponding card number are transmitted to the encryption buffer of the printing device through the hardware encryption interface. Among them, the hardware encryption interface ensures the security of data transmission, and the encryption buffer temporarily stores the data.

[0114] S5, printing the generated card password on the card password area of the card number corresponding card through the printing device.

[0115] Specifically, through the printing device connected with the hardware security module, the card password and the card number transmitted by the hardware security module are received, and the card password is printed on the card corresponding to the card number according to the preset printing format, specifically in the preset card password area of the card.

[0116] The printing device can adopt an inkjet printer or a laser printer, and its structural feature is that it can accurately print the card password on the specified position. It obtains the card password and card number information through data interaction with the hardware security module, and prints according to the preset format.

[0117] S6, performing OCR identification on the card to obtain a card password identification result, and comparing the card password identification result with the card password, specifically including the following steps.

[0118] S61, after printing, the image data is obtained by image acquisition of the card through the camera device, and the camera device can adopt a high-definition camera, which can clearly collect the image information on the card.

[0119] S62, character segmentation is performed on the image data, and the card password identification result of the card is obtained by using the OCR recognition engine for character recognition. The card password identification result includes the card number and the card password identified. The OCR recognition engine adopts an advanced optical character recognition algorithm, which can accurately recognize the characters in the image.

[0120] S63, the card number and the card password of the card password identification result are compared with the card number and the card password received from the hardware security module through the security comparator of the hardware security module, and the comparison result is obtained. Among them, the security comparator is a circuit that can accurately compare whether two data are consistent.

[0121] S6, if the comparison result is consistent, the card password area is covered and the card password is deleted.

[0122] When the comparison result is completely consistent, the comparison passes, triggering the area full coverage command to physically cover the card secret area, while the hardware security module executes the register erasing instruction to delete the temporarily stored card secret. The physical coverage can be achieved by coating, etc., to ensure that the card secret cannot be read again. The register erasing instruction can completely clear the temporarily stored card secret in the hardware security module, preventing information leakage.

[0123] If the comparison result is inconsistent, the system will start the alarm mechanism, and the error or problem card will be sent to the waste processing flow.

[0124] The embodiment realizes the dynamic generation, instant verification and instant deletion of card numbers and card secrets by integrating a series of hardware modules and algorithms on the card coupon production line. The security risks of traditional database storage of card secrets are avoided, and the security of card secrets is improved. At the same time, through secondary verification, it is ensured that each product card secret is accurate and correct, improving product quality and reducing subsequent processing costs. And can be flexibly configured according to actual needs Production line, improve production efficiency.

[0125] Based on the same inventive concept as described above, the embodiment of the present application also discloses a card secret generation, printing and verification device, the architecture is as shown in Figure 2 The device includes the following modules:

[0126] The data reading module is configured to read the enterprise code and the seed code corresponding to the enterprise code from the hardware security module, and each enterprise has a unique enterprise code;

[0127] The card secret generation module is configured to generate a card number based on the hardware security module, according to the enterprise code, the seed code and the preset card number generation algorithm, and generate the card secret corresponding to the card number in combination with the card number and the preset card secret generation algorithm;

[0128] The card secret printing module is configured to print the generated card secret on the card secret area of the card number corresponding card coupon;

[0129] The card secret verification module is configured to obtain a card secret recognition result by performing OCR identification on the card coupon, and compare the card secret recognition result with the card secret;

[0130] The card secret deletion module is configured to cover the card secret area and delete the card secret if the comparison result is consistent.

[0131] In a specific implementable scheme, the following modules are further included:

[0132] The card number verification module is configured to call a preset card number verification algorithm to verify the card number read from the hardware security module, the card number verification algorithm is bound with the card number generation algorithm, and the verification process includes identifying the coding structure of the card number through the mode matching circuit of the hardware security module, analyzing the generated card number according to the coding structure to obtain the parsed enterprise code, seed code, first check code and second check code;

[0133] The random factor for generating the current card number is obtained, the enterprise code and the seed code obtained after the analysis are combined, the first verification code and the second verification code are generated according to the card number generation algorithm, when the first verification code is the same as the first check code after the analysis and the second verification code is the same as the second check code after the analysis, it is determined that the generated card number is valid, otherwise it is determined that the card number is invalid, and the subsequent card password generation process is terminated.

[0134] In a specific implementation scheme, the card password generation module includes the following units:

[0135] The card number generation unit is configured to read the enterprise code and the corresponding seed code from the encrypted storage area of the hardware security module, generate a 4-bit random factor through the true random number generator built-in the hardware security module, the enterprise code is 6-bit pure number, the seed code is 8-bit pure number, and the seed code is unique in the current enterprise;

[0136] The random factor is converted into a first intermediate value through a hardware adder, a hardware multiplier and a modulo operation circuit, the first intermediate value is 2-bit; the parity of the enterprise code is judged through the parity detection circuit, the corresponding second intermediate value combination path is selected according to the parity using the multiplexer, the second intermediate value is generated combining the first intermediate value and the enterprise code, and the second intermediate value is 8-bit;

[0137] The first check code is obtained according to the bit shift register and the second intermediate value, and the second check code is obtained according to the enterprise code and the seed code;

[0138] In order to combine the enterprise code, the seed code, the random factor, the first check code and the second check code, the card number is generated according to the preset coding combination rule and stored in the hardware security module.

[0139] The card password generation unit is configured to identify the coding structure of the card number through the mode matching circuit of the hardware security module, and store the identified coding structure into the corresponding security register, the coding structure includes the enterprise code, the seed code and the coupon check code, and the coupon check code is generated according to the first check code and the second check code;

[0140] The card number is summed through the hardware accumulator, and the 1-bit first password check code is obtained combining the modulo operation circuit;

[0141] The seed code and the card coupon verification code are subjected to exclusive OR operation through an exclusive OR gate array, and a second password verification code with 2 bits is generated by combining the obtained result with a modulo operation circuit and a preset first password combination rule;

[0142] The enterprise code, the second password verification code and the card coupon verification code are subjected to bit shift operation through a bit shift register, and a third password verification code with 3 bits is generated by combining a modulo operation circuit and a preset second password combination rule;

[0143] The first password verification code, the second password verification code and the third password verification code are combined in a preset order through a hardware splicing circuit to obtain a card secret, and the card secret and the corresponding card number are transmitted to an encryption buffer of a printing device through a hardware encryption interface.

[0144] In one specific implementation scheme, the card secret printing module comprises the following units:

[0145] The card secret printing unit is configured to receive the card secret and the card number transmitted by the hardware security module through the printing device connected with the hardware security module, and print the card secret on the card coupon corresponding to the card number in a preset printing format, specifically in a preset card secret area on the card coupon.

[0146] In one specific implementation scheme, the card secret verification module comprises the following units:

[0147] The card secret verification unit is configured to perform image acquisition on the card coupon through the camera device after printing to obtain image data, perform character segmentation on the image data, perform character recognition using an OCR recognition engine to obtain a card secret recognition result of the card coupon, the card secret recognition result comprising the recognized card number and card secret, and compare the card number and card secret of the card secret recognition result with the card number and card secret received from the hardware security module through the security comparator of the hardware security module to obtain a comparison result.

[0148] In one specific implementation scheme, the card secret deletion module comprises the following units:

[0149] The card secret deletion unit is configured to trigger a full-area covering command to physically cover the card secret area when the comparison result is completely consistent, and simultaneously execute a register erasing instruction to delete the temporarily stored card secret.

[0150] In the above device, the "card number verification module" and the "card secret verification module" are in communication, and the "card secret verification module" and the "card secret generation module" are also in communication.

[0151] Based on the same inventive concept, the application further discloses a computer readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set can be loaded and executed by a processor to implement the card secret code generation, printing and verification method provided by the above method embodiment.

[0152] Based on the same inventive concept, the application further discloses a computer readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set can be loaded and executed by a processor to implement the card secret code generation, printing and verification method provided by the above method embodiment.

[0153] Those skilled in the art can understand that all or part of the steps of the above embodiments can be completed by hardware, or by a program instructing related hardware to complete, and the program can be stored in a computer readable storage medium, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.

[0154] The above is only an optional embodiment of the application, and does not limit the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall be included in the protection scope of the application.

Claims

1. A method for card key generation, printing and verification, characterized in that, The method is based on a hardware security module, and the method comprises the following steps: reading an enterprise code and a seed code corresponding to the enterprise code from an encrypted storage area of the hardware security module, and each enterprise having a unique enterprise code; generating a card number based on the hardware security module according to the enterprise code, the seed code and a preset card number generation algorithm, wherein the process of generating the card number comprises, generating a 4-digit random factor by a true random number generator built in the hardware security module, the enterprise code being 6 digits, the seed code being 8 digits, and the seed code being unique in the current enterprise; converting the random factor into a first intermediate value by a hardware adder, a hardware multiplier and a modulo operation circuit, the first intermediate value being 2 digits; judging the parity of the enterprise code by a parity detection circuit, selecting a corresponding second intermediate value combination path by a multiplexer according to the parity, combining the first intermediate value and the enterprise code to generate a second intermediate value, the second intermediate value being 8 digits; obtaining a first check code according to a bit shift register and the second intermediate value, and obtaining a second check code according to the enterprise code and the seed code; combining the enterprise code, the seed code, the random factor, the first check code and the second check code, generating a card number according to a preset encoding combination rule and storing the card number in the hardware security module; combining the card number and a preset card password generation algorithm to generate a card password corresponding to the card number; spraying the generated card password on a card password area of a card corresponding to the card number by a spraying device; after spraying, performing OCR identification on the card to obtain a card password identification result, and comparing the card password identification result with the card password in the hardware security module by a security comparator of the hardware security module; when the comparison result is completely consistent, the comparison passes, a region full coverage command is triggered to physically cover the card password area, a register erasing instruction is executed by the hardware security module, and the temporarily stored card password is deleted.

2. The card key generation, printing and verification method of claim 1, wherein, After the card number is generated, the following steps are further included: calling a preset card number verification algorithm to verify the card number read from the hardware security module, the card number verification algorithm being bound with the card number generation algorithm, and the verification process comprising identifying an encoding structure of the card number by a pattern matching circuit of the hardware security module, analyzing the generated card number according to the encoding structure to obtain an analyzed enterprise code, seed code, first check code and second check code; obtaining the random factor for generating the current card number, combining the analyzed enterprise code and seed code, generating a first verification code and a second verification code according to the card number generation algorithm, and determining that the generated card number is valid when the first verification code is the same as the analyzed first check code and the second verification code is the same as the analyzed second check code, otherwise determining that the card number is invalid and terminating the subsequent card password generation process.

3. The card key generation, printing and verification method of claim 1, wherein, The combination of the card number and the preset card password generation algorithm to generate the card password corresponding to the card number specifically comprises the following steps: The mode matching circuit of the hardware security module identifies the encoding structure of the card number, and stores the identified encoding structure into a corresponding security register, the encoding structure including the enterprise code, the seed code, and a coupon verification code generated according to the first verification code and the second verification code; The hardware accumulator is used to sum the card number, and a 1-bit first password verification code is obtained through a modulo operation circuit; An XOR gate array is used to perform an XOR operation on the seed code and the coupon verification code, and a 2-bit second password verification code is generated according to the obtained result, a modulo operation circuit, and a preset first password combination rule; A bit shift register is used to perform a bit shift operation on the enterprise code, the second password verification code, and the coupon verification code, and a 3-bit third password verification code is generated according to a modulo operation circuit and a preset second password combination rule; A hardware splicing circuit is used to combine the first password verification code, the second password verification code, and the third password verification code according to a preset order to obtain a card secret, and the card secret and the corresponding card number are transmitted to an encryption buffer of the printing device through a hardware encryption interface.

4. The card key generation, printing and verification method of claim 1, wherein, The printing device connected to the hardware security module receives the card secret and the card number transmitted by the hardware security module, and prints the card secret on the card coupon corresponding to the card number according to a preset printing format, specifically in a preset card secret area on the card coupon.

5. The card key generation, printing and verification method of claim 1, wherein, The card secret recognition result is obtained by performing OCR identification on the card coupon, and the card secret recognition result is compared with the card secret, specifically including the following steps: After printing is completed, the image data is obtained by image acquisition of the card coupon through a camera device, character segmentation is performed on the image data, character recognition is performed using an OCR recognition engine to obtain the card secret recognition result of the card coupon, the card secret recognition result including the recognized card number and card secret, and the card number and card secret of the card secret recognition result are compared with the card number and card secret received from the hardware security module through a security comparator of the hardware security module to obtain a comparison result.

6. A card key generation, printing and verification apparatus, characterized by, The hardware security module and the following modules in communication connection with the hardware security module are included: A data reading module configured to read an enterprise code and a seed code corresponding to the enterprise code from an encrypted storage area of the hardware security module, and each enterprise has a unique enterprise code; A card secret generation module configured to generate a card number according to the enterprise code, the seed code, and a preset card number generation algorithm based on the hardware security module, and generate a card secret corresponding to the card number according to the card number and a preset card secret generation algorithm; The card secret generation module further includes a card number generation unit configured to generate a 4-bit random factor through a true random number generator built in the hardware security module, the enterprise code is a 6-digit number, the seed code is an 8-digit number, and the seed code is unique in the current enterprise; The random factor is converted into a first intermediate value of 2 bits through a hardware adder, a hardware multiplier and a modulo operation circuit; the parity of the enterprise code is judged through a parity detection circuit, a corresponding second intermediate value combination path is selected according to the parity using a multiplexer, a second intermediate value is generated by combining the first intermediate value and the enterprise code, and the second intermediate value is 8 bits; A first check code is obtained according to a shift register and the second intermediate value, and a second check code is obtained according to the enterprise code and the seed code; the enterprise code, the seed code, the random factor, the first check code and the second check code are combined to generate a card number according to a preset encoding combination rule and stored in the hardware security module; A card number printing module is configured to print the generated card number on a card number area of a card corresponding to the card number; A card number verification module is configured to, after printing, perform OCR identification on the card to obtain a card number identification result, and compare the card number identification result with the card number in the hardware security module through a security comparator of the hardware security module; A card number deletion module is configured to, if the comparison result is consistent, cover the card number area and delete the card number. The card number deletion module further includes a card number deletion unit configured to, when the comparison result is completely consistent, pass the comparison, trigger a region full coverage command to physically cover the card number area, and execute a register erasing instruction to delete the temporarily stored card number by the hardware security module.

7. A smart terminal, characterized in that The readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, which are loaded and executed by the processor to implement the card number generation, printing and verification method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, which are loaded and executed by the processor to implement the card number generation, printing and verification method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Two-dimensional code dynamic encryption and decryption algorithm

    CN105426765A

  • System, Apparatus And Method For Providing Randomly Generated Codes In A User Anonymous Manner

    CN107636713A

  • Password printing system and method

    CN114553406A