CN112910878A - Data transmission method and system based on serial port communication - Google Patents

Data transmission method and system based on serial port communication Download PDF

Info

Publication number
CN112910878A
CN112910878A CN202110117993.0A CN202110117993A CN112910878A CN 112910878 A CN112910878 A CN 112910878A CN 202110117993 A CN202110117993 A CN 202110117993A CN 112910878 A CN112910878 A CN 112910878A
Authority
CN
China
Prior art keywords
data packet
data
equipment
key
dynamic
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.)
Pending
Application number
CN202110117993.0A
Other languages
Chinese (zh)
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.)
Wuhan Bochang Software Development Co ltd
Original Assignee
Wuhan Bochang Software Development 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 Wuhan Bochang Software Development Co ltd filed Critical Wuhan Bochang Software Development Co ltd
Priority to CN202110117993.0A priority Critical patent/CN112910878A/en
Publication of CN112910878A publication Critical patent/CN112910878A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/0435Network 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 symmetric encryption, i.e. same key used for encryption and decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • 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/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds

Abstract

The invention discloses a data transmission method and a system based on a serial communication protocol, wherein the method comprises the following steps: establishing handshake connection between the first device and the second device based on a serial communication protocol; the first device acquires first noise data and sends a first request data packet to the second device; receiving a first response data packet fed back by the second device, wherein the first response data packet is obtained by mixing a dynamic secret key randomly generated by the second device into the first request data packet; analyzing the first answer data packet to obtain a first dynamic secret key; encrypting the first dynamic key pair by adopting the first noise data to obtain a first encryption key; an encrypted communication between the first device and the second device is established by the first encryption key. The invention generates the first encryption key based on the noise data acquired by the first equipment and the dynamic key randomly generated by the second equipment, and realizes the encryption communication between the equipment based on the first encryption key, thereby improving the safety of serial communication.

Description

Data transmission method and system based on serial port communication
Technical Field
The invention relates to the technical field of serial port communication, in particular to a data transmission method and a data transmission system based on a serial port communication protocol.
Background
The serial communication protocol (serial communication) specifies the content of a data packet, and the content includes a start bit, main data, a check bit and a stop bit, and both sides need to agree on a data packet format consistent with each other to be able to normally receive and transmit data. Serial communication refers to a communication mode in which data is transmitted bit by bit on a signal line by bit using a serial communication protocol. Serial communication is also adopted among a plurality of product devices, and in the serial communication, common protocols comprise RS-232, RS-422 and RS-485.
A plurality of serial port monitoring programs exist in the prior art, communication among monitoring devices can be monitored conveniently, the existing serial port communication is generally not encrypted or is single in encryption mode, the safety is still not high, and the serial port monitoring programs are easy to crack violently.
Disclosure of Invention
In view of this, the present invention provides a data transmission method and system based on a serial communication protocol, which are used to solve the problem of low security of the existing serial communication.
In a first aspect of the present invention, a data transmission method based on a serial communication protocol is provided, where the method includes:
establishing handshake connection between the first device and the second device based on a serial communication protocol;
the first device acquires first noise data and sends a first request data packet to the second device;
receiving a first response data packet fed back by the second device, wherein the first response data packet is obtained by mixing a dynamic secret key randomly generated by the second device into the first request data packet;
analyzing the first answer data packet to obtain a first dynamic secret key;
encrypting the first dynamic key pair by adopting the first noise data to obtain a first encryption key;
an encrypted communication between the first device and the second device is established by the first encryption key.
Preferably, the first answer data packet is obtained by mixing a dynamic key randomly generated by the second device with the first request data packet according to a preset rule, and when the first answer data packet is analyzed, the first answer data packet is analyzed according to the preset rule.
Preferably, the first noise data includes a time stamp of the current time, and the time stamp is the same as the time of the first request packet.
Preferably, the generating the first encryption key by encrypting the first noise data with the first dynamic key specifically includes: and encrypting the first dynamic secret key by adopting a symmetric encryption algorithm to generate the first encryption secret key.
Preferably, the establishing of the encrypted communication between the first device and the second device by using the first encryption key specifically includes: the first encryption key is sent to the second equipment, the first target data sent by the second equipment is received, the first target data is obtained by the second equipment through a symmetric encryption algorithm and through encryption of the first encryption key on the requested data, and the first equipment adopts an inverse algorithm of the symmetric encryption algorithm to decrypt the first target data, and the requested data is obtained. Preferably, the method further comprises:
the second equipment acquires second noise data and sends a second request data packet to the first equipment;
receiving a second response data packet fed back by the first device, wherein the second response data packet is obtained by mixing a dynamic key randomly generated by the first device into the second request data packet; analyzing the second response data packet to obtain a second dynamic secret key;
and encrypting the second dynamic key pair by adopting the second environmental noise data to obtain a second encryption key, and establishing encryption communication between the second equipment and the first equipment through the second encryption key.
In a second aspect of the present invention, a data transmission method based on a serial communication protocol is disclosed, the system comprising:
an equipment connection module: establishing handshake connection between the first device and the second device based on a serial communication protocol;
a data request module: the first device acquires first noise data and sends a first request data packet to the second device; receiving a first response data packet fed back by the second device, wherein the first response data packet is obtained by mixing a dynamic secret key randomly generated by the second device into the first request data packet; analyzing the first answer data packet to obtain a first dynamic secret key;
encryption key module: encrypting the first dynamic key pair by adopting the first noise data to obtain a first encryption key;
a communication connection module: and sending the first encryption key to the second equipment, receiving and decrypting first target data sent by the second equipment to obtain request data, wherein the first target data is obtained by encrypting the request data by the second equipment through the first encryption key.
Compared with the prior art, the invention has the following beneficial effects:
according to the method and the device, the noise data acquired by the first device and the dynamic key randomly generated by the second device are used for generating the first encryption key together, encryption communication between the devices is realized based on the first encryption key, the noise data and the dynamic key are randomly generated and ciphertext transmission is adopted, the first encryption key cannot be deciphered even if the equipment is monitored, and the safety of serial port communication is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of a data transmission method based on a serial communication protocol according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
As shown in fig. 1, the present invention provides a data transmission method based on a serial communication protocol, where the method includes:
s1, establishing handshake connection between the first device and the second device based on the serial port communication protocol;
establishing handshake connection after the first device and the second device are physically connected;
s2, the first device acquires the first noise data and sends a first request data packet to the second device;
the first noise data is randomly generated by the first device, each noise data is not repeated, the first noise data comprises a time stamp of the current time, and the time stamp is the same as the time of the first request data packet.
S3, receiving a first response data packet fed back by the second device, wherein the first response data packet is obtained by mixing a dynamic secret key randomly generated by the second device into the first request data packet; analyzing the first answer data packet to obtain a first dynamic secret key;
specifically, the first response data packet is obtained by mixing a dynamic key randomly generated by the second device with the first request data packet according to a preset rule, and when the first response data packet is analyzed, the first response data packet is analyzed according to the preset rule. For example, the dynamic key may be sliced and inserted into the first request packet according to a specific sequence, so as to obtain a first response packet.
S4, encrypting the first dynamic key pair with the first noise data to obtain a first encryption key;
specifically, the first dynamic key is used as original data, the key is encrypted for the first noise data, and the first dynamic key is encrypted by adopting a symmetric encryption algorithm to generate a first encryption key.
S5, establishing encrypted communication between the first device and the second device through the first encryption key;
and sending the first encryption key to the second equipment, receiving and decrypting first target data sent by the second equipment to obtain request data, wherein the first target data is obtained by encrypting the request data by the second equipment through the first encryption key.
The second equipment encrypts the requested data by adopting a first encryption key through a symmetric encryption algorithm to obtain first target data, and sends the first target data to the first equipment, and the first equipment decrypts the first target data by adopting an inverse algorithm of the symmetric encryption algorithm to obtain the requested data.
Fig. 1 is a schematic flow chart illustrating a process of establishing encrypted communication between first equipment and second equipment by using a first encryption key, in which noise data acquired by the first equipment and a dynamic key randomly generated by the second equipment are used together to generate the first encryption key, encrypted communication between the equipment is realized based on the first encryption key, the noise data and the dynamic key are both randomly generated and ciphertext transmission is adopted, and the first encryption key cannot be decrypted even if the equipment is monitored, so that the security of serial communication is improved.
S6, establishing encrypted communication between the second device and the first device via the second encryption key.
Establishing handshake connection between the second equipment and the first equipment based on a serial communication protocol;
the second equipment acquires second noise data and sends a second request data packet to the first equipment;
receiving a second response data packet fed back by the first device, wherein the second response data packet is obtained by mixing a dynamic key randomly generated by the first device into the second request data packet; analyzing the second response data packet to obtain a second dynamic secret key;
and encrypting the second dynamic key pair by adopting the second environmental noise data to obtain a second encryption key, and establishing encryption communication between the second equipment and the first equipment through the second encryption key.
Corresponding to the embodiment of the method, the invention also provides a data transmission method based on the serial port communication protocol, and the system comprises:
an equipment connection module: establishing handshake connection between the first device and the second device based on a serial communication protocol;
a data request module: the first device acquires first noise data and sends a first request data packet to the second device; receiving a first response data packet fed back by the second device, wherein the first response data packet is obtained by mixing a dynamic secret key randomly generated by the second device into the first request data packet; analyzing the first answer data packet to obtain a first dynamic secret key;
encryption key module: encrypting the first dynamic key pair by adopting the first noise data to obtain a first encryption key;
a communication connection module: and sending the first encryption key to the second equipment, receiving and decrypting first target data sent by the second equipment to obtain request data, wherein the first target data is obtained by encrypting the request data by the second equipment through the first encryption key.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (7)

1. A data transmission method based on a serial port communication protocol is characterized by comprising the following steps:
establishing handshake connection between the first device and the second device based on a serial communication protocol;
the first device acquires first noise data and sends a first request data packet to the second device;
receiving a first response data packet fed back by the second device, wherein the first response data packet is obtained by mixing a dynamic secret key randomly generated by the second device into the first request data packet;
analyzing the first answer data packet to obtain a first dynamic secret key;
encrypting the first dynamic key pair by adopting the first noise data to obtain a first encryption key;
an encrypted communication between the first device and the second device is established by the first encryption key.
2. The serial communication protocol-based data transmission method according to claim 1, wherein the first reply data packet is obtained by mixing a dynamic key randomly generated by the second device with the first request data packet according to a preset rule, and when the first reply data packet is analyzed, the first reply data packet is analyzed according to the preset rule.
3. The serial port communication protocol-based data transmission method according to claim 2, wherein the first noise data includes a timestamp of the current time, and the timestamp is the same as the time of the first request data packet.
4. The serial communication protocol-based data transmission method according to claim 3, wherein the step of encrypting the first noise data by using the first dynamic key to generate the first encryption key specifically comprises:
and encrypting the first dynamic secret key by adopting a symmetric encryption algorithm to generate the first encryption secret key.
5. The serial communication protocol-based data transmission method according to claim 3, wherein the establishing of the encrypted communication between the first device and the second device by using the first encryption key specifically includes:
the first encryption key is sent to the second equipment, the first target data sent by the second equipment is received, the first target data is obtained by the second equipment through a symmetric encryption algorithm and through encryption of the first encryption key on the requested data, and the first equipment adopts an inverse algorithm of the symmetric encryption algorithm to decrypt the first target data, and the requested data is obtained.
6. The serial port communication-based data communication method according to claim 1, further comprising:
establishing handshake connection between the second equipment and the first equipment;
the second equipment acquires second noise data and sends a second request data packet to the first equipment;
receiving a second response data packet fed back by the first device, wherein the second response data packet is obtained by mixing a dynamic key randomly generated by the first device into the second request data packet; analyzing the second response data packet to obtain a second dynamic secret key;
and encrypting the second dynamic key pair by adopting the second environmental noise data to obtain a second encryption key, and establishing encryption communication between the second equipment and the first equipment through the second encryption key.
7. A data transmission method based on a serial port communication protocol is characterized in that the system comprises:
an equipment connection module: establishing handshake connection between the first device and the second device based on a serial communication protocol;
a data request module: the first device acquires first noise data and sends a first request data packet to the second device; receiving a first response data packet fed back by the second device, wherein the first response data packet is obtained by mixing a dynamic secret key randomly generated by the second device into the first request data packet; analyzing the first answer data packet to obtain a first dynamic secret key;
encryption key module: encrypting the first dynamic key pair by adopting the first noise data to obtain a first encryption key;
a communication connection module: and sending the first encryption key to the second equipment, receiving and decrypting first target data sent by the second equipment to obtain request data, wherein the first target data is obtained by encrypting the request data by the second equipment through the first encryption key.
CN202110117993.0A 2021-01-28 2021-01-28 Data transmission method and system based on serial port communication Pending CN112910878A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110117993.0A CN112910878A (en) 2021-01-28 2021-01-28 Data transmission method and system based on serial port communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110117993.0A CN112910878A (en) 2021-01-28 2021-01-28 Data transmission method and system based on serial port communication

Publications (1)

Publication Number Publication Date
CN112910878A true CN112910878A (en) 2021-06-04

Family

ID=76119585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110117993.0A Pending CN112910878A (en) 2021-01-28 2021-01-28 Data transmission method and system based on serial port communication

Country Status (1)

Country Link
CN (1) CN112910878A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120063597A1 (en) * 2010-09-15 2012-03-15 Uponus Technologies, Llc. Apparatus and associated methodology for managing content control keys
CN105635039A (en) * 2014-10-27 2016-06-01 阿里巴巴集团控股有限公司 Network safety communication method and device
WO2018120938A1 (en) * 2016-12-27 2018-07-05 百富计算机技术(深圳)有限公司 Offline key transmission method, terminal and storage medium
CN109936448A (en) * 2019-02-26 2019-06-25 北京钰安信息科技有限公司 A kind of data transmission method and device
CN111770064A (en) * 2020-06-08 2020-10-13 珠海格力电器股份有限公司 Data communication method, device, storage medium and electronic equipment
CN111881463A (en) * 2020-07-17 2020-11-03 盛视科技股份有限公司 Serial port communication encryption method and system and serial port device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120063597A1 (en) * 2010-09-15 2012-03-15 Uponus Technologies, Llc. Apparatus and associated methodology for managing content control keys
CN105635039A (en) * 2014-10-27 2016-06-01 阿里巴巴集团控股有限公司 Network safety communication method and device
WO2018120938A1 (en) * 2016-12-27 2018-07-05 百富计算机技术(深圳)有限公司 Offline key transmission method, terminal and storage medium
CN109936448A (en) * 2019-02-26 2019-06-25 北京钰安信息科技有限公司 A kind of data transmission method and device
CN111770064A (en) * 2020-06-08 2020-10-13 珠海格力电器股份有限公司 Data communication method, device, storage medium and electronic equipment
CN111881463A (en) * 2020-07-17 2020-11-03 盛视科技股份有限公司 Serial port communication encryption method and system and serial port device

Similar Documents

Publication Publication Date Title
CN106941401B (en) Acceleration equipment and method for obtaining session key based on acceleration equipment
US20080037785A1 (en) Constrained Cryptographic Keys
CN105376261B (en) Encryption method and system for instant messaging message
CA2564909A1 (en) Systems and methods to securely generate shared keys
CN102333093A (en) Data encryption transmission method and system
CA2561796A1 (en) Key agreement and re-keying over a bidirectional communication path
CN109005027B (en) Random data encryption and decryption method, device and system
CN106453391A (en) Long repeating data encryption and transmission method and system
CN111082929A (en) Method for realizing encrypted instant communication
CN111600829A (en) Secure communication method and system for Internet of things equipment
KR101481403B1 (en) Data certification and acquisition method for vehicle
CN114499857B (en) Method for realizing data correctness and consistency in encryption and decryption of large data quanta
CN112929166B (en) Master station, slave station and data transmission system based on Modbus-TCP protocol
CN111555879B (en) Satellite communication network management channel message encryption and decryption method and system
CN112738037B (en) Data encryption communication method
CN109462480B (en) Satellite communication system encryption method based on RSA and AES
CN112910878A (en) Data transmission method and system based on serial port communication
CN114928503A (en) Method for realizing secure channel and data transmission method
CN111885013B (en) Mimicry encryption communication module, system and method
CN112668029A (en) Private social software and private implementation method thereof
CN112953898A (en) Audio and video encryption and decryption transmission control method
CN110855628A (en) Data transmission method and system
CN111147487A (en) Safe offshore data transmission method
CN110545226B (en) Device communication method and communication system
CN116346505B (en) Internet of things data security communication method, system and computer readable storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210604

RJ01 Rejection of invention patent application after publication