CN104796249A - Method for encrypting serial communication data of microcomputer - Google Patents
Method for encrypting serial communication data of microcomputer Download PDFInfo
- Publication number
- CN104796249A CN104796249A CN201510121351.2A CN201510121351A CN104796249A CN 104796249 A CN104796249 A CN 104796249A CN 201510121351 A CN201510121351 A CN 201510121351A CN 104796249 A CN104796249 A CN 104796249A
- Authority
- CN
- China
- Prior art keywords
- microcomputer
- byte
- data
- standard
- frame
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/065—Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
Abstract
The invention discloses a method for encrypting serial communication data of a microcomputer. A standard hardware serial port module in the microcomputer is not used, but a digital I/O (input/output) port of the microcomputer is used for receiving and transmitting the serial data in an encrypted manner. The method specifically comprises the following steps of correcting the existing standard byte length which comprises 7-8 bits into a byte length which comprises n bits; reediting transmitted bytes in an encrypting mode; or/and changing level, effects and byte lengths of byte mark information so that a standard serial port cannot be recognized; or/and dividing transmitting frames and receiving frames of the microcomputer into a plurality of short frames which are transmitted and received alternately; concealing a secret key in the transmitted short frames; and transmitting data of the short frames by using a receiving end after the data of the short frames are encrypted according to different secret keys. In the first step, n is a natural number, and in the encrypting mode, the byte mark information is redefined, so that the standard serial port cannot recognize the byte mark information. The method has the advantage that a serial communication encryption function of the microcomputer can be fulfilled by minimum resources.
Description
Technical field
The present invention relates to microcomputer communication field, particularly, relate to a kind of encryption method of the serial communication data for microcomputer.
Background technology
Along with popularizing of micro-computer technology, all kinds of intelligent miniature terminal gets more and more, the multiplex serial communication of transfer of data of terminal room, maliciously being intercepted in transmitting procedure for preventing data, being distorted, pseudo-to be brought up and for important, each producer all spends and researches and develops all kinds of cryptographic algorithm energetically for this reason, reaches the object of data confidentiality transmission with it.Mostly serial communication due to terminal room is to rely on the hardware serial communication module in microcomputer, disclosed in its hardware configuration is, the form of minimum communication unit (1 data byte) is also open and fixing (see figure 1), therefore all encryption methods can only have been come by all kinds of key algorithm of software programming, and its key algorithm of large scale system is very complicated, the a large amount of resource of system and time need be taken, for the micro terminal of all kinds of observing and controlling by the restriction of hardware resource, basic computing not large-scale encryption software.
Summary of the invention
The object of the invention is to, for the problems referred to above, propose a kind of encryption method of the serial communication data for microcomputer, to realize the advantage of the serial communication encryption function completing microcomputer by minimum resource.
For achieving the above object, the technical solution used in the present invention is:
For an encryption method for the serial communication data of microcomputer, do not use the standard hardware serial port module in microcomputer, use the encryption of the existing serial data of the digital I/O cause for gossip of microcomputer to receive and send;
Specifically comprise:
Be that the standard byte length of 7 ~ 8 is revised as n position by existing byte length, n is natural number;
Cipher mode is adopted to update to the byte of transmission;
Described cipher mode is:
By the flag information of byte from new definition, make standard serial port None-identified;
Or and the level of change byte flag information and effect and byte length, make standard serial port None-identified;
Or and the transmission frame of microcomputer and received frame are divided into multiple short frame and alternately send and receive, and be hidden in by key and send in short frame, the data of each short frame send by after different secret key encryptions by receiving terminal.
Technical scheme of the present invention has following beneficial effect:
Technical scheme of the present invention, do not use the standard hardware serial port module in microcomputer, the all functions of serial communication are completed with microcomputer numeral I/O mouth, because of the restriction not by standard serial port communication regulations, by self-defined communication regulations, key is carried out to the methods such as simple process, reach the object of micro terminal Data Encryption Transmission.Realize the advantage of the serial communication encryption function completing microcomputer by minimum resource.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Accompanying drawing explanation
Fig. 1 is existing standard serial communication regulations schematic diagram;
Fig. 2 is the encryption serial communication code schematic diagram described in the embodiment of the present invention;
Fig. 3 is the frame data sectional encryption transmission schematic diagram described in the embodiment of the present invention.
Embodiment
Below in conjunction with accompanying drawing, the preferred embodiments of the present invention are described, should be appreciated that preferred embodiment described herein is only for instruction and explanation of the present invention, is not intended to limit the present invention.
For an encryption method for the serial communication data of microcomputer, do not use the standard hardware serial port module in microcomputer, use the encryption of the existing serial data of the digital I/O cause for gossip of microcomputer to receive and send;
Specifically comprise:
Be that the standard byte length of 7 ~ 8 is revised as n position by existing byte length, n is natural number;
Cipher mode is adopted to update to the byte of transmission;
Described cipher mode is:
By the flag information of byte from new definition, make standard serial port None-identified;
Or and the level of change byte flag information and effect and byte length, make standard serial port None-identified;
Or and the transmission frame of microcomputer and received frame are divided into multiple short frame and alternately send and receive, and be hidden in by key and send in short frame, the data of each short frame send by after different secret key encryptions by receiving terminal.
Several cipher mode can be used alone wherein a kind of above, also can select several combinationally using.
The length of every byte can according to 1 ~ n interdigit change transmission that do not coexist of key, and n is natural number, realizes byte length rolling code encrypting.As shown in Figure 2.
The flag information of byte is specially from new definition:
the flag informations such as start bit, parity check bit, position of rest are all from new definition.
the level of the flag information such as start bit, position of rest is difference changing according to key at any time with effect and byte length.
Technical scheme of the present invention is without standard hardware serial communication module existing in microcomputer, and use microcomputer numeral I/O mouth to complete all working of serial communication, so just can not by the restriction of standard serial port hardware formats, by the data length of every byte by 7 ~ 8 of standard for changing n position into, n is natural number, the flag informations such as start bit, parity check bit, position of rest, all from new definition, allow standard serial port None-identified, thus reach the object of encryption.
And the length of every byte can according to 1 ~ n interdigit change transmission that do not coexist of key, n is natural number, realizes length rolling code encrypting, and deciphering difficulty is just more difficult.
Transmission frame and received frame are divided into multiple short frame alternately send and receive, key is hidden in and sends in short frame, each short frame data sends by after different secret key encryptions by receiving terminal, and realizing frame data has multiple different cryptographic algorithm, improves further and cracks difficulty.As shown in Figure 3.
Self-defined communication regulations, by the level of the flag information such as start bit, position of rest with effect and byte length difference changing at any time according to key, allow logic analyzer be difficult to find out its rule, thus reach the object of encryption.
Hereafter based on digital sensor, technical solution of the present invention is specifically described, digital sensor is a kind of intelligent terminal with measuring ability, it is arranged on Test Field, instrument is operation control terminal, and it is placed in control room, middle connected by serial communication line, manipulation instruction is issued digital sensor by instrument, testing result is returned instrument by digital sensor, and for preventing measurement result from maliciously being stolen and distorting in communication process, data need encrypted transmission.Because two limits are single chip microcomputer, internal memory and finite rate, complicated cryptographic algorithm cannot complete, simple cryptographic algorithm can only be done, and the system that cracks of routine is all based on standard serial port module, or with logic analyzer, find out the transportation law of data to crack enciphered data.Adopt the way avoiding standard serial port hardware and communication regulations thereof for this reason, self-defined communication regulations, as long as digital sensor is the same with the communication regulations (key) of instrument, the communication on two limits is just out of question, standard hardware serial ports is also read not to data, and data just cannot be stolen.Concrete grammar is as follows:
The waiting signal of standard serial port is 1 level, and start bit is 0 level, and position of rest is 1 level, and byte length is fixed as 7 or 8.Byte data can identify according to these flag informations by serial ports hardware module.
For making standard hardware serial ports None-identified, flag information changes into by technical solution of the present invention: waiting signal is 0 level, and start bit is 1 level, and byte length changes n position into, and n is natural number, and concrete n can be 2 ~ 16.And its length is rolled according to key and is changed: as pressed the arrangement of key 1:
First byte length is 2, and the second byte length is 6, and the 3rd byte length is 13 ...,
The arrangement of key 2:
First byte length is 5, and the second byte length is 9, and the 3rd byte length is 16 ...,
Existing hardware serial port module can only identify that byte length is the data of 7,8, and length must be fixed, and is None-identified, thus reaches the object of encrypted transmission for the byte more than 8 or elongated degree.
Byte length rolls according to key change, namely use logic analyzer all difficulty find out rule, increase and decode difficulty.
Transmission or the reception of general serial data process all frame by frame, the such as data of frame 30 byte, wherein there are frame beginning flag, frame end mark, frame check data etc., general frame data are by cryptographic algorithm (key) encryption, whole frame sends, and its rule is easier to find out (easily decoding).
Decode difficulty for improving, frame length data are divided into n section short data and encrypt, the cryptographic algorithm (key) of each section is all not identical.When sending and receive, the way that a frame receives a frame again of sending of routine is changed into transmission and received frame are split into n section, alternately send and receive, key is hidden in each delivery section, recipient is at any time by the data of next delivery section of new key re-encrypted process, thus realize frame data and have multiple different encryption method, further increase decoding difficulty.
As main frame will receive the data of frame 30 byte, the short data segment that can be divided into 3 10 bytes receives, and main frame first sends out data segment A to extension set, tells that extension set encrypts front 10 bytes by key 1 in A segment data; After encrypting front 10 bytes by key 1 after extension set receives A field, data are issued main frame, after main frame harvests, send out data segment B to extension set again, in B segment data, tell that extension set encrypts middle 10 bytes by key 3; After encrypting middle 10 bytes by key 3 after extension set receives B field, data are issued main frame, after main frame harvests, send out data segment C to extension set again ..., complete the object of sectional encryption.Key because of each section is all random change, and it is just more difficult to decode.
Last it is noted that the foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, although with reference to previous embodiment to invention has been detailed description, for a person skilled in the art, it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.
Claims (1)
1. for an encryption method for the serial communication data of microcomputer, it is characterized in that, do not use the standard hardware serial port module in microcomputer, use the encryption of the existing serial data of the digital I/O cause for gossip of microcomputer to receive and send;
Specifically comprise:
Be that the standard byte length of 7 ~ 8 is revised as n position by existing byte length, n is natural number;
Cipher mode is adopted to update to the byte of transmission;
Described cipher mode comprises:
By the flag information of byte from new definition, make standard serial port None-identified;
Or and the level of change byte flag information and effect and byte length, make standard serial port None-identified;
Or and the transmission frame of microcomputer and received frame are divided into multiple short frame and alternately send and receive, and be hidden in by key and send in short frame, the data of each short frame send by after different secret key encryptions by receiving terminal.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510121351.2A CN104796249B (en) | 2015-03-19 | 2015-03-19 | The encryption method of serial communication data for micro computer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510121351.2A CN104796249B (en) | 2015-03-19 | 2015-03-19 | The encryption method of serial communication data for micro computer |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104796249A true CN104796249A (en) | 2015-07-22 |
CN104796249B CN104796249B (en) | 2018-10-30 |
Family
ID=53560782
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510121351.2A Active CN104796249B (en) | 2015-03-19 | 2015-03-19 | The encryption method of serial communication data for micro computer |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104796249B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106850191A (en) * | 2017-02-19 | 2017-06-13 | 郑州云海信息技术有限公司 | The encryption and decryption method and device of distributed memory system communication protocol |
CN110209622A (en) * | 2019-05-14 | 2019-09-06 | 大连理工大学 | A kind of means of communication and system for transmitting multipacket message by serial ports |
CN113382022A (en) * | 2021-08-12 | 2021-09-10 | 江西嘉捷鑫源科技有限公司 | Serial port data processing method, electronic equipment and readable storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1339131A (en) * | 1999-01-27 | 2002-03-06 | 艾利森电话股份有限公司 | Method enabling communications between an electronic device and a battery, an apparatus comprising an electronic device and a battery, and a battery enabling communication |
EP1298834A1 (en) * | 2001-09-29 | 2003-04-02 | Technische Universität Braunschweig | Method and apparatus for encrypting and decrypting data |
CN101345764A (en) * | 2008-06-18 | 2009-01-14 | 西安联合信息技术股份有限公司 | Multilink wireless mobile industrial management and control integrated data transmission system |
US20090052655A1 (en) * | 2005-02-07 | 2009-02-26 | Igor Aleksandrovich Semaev | Method for Encryption and Decryption |
CN101828160A (en) * | 2007-08-24 | 2010-09-08 | 泽蒙特有限责任公司 | Platform independent communication protocol |
CN102478797A (en) * | 2010-11-22 | 2012-05-30 | 中国科学院空间科学与应用研究中心 | Monitoring system with configurable communication protocol |
US8774305B1 (en) * | 2004-04-21 | 2014-07-08 | Altera Corporation | Bit slip circuitry for serial data signals |
CN104270243A (en) * | 2014-10-10 | 2015-01-07 | 重庆邮电大学 | Safety function implementation method for industrial Internet of Things chip |
-
2015
- 2015-03-19 CN CN201510121351.2A patent/CN104796249B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1339131A (en) * | 1999-01-27 | 2002-03-06 | 艾利森电话股份有限公司 | Method enabling communications between an electronic device and a battery, an apparatus comprising an electronic device and a battery, and a battery enabling communication |
EP1298834A1 (en) * | 2001-09-29 | 2003-04-02 | Technische Universität Braunschweig | Method and apparatus for encrypting and decrypting data |
US8774305B1 (en) * | 2004-04-21 | 2014-07-08 | Altera Corporation | Bit slip circuitry for serial data signals |
US20090052655A1 (en) * | 2005-02-07 | 2009-02-26 | Igor Aleksandrovich Semaev | Method for Encryption and Decryption |
CN101828160A (en) * | 2007-08-24 | 2010-09-08 | 泽蒙特有限责任公司 | Platform independent communication protocol |
CN101345764A (en) * | 2008-06-18 | 2009-01-14 | 西安联合信息技术股份有限公司 | Multilink wireless mobile industrial management and control integrated data transmission system |
CN102478797A (en) * | 2010-11-22 | 2012-05-30 | 中国科学院空间科学与应用研究中心 | Monitoring system with configurable communication protocol |
CN104270243A (en) * | 2014-10-10 | 2015-01-07 | 重庆邮电大学 | Safety function implementation method for industrial Internet of Things chip |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106850191A (en) * | 2017-02-19 | 2017-06-13 | 郑州云海信息技术有限公司 | The encryption and decryption method and device of distributed memory system communication protocol |
CN110209622A (en) * | 2019-05-14 | 2019-09-06 | 大连理工大学 | A kind of means of communication and system for transmitting multipacket message by serial ports |
CN110209622B (en) * | 2019-05-14 | 2022-09-06 | 大连理工大学 | Communication method and system for transmitting multiple groups of information through serial port |
CN113382022A (en) * | 2021-08-12 | 2021-09-10 | 江西嘉捷鑫源科技有限公司 | Serial port data processing method, electronic equipment and readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN104796249B (en) | 2018-10-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3526927B1 (en) | Cipher message with authentication instruction | |
CA2441392A1 (en) | Encrypting apparatus | |
CN103684794A (en) | Communication data encryption and decryption method based on DES (Data Encryption Standard), RSA and SHA-1 (Secure Hash Algorithm) encryption algorithms | |
CN102437910A (en) | Data encryption/decryption checking method and system | |
CN108173885B (en) | Data encryption method, data decryption method and related devices | |
CN111465006B (en) | Beidou short message encryption and decryption method based on ancestor algorithm and communication system | |
CN110071909A (en) | Long data ciphering method, device, computer equipment and storage medium based on RSA | |
CN108280356A (en) | File encryption-decryption method, device, processing terminal and computer readable storage medium | |
CN102598575B (en) | Method and system for the accelerated decryption of cryptographically protected user data units | |
CN112738051A (en) | Data information encryption method, system and computer readable storage medium | |
CN107222759A (en) | Method, system, equipment and the medium of media file encryption and decryption | |
CN105848145A (en) | WIFI intelligent configuration method and device | |
CN109040132A (en) | One kind being based on the randomly selected encryption communication method of shared key | |
CN102957513A (en) | Error correction method and device based on visible light communication | |
CN112054896B (en) | White box encryption method, white box encryption device, terminal and storage medium | |
CN104796249A (en) | Method for encrypting serial communication data of microcomputer | |
CN110213292B (en) | Data sending method and device and data receiving method and device | |
US9729521B2 (en) | Methods and systems for auto-commissioning of devices in a communication network | |
US10021074B2 (en) | Encrypting method and decrypting method of security short message and receiving apparatus for receiving security short message | |
CN101882991B (en) | Communication data stream encryption method based on block cipher | |
CN105721139B (en) | A kind of the AES encipher-decipher method and circuit of the FPGA suitable for limited I/O resource | |
US20170310646A1 (en) | Method to detect an ota (over the air) standard message affected by an error | |
CN108667599A (en) | Encryption method, device, computer equipment and storage medium | |
CN107343001A (en) | Data processing method and device | |
CN101882994B (en) | Triple authentication method based on block cipher |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20180918 Address after: 545100 2 Hengye Road, Xinxing Industrial Park, the Liujiang River District, Liuzhou, the Guangxi Zhuang Autonomous Region Applicant after: The new computer weighing apparatus in Liuzhou City manufactures Co., Ltd Address before: 545000, 101 unit, 1 units, 7 District, goose Kong Road, Liuzhou, the Guangxi Zhuang Autonomous Region. Applicant before: Tan Qi |
|
GR01 | Patent grant | ||
GR01 | Patent grant |