CN106789075B - POS digital signature anti-cutting system - Google Patents

POS digital signature anti-cutting system Download PDF

Info

Publication number
CN106789075B
CN106789075B CN201611229082.2A CN201611229082A CN106789075B CN 106789075 B CN106789075 B CN 106789075B CN 201611229082 A CN201611229082 A CN 201611229082A CN 106789075 B CN106789075 B CN 106789075B
Authority
CN
China
Prior art keywords
signature
length
file
signed
algorithm
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611229082.2A
Other languages
Chinese (zh)
Other versions
CN106789075A (en
Inventor
代启超
卢建兴
刘福标
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aitiwell Electronic Technology (beijing) Co Ltd
Original Assignee
Aitiwell Electronic Technology (beijing) Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aitiwell Electronic Technology (beijing) Co Ltd filed Critical Aitiwell Electronic Technology (beijing) Co Ltd
Priority to CN201611229082.2A priority Critical patent/CN106789075B/en
Publication of CN106789075A publication Critical patent/CN106789075A/en
Application granted granted Critical
Publication of CN106789075B publication Critical patent/CN106789075B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • H04L9/3249Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures using RSA or related signature schemes, e.g. Rabin scheme
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0442Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply asymmetric encryption, i.e. different keys for encryption and decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0876Network architectures or network communication protocols for network security for authentication of entities based on the identity of the terminal or configuration, e.g. MAC address, hardware or software configuration or device fingerprint
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/126Applying verification of the received information the source of the received data

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Power Engineering (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses a POS digital signature anti-cutting system, and relates to the field of program devices. The system comprises: the POS machine operation system comprises a client, a server and a POS machine operation system, wherein the client is in communication connection with the server; the client is responsible for sending the program software code and the code executable file to the server, the server backups the code, signs the code executable file, and publishes the version of the program software to the POS machine operating system after the signed data is obtained; the server is responsible for signing the data sent by the client and returning the signed data to the client; and the POS machine operation system requests to download, install and operate the new version software when acquiring that the installed software is released by the new version, and utilizes a public key stored in the POS machine operation system to check the signature in the process of downloading, installing and operating the new version software. The invention ensures that the programs of different signed clients cannot be downloaded and run, and prevents violent cracking and illegal use of the users.

Description

POS digital signature anti-cutting system
Technical Field
The invention relates to the field of program devices, in particular to a POS digital signature anti-cutting system.
Background
At present, POS machines are widely popularized and applied to various industries, and bank card bill collecting business is used as a bill collecting link of bank card system operation and is also the most important component of a bank card acceptance environment. With the development of bank card business in recent years, particularly, the bank of people at the end of 11 years releases the bank card receipt restriction, third party payment license plates begin to be issued, and the receipt market is greatly developed. The POS distribution amount is high.
However, while the waybill market is developing vigorously, the extensive development and unordered competition also generate many problems and financial risks. Among them, the POS agent switches the POS program by itself, which is one of the most serious financial risks. The agent obtains POS equipment from an informal channel, automatically switches POS programs, and switches original normal and safe POS application into other unknown application to form transaction risk.
Thus, to stop such actions, financial risks are circumvented. The invention adopts a digital signature anti-cutting system to avoid the problems.
Disclosure of Invention
The invention aims to provide a POS digital signature anti-cutting system and a POS digital signature anti-cutting method, so as to solve the problems in the prior art.
In order to achieve the above object, the POS digital signature anti-cutting system of the present invention includes: the POS machine operation system comprises a client, a server and a POS machine operation system, wherein the client is in communication connection with the server;
the client is responsible for sending the program software code and the code executable file to the server, the server backs up the code, signs the code executable file, and publishes the version of the program software to the POS machine operating system after the signed data is obtained;
the server is responsible for signing the data sent by the client and returning the signed data to the client;
and the POS machine operation system requests to download, install and operate the new version software when acquiring that the installed software is released by the new version, and utilizes a public key stored in the POS machine operation system to check the signature in the process of downloading, installing and operating the new version software.
Preferably, the server signs the data sent by the client, specifically implemented according to the following steps:
s11, acquiring an original file F to be signed, determining a signature algorithm, and generating a data format I before the original file F to be signed is signed, wherein the data format I is 164 bytes and comprises an algorithm identifier, a public key ID, additional information and file information;
s12, judging whether the original file F to be signed includes the important data field D, if so, completing the signing of the important data field D, and entering S13; if not, randomly filling the hash value and the signature value of the important field in the signed file, setting the byte length of the important data field to be 0 in the signed file information, and then entering S13;
s13, calculating the hash value of the original file F to be signed by using a hash algorithm to obtain a hash (F) marked as H2
S14, filling random number R in the file information being signed2The Length of the padding is Length (S) -Length (I) -Length (H)2) Wherein, Length (H)2) Is composed ofThe length of the hash value of the original file F to be signed is byte unit;
s15, using private key to determine signature algorithm, for IH2|R2I0 xDC is signed to obtain the signature S of the original file F to be signedFThe 0xDC is a mark of signature end;
s16, obtaining the original file signature S to be signedFLength of bytes LSFAnd/or important data field signature LSDLength of bytes of, total length L of the acquired additional information fieldaAcquiring a signature packet mark E, wherein the mark E is a character string signed. VERSION01;
s17, forming a finished signed file, having the format: f | La|SD|SF|I|LSF|LSDI, | E; wherein the symbol | represents that the contents are connected in a byte stream;
the signature of the important data field D specifically includes:
a1, calculating the hash value of the important data field D, namely H1
A2, filling random number R in the file information being signed1Random number R1Is Length (S) -Length (I) -Length (H)1) Wherein, Length (S) is the byte unit Length of the signing key, Length (I) is the byte unit Length of the data format I before the original file F to be signed, and Length (H)1) The length of the hash value of the important data field D is byte unit;
a3, using a pre-customized private key to pair IH according to a determined signature algorithm1|R1I0 xDC is signed to obtain the signature S of the important data fieldDThe 0xDC is a flag of signature end.
Preferably, the POS operating system performs signature verification by using a public key stored in the POS operating system in the processes of downloading, installing, and operating a new version of software, and is specifically implemented according to the following steps:
s21, checking whether the information of the data file which is downloading or installing and running the new software version includes the signature package identification E, if so, downloading or installing and running the new software version as the signed file, and entering S22 to judge whether the signed file is valid; if not, downloading or installing and running the new version of software which is not the signed file, and prompting the prompt of unsuccessful downloading or failed installation and running;
s22, assuming that the format of the signature file to be verified is F' | La’|SD’|SF’|I’|LSF’|LSD’|E;
F' represents the original file corresponding to the signature file to be verified, La' indicates the total length of the additional information in the signature file to be verified, SD' signature representing important fields in a signature document to be verified, SF' denotes the signature of the original document corresponding to the signature document to be verified, I ' denotes the data format of F ', LSF' represents SF' byte length, LSD' represents SDThe length in bytes of the' is,
s23, checking whether the signature algorithm and the hash algorithm mark in I' are both 0x00, if so, the signature file to be verified is invalid; if not, go to S24;
s24, extracting an original file f and important data d according to the length of the original file and the length of the important data in the I' respectively; then, respectively calculating the hash values of the original file f and the important data d according to the algorithm marks in the I' to obtain HfAnd Hd
S25, according to LSF’、LSD' separate extraction of SD’、SF', at SD’、SFOn the basis, the public key is used for decrypting the signature data of the file to be verified to obtain a data format I before signature and a hash value H of the original file before signature2Hash value H of important data field of original file before signature1
S26, judging the plaintext I' in the decrypted I and the signature file to be verified, and the decrypted H2And HfDecrypting the obtained H1And HdIf the two are consistent, the signature of the signature file needs to be verified to pass the verification; if not, the signature verification of the signature file needs to be verified to fail.
Preferably, step S21 is followed by: verifying the total length L of the additional information in the signature file to be verifieda' Total length L of additional information in a signed file signed with original file F decrypted by public keyaWhether they are consistent.
Preferably, the algorithm type and the corresponding key length used by the server for the data signature sent by the client are as follows:
the algorithm DES, the corresponding key length is 168 bits;
the algorithm RSA, the corresponding key length is 2048bits, 3072bits, 4096 bits;
the corresponding key length of the algorithm ECC is 224bits, 256bits, 384bits and 512 bits;
the corresponding key length of the AES algorithm is 2048bits and 3072 bits;
the algorithm SM2 corresponds to a key length of 256 bits.
Preferably, the public key ID is expressed by a 16-byte hexadecimal number.
More preferably, the additional information includes signature company information data, signer name data, signature time; the signature time is a fixed 8-byte BCD code accurate to seconds, with the last byte representing the week.
More preferably, the representation of the algorithm identification is as follows:
when the algorithm mark is 0x0000, the mirror image is not signed, and the subsequent fields except the signature packet mark field are invalid data;
the algorithm identifier 0x00 represents no signature, the algorithm identifier 0x0N represents the same algorithm with different key lengths, and N is a positive integer.
Preferably, when the server side performs original file signature according to an application private key customized by a client in advance, the POS digital signature anti-cutting machine system comprises a firmware key pair, an initial key pair and an application key pair;
the public key of the firmware public and private keys is used for signing the firmware and important data in the firmware, and the public key is used for verifying the signature of the firmware and the important data in the firmware;
signing a public key in the application public and private key pair by using a private key in the initial public and private key pair, obtaining a public key in the application public and private key pair after the public key in the initial public and private key pair in the POS machine system is signed, and covering the public key in the application public and private key pair with the public key in the initial public and private key pair;
and the application public and private key pair is at least simultaneously stored in 2 pairs and used for verifying the signature of a private key signature program in the application public and private key pair.
The invention has the beneficial effects that:
1. the method is carried out in a one-to-one mode, in the signing process, a public and private key pair for encryption and decryption is customized for each client, and it is guaranteed that programs of different signed clients cannot be downloaded and run.
2. The algorithm adopts asymmetric and mainstream algorithms, can not be cracked basically, and can prevent violent cracking and illegal use of users.
3. The scheme of network backup is adopted for application and approval, and effective management and control can be achieved.
Drawings
Fig. 1 is a schematic flowchart of a server-side signing a data sent by a client;
FIG. 2 is a schematic flow chart of a signature of a significant data field D;
fig. 3 is a schematic flow chart of the process of verifying the signature by using the public key stored in the POS operating system in the process of downloading, installing and operating the new software version by the POS operating system.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
Examples
The POS digital signature system of preventing cutting machine in this embodiment includes: the POS machine operation system comprises a client, a server and a POS machine operation system, wherein the client is in communication connection with the server;
the client is responsible for sending the program software code and the code executable file to the server, the server backs up the code, signs the code executable file, and publishes the version of the program software to the POS machine operating system after the signed data is obtained;
the server is responsible for signing the data sent by the client and returning the signed data to the client;
and the POS machine operation system requests to download, install and operate the new version software when acquiring that the installed software is released by the new version, and utilizes a public key stored in the POS machine operation system to check the signature in the process of downloading, installing and operating the new version software.
The more detailed explanation is:
referring to fig. 1, the server signs a data signature sent by a client, specifically implemented according to the following steps:
s11, acquiring an original file F to be signed, determining a signature algorithm, and generating a data format I before the original file F to be signed is signed, wherein the data format I is 164 bytes and comprises an algorithm identifier, a public key ID, additional information and file information;
s12, judging whether the original file F to be signed includes the important data field D, if so, completing the signing of the important data field D, and entering S13; if not, randomly filling the hash value and the signature value of the important field in the signed file, setting the byte length of the important data field to be 0 in the signed file information, and then entering S13;
s13, calculating the hash value of the original file F to be signed by using a hash algorithm to obtain a hash (F) marked as H2
S14, filling random number R in the file information being signed2The Length of the padding is Length (S) -Length (I) -Length (H)2) Wherein, Length (H)2) The length of the hash value of the original file F to be signed is byte unit length;
s15, using private key to determine signature algorithm, for IH2|R2I0 xDC is signed to obtain the signature S of the original file F to be signedFThe 0xDC is a mark of signature end;
s16, obtaining the original file signature S to be signedFLength of bytes LSFAnd/or important data field signature LSDLength of bytes of, total length L of the acquired additional information fieldaAcquiring a signature packet mark E, wherein the mark E is a character string signed. VERSION01;
s17, forming a finished signed file, having the format: f | La|SD|SF|I|LSF|LSDI, | E; wherein the symbol | represents that the contents are connected in a byte stream;
referring to fig. 2, the signature of the important data field D specifically includes:
a1, calculating the hash value of the important data field D, namely H1
A2, filling random number R in the file information being signed1Random number R1Is Length (S) -Length (I) -Length (H)1) Wherein, Length (S) is the byte unit Length of the signing key, Length (I) is the byte unit Length of the data format I before the original file F to be signed, and Length (H)1) The length of the hash value of the important data field D is byte unit;
a3, using a pre-customized private key to pair IH according to a determined signature algorithm1|R1I0 xDC is signed to obtain the signature S of the important data fieldDThe 0xDC is a flag of signature end.
Wherein
(1) The algorithm type and the corresponding key length used by the server for the data signature sent by the client are as follows:
the algorithm DES, the corresponding key length is 168 bits;
the algorithm RSA, the corresponding key length is 2048bits, 3072bits, 4096 bits;
the corresponding key length of the algorithm ECC is 224bits, 256bits, 384bits and 512 bits;
the corresponding key length of the AES algorithm is 2048bits and 3072 bits;
the algorithm SM2 corresponds to a key length of 256 bits.
(2) The expression of the algorithm identification is as follows: when the algorithm mark is 0x0000, the mirror image is not signed, and the subsequent fields except the signature packet mark field are invalid data; the algorithm identifier 0x00 represents no signature, the algorithm identifier 0x0N represents the same algorithm with different key lengths, and N is a positive integer. Examples are given in Table 1:
table 1 shows the algorithm identifiers of two different algorithms and their corresponding meanings
(3) Additional information is an effective means for developer traceability. There is no specific meaning for signature verification of the device. The additional information comprises signature company information data, signer name data and signature time;
the signature company information data is represented by ASCII characters, and the others are filled with 0.
The signer name data is represented by ASCII characters, and others are filled with 0.
The signature time is a fixed 8-byte BCD code, YYYYMMDDHHMMSSWW, accurate to seconds, with the last byte representing the week.
(4) The public key ID is represented by a 16-byte hexadecimal number.
(5) The random number is filled with a random number generated from the outside, so that the signature results of the same firmware image are prevented from being consistent.
(6) The signature data indicates that the hash/hash value of the domain participating in the signature is signed, resulting in a signature result. The effective data length is determined by a signature algorithm and a hash algorithm, and is 2 times of the key length or the key length.
(7) The signature pack identification indicates that the binary file contains the signature pack. If the binary file does not have a signature envelope identification, it is understood that the file is not a valid signed firmware file.
(8) The plaintext key structure used by the server side is as shown in table 2:
table 2 clear text key structure used by server side
Referring to fig. 3, the POS operating system performs signature verification by using a public key stored in the POS operating system in the processes of downloading, installing, and operating a new version of software, and is specifically implemented according to the following steps:
s21, checking whether the information of the data file which is downloading or installing and running the new software version includes the signature package identification E, if so, downloading or installing and running the new software version as the signed file, and entering S22 to judge whether the signed file is valid; if not, downloading or installing and running the new version of software which is not the signed file, and prompting the prompt of unsuccessful downloading or failed installation and running;
s22, assuming that the format of the signature file to be verified is F' | La’|SD’|SF’|I’|LSF’|LSD’|E;
F' represents the original file corresponding to the signature file to be verified, La' indicates the total length of the additional information in the signature file to be verified, SD' signature representing important fields in a signature document to be verified, SF' denotes the signature of the original document corresponding to the signature document to be verified, I ' denotes the data format of F ', LSF' represents SF' byte length, LSD' represents SDThe length in bytes of the' is,
s23, checking whether the signature algorithm and the hash algorithm mark in I' are both 0x00, if so, the signature file to be verified is invalid; if not, go to S24;
s24, extracting an original file f and important data d according to the length of the original file and the length of the important data in the I' respectively; then, respectively calculating the hash values of the original file f and the important data d according to the algorithm marks in the I' to obtain HfAnd Hd
S25, according to LSF’、LSD' separate extraction of SD’、SF', at SD’、SFBased on' the public key is used for decrypting the signature text needing to be verifiedThe signature data of the file obtains a data format I before signature and a hash value H of an original file before signature2Hash value H of important data field of original file before signature1
S26, judging the plaintext I' in the decrypted I and the signature file to be verified, and the decrypted H2And HfDecrypting the obtained H1And HdIf the two are consistent, the signature of the signature file needs to be verified to pass the verification; if not, the signature verification of the signature file needs to be verified to fail.
Step S21 is followed by: verifying the total length L of the additional information in the signature file to be verifieda' Total length L of additional information in a signed file signed with original file F decrypted by public keyaWhether they are consistent.
(III) whether the server side signs the original file by using a pre-customized private key
(1) When the server uses a private key in the initial key pair to sign an original file, the POS digital signature anti-cutting machine system comprises a firmware key pair and an initial signature verification key pair;
the private key in the firmware secret key is used for signing the firmware and the important data in the fixed part, and the public key is used for verifying the signature of the firmware and the important data in the firmware;
and signing the data sent by the client by using the private key in the initial signature verification key pair, wherein the public key in the initial signature verification key pair is stored in the POS machine operating system and is used for verifying the data of the signature and the release edition.
(2) When the server side carries out original file signature according to an application private key customized by a client in advance, the POS digital signature anti-cutting machine system comprises a firmware key pair, an initial key pair and an application key pair;
the public key of the firmware public and private keys is used for signing the firmware and important data in the firmware, and the public key is used for verifying the signature of the firmware and the important data in the firmware;
signing a public key in the application public and private key pair by using a private key in the initial public and private key pair, obtaining a public key in the application public and private key pair after the public key in the initial public and private key pair in the POS machine system is signed, and covering the public key in the application public and private key pair with the public key in the initial public and private key pair;
and the application public and private key pair is at least simultaneously stored in 2 pairs and used for verifying the signature of a private key signature program in the application public and private key pair.
Wherein, the key generation and management: and the management tool running at the PC end interacts with the U-Key through the USB.
The functions of the management tool include: the generation of RSA key pairs is supported, and the strength of the supported keys is 1024bits and 2048 bits; supporting a ciphertext derived private key, wherein the derived private key needs to be protected by a key consisting of two components, and the key strength is at least equal to 192bit 3 DES; the import of a cipher text private key is supported; the generated private Key or the private Key imported by the ciphertext can be downloaded into the U-Key; the public key may be derived in the clear.
The functions of the U-Key include: the RSA private key is guided in through a programming interface, and the strength of the key is 1024bits and 2048 bits; the private key is stored safely, and cannot be exported; for convenience of management and distribution, each physical U-Key only stores one private Key, and the U-Key storing the corresponding private Key needs to be used according to different types of signature files.
The function of the signature tool: supporting the signature of the firmware, the application, the firmware public key, the application public key verification public key and the application public key; the first stage supports only RSA 2048+ SHA 512.
Comparing the data format of the signature packet before signature with the data format of the signature packet after signature in the form of table 3 and table 4:
expression 3 is a Pre-signature Package Structure
Where the other fields are set by the signature tool, except that the original file content is generated by the compilation tool.
Table 4 is the post-signature packet structure
By adopting the technical scheme disclosed by the invention, the following beneficial effects are obtained:
1. the method is carried out in a one-to-one mode, in the signing process, a public and private key pair for encryption and decryption is customized for each client, and it is guaranteed that programs of different signed clients cannot be downloaded and run.
2. The algorithm adopts asymmetric and mainstream algorithms, can not be cracked basically, and can prevent violent cracking and illegal use of users.
3. The scheme of network backup is adopted for application and approval, and effective management and control can be achieved.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements should also be considered within the scope of the present invention.

Claims (8)

1. A POS digital signature cut-off prevention system, the system comprising: the POS machine operation system comprises a client, a server and a POS machine operation system, wherein the client is in communication connection with the server;
the client is responsible for sending the program software code and the code executable file to the server, the server backs up the code, signs the code executable file, and publishes the version of the program software to the POS machine operating system after the signed data is obtained;
the server is responsible for signing the data sent by the client and returning the signed data to the client;
the POS machine operation system requests to download, install and operate the new version software when acquiring that the installed software is released by the new version, and utilizes a public key stored in the POS machine operation system to check the signature in the process of downloading, installing and operating the new version software;
the server side signs the data sent by the client side, and the method is specifically realized according to the following steps:
s11, acquiring an original file F to be signed, determining a signature algorithm, and generating a data format I before the original file F to be signed is signed, wherein the data format I is 164 bytes and comprises an algorithm identifier, a public key ID, additional information and file information;
s12, judging whether the original file F to be signed includes the important data field D, if so, completing the signing of the important data field D, and entering S13; if not, randomly filling the hash value and the signature value of the important field in the signed file, setting the byte length of the important data field to be 0 in the signed file information, and then entering S13;
s13, calculating the hash value of the original file F to be signed by using a hash algorithm to obtain a hash (F) marked as H2
S14, filling random number R in the file information being signed2The Length of the padding is Length (S) -Length (I) -Length (H)2) Wherein, Length (H)2) The length of the hash value of the original file F to be signed is byte unit length;
s15, using private key to determine signature algorithm, for IH2|R2I0 xDC is signed to obtain the signature S of the original file F to be signedFThe 0xDC is a mark of signature end;
s16, obtaining the original file signature S to be signedFLength of bytes LSFAnd/or important data field signature LSDLength of bytes of, total length L of the acquired additional information fieldaAcquiring a signature packet mark E, wherein the mark E is a character string signed. VERSION01;
s17, forming the finished signatureA file, having a format of: f | La|SD|SF|I|LSF|LSDI, | E; wherein the symbol | represents that the contents are connected in a byte stream;
the signature of the important data field D specifically includes:
a1, calculating the hash value of the important data field D, namely H1
A2, filling random number R in the file information being signed1Random number R1Is Length (S) -Length (I) -Length (H)1) Wherein, Length (S) is the byte unit Length of the signing key, Length (I) is the byte unit Length of the data format I before the original file F to be signed, and Length (H)1) The length of the hash value of the important data field D is byte unit;
a3, using a pre-customized private key to pair IH according to a determined signature algorithm1|R1I0 xDC is signed to obtain the signature S of the important data fieldDThe 0xDC is a flag of signature end.
2. The POS digital signature anti-cutting machine system according to claim 1, wherein the POS machine operation system uses a public key stored in the POS machine operation system to perform signature verification in the processes of downloading, installing and operating a new version of software, and the signature verification is specifically realized according to the following steps:
s21, checking whether the information of the data file which is downloading or installing and running the new software version includes the signature package identification E, if so, downloading or installing and running the new software version as the signed file, and entering S22 to judge whether the signed file is valid; if not, downloading or installing and running the new version of software which is not the signed file, and prompting the prompt of unsuccessful downloading or failed installation and running;
s22, assuming that the format of the signature file to be verified is F' | La’|SD’|SF’|I’|LSF’|LSD’|E;
F' represents the original file corresponding to the signature file to be verified, La' indicates the total length of the additional information in the signature file to be verified, SD' meansThe signature of important fields in the signature file needs to be verified, SF' denotes the signature of the original document corresponding to the signature document to be verified, I ' denotes the data format of F ', LSF' represents SF' byte length, LSD' represents SDThe length in bytes of the' is,
s23, checking whether the signature algorithm and the hash algorithm mark in I' are both 0x00, if so, the signature file to be verified is invalid; if not, go to S24;
s24, extracting an original file f and important data d according to the length of the original file and the length of the important data in the I' respectively; then, respectively calculating the hash values of the original file f and the important data d according to the algorithm marks in the I' to obtain HfAnd Hd
S25, according to LSF’、LSD' separate extraction of SD’、SF', at SD’、SFOn the basis, the public key is used for decrypting the signature data of the file to be verified to obtain a data format I before signature and a hash value H of the original file before signature2Hash value H of important data field of original file before signature1
S26, judging the plaintext I' in the decrypted I and the signature file to be verified, and the decrypted H2And HfDecrypting the obtained H1And HdIf the two are consistent, the signature of the signature file needs to be verified to pass the verification; if not, the signature verification of the signature file needs to be verified to fail.
3. The POS digital signature anti-skimming system according to claim 2, wherein the step S21 is followed by further comprising: verifying the total length L of the additional information in the signature file to be verifieda' Total length L of additional information in a signed file signed with original file F decrypted by public keyaWhether they are consistent.
4. The POS digital signature anti-cutting system according to claim 1, wherein the algorithm type and the corresponding key length used by the server for signing the data sent by the client are as follows:
the algorithm DES, the corresponding key length is 168 bits;
the algorithm RSA, the corresponding key length is 2048bits, 3072bits, 4096 bits;
the corresponding key length of the algorithm ECC is 224bits, 256bits, 384bits and 512 bits;
the corresponding key length of the AES algorithm is 2048bits and 3072 bits;
the algorithm SM2 corresponds to a key length of 256 bits.
5. The POS digital signature anti-skimming system of claim 1, wherein the public key ID is represented by a 16 byte hexadecimal number.
6. The POS digital signature anti-skimming system of claim 1, wherein the additional information comprises signature company information data, signer name data, signature time; the signature time is a fixed 8-byte BCD code accurate to seconds, with the last byte representing the week.
7. The POS digital signature tripping-prevention system according to claim 1, wherein the representation form of the algorithm identification is as follows:
when the algorithm mark is 0x0000, the subsequent domain except the signature packet mark domain is invalid data;
the algorithm identifier 0x00 represents no signature, the algorithm identifier 0x0N represents the same algorithm with different key lengths, and N is a positive integer.
8. The POS digital signature anti-cutting system according to claim 1, wherein when the server side performs original file signature according to an application private key customized by a customer in advance, the POS digital signature anti-cutting system comprises a firmware key pair, an initial key pair and an application key pair;
the public key of the firmware public and private keys is used for signing the firmware and important data in the firmware, and the public key is used for verifying the signature of the firmware and the important data in the firmware;
signing a public key in the application public and private key pair by using a private key in the initial public and private key pair, obtaining a public key in the application public and private key pair after the public key in the initial public and private key pair in the POS machine system is signed, and covering the public key in the application public and private key pair with the public key in the initial public and private key pair;
and the application public and private key pair is at least simultaneously stored in 2 pairs and used for verifying the signature of a private key signature program in the application public and private key pair.
CN201611229082.2A 2016-12-27 2016-12-27 POS digital signature anti-cutting system Active CN106789075B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611229082.2A CN106789075B (en) 2016-12-27 2016-12-27 POS digital signature anti-cutting system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611229082.2A CN106789075B (en) 2016-12-27 2016-12-27 POS digital signature anti-cutting system

Publications (2)

Publication Number Publication Date
CN106789075A CN106789075A (en) 2017-05-31
CN106789075B true CN106789075B (en) 2019-12-24

Family

ID=58922813

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611229082.2A Active CN106789075B (en) 2016-12-27 2016-12-27 POS digital signature anti-cutting system

Country Status (1)

Country Link
CN (1) CN106789075B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108306970A (en) * 2018-02-02 2018-07-20 浙江德景电子科技有限公司 A kind of download of firmware safety and calibration equipment and method based on safety chip
CN108875382B (en) * 2018-05-24 2022-05-10 深圳鼎智通讯股份有限公司 Protection method for permanent anti-cutting machine of intelligent POS terminal
CN109326061B (en) * 2018-09-10 2021-10-26 惠尔丰(中国)信息系统有限公司 Anti-cutting method of intelligent POS
CN109816389B (en) * 2018-12-03 2021-09-21 深圳市新国都支付技术有限公司 POS machine signature verification method and system
CN109671229B (en) * 2019-01-31 2022-01-25 环旭(深圳)电子科创有限公司 Cash register and safety verification method thereof
CN111106929B (en) * 2019-12-09 2023-04-18 上海创能国瑞数据系统有限公司 Hash-based approval method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101631022A (en) * 2009-08-04 2010-01-20 北京飞天诚信科技有限公司 Signing method and system thereof
CN102081821A (en) * 2009-11-27 2011-06-01 中国银联股份有限公司 IC (integrated circuit) card paying system and method as well as multi-application IC card and payment terminal
CN102236766A (en) * 2011-05-10 2011-11-09 桂林电子科技大学 Security data item level database encryption system
CN104063756A (en) * 2014-05-23 2014-09-24 国网辽宁省电力有限公司本溪供电公司 Electric power utilization information remote control system
CN106155663A (en) * 2015-04-15 2016-11-23 中兴通讯股份有限公司 The method and apparatus of application program loading code signature

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101631022A (en) * 2009-08-04 2010-01-20 北京飞天诚信科技有限公司 Signing method and system thereof
CN102081821A (en) * 2009-11-27 2011-06-01 中国银联股份有限公司 IC (integrated circuit) card paying system and method as well as multi-application IC card and payment terminal
CN102236766A (en) * 2011-05-10 2011-11-09 桂林电子科技大学 Security data item level database encryption system
CN104063756A (en) * 2014-05-23 2014-09-24 国网辽宁省电力有限公司本溪供电公司 Electric power utilization information remote control system
CN106155663A (en) * 2015-04-15 2016-11-23 中兴通讯股份有限公司 The method and apparatus of application program loading code signature

Also Published As

Publication number Publication date
CN106789075A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN106789075B (en) POS digital signature anti-cutting system
CN108780548B (en) Using elliptic curve cryptography for personal device security to share secrets
US9824353B2 (en) Key protection method and system
WO2021012552A1 (en) Login processing method and related device
CN110401615B (en) Identity authentication method, device, equipment, system and readable storage medium
JP2016515235A5 (en)
WO2015161683A1 (en) Unified apk signing method and system thereof
WO2015161682A1 (en) Multi-party authorized apk signing method and system
CN103095456A (en) Method and system for processing transaction messages
CN113128999B (en) Block chain privacy protection method and device
CN105227680A (en) A kind of smart machine file download Validity control method
CN103078742A (en) Generation method and system of digital certificate
CN110190950B (en) Method and device for realizing security signature
WO2017066995A1 (en) Method and device for preventing unauthorized access to server
CN103825724A (en) Identification type password system and method for updating and recovering private key automatically
CN111130798A (en) Request authentication method and related equipment
KR101253683B1 (en) Digital Signing System and Method Using Chained Hash
CN112560017A (en) Method for realizing APK unified signature by using three-level certificate authentication
CN111241492A (en) Product multi-tenant secure credit granting method, system and electronic equipment
CN114726536A (en) Timestamp generation method and device, electronic equipment and storage medium
TW396327B (en) Distribution system with authentication
CN101808100B (en) Method and system for solving replay of remote update of information safety device
CN117436043A (en) Method and device for verifying source of file to be executed and readable storage medium
CN108052836B (en) Anti-tampering method and device for patch package and server
CN113221074B (en) Offline authorization method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant