A receipt encryption method and device
By digitally signing and encrypting the content of the receipt voucher, and using the CA certification algorithm and asymmetric keys, the problem of the receipt voucher being tampered with or reused during the delivery process is solved, and the security and uniqueness of the data are achieved.
Patent Information
- Application Number
- CN202310942836.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-07-28
AI Technical Summary
Existing receipt vouchers are easily tampered with or reused during the delivery process, and cannot effectively prevent extreme problems caused by lack of data center management.
The first encryption algorithm and the second encryption algorithm are used to encrypt the receipt voucher, and the CA certification algorithm and asymmetric key are used to digitally sign the content of the receipt voucher to ensure that it is not tampered with during the transmission process and to prevent reuse.
It achieves the data integrity and uniqueness of the receipt voucher during the transmission process, avoids reuse and tampering, and ensures the security and legality of the transaction.
Smart Images

Figure CN117056948B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of receipt voucher management, and in particular to a receipt voucher encryption method and device. Background Art
[0002] In the past, bills were mainly printed out in small receipts, and the relevant personnel held paper receipts as transaction receipts. With the increasing degree of digitalization in life and production, receipts are used to record transaction information during the transaction process, and are recorded in the form of electronic invoices. At present, domestic electronic invoices are still similar to paper scanned versions, relying on the unique number on the bill to identify authenticity or duplicate checking through the query of the bill center.
[0003] Existing receipts are still simple digital records with only anti-counterfeiting and coding, which cannot prevent them from being copied or require a data center to manage them properly. If there is no data management center, they are more likely to be reused, which has great limitations. Summary of the invention
[0004] In view of the above technical problems, the present invention provides a receipt certificate encryption method and device, which can prevent the receipt certificate from being tampered with during the transmission process and avoid the receipt certificate from being reused.
[0005] A first aspect of the present invention provides a receipt voucher encryption method, comprising:
[0006] The receipt voucher is encrypted using a first encryption algorithm, and the receipt voucher is encrypted using a second encryption algorithm, wherein the first encryption algorithm is used to encrypt the content of the receipt voucher, and the second encryption algorithm is used to prevent the receipt voucher from being tampered with or reused;
[0007] When the receipt is read by a contactless card reader, a new digital signature is generated using the second encryption algorithm, wherein the new digital signature includes the newly added data content and the original receipt content;
[0008] When the receipt voucher is transmitted to other devices, the receipt voucher is verified using the first encryption algorithm, wherein the first encryption algorithm includes a CA authentication algorithm.
[0009] In an optional implementation, the step of encrypting the receipt voucher using the first encryption algorithm includes:
[0010] The first encryption algorithm is a first asymmetric key provided by a CA certification center. The public key of the first asymmetric key is stored in the contactless card storing the receipt certificate, and the private key of the first asymmetric key is stored in the CA certification center.
[0011] In an optional implementation, the step of encrypting the receipt voucher using a second encryption algorithm includes:
[0012] A second asymmetric key is autonomously generated using a chip in the contactless card storing the receipt voucher, wherein the second asymmetric key includes a public key and a private key.
[0013] In an optional implementation, when the receipt voucher is read by a contactless card reader, generating a new digital signature using the second encryption algorithm includes:
[0014] When the receipt is read by a contactless card reader, the second encryption algorithm will automatically increase the number of reads by one and generate a new digital signature, which is recorded as Sign2 = RSA (PUBK1, DATA1 + 1).
[0015] In an optional embodiment, the receipt voucher encryption method further includes: when the receipt voucher is transmitted to other devices, receiving a third encryption algorithm transmitted by the other devices, encrypting the receipt voucher using the third encryption algorithm, and transmitting the encrypted receipt voucher to the other devices.
[0016] A second aspect of the present invention provides a receipt certificate encryption device, comprising:
[0017] An encryption module, used to encrypt the receipt voucher using a first encryption algorithm and to encrypt the receipt voucher using a second encryption algorithm, wherein the first encryption algorithm is used to encrypt the content of the receipt voucher and the second encryption algorithm is used to prevent the receipt voucher from being tampered with or reused;
[0018] an anti-tampering module, configured to generate a new digital signature using the second encryption algorithm when the receipt is read by a contactless card reader, wherein the new digital signature includes the newly added data content and the original receipt content;
[0019] A transfer module is used to verify the receipt voucher using the first encryption algorithm when the receipt voucher is transmitted to other devices, and the first encryption algorithm includes a CA authentication algorithm.
[0020] In an optional implementation, the first encryption algorithm is a first asymmetric key provided by a CA certification center, a public key of the first asymmetric key is stored in a contactless card storing the receipt, and a private key of the first asymmetric key is stored in the CA certification center.
[0021] In an optional embodiment, the transfer module is also used to receive a third encryption algorithm transmitted by other devices when the receipt voucher is transmitted to the other devices, encrypt the receipt voucher using the third encryption algorithm, and then transmit the encrypted receipt voucher to the other devices.
[0022] In an optional implementation manner, the present invention uses a second asymmetric key autonomously generated by a chip in the contactless card storing the receipt voucher, wherein the second asymmetric key includes a public key and a private key.
[0023] In an optional implementation, when the receipt certificate is read by a contactless card reader, the second encryption algorithm will automatically increase the number of reads by one and generate a new digital signature, which is recorded as Sign2 = RSA (PUBK1, DATA1 + 1).
[0024] According to a third aspect of the present invention, there is provided an electronic device, comprising:
[0025] At least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the method described in the first aspect of the embodiment of the present invention.
[0026] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a computer, the method according to the first aspect of the embodiment of the present invention is executed.
[0027] The present invention digitally signs the contents of the receipt voucher and stores it in a contactless smart card chip. When the receipt is passed to a new recipient, the mark of the original holder is taken back, and the new holder information is marked and stored in the contactless card of the new holder. This ensures that the receipt voucher is not tampered with during the transmission process and can also prevent the receipt voucher from being reused. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 The figure is a flow chart of a receipt voucher encryption method in an embodiment of the present invention.
[0029] Figure 2 Schematic diagram of a module of a receipt voucher encryption device in an embodiment of the present invention.
[0030] Figure 3 FIG. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0032] It should be understood that the terms "include" and "comprising" used in the specification and claims of the present disclosure indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0033] The electronic ticket described in the present invention is an electronic transaction receipt voucher, or a voucher, a voucher, a points card or other valuable tickets. The present invention adopts a digital signature method to digitally store the content of the receipt voucher in a contactless card, and signs the digitized receipt voucher content. The signature content is added with the holder information, and when the holder changes, the signature will also change to the new holder information, ensuring that a certain transaction receipt has only one valid holder; at the same time, the data is written into the contactless card, and the security characteristics of the contactless card are used to prevent the content of the receipt voucher from being tampered with or reused. Using the present invention, a backup of a certain electronic transaction receipt before transfer will no longer be able to be transferred after it is transferred once.
[0034] See also Figure 1 , Figure 1 The flowchart of a receipt voucher encryption method in an embodiment of the present invention is shown in FIG. The receipt voucher encryption method provided by the present invention includes:
[0035] Step 100: Encrypt the receipt voucher using a first encryption algorithm and encrypt the receipt voucher using a second encryption algorithm, wherein the first encryption algorithm is used to encrypt the content of the receipt voucher and the second encryption algorithm is used to prevent the receipt voucher from being tampered with or reused.
[0036] In some embodiments of the present invention, the first encryption algorithm is a first asymmetric key provided by a CA certification center, a public key of the first asymmetric key is stored in a contactless card storing the receipt, and a private key of the first asymmetric key is stored in the CA certification center.
[0037] In some embodiments of the present invention, the second encryption algorithm is a second asymmetric key autonomously generated by a chip in the contactless card storing the receipt voucher, wherein the second asymmetric key includes a public key and a private key. Each time the receipt voucher is read, the second encryption algorithm will generate new content and perform encryption to prevent the receipt voucher from being tampered with or reused.
[0038] For example, two groups of asymmetric keys are stored in the contactless card, one of which is a public key (PUBK1) and private key (PRIK1) pair generated autonomously inside the card, which serves as the second encryption algorithm, and the other is an externally written signature public key (PUBK2), and the corresponding private key (PRIK2) is stored in a secure CA certification center. This group serves as the first encryption algorithm.
[0039] The receipt voucher is stored in the memory of the contactless card in a digital format. It can be read and written by a contactless card reader, such as the NFC function of a mobile phone or other contactless card readers.
[0040] Step 200: When the receipt is read by a contactless card reader, a new digital signature is generated using the second encryption algorithm, and the new digital signature includes the newly added data content and the original receipt content.
[0041] In some embodiments of the present invention, the receipt voucher stored in the contactless card includes at least two digital signatures. One is the signature of the content of the initial creation of the receipt voucher (the first non-copy write), represented by Sign1, Sign1 = RSA (PRIK2, DATA1), and its calculation process is completed in the CA certification center. Each receipt voucher only needs to be calculated once, and this part is never modified. The other is the signature of the newly added data content and the original content after each reading, represented by Sign2, Sign2 = RSA (PUBK1, DATA1+1), and this part is modified when the receipt voucher is transmitted. They correspond to the first encryption algorithm and the second encryption algorithm mentioned above respectively.
[0042] When the contactless card reader reads the contents of the receipt voucher, each time the content is read, the second encryption algorithm will automatically increase the number of reads by 1, and generate a new digital signature Sign2, Sign2 = RSA (PUBK1, DATA1 + 1), so that the signature will change after each reading to prevent tampering or duplication and reuse. That is, when the receipt voucher is read by the contactless card reader, the second encryption algorithm will automatically increase the number of reads by one, and generate a new digital signature, recorded as Sign2 = RSA (PUBK1, DATA1 + 1).
[0043] In this step, when the second encryption algorithm is encrypting, the signature content is added with the holder's information, such as the holder's mobile phone identification code, processor code, or user ID code.
[0044] Step 300: When the receipt certificate is transmitted to other devices, the receipt certificate is verified using the first encryption algorithm, where the first encryption algorithm includes a CA authentication algorithm.
[0045] CA authentication method is a digital certificate authentication method, which verifies identity and protects data security through digital certificates. CA authentication method is a very important authentication method that can ensure the security and integrity of data, and also prevent data from being tampered with or stolen. The basic principle of CA authentication method is to verify identity and protect data security through digital certificates. A digital certificate is an electronic certificate that contains some information about the certificate holder, such as name, address, email address, etc. A digital certificate contains a public key and a private key. The public key is used to encrypt data, and the private key is used to decrypt data.
[0046] In order to ensure that the content of the receipt voucher is not modified by subsequent holders, the initial signature Sign1 is encrypted with the private key PRI2 of the CA certification center, and its corresponding public key PUBK2 is published to the user. Therefore, when verifying the authenticity of the receipt voucher, the public key of the first encryption algorithm can be used to decrypt it, and it can be checked whether the content has been modified. Because the public key is public, other users can verify Sign1 without going to the certification CA center for verification. And because the subsequent second encryption algorithm has newly added read times and new signature content Sign2, even the person who originally created this receipt voucher cannot modify this receipt voucher.
[0047] Specifically, when the receipt voucher is transmitted to other devices, the third encryption algorithm transmitted by the other devices is received, the receipt voucher is encrypted using the third encryption algorithm, and the encrypted receipt voucher is transmitted to the other devices.
[0048] For example, when a receipt voucher is to be sent to another user, the user needs to first send the private key PRIK1 of the first encryption algorithm in his contactless card to the original holder. The original holder encrypts the receipt voucher with the private key PRIK1 and sends it to the user. The user writes the received data into the contactless card he holds. The contactless card can decrypt the received data and use the private key PRIK1 in the card to sign and save it. In this way, the receipt voucher is transmitted, making it convenient for users to conduct transactions and use receipt vouchers.
[0049] The present invention digitally signs the contents of the receipt voucher and stores it in a contactless smart card chip. When the receipt is passed to a new recipient, the mark of the original holder is taken back, and the new holder information is marked and stored in the contactless card of the new holder. This ensures that the receipt voucher is not tampered with during the transmission process and can also prevent the receipt voucher from being reused.
[0050] See also Figure 2 , Figure 2 The module diagram of a receipt voucher encryption device in an embodiment of the present invention is shown in FIG. The receipt voucher encryption device provided by the present invention comprises:
[0051] The encryption module 21 is used to encrypt the receipt voucher using a first encryption algorithm and to encrypt the receipt voucher using a second encryption algorithm, wherein the first encryption algorithm is used to encrypt the content of the receipt voucher and the second encryption algorithm is used to prevent the receipt voucher from being tampered with or reused.
[0052] The first encryption algorithm is a first asymmetric key provided by a CA certification center. The public key of the first asymmetric key is stored in the contactless card storing the receipt certificate, and the private key of the first asymmetric key is stored in the CA certification center.
[0053] The second encryption algorithm is a second asymmetric key autonomously generated by a chip in the contactless card storing the receipt certificate, and the second asymmetric key includes a public key and a private key.
[0054] The anti-tampering module 22 is used to generate a new digital signature using the second encryption algorithm when the receipt certificate is read by a contactless card reader. The new digital signature includes the newly added data content and the original receipt certificate content.
[0055] In one embodiment, when the receipt is read by a contactless card reader, the second encryption algorithm increases the number of automatic reads by one and generates a new digital signature, which is recorded as Sign2 = RSA (PUBK1, DATA1 + 1).
[0056] The transfer module 23 is used to verify the receipt voucher by using the first encryption algorithm when the receipt voucher is transmitted to other devices, and the first encryption algorithm includes a CA authentication algorithm.
[0057] The transfer module is specifically used to receive a third encryption algorithm transmitted by other devices when the receipt voucher is transmitted to the other devices, encrypt the receipt voucher using the third encryption algorithm, and then transmit the encrypted receipt voucher to the other devices.
[0058] like Figure 3 As shown, the present invention also provides an electronic device, comprising:
[0059] At least one processor; and at least one memory in communication with the processor, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the above-mentioned receipt voucher encryption method.
[0060] The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned receipt voucher encryption method is implemented.
[0061] It can be understood that computer-readable storage media may include: any entity or device capable of carrying a computer program, recording media, USB flash drives, mobile hard disks, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution media, etc. A computer program includes computer program code. The computer program code may be in source code form, object code form, executable file, or some intermediate form, etc. A computer-readable storage medium may include: any entity or device capable of carrying a computer program code, recording media, USB flash drives, mobile hard disks, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution media, etc.
[0062] In certain embodiments of the present invention, the device may include a controller, which is a single-chip microcomputer chip that integrates a processor, a memory, a communication module, etc. The processor may refer to the processor contained in the controller. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
[0063] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present invention belong.
[0064] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0065] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A receipt encryption method, It is characterized in that include: The receipt voucher is encrypted using a first encryption algorithm, and the receipt voucher is encrypted using a second encryption algorithm, wherein the first encryption algorithm is used to encrypt the content of the receipt voucher, and the second encryption algorithm is used to prevent the receipt voucher from being tampered with or reused; When the receipt is read by a contactless card reader, a new digital signature is generated using the second encryption algorithm, wherein the new digital signature includes the newly added data content and the original receipt content; When the receipt voucher is transmitted to another device, the receipt voucher is verified using the first encryption algorithm, wherein the first encryption algorithm includes a CA authentication algorithm; The step of encrypting the receipt voucher using the first encryption algorithm comprises: The first encryption algorithm is a first asymmetric key provided by a CA certification center, a public key of the first asymmetric key is stored in the contactless card storing the receipt certificate, and a private key of the first asymmetric key is stored in the CA certification center; The step of encrypting the receipt voucher using the second encryption algorithm comprises: A second asymmetric key is autonomously generated using a chip in the contactless card storing the receipt voucher, wherein the second asymmetric key includes a public key and a private key; When the receipt is read by a contactless card reader, a new digital signature is generated using the second encryption algorithm, including: When the receipt is read by a contactless card reader, the second encryption algorithm automatically increases the number of reads by one and generates a new digital signature; It also includes: when the receipt voucher is transmitted to other devices, receiving a third encryption algorithm transmitted by the other devices, encrypting the receipt voucher using the third encryption algorithm, and transmitting the encrypted receipt voucher to the other devices.
2. A receipt encryption device, It is characterized in that include: An encryption module, used to encrypt the receipt voucher using a first encryption algorithm and to encrypt the receipt voucher using a second encryption algorithm, wherein the first encryption algorithm is used to encrypt the content of the receipt voucher and the second encryption algorithm is used to prevent the receipt voucher from being tampered with or reused; an anti-tampering module, configured to generate a new digital signature using the second encryption algorithm when the receipt is read by a contactless card reader, wherein the new digital signature includes the newly added data content and the original receipt content; A transfer module, configured to verify the receipt voucher using the first encryption algorithm when the receipt voucher is transmitted to another device, wherein the first encryption algorithm includes a CA authentication algorithm; The step of encrypting the receipt voucher using the first encryption algorithm comprises: The first encryption algorithm is a first asymmetric key provided by a CA certification center, a public key of the first asymmetric key is stored in the contactless card storing the receipt certificate, and a private key of the first asymmetric key is stored in the CA certification center; The step of encrypting the receipt voucher using the second encryption algorithm comprises: A second asymmetric key is autonomously generated using a chip in the contactless card storing the receipt voucher, wherein the second asymmetric key includes a public key and a private key; When the receipt is read by a contactless card reader, a new digital signature is generated using the second encryption algorithm, including: When the receipt is read by a contactless card reader, the second encryption algorithm automatically increases the number of reads by one and generates a new digital signature; It also includes: when the receipt voucher is transmitted to other devices, receiving a third encryption algorithm transmitted by the other devices, encrypting the receipt voucher using the third encryption algorithm, and transmitting the encrypted receipt voucher to the other devices.
3. An electronic device, It is characterized in that include: at least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the receipt voucher encryption method as claimed in claim 1.
4. A computer-readable storage medium, It is characterized in that A computer program is stored thereon, and when the computer program is run by a computer, the receipt voucher encryption method as claimed in claim 1 is executed.
