Secret key filling method and system based on serial communication

By adopting the key filling method and system based on serial port communication in the POS machine, the problem of poor security of key filling in the existing technology is solved, and higher security and information confidentiality are achieved.

CN119316141APending Publication Date: 2025-01-14无锡宇宁科技集团股份有限公司

Patent Information

Application Number
CN202411840171.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

The existing POS key filling methods are in the form of wifi, Bluetooth and NFC, which are poorly secure and easily leak information.

Method used

Adopt a key filling method and system based on serial port communication, and use serial port communication through special equipment to achieve key filling to ensure the security of the connection status and data transmission.

Benefits of technology

It improves the security of key filling, reduces the risk of information leakage, and ensures the confidentiality of keys during transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316141A_ABST
    Figure CN119316141A_ABST
Patent Text Reader

Abstract

The invention relates to a secret key filling method and system based on serial port communication. The method comprises the steps that a connection request is sent to a filled terminal in a serial port communication mode or the received connection request sent based on the serial port communication mode is responded, and the connection state is determined; when the connection state is connected, communication related parameters are sent to the filled terminal; and sending the secret key filling data to the filled terminal or sending the secret key filling data to the filled terminal in response to a request of the filled terminal, and stopping sending the secret key filling data after a filling success result sent by the filled terminal is received. According to the secret key filling method and system based on serial port communication, secret key filling is achieved in a serial port communication mode through special equipment, information is not prone to being leaked, and safety is higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of confidential communication technology, and in particular to a key filling method and system based on serial communication. Background Art

[0002] Key loading or key injection refers to the process of transferring key data from one device (such as a key server or key generation device) to another device (such as an encryption device, security chip or security module). This process needs to ensure the security and confidentiality of the key during transmission to prevent the key from being obtained by unauthorized parties.

[0003] The key filling of POS machines is mostly done through WiFi, Bluetooth, NFC and other forms. These forms of key filling are prone to information leakage and have poor security, mainly because the sent information may be intercepted and additional information may be inserted into the sent information during the filling process. Summary of the invention

[0004] The present application provides a key filling method and system based on serial port communication, which uses dedicated equipment to implement key filling through serial port communication, is less likely to leak information, and has higher security.

[0005] The above-mentioned purpose of the present application is achieved through the following technical solutions: In a first aspect, the present application provides a key filling method based on serial communication, comprising: Sending a connection request to the terminal being filled using a serial communication method or responding to a received connection request sent based on the serial communication method and determining a connection status; When the connection state is connected, communication related parameters are sent to the filled terminal; Sending key filling data to the terminal being filled or sending key filling data to the terminal being filled in response to a request from the terminal being filled; After receiving the filling success result sent by the filled terminal, stop sending the secret key filling data; Among them, when receiving the key filling data, it also includes: The length of the buffer is used as the data length; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The key filling data is continuously sent before the filling success result sent by the filling terminal is received.

[0006] In a possible implementation manner of the first aspect, when determining the connection state, it is simultaneously determined that all communication ports of the filled terminal except the communication port associated with the serial communication mode are shielded.

[0007] In a possible implementation manner of the first aspect, generating key filling data to be sent to the filled terminal includes: Create a byte buffer; Filling the byte buffer with content, including an identifier, a version number of the protocol or data format used, a sequence number, an execution command or operation identifier, a length, and actual carried data into the byte buffer; Generates a checksum using the padding content and places the checksum into the byte buffer.

[0008] In a possible implementation manner of the first aspect, receiving the key filling data includes: Create a temporary memory area and determine the data length; intercepting the received key filling data in the buffer area according to the data length and putting the intercepted key filling data into the temporary memory area; Splice the temporary memory area and the buffer and intercept the received key filling data in the cache area and put it into the buffer; The length of the buffer is used as the data length; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The identifier, the version number of the used protocol or data format, the sequence number, the execution command or operation identifier, the length, and the actual carried data are sequentially taken out from the byte buffer and put into the byte buffer.

[0009] In a possible implementation manner of the first aspect, when the identifier cannot be retrieved, the method further includes: Reduce data length; Using the reduced data length to trim the key filling data intercepted and received in the buffer area and placing the trimmed key filling data intercepted and received in the buffer area into the byte buffer; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; Get the identifier from the byte buffer; When the version number or serial number of the protocol or data format used cannot be retrieved, the same method is used for processing; The identifier, the version number of the protocol or data format used, and the sequence number need to be retrieved in sequence.

[0010] In a possible implementation of the first aspect, after the sequence number is taken out, the execution command or operation identifier, the length, and the actually carried data are taken out in sequence; Also includes: The sum of the actual carried data and the set value is taken as the total data length; When the total length of the data is greater than the data length, the reception of the key-filled data is terminated. When the total length of the data is less than or equal to the data length, the check code is taken out from the byte buffer and checked.

[0011] In a possible implementation manner of the first aspect, the method further includes: Use the execution command or operation identifier, length and actual carried data to perform key filling of the terminal being filled; Intercept the data length value data from the buffer starting from the data total length value position and assign the data to the buffer; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The identifier, the version number of the used protocol or data format, the sequence number, the execution command or operation identifier, the length, and the actual carried data are sequentially taken out from the byte buffer and put into the byte buffer.

[0012] In a second aspect, the present application provides a key filling device based on serial communication, comprising: A first communication unit, used to send a connection request to the terminal being filled using a serial communication method or respond to a received connection request sent based on the serial communication method and determine a connection state; A second communication unit, used for sending communication related parameters to the filled terminal when the connection state is connected; A third communication unit, used to send the key filling data to the filled terminal or send the key filling data to the filled terminal in response to a request of the filled terminal; The fourth communication unit is used to stop sending the secret key filling data after receiving the filling success result sent by the filling terminal; Among them, when receiving the key filling data, it also includes: The length of the buffer is used as the data length; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The key filling data is continuously sent before the filling success result sent by the filling terminal is received.

[0013] In a third aspect, the present application provides a key filling system based on serial communication, the system comprising: one or more memories for storing instructions; and One or more processors, used to call and run the instructions from the memory to execute the method as described in the first aspect and any possible implementation of the first aspect.

[0014] In a fourth aspect, the present application provides a computer-readable storage medium, the computer-readable storage medium comprising: Program, when the program is executed by a processor, the method described in the first aspect and any possible implementation of the first aspect is executed.

[0015] In a fifth aspect, the present application provides a computer program product, comprising program instructions. When the program instructions are executed by a computing device, the method described in the first aspect and any possible implementation of the first aspect is executed.

[0016] In a sixth aspect, the present application provides a chip system, which includes a processor for implementing the functions involved in the above aspects, for example, generating, receiving, sending, or processing the data and / or information involved in the above methods.

[0017] The chip system may be composed of chips, or may include chips and other discrete devices.

[0018] In a possible design, the chip system also includes a memory, which is used to store necessary program instructions and data. The processor and the memory can be decoupled and respectively set on different devices, connected by wired or wireless means, or the processor and the memory can also be coupled on the same device.

[0019] The beneficial effects of this application are: The serial communication-based key filling method and system provided in the present application use dedicated communication equipment and serial communication to implement key filling between two device terminals, which is not easy to leak information and has higher security. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a schematic block diagram of the steps of a key filling method based on serial communication provided by the present application.

[0021] Figure 2 It is a schematic diagram of related hardware provided by this application.

[0022] Figure 3 This is a schematic diagram of a connection establishment request provided by the present application.

[0023] Figure 4 This is another schematic diagram of establishing a connection request provided by the present application.

[0024] Figure 5 It is a schematic diagram of sending communication related parameters provided by this application.

[0025] Figure 6 This is a schematic diagram of sending secret key filling data provided by this application. DETAILED DESCRIPTION

[0026] In order to more clearly understand the technical solution in this application, the relevant contents are first introduced.

[0027] The specific steps of key filling are: Device preparation: First, you need to ensure that the target device (such as encryption device, security chip, etc.) is in normal condition and ready to receive the key.

[0028] Key generation and acquisition: Generate or obtain unique keys that match the device as needed. These keys may be generated by a key server, key generation device, or a dedicated key management system.

[0029] Key transport: The key is transferred from the source device to the target device using a secure communication channel. This usually involves encrypted communication protocols and authentication mechanisms to ensure that the key is not intercepted or tampered with during transmission.

[0030] Key verification and testing: After the key is successfully transferred to the target device, verification and testing are required to ensure the correctness and validity of the key. This may include checking the match between the key and the device, confirming whether the encryption and decryption functions are normal, etc.

[0031] Logging and Auditing: The entire process of key filling is recorded, including the steps of key generation, transmission, verification and testing. This helps with subsequent auditing and troubleshooting.

[0032] Security measures for key filling: Use secure communication protocols: Use encrypted communication protocols (such as HTTPS, TLS, etc.) during key transmission to ensure data security and confidentiality.

[0033] Implement strict access control: Implement strict access control on key servers, key generation devices, and target devices to prevent unauthorized access and operations.

[0034] Update keys regularly: Update keys regularly to reduce the risk of key compromise and ensure the continued security of the encryption system.

[0035] Conduct security audits and monitoring: Regularly conduct security audits and monitoring of the key filling process to identify and resolve potential security issues.

[0036] The technical solution in this application is further described in detail below in conjunction with the accompanying drawings.

[0037] This application discloses a key filling method based on serial communication, please refer to Figure 1 In some examples, the key filling method based on serial communication disclosed in this application includes the following steps: S101, sending a connection request to a terminal to be filled using a serial communication method or responding to a received connection request sent based on the serial communication method and determining a connection status; S102, sending communication related parameters to the filled terminal when the connection state is connected; S103, sending the key filling data to the terminal being filled or sending the key filling data to the terminal being filled in response to a request from the terminal being filled; S104, after receiving the filling success result sent by the filling terminal, stop sending the secret key filling data.

[0038] The key filling method based on serial communication disclosed in this application is applied to the key filling of POS machines. Both the parent POS machine and the child POS machine use the Android system. The parent POS machine fills the key to the child POS machine. Please refer to Figure 2 , the data communication between the master POS machine and the slave POS machine is completed using a serial data cable.

[0039] In some possible implementations, the serial port data cable uses a USB-to-serial port data cable made based on chip ch343.

[0040] In the following content, the parent POS machine is called the filling terminal and the child POS machine is called the filled terminal.

[0041] In step S101, refer to Figure 3 and Figure 4 First, a connection request is sent to the filled terminal using the serial communication method, or a connection request received based on the serial communication method is responded to and the connection status is determined. The connection request here refers to a request by the filling terminal to communicate data with the filled terminal (a connection request is sent to the filled terminal using the serial communication method), or a request by the filled terminal to communicate data with the filling terminal (a connection request received based on the serial communication method is responded to).

[0042] Before executing step S101, the filling terminal is first connected to the terminal to be filled using a serial port data cable.

[0043] Next, confirm the connection status, which can be either connected or not connected.

[0044] When the connection status is connected, the communication related parameters are sent to the terminal being filled. Figure 5 As shown, both the filling terminal and the filled terminal can confirm the connection status, and when one of them confirms, it needs to inform the other party.

[0045] In step S103, refer to Figure 6 The filling terminal sends the key filling data to the filled terminal or sends the key filling data to the filled terminal in response to the request of the filled terminal. When receiving the filling success result sent by the filled terminal, it stops sending the key filling data, which is the content in step S104.

[0046] In some examples, when determining the connection status, it is also determined that all communication ports of the terminal being filled, except for the communication port associated with the serial communication method, are blocked, in order to ensure the security of the filling process. Specific implementation methods include using OkHttp interceptor, using VPN or proxy server, and using system permissions and tools. This part of the content is prior art and will not be repeated here.

[0047] The relevant content about serial communication is as follows: Transmission method: Serial communication uses serial communication protocol to transmit data through a data line. At the sending end, the data is converted into electrical signals one bit at a time, and then sent to the receiving end through the data line. At the receiving end, the electrical signals are restored to the original data one bit at a time.

[0048] Data format: Each communication unit (one cycle) usually includes a start bit (1 bit), data bits (8 bits), a parity bit (optional, 1 bit) and a stop bit (1 bit). The start bit marks the beginning of the data, the data bit contains the information to be transmitted, the parity bit is used to detect data errors, and the stop bit marks the end of the data.

[0049] Communication mode: Serial communication can be simplex, half-duplex or full-duplex mode. Simplex mode data can only be transmitted in one direction; half-duplex mode data can be transmitted in both directions, but not at the same time; full-duplex mode allows data to be transmitted in both directions at the same time.

[0050] From the above content, we can see that when performing serial communication, it is necessary to first send communication related parameters so that the terminal being filled and the filling terminal use the same parameters to complete the data sending and receiving work.

[0051] The specific method of generating the key filling data to be sent to the filled terminal is as follows: Create a byte buffer; Fill the byte buffer with content, including an identifier, a version number of the protocol or data format used, a sequence number, an execution command or operation identifier, a length, and actual carried data into the byte buffer; Generates a checksum using the padding content and places the checksum into the byte buffer.

[0052] The specific method of generating the key filling data sent to the filled terminal is described in professional terms as follows: 1. Enter command, seq, and payload. 2, short len ​​= payload.length; 3. Create a new ByteBuffer of size len + 13; 4. Put MAGIC into ByteBuffer; 5. Put VERSION into ByteBuffer; 6. Put seq into ByteBuffer; 7. Put command into ByteBuffer; 8. Put len ​​into ByteBuffer; 9. If len>0, put the payload into ByteBuffer; 10. Generate crc32 checksum based on the above data, int type 11. Put the crc32 checksum into ByteBuffer; 12. Write the ByteBuffer to the file node of the serial communication.

[0053] The specific method of receiving key filling data is as follows: Create a temporary memory area and determine the data length; intercepting the received key filling data in the buffer area according to the data length and putting the intercepted key filling data into the temporary memory area; Splice the temporary memory area and the buffer and intercept the received key filling data in the cache area and put it into the buffer; The length of the buffer is used as the data length; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The identifier, the version number of the used protocol or data format, the sequence number, the execution command or operation identifier, the length, and the actual carried data are sequentially taken out from the byte buffer and put into the byte buffer.

[0054] When the identifier cannot be retrieved, use the following method to handle it: Reduce data length; Using the reduced data length to trim the key filling data intercepted and received in the buffer area and placing the trimmed key filling data intercepted and received in the buffer area into the byte buffer; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; Get the identifier from the byte buffer; When the version number or serial number of the protocol or data format used cannot be retrieved, the same method is used; The identifier, the version number of the protocol or data format used, and the sequence number need to be retrieved in sequence.

[0055] After taking out the serial number, you also need to take out the execution command or operation identifier, length and actual carried data in turn; Then follow these steps: The sum of the actual carried data and the set value is taken as the total data length; When the total length of the data is greater than the data length, the receiving of the key-filled data is terminated. When the total length of the data is less than or equal to the data length, the check code is taken out from the byte buffer and checked. If the check is successful, the following steps are executed: In a possible implementation manner of the first aspect, the method further includes: Use the execution command or operation identifier, length and actual carried data to perform key filling of the terminal being filled; Intercept the data length value data from the buffer starting from the data total length value position and assign the data to the buffer; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The identifier, the version number of the used protocol or data format, the sequence number, the execution command or operation identifier, the length, and the actual carried data are sequentially taken out from the byte buffer and put into the byte buffer.

[0056] If verification fails, perform the following steps: Intercept the data length value data from the buffer starting from the data total length value position and assign the data to the buffer; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The identifier, the version number of the used protocol or data format, the sequence number, the execution command or operation identifier, the length, and the actual carried data are sequentially taken out from the byte buffer and put into the byte buffer.

[0057] The specific method of receiving key filling data is described as follows using professional terms: 1. Input buffer and size. 2. Take the size data starting from position 0 of the buffer and assign it to the buffer; 3. Concatenate mBuffer and buffer and assign the value to mBuffer (buffer); 4. Take mBuffer.length and assign it to size; 5. When size < 13, jump to step 27; 6. Create a new ByteBuffer of size; 7. Put mBuffer into ByteBuffer; 8, rewind ByteBuffer; 9. Take out magic from ByteBuffer. If it is equal to the MAGIC specified by the protocol, jump to step 12. 10, size minus 2; 11. Intercept size data starting from position 2 of mBuffer and assign them to mBuffer, and jump to step 5; 12. Get the version from ByteBuffer. If it is equal to the VERSION specified in the protocol, jump to step 15. 13, size minus 4; 14. Intercept size data starting from position 4 of mBuffer and assign them to mBuffer, and jump to step 5; 15. Get seq from ByteBuffer; 16. Get command from ByteBuffer; 17, get len ​​from ByteBuffer; 18, assign len+13 to totalLength; 19. If totalLength>size, jump to step 27; 20. Get the payload from the ByteBuffer. 21. Get the crc32 check code crc32int from ByteBuffer; 22, calculate the crc32 check code crc32intVerify through the data from position 0 to len+9 of mBuffer; 23. If crc32int and crc32intVerify are different, jump to step 25; 24. Process related instructions through seq, command, and payload; 25 , size minus totalLength; 26, intercept size data from mBuffer starting from position totalLength and assign it to mBuffer and jump to step 5; 27, end the current data reception and wait for the next data reception.

[0058] The present application also provides a key filling device based on serial communication, comprising: A first communication unit, used to send a connection request to the terminal being filled using a serial communication method or respond to a received connection request sent based on the serial communication method and determine a connection state; A second communication unit, used for sending communication related parameters to the filled terminal when the connection state is connected; A third communication unit, used to send the key filling data to the filled terminal or send the key filling data to the filled terminal in response to a request of the filled terminal; The fourth communication unit is used to stop sending the secret key filling data after receiving the filling success result sent by the filling terminal.

[0059] In one example, the unit in any of the above devices can be one or more integrated circuits configured to implement the above methods, such as: one or more application specific integrated circuits (ASICs), or, one or more digital signal processors (DSPs), or, one or more field programmable gate arrays (FPGAs), or a combination of at least two of these integrated circuit forms.

[0060] For another example, when the units in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these units can be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0061] Various objects such as various messages / information / equipment / network elements / systems / devices / actions / operations / processes / concepts that may appear in this application are named. It can be understood that these specific names do not constitute a limitation on the relevant objects. The names assigned may change with factors such as scenarios, contexts or usage habits. The understanding of the technical meaning of the technical terms in this application should be mainly determined from the functions and technical effects embodied / executed in the technical scheme.

[0062] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0063] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0064] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0065] 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, or a combination of computer software and electronic hardware. 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 this application.

[0066] It should also be understood that in various embodiments of the present application, the first, second, etc. are only used to indicate that multiple objects are different. For example, the first time window and the second time window are only used to indicate different time windows. They should not have any impact on the time window itself, and the first, second, etc. mentioned above should not impose any limitations on the embodiments of the present application.

[0067] It should also be understood that in the various embodiments of the present application, unless otherwise specified or there is a logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form new embodiments according to their internal logical relationships.

[0068] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a computer-readable storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned computer-readable storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0069] The present application also provides a key filling system based on serial communication, the system comprising: one or more memories for storing instructions; and One or more processors are used to call and run the instructions from the memory to execute the method as described above.

[0070] The present application also provides a computer program product, which includes instructions. When the instructions are executed, the terminal device and the network device perform operations of the terminal device and the network device corresponding to the above method.

[0071] The present application also provides a chip system, which includes a processor for implementing the functions involved in the above content, such as generating, receiving, sending, or processing the data and / or information involved in the above method.

[0072] The chip system may be composed of chips, or may include chips and other discrete devices.

[0073] The processor mentioned in any of the above places can be a CPU, a microprocessor, an ASIC, or one or more integrated circuits for executing programs for controlling the above-mentioned feedback information transmission method.

[0074] In a possible design, the chip system also includes a memory, which is used to store necessary program instructions and data. The processor and the memory can be decoupled and respectively set on different devices, connected by wire or wireless means to support the chip system to implement various functions in the above embodiments. Alternatively, the processor and the memory can also be coupled on the same device.

[0075] Optionally, the computer instructions are stored in a memory.

[0076] Optionally, the memory is a storage unit within the chip, such as a register, a cache, etc. The memory can also be a storage unit within the terminal located outside the chip, such as a ROM or other types of static storage devices that can store static information and instructions, RAM, etc.

[0077] It can be understood that the memory in the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.

[0078] The nonvolatile memory may be a ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), or a flash memory.

[0079] The volatile memory may be a RAM, which is used as an external cache. There are many different types of RAM, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct memory bus RAM.

[0080] The embodiments of this specific implementation method are all preferred embodiments of the present application, and are not intended to limit the protection scope of the present application. Therefore, all equivalent changes made based on the structure, shape, and principle of the present application should be included in the protection scope of the present application.

Claims

1. A key filling method based on serial communication, characterized in that: include: Sending a connection request to the terminal being filled using a serial communication method or responding to a received connection request sent based on the serial communication method and determining a connection status; When the connection state is connected, communication related parameters are sent to the terminal being filled; Sending key filling data to the terminal being filled or sending key filling data to the terminal being filled in response to a request from the terminal being filled; After receiving the filling success result sent by the filled terminal, stop sending the secret key filling data; Among them, when receiving the key filling data, it also includes: The length of the buffer is used as the data length; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The key filling data is continuously sent before the filling success result sent by the filling terminal is received.

2. The key filling method based on serial communication according to claim 1 is characterized in that: When determining the connection status, it is also determined that all communication ports of the filled terminal except the communication port associated with the serial communication mode are blocked.

3. The key filling method based on serial communication according to claim 1 is characterized in that: The key filling data generated and sent to the filled terminal includes: Create a byte buffer; Filling the byte buffer with content, including an identifier, a version number of the protocol or data format used, a sequence number, an execution command or operation identifier, a length, and actual carried data into the byte buffer; Generates a checksum using the padding content and places the checksum into the byte buffer.

4. The key filling method based on serial communication according to claim 1 or 3 is characterized in that: The received key filling data includes: Create a temporary memory area and determine the data length; intercepting the received key filling data in the buffer area according to the data length and putting the intercepted key filling data into the temporary memory area; Splice the temporary memory area and the buffer and intercept the received key filling data in the cache area and put it into the buffer; The length of the buffer is used as the data length; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The identifier, the version number of the used protocol or data format, the sequence number, the execution command or operation identifier, the length, and the actual carried data are sequentially taken out from the byte buffer and put into the byte buffer.

5. The key filling method based on serial communication according to claim 4 is characterized in that: When the identifier cannot be retrieved, it also includes: Reduce data length; Using the reduced data length to trim the key filling data intercepted and received in the buffer area and placing the trimmed key filling data intercepted and received in the buffer area into the byte buffer; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; Get the identifier from the byte buffer; When the version number or serial number of the protocol or data format used cannot be retrieved, the same method is used for processing; The identifier, the version number of the protocol or data format used, and the sequence number need to be retrieved in sequence.

6. The key filling method based on serial communication according to claim 5 is characterized in that: After taking out the sequence number, take out the execution command or operation identifier, length and actual carried data in turn; Also includes: The sum of the actual carried data and the set value is taken as the total data length; When the total length of the data is greater than the data length, the reception of the key-filled data is terminated. When the total length of the data is less than or equal to the data length, the check code is taken out from the byte buffer and checked.

7. The key filling method based on serial communication according to claim 6 is characterized in that: Also includes: Use the execution command or operation identifier, length and actual carried data to perform key filling of the terminal being filled; Intercept the data length value data from the buffer starting from the data total length value position and assign the data to the buffer; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The identifier, the version number of the used protocol or data format, the sequence number, the execution command or operation identifier, the length, and the actual carried data are sequentially taken out from the byte buffer and put into the byte buffer.

8. A key filling device based on serial communication, characterized in that: include: A first communication unit, used to send a connection request to the terminal being filled using a serial communication method or respond to a received connection request sent based on the serial communication method and determine a connection state; A second communication unit, used for sending communication related parameters to the filled terminal when the connection state is connected; A third communication unit, used to send the key filling data to the filled terminal or send the key filling data to the filled terminal in response to a request of the filled terminal; The fourth communication unit is used to stop sending the secret key filling data after receiving the filling success result sent by the filling terminal; Among them, when receiving the key filling data, it also includes: The length of the buffer is used as the data length; When the data length is less than the set length, the receiving of the key filling data is terminated. When the data length is greater than or equal to the set length, a new byte buffer will be created according to the data length and the received key filling data will be intercepted in the buffer and put into the byte buffer; The key filling data is continuously sent before the filling success result sent by the filling terminal is received.

9. A key filling system based on serial communication, characterized in that: The system comprises: one or more memories for storing instructions; and One or more processors, configured to call and execute the instructions from the memory to perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer readable storage medium comprises: The program, when the program is executed by a processor, the method according to any one of claims 1 to 7 is executed.

Citation Information

Patent Citations

  • Serial interface

    CN103460201A

  • Method for transmitting keys, receiving terminal and distribution terminal

    CN108401493A

Cited By

  • Payment terminal data automatic downloading method and system

    CN119854288A

  • A method and system for automatic downloading of payment terminal data

    CN119854288B