WO2022110688A1 - Field bus-based data transmission method and system, and field bus-based identity verification method and system - Google Patents

Field bus-based data transmission method and system, and field bus-based identity verification method and system Download PDF

Info

Publication number
WO2022110688A1
WO2022110688A1 PCT/CN2021/094641 CN2021094641W WO2022110688A1 WO 2022110688 A1 WO2022110688 A1 WO 2022110688A1 CN 2021094641 W CN2021094641 W CN 2021094641W WO 2022110688 A1 WO2022110688 A1 WO 2022110688A1
Authority
WO
WIPO (PCT)
Prior art keywords
master station
data
identity
station
slave
Prior art date
Application number
PCT/CN2021/094641
Other languages
French (fr)
Chinese (zh)
Inventor
仇建喜
刘吉辉
陈涛
孙业辉
董峰
钱康
曾嘉俊
Original Assignee
上海电气风电集团股份有限公司
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 上海电气风电集团股份有限公司 filed Critical 上海电气风电集团股份有限公司
Publication of WO2022110688A1 publication Critical patent/WO2022110688A1/en

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40221Profibus
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Definitions

  • the invention relates to the technical field of digital security, in particular to a field bus-based data transmission method, an identification method, a system, equipment and a medium.
  • Fieldbus is widely used in industrial control systems with the characteristics of distribution, openness, interconnection, high reliability and low cost.
  • fieldbuses are usually used to achieve the Control, monitoring and communication between the station-level monitoring center and the fan unit.
  • the general industrial control system based on field bus it has the characteristics of slow data processing speed and high real-time requirements.
  • FIG 1 shows a schematic diagram of the (SupervisoryControlAndDataAcquisition detection control and data acquisition) system architecture.
  • the SCADA system is a distributed remote computer control system, which is mainly used to measure and control equipment with a wide distribution range and monitor its production process.
  • the wind farm and the site-level centralized monitoring center, the site-level centralized monitoring center and the headquarters-level remote monitoring center can communicate with each other through the field bus between the master station and the slave station to transmit data.
  • FIG. 2 shows the schematic diagram of the fieldbus system architecture of the industrial control system, in which the listener/destroyer may disguise as a slave node or disguise as the master to destroy the normal transmission between the master and the slave.
  • the existing data transmission methods are difficult to ensure safe data transmission between the master station and the slave station.
  • the technical problem to be solved by the present invention is to overcome the defect in the prior art that it is difficult to ensure the safety of data transmission between the master station and the slave station when performing data transmission through the field bus, and to provide a method that can improve the data transmission between the master station and the slave station.
  • the present invention provides a data transmission method based on a field bus.
  • the data transmission method is applied in the master station, and the data transmission method includes:
  • the position of each character in the master station identity plaintext data is rearranged by preset coding rules to generate the master station identity. Encrypted data.
  • the master station identity plaintext data includes the target master station identifier.
  • the step further includes:
  • the master station identity plaintext data includes a master station random code
  • the slave station identity plaintext data includes the target master station identifier and the master station random code
  • the preset slave station plaintext data includes a preset master station identifier and the target master station identifier sent in the step of sending the master station identity ciphertext data to the slave station;
  • the target master station identifier matches the preset master station identifier and the master station random code matches the target master station identifier sent in the step of sending the master station identity ciphertext data to the slave station
  • the plaintext data of the slave station identity is consistent with the preset plaintext data of the slave station.
  • the master station identity plaintext data further includes a target slave station identifier
  • the preset slave station plaintext data further includes a preset slave station identifier
  • the judging that the plaintext data of the slave station identity is consistent with the preset plaintext data of the slave station further includes: the target slave station identifier is consistent with the preset slave station identifier.
  • the target slave station identifier is also used for the slave station to authenticate the master station.
  • the step further includes: randomly generating a target slave station identifier, and the target slave station identifier updated in the slave station is used for the master station to pair the target slave station identifier.
  • the slave is authenticated.
  • the step of sending the master station identity ciphertext data to the slave station is performed multiple times.
  • the step of receiving the slave station identity ciphertext data sent by the slave station includes: receiving the slave station identity ciphertext data sent by the slave station multiple times, and counting the number of times the data is inconsistent in the data received multiple times. , judging whether the number of times is greater than the first preset number of times, if so, generating slave station identity error information, if not, executing the step of decrypting the slave station identity ciphertext data to obtain the slave station identity plaintext data.
  • the step of receiving the slave station identity ciphertext data sent by the slave station includes:
  • the steps of generating the master station identity plaintext data, encrypting the master station identity plaintext data to generate the master station identity ciphertext data and sending the master station identity ciphertext data to the slave station are periodically performed.
  • the receiving of the slave station identity ciphertext data sent by the slave station, the decrypting of the slave station identity ciphertext data to generate the slave station identity plaintext data, and the execution of judging the target master are periodically performed.
  • the master station includes a master station authority token.
  • the master station authority token is the first identifier
  • the master station has the authority to execute the data transmission method.
  • the token is the second identifier
  • the master station does not have the authority to execute the data transmission method;
  • the step of generating the master station identity plaintext data further includes the step of: setting the master station authority token as the first identifier;
  • the step of sending the master station identity ciphertext data to the slave station further includes: setting the master station authority token as a second identifier.
  • the present invention also provides a field bus-based identification method, the identification method is applied to the slave station, and the identification method includes:
  • the position of each character in the master station identity ciphertext data is restored by the preset anti-encoding rule corresponding to the preset encoding rule to generate the master station identity plaintext. data.
  • the master station identity plaintext data includes a target master station identifier
  • the preset master station identity data includes a preset master station identifier, when the master station identity plaintext data and the preset master station identity When the data match, it is determined that the target master station identifier matches the preset master station identifier.
  • the identity plaintext data of the master station further includes a random code of the master station, and the random code of the master station is used for the master station to perform the identity verification of the slave station, and the confirmation of the identity verification of the master station.
  • successful steps also include:
  • the master station identity plaintext data further includes a target slave station identifier, and in the step of generating the slave station identity plaintext data according to the target master station identifier and the master station random code:
  • the master station identifier, the target slave station identifier and the master station random code generate slave station identity plaintext data.
  • the preset slave station identity data further includes a preset slave station identifier
  • the judging that the target master station identifier is consistent with the preset master station identifier further includes:
  • the target slave station identifier is consistent with the preset slave station identifier.
  • the step of generating the identity plaintext data of the slave station further comprises: updating the target slave station identifier according to the self identifier of the slave station, and the updated target slave station identifier is used for all The master station authenticates the slave station.
  • the step of receiving the master station identity ciphertext data sent by the master station includes: receiving the master station identity ciphertext data sent by the master station multiple times, and judging whether there is a first one in the multiple received data. If the data of the preset number of times is inconsistent with other data, if yes, generate the master station identity error message, if not, execute the step of decrypting the master station identity ciphertext data to obtain the master station identity plaintext data.
  • the step of sending the slave station identity ciphertext data to the master station sending the slave station identity ciphertext data to the master station multiple times.
  • the step of sending the slave station identity ciphertext data to the master station includes:
  • the master station identity ciphertext data sent by the master station, decrypting the master station identity ciphertext data to obtain the master station identity plaintext data and judging whether the master station identity plaintext data is the same as the preset plaintext data. Consistent steps, and after the first confirmation that the identity verification of the master station is successful, allow to receive and process the working data sent by the master station, and after the first step of confirming that the identity verification of the master station is successful, If in the step of judging whether the master station identity plaintext data is consistent with the preset master station identity data, if the judging result is no, it is confirmed that the identity verification of the master station fails.
  • the steps of generating the slave station identity plaintext data, encrypting the slave station identity plaintext data to generate the slave station identity ciphertext data, and sending the slave station identity ciphertext data to the master station are periodically performed.
  • the slave station includes a slave station authority token, and when the slave station authority token is the second identifier, the slave station has the authority to execute the identification method, and when the slave station authority token is the second identifier When the slave station authority token is the first identifier, the slave station does not have the authority to execute the identification method;
  • the step of generating the slave station identity plaintext data further includes the step of: setting the slave station authority token as a second identifier;
  • the step of sending the slave station identity ciphertext data to the slave station further includes: setting the slave station authority token as a first identifier.
  • the invention also provides a field bus-based data transmission system, the data transmission system is applied in the master station, and the data transmission system includes: a master station identity data generation module, a master station identity data encryption module and a master station identity data sending module;
  • the master station identity data generation module is used to generate the master station identity plaintext data
  • Described master station identity data encryption module and is used for encrypting described master station identity plaintext data to generate master station identity ciphertext data, and described master station identity ciphertext data is used for slave station to carry out identity verification to described master station;
  • the master station identity data sending module is configured to send the master station identity ciphertext data to the slave station.
  • the invention also provides a field bus-based identity recognition system, the identity recognition system is applied to the slave station, and the identity recognition system includes: a master station identity data receiving module, a master station identity data decryption module and a master station identity Data judgment module;
  • the master station identity data receiving module is used for receiving the master station identity ciphertext data sent by the master station;
  • the master station identity data decryption module is used to decrypt the master station identity ciphertext data to obtain the master station identity plaintext data;
  • the master station identity data verification module is used for judging whether the master station identity plaintext data is consistent with the preset master station identity data, and if so, confirming that the master station's identity verification is successful.
  • the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the above-mentioned data transmission method and identity recognition method.
  • the positive improvement effect of the present invention is: in the present invention, on the basis of the original communication data between the master station and the slave station, the master station identity plaintext data is separately generated and the data is encrypted for identification between the master station and the slave station. Verification, after the slave station receives the encrypted data sent by the master station, only after the data decryption is successful and the data verification is successful, the master station can obtain the authority to communicate with the slave station normally, because the master station identity plaintext data generated separately For working data, the data occupies a small space. Therefore, the security of data transmission between the master and slave stations is greatly increased without affecting the normal communication efficiency between the master station and the slave station.
  • Figure 1 is a schematic diagram of the system architecture of the SCADA system.
  • Figure 2 is a schematic diagram of the field bus system architecture of the industrial control system.
  • FIG. 3 is a flowchart of a field bus-based identification method according to Embodiment 1 of the present invention.
  • FIG. 4 is a schematic diagram of the format of the master station identity plaintext data in Embodiment 1.
  • FIG. 4 is a schematic diagram of the format of the master station identity plaintext data in Embodiment 1.
  • FIG. 5 is a flowchart of an implementation manner of step 104 in Embodiment 1. As shown in FIG.
  • FIG. 6 is a flowchart of a field bus-based identification method according to Embodiment 2 of the present invention.
  • FIG. 7 is a schematic flowchart of a fieldbus-based identification method in a specific scenario of Embodiment 2.
  • FIG. 7 is a schematic flowchart of a fieldbus-based identification method in a specific scenario of Embodiment 2.
  • FIG. 8 is a schematic block diagram of a field bus-based identification system according to Embodiment 3 of the present invention.
  • FIG. 9 is a schematic block diagram of a field bus-based identification system according to Embodiment 4 of the present invention.
  • FIG. 10 is a schematic diagram of a module of an electronic device according to Embodiment 5 of the present invention.
  • This embodiment provides a data transmission method based on a field bus.
  • the data transmission method is applied in the master station. As shown in FIG. 3 , the data transmission method includes:
  • Step 101 generating the master station identity plaintext data.
  • the master station identity plaintext data is data different from other data (herein referred to as working data), and the master station identity plaintext data is independently extracted data for the slave station to authenticate the master station.
  • the master station identity plaintext data has multiple implementation manners.
  • the master station identity plaintext data includes the target master station identifier, and in another implementation manner, the master station identity plaintext data includes the target station identifier. The master station identifier and the target slave station identifier.
  • the master station identity plaintext data includes the master station identifier and the master station random code.
  • the master station identity plaintext data includes the target master station. Identifier, target slave station identifier and master station random code.
  • the master station identity plaintext data includes the target slave station identifier, and in an implementation manner, the master station identity plaintext data includes the master station random code. .
  • the master station identity plaintext data includes a target master station identifier, a target slave station identifier and a random code of the master station as an example.
  • Figure 4 shows a format diagram of the master station identity plaintext data under a specific embodiment, specifically, the master station identity plaintext data includes the target master station identifier B01, and its data length is X bit (bit); The slave station identifier B02, the data length is Y bits; the master station random code B03, the data length is Z bits. According to the number of master stations and slave stations of the fieldbus and the requirements of different applications, the data lengths of X, Y and Z can be set arbitrarily.
  • the target master station identifier B01 is the data agreed between the master station and the slave station, and the master station random code B03 is randomly generated data.
  • the target slave station identifier B02 is the agreed data between the master station and the slave station, and is mutually stored in the master station and the slave station; in the second scenario, the target slave station identifier B02 is randomly generated. data.
  • the implementation manner of the master station identity plaintext data is not limited to the above manner, which can be selected according to the actual situation.
  • the master station can randomly generate the target slave station identifier, which improves the generation speed of identity plaintext data, and further improves the efficiency of the data transmission method in this embodiment.
  • the target slave station identifier is generated for the slave station to further verify the identity of the master station, thereby further improving the security of data transmission between the master and slave stations.
  • Step 102 Encrypt the master station identity plaintext data to generate the master station identity ciphertext data.
  • the encryption algorithm in the prior art can be used to encrypt the master station plaintext data, such as DES (Data Encryption Standard Algorithm), 3DES (Triple Data Encryption Standard Algorithm), IDEA (International Data Encryption Algorithm), AES (Auxiliary Encoder System Algorithm), RC (Rivest Code an encryption algorithm) and other symmetric encryption algorithms or RSA (a public key encryption algorithm), DSA (Digital Signature Algorithm), Diffie - Asymmetric encryption algorithms such as Hellman (a method of ensuring the safe passage of shared keys across insecure networks).
  • the processors of the master station and the slave station are mostly embedded chips with a main frequency of 100 MHz, their computing processing capabilities are limited, and the execution cycle of all tasks is generally about 1 to 20 milliseconds, including processing data acquisition, data calculation, Data communication, sequential logic, control algorithm and fault protection and other more complex work have high real-time requirements.
  • the communication speed of the field bus device of the industrial control system is generally 100kbit/s (kilobits per second) ⁇ 12Mbit/s, and it is generally required to complete the communication data processing between the master and slave stations within a task cycle.
  • the communication data encryption algorithm with high confidentiality whether it is the aforementioned symmetric encryption algorithm or asymmetric encryption algorithm, the amount of calculation required is very large, and currently it is mostly used in occasions where the real-time requirement of communication data is not high. If the above-mentioned encryption algorithm is used to complete the data encryption and decryption of communication authentication within the embedded chip task cycle of 1 to 20 milliseconds, it will occupy a lot of time resources of the embedded chip, resulting in that the execution of all tasks cannot be completed within the execution cycle. In the end, it seriously affects the real-time performance of the communication, monitoring, sequential logic and control between the master station and the slave station based on the field bus of the industrial control system, and cannot meet the control requirements of the fan unit.
  • a preset encoding rule with a relatively simple amount of calculation is preferentially selected to encrypt the plaintext data of the master station to overcome the defects of large amount of calculation and time-consuming calculation, and at the same time to improve the security of data transmission, ensure the safety of data transmission.
  • the preset coding rules are used to rearrange the positions of each character in the master station identity plaintext data to generate the master station identity ciphertext data. For example, each character in the random code of the master station can be inserted into the respective characters of the target master station identifier and the target slave station identifier to change the positional relationship between the characters in the master station identity plaintext data.
  • the sequence of each character in the identifier of the target master station, the identifier of the target slave station and the random code of the master station may be disrupted.
  • preset coding rules are only used as an example, and should not be a limitation to this embodiment. In practice, there may be other ways to rearrange the positions of each character in the master station identity plaintext data to generate the master station identity password. text data.
  • the communication between the master station and the slave station is in plain text, it is easy for the saboteur to masquerade as the slave station that the master station needs to communicate with to receive the data sent by the master station to monitor and steal the data. .
  • the slave station can continue to receive and parse the work sent by the master station only after decrypting the master station identity ciphertext data and the decryption is successful. data, thereby improving the security of communication between the master station and the slave station.
  • the identity plaintext data of the master station can be encrypted through a simple preset coding rule, thereby not only improving the security of the communication process between the master station and the slave station, but also ensuring the communication process between the master station and the slave station. real-time.
  • the master station identity plaintext data setting rules are simple, the data length is small, and the required resources are limited, so the processing of working data will not be affected while ensuring the security of the master-slave communication process.
  • Step 103 Send the master station identity ciphertext data to the slave station.
  • the master station can either broadcast the master station identity ciphertext data to all slave stations by broadcasting, or send the master station identity ciphertext data to the corresponding slave stations by one-to-one broadcasting.
  • step 103 includes sending the master station identity ciphertext data multiple times.
  • the sending times can be set according to actual needs, such as 10 times.
  • the master station identity plaintext data is separately generated and encrypted for identity verification between the master station and the slave station, and the slave station receives the master station.
  • the master station can obtain the authority to communicate with the slave station normally only after the data is decrypted successfully and the data is verified successfully. Occupy small space, therefore, under the premise of not affecting the normal communication efficiency between the master station and the slave station, the security of data transmission between the master and slave stations is greatly increased.
  • the identity ciphertext data of the master station can be sent to the slave stations for many times, thereby avoiding the failure of authentication between the master and slave stations due to network reasons, and further enhancing the security of data communication between the master and slave stations.
  • the master station can also receive the identity ciphertext data sent by the slave station to verify the identity of the slave station.
  • the steps Post-103 can also include:
  • Step 104 Receive the slave station identity ciphertext data sent by the slave station.
  • the method for receiving the slave station identity ciphertext data may refer to the method for receiving the master station identity ciphertext data sent by the master station in step 201 in Embodiment 2 below, which will not be repeated here.
  • Step 105 Decrypt the ciphertext data of the slave station identity to generate the plaintext data of the slave station identity.
  • the method for decrypting the ciphertext data of the identity of the slave station by the slave station may refer to the method of decrypting the ciphertext data of the identity of the master station in step 202 in Embodiment 2, which will not be repeated here.
  • Step 106 determine whether the plaintext data of the slave station identity is consistent with the preset slave station identity data, if yes, go to step 107 , if not, go to step 108 .
  • Step 107 Confirm that the identity verification of the slave is successful.
  • Step 108 Confirm that the authentication of the slave station fails.
  • the specific verification method in step 106 is to determine whether the target master station identifier is the same as the preset identifier. If the identity data of the master station is consistent, if yes, go to step 107, if not, go to step 108.
  • the specific verification method in step 106 is to determine whether the target master station identifier is the same as the target master station identifier.
  • the preset master station identity data is consistent, and it is judged whether the target slave station identifier is consistent with the preset slave station identity data.
  • the specific verification method in step 106 is to determine whether the target master station identifier is the same as the predetermined one. It is assumed that the identity data of the master station is consistent, and it is judged whether the master station random code obtained after decryption is consistent with the master station random code generated in step 101, if the judgment results of both are yes, then execute step 107, if not, execute step 107 Step 108.
  • the specific verification method in step 106 is to judge the target master station. Whether the station identifier is consistent with the preset master station identity data, determine whether the target slave station identifier is consistent with the preset slave station identity data, and determine whether the master station random code obtained after decryption is the same as the master station random code generated in step 101. If the result of the three judgments is yes, then go to step 107; if not, go to step 108.
  • step 105 if the decryption is not successful in step 105, or if the plaintext data of the slave station identity in step 106 is inconsistent with the preset slave station identity data, the slave station is considered to be an unsafe master station, and the communication between the master station and the slave station is prohibited. Communication, you can further generate slave station authentication error information and prompt relevant personnel to deal with it.
  • the master station can verify the slave station only through the target master station identifier obtained after decryption, which improves the verification speed and enhances the security of data transmission between the master and slave stations.
  • the master station can further verify the slave station through the target slave station identifier obtained after decryption, thereby further improving the security of data transmission between the master and slave stations.
  • the master station may further verify the slave station through the random code of the master station that is randomly generated before the master station, thereby further increasing the reliability and security of data transmission between the master and slave stations.
  • step 104 may specifically include:
  • Step 1041 Determine whether the slave station identity ciphertext data sent by the slave station is received within the first time threshold range, if not, go to step 1042, if yes, go to step 105.
  • Step 1042 Generate slave processing timeout information.
  • the master station if it does not receive the slave station identity ciphertext data sent by the slave station within the range of the first time threshold, it generates slave station processing timeout information, which can be used to remind relevant personnel to process, so as to strengthen the Communication security and at the same time guarantee the efficiency of authentication between master and slave stations.
  • the master station authority token may also be preset in the master station.
  • the master station authority token is the first identifier, the master station has the authority to execute the data transmission method.
  • the master station does not have the authority to execute the data transmission method, and at the same time or before the generation of the master station identity plaintext data in step 101, it may further include the step of setting the master station authority token as the first identifier .
  • step of setting the master station authority token as the second identifier may be further included at the same time as or before the sending of the master station identity plaintext data in step 103 .
  • the step 104 of receiving the slave station identity ciphertext data may further include the step of setting the master station authority token as the first identifier.
  • the operation authority of the master station can be modified by modifying the authority token of the master station. It should be understood that at the same time, only one of the master station and the slave station has the operation authority. By modifying the authority token, the master station can be avoided. The station and the slave station process the identity data of the master station and the slave station at the same time to ensure the synchronization of the identity-related data in the master station and the slave station, and further ensure that the identification process between the master station and the slave station can be carried out effectively.
  • steps 101 to 108 may be performed periodically, and within a preset time range, such as 24 hours, 48 hours, etc., the third
  • the data transmission authority of the slave is enabled, that is, the master is allowed to receive the working data sent by the corresponding slave and the master is allowed to further process the working data sent by the slave.
  • steps 101 to 108 are executed in the subsequent cycle, if in the verification process of step 106, the identity verification of the slave station fails, the data transmission authority of the slave station is closed, that is, the master station is forbidden to receive and process the transmission from the slave station. work data.
  • the ciphertext data of the slave station may be decrypted in multiple cycles in subsequent cycles. For example, only 10% of the data is decrypted in the second cycle, and then 10% of the data is decrypted in the third cycle. 20% of the data, and then decrypt 20% of the data in the fourth cycle.
  • the normal data processing between the master station and the slave station is still maintained.
  • the slave station ciphertext data After the overall decryption is completed, the decrypted plaintext data of the slave station is verified.
  • segmental verification can also be performed in the process of decrypting the slave station ciphertext data. 10 out of 10.
  • the first scenario if the overall verification of the plaintext data of the slave fails, it is considered that the authentication of the slave fails.
  • the second scenario when the decrypted part of the data fails to be verified, it is considered that the slave The authentication of the station failed.
  • the data transmission authority of the slave station is enabled. After the data transmission authority of the slave station to the master station is enabled, the slave station can continue to send working data to the master station. During this period, the data transmission authority of the slave station will be closed only when the authentication of the slave station fails in the verification process of the subsequent cycle. In this way, it can be guaranteed that after the first verification is successful, The normal data transmission between the master station and the slave station is not affected, that is, the efficiency and real-time performance of normal data transmission will not be affected while ensuring the security of data transmission.
  • This embodiment provides a field bus-based identification method.
  • the identification method is applied to a slave station. As shown in FIG. 6 , the identification method includes:
  • Step 201 Receive the master station identity ciphertext data sent by the master station.
  • the master station identity ciphertext data received in step 201 is the data sent by the master station in step 103 in Embodiment 1.
  • the master station identity ciphertext data sent by the master station may be received multiple times, and it is determined whether there is a first preset number of data in the multiple received data that is inconsistent with other data If yes, generate the master station identity error message, if not, go to step 202. After the identity error information is generated, the relevant personnel can be reminded to check the network situation through the information, so as to avoid affecting the identity verification between the master and slave stations due to network reasons.
  • the first preset number of times can be set according to the actual situation. Specifically, the first preset number of times can be set in proportion to the number of times sent in step 103 in Embodiment 1. For example, the first preset number of times can be set to 1 -0.7*The number of times of the above-mentioned sending, the coefficient 0.7 here is just for illustration, and the specific setting can be arbitrarily selected according to the actual situation, such as 0.6, 0.8, 0.9 and so on.
  • the authentication failure between the master and slave stations due to network reasons is avoided, and the communication between the master and slave stations is further strengthened. security of data communication between them.
  • Step 202 Decrypt the master station identity ciphertext data to obtain the master station identity plaintext data.
  • a decryption method corresponding to the encryption method in step 102 in Embodiment 1 is used to decrypt the master station identity ciphertext data.
  • step 202 adopts the preset reverse encoding corresponding to the preset encoding rule The encoding rule restores the position of each character in the master station identity ciphertext data to generate the master station identity plaintext data.
  • master station identity plaintext data For the master station identity plaintext data, reference may be made to the master station identity plaintext data generated in step 101 in Embodiment 1, which will not be repeated here.
  • Step 203 Determine whether the master station identity plaintext data is consistent with the preset master station identity data, if yes, go to step 204, if not, go to step 205.
  • Step 204 Confirm that the identity verification of the master station is successful.
  • Step 205 Confirm that the identity verification of the master station fails, and the process ends.
  • the slave station after confirming that the identity verification of the master station is successful in step 204, the slave station can be allowed to receive and parse the working data sent by the corresponding master station. In other words, the corresponding master station thus obtains the authority to conduct data communication with the slave station. .
  • step 202 if the decryption is not successful in step 202, or the master station identity plaintext data in step 203 is inconsistent with the preset master station identity data, the master station is considered to be an unsafe master station, and the communication between the master station and the slave station is prohibited. Communication, you can further generate the master station authentication error message and prompt the relevant personnel to deal with it.
  • step 203 may specifically determine whether the target master station identifier is consistent with the preset master station identity data, and if so, execute step 204, if If not, step 205 is executed.
  • step 203 specifically can judge whether the target slave station identifier is consistent with the preset master station identity data while judging whether the target slave station identifier is consistent with the preset master station identity data.
  • the preset identity data of the slave stations are consistent. If the above judgment results are all yes, then step 204 is executed, and if any one of the judgment results is negative, step 205 is executed.
  • the slave station can only verify the master station through the target master station identifier obtained after decryption, which improves the verification speed and enhances the security of data transmission between the master and slave stations.
  • the slave station can further verify the master station through the target slave station identifier obtained after decryption, thereby further improving the security of data transmission between the master and slave stations.
  • the slave station can generate slave station identity ciphertext data for the master station to verify the identity of the slave station.
  • Step 204 and 205 Can further include:
  • Step 206 Generate the slave station identity plaintext data.
  • the plaintext data of the identity of the slave is data different from other data (referred to as working data in the text), and the plaintext data of the identity of the slave is the data extracted independently and used for the identity verification of the slave by the master.
  • the slave station identity plaintext data has various implementation manners, and the specific implementation manner may refer to the implementation manner of the master station plaintext data in Embodiment 1, which will not be repeated here.
  • the slave station identity plaintext data includes the target master station identifier, the target slave station identifier and the master station random code as an example.
  • the slave station identifier received by the master station, the target slave station identifier and the master station random code received from the master station are used to generate the slave station identity plaintext data.
  • the target slave station identifier in the master station identity plaintext data in Embodiment 1 is the target slave station identifier pre-agreed with the slave station
  • the target slave station identifier received from the master station can be Target Slave Identifier to generate Slave Identity clear text data.
  • the target slave station identifier in the master station identity plaintext data in Example 1 is a randomly generated target slave station identifier
  • the target slave station identifier is updated by the self identifier of the slave station Slave identifier, and generate slave identity plaintext data according to the updated target slave identifier.
  • the slave station plaintext data for verifying the identity of the slave station can be generated, thereby improving the identity recognition in this embodiment.
  • the security of data transmission between the master and slave stations is improved.
  • Step 207 Encrypt the slave station identity plaintext data to generate the slave station identity ciphertext data.
  • the method for encrypting the plaintext data of the identity of the slave station refers to the method for encrypting the plaintext data of the identity of the master station in step 102 in Embodiment 1, which will not be repeated here.
  • Step 208 Send the slave station identity ciphertext data to the master station.
  • the method for sending the ciphertext data of the identity of the slave may refer to the method for sending the ciphertext data of the identity of the master in step 103 in Embodiment 1, which will not be repeated here.
  • the slave station may also preset a slave station authority token.
  • the slave station authority token is the second identifier
  • the slave station has the authority to execute the identification method.
  • the slave station does not have the authority to execute the identification method, and at the same time or before receiving the master station identity plaintext data in step 201, it may further include setting the slave station authority token as the second identification. character steps.
  • the step 208 of receiving the master station identity ciphertext data may further include a step of setting the slave station authority token as the second identifier.
  • the operation authority of the slave station can be modified by modifying the authority token of the slave station.
  • only one of the master station and the slave station has the operation authority.
  • the master station and the slave station can be avoided.
  • the slave station processes the identity data of the master station and the slave station identity data to ensure the synchronization of the identity-related data between the master station and the slave station, and further ensure that the identification process between the master and slave stations can be carried out effectively.
  • steps 201 to 208 may be performed periodically, and within a preset time range, such as 24 hours, 48 hours, etc., the first After the verification of step 203 confirms that the identity verification of the master station is successful, the data transmission authority of the master station is opened, that is, the slave station is allowed to receive the working data sent by the corresponding master station and the slave station is allowed to further process the working data sent by the master station. .
  • steps 201 to 208 are executed in the subsequent cycle, if in the verification process of step 203, after it is confirmed that the identity verification of the master station fails, the data transmission authority of the slave station is closed, that is, the slave station is prohibited from receiving and processing the transmission of the master station. work data.
  • the master station ciphertext data may be decrypted in multiple cycles in subsequent cycles. For example, only 10 percent of the data is decrypted in the second cycle, and 10 percent of the data is decrypted in the third cycle. Of the 20 percent of the data, decrypt 20 percent of the data in the fourth cycle.
  • the normal data processing between the master station and the slave station is still maintained.
  • the master station ciphertext After the data is decrypted as a whole, the decrypted plaintext data of the master station is verified.
  • segmental verification can also be performed during the process of decrypting the master station ciphertext data. For example, 10% decryption means verification.
  • the data transmission authority of the master station is enabled. After the data transmission authority of the master station to the slave station is enabled, the master station can continue to send working data to the slave station. , during this period, the data transmission authority of the master station will be closed only when the authentication of the master station fails in the verification process of the subsequent cycle. In this way, it can be guaranteed that after the first verification is successful, The normal data transmission between the master station and the slave station is not affected, that is, the efficiency of normal data transmission will not be affected while ensuring the security of data transmission.
  • the identity of the master station is verified through steps 201 to 205. If the judgment result of whether the verification is valid is yes, then the authentication timer is +1. It should be understood that the default value of the authentication timer can be preset according to actual needs.
  • the first identity verification operation of the station specifically, steps 202 and 203 are executed, and then the result of the completion of the first identity verification operation is judged. If the judgment result is yes, it is further judged whether the first identity verification is passed, and if the first identity verification operation is completed If the judgment result is no, the process ends. There may be network or other faults. At this time, relevant personnel can be notified for processing.
  • the authentication timer is cleared and the first authentication flag is set to 1. After that, other tasks can be performed, such as receiving and parsing the working data transmitted by the master station. It should be understood that each time If the interval is preset time, it will return again to determine whether the first authentication flag is valid or not, and the round-robin verification has been carried out.
  • step 201-step 205 can be performed again to perform the identity verification operation on the master and slave stations.
  • the slave station verifies the identity of the master station. Through, in the process of verifying the identity of the master station in the subsequent cycle (that is, when the judgment result of whether the authentication operation is completed is no), the slave station can still perform other tasks for normal data communication.
  • the judgment result of whether the operation is completed is yes, it is further judged whether the non-first-time authentication has passed. If so, it is considered that the master has passed the authentication, the authentication timer is cleared, and the slave can continue to perform other tasks. If it is not the first time The result of whether the authentication is passed is no, then an authentication error is reported and the communication is interrupted.
  • This embodiment provides a data transmission system based on a field bus.
  • the data transmission system is applied to the master station.
  • the data transmission system includes: a master station identity data generation module 301 and a master station identity data encryption module 302 and the master station identity data sending module 303.
  • the master station identity data generating module 301 is used to generate the master station identity plaintext data.
  • the master station identity plaintext data is data different from other data (herein referred to as working data), and the master station identity plaintext data is independently extracted data for the slave station to authenticate the master station.
  • the master station identity plaintext data has multiple implementation manners.
  • the master station identity plaintext data includes the target master station identifier, and in another implementation manner, the master station identity plaintext data includes the target station identifier. The master station identifier and the target slave station identifier.
  • the master station identity plaintext data includes the master station identifier and the master station random code.
  • the master station identity plaintext data includes the target master station. Identifier, target slave station identifier and master station random code.
  • the master station identity plaintext data includes the target slave station identifier, and in an implementation manner, the master station identity plaintext data includes the master station random code. .
  • FIG. 4 shows a format diagram of the master station identity plaintext data in a specific implementation manner.
  • the specific master station identity plaintext data format refer to the format of the master station plaintext data in Embodiment 1, and here is the No longer.
  • the target master station identifier B01 is the data agreed between the master station and the slave station, and the master station random code B03 is randomly generated data.
  • the target slave station identifier B02 is the agreed data between the master station and the slave station, and is mutually stored in the master station and the slave station; in the second scenario, the target slave station identifier B02 is randomly generated. data.
  • the implementation manner of the master station identity plaintext data is not limited to the above manner, which can be selected according to the actual situation.
  • the master station identity data generation module 301 can randomly generate the target slave station identifier, which improves the generation speed of the identity plaintext data and further improves the efficiency of the data transmission system in this embodiment.
  • the station identity data generating module 301 can generate a target slave station identifier for the slave station to further verify the identity of the master station through the pre-appointment between the master station and the slave station, thereby further improving the security of data transmission between the master station and the slave station.
  • the master station identity data encryption module 302 is used for encrypting the master station identity plaintext data to generate the master station identity ciphertext data.
  • the master station identity data encryption module 302 can use various methods to encrypt the master station identity plaintext data, for example, the encryption algorithm in the prior art can be used to encrypt the master station plaintext data, such as DES, 3DES, IDEA, AES, RC, etc. Symmetric encryption algorithm or asymmetric encryption algorithm such as RSA, DSA, Diffie-Hellman, etc.
  • the processors of the master station and the slave station are mostly embedded chips with a main frequency of 100 MHz, their computing processing capabilities are limited, and the execution cycle of all tasks is generally about 1 to 20 milliseconds, including processing data acquisition, data calculation, Data communication, sequential logic, control algorithm and fault protection and other more complex work have high real-time requirements.
  • the communication speed of the field bus device of the industrial control system is generally 100kbit/s (kilobits per second) ⁇ 12Mbit/s, and it is generally required to complete the communication data processing between the master and slave stations within a task cycle.
  • the communication data encryption algorithm with high confidentiality whether it is the aforementioned symmetric encryption algorithm or asymmetric encryption algorithm, the amount of calculation required is very large, and currently it is mostly used in occasions where the real-time requirement of communication data is not high. If the above-mentioned encryption algorithm is used to complete the data encryption and decryption of communication authentication within the embedded chip task cycle of 1 to 20 milliseconds, it will occupy a lot of time resources of the embedded chip, resulting in that the execution of all tasks cannot be completed within the execution cycle. In the end, it seriously affects the real-time performance of the communication, monitoring, sequential logic and control between the master station and the slave station based on the field bus of the industrial control system, and cannot meet the control requirements of the fan unit.
  • the master station identity data encryption module 302 preferentially selects a preset encoding rule with a relatively simple amount of calculation to encrypt the plaintext data of the master station to overcome the defects of large amount of calculation and time-consuming calculation, thereby improving the security of data transmission.
  • the preset encoding rules are used to rearrange the positions of each character in the master station identity plaintext data to generate the master station identity ciphertext data. For example, each character in the random code of the master station can be inserted into the respective characters of the target master station identifier and the target slave station identifier to change the positional relationship between the characters in the master station identity plaintext data.
  • the sequence of each character in the identifier of the target master station, the identifier of the target slave station and the random code of the master station may be disrupted.
  • preset coding rules are only used for illustration, and should not be a limitation to this embodiment. In practice, there may be other ways to rearrange the position of each character in the master station identity plaintext data to generate the master station identity password. text data.
  • the master station plaintext data generation module sets separate master station identity plaintext data
  • the master station identity data encryption module 302 encrypts the identity plaintext data
  • the slave station only decrypts the master station identity ciphertext data and Only after the decryption is successful, can the working data sent by the master station be continued to be received and analyzed, thereby improving the security of the communication between the master station and the slave station.
  • the master station identity data encryption module 302 can encrypt the master station identity plaintext data through a simple preset encoding rule, thereby not only improving the security of the communication process between the master station and the slave station, but also ensuring the master station The real-time nature of the communication process with the slaves.
  • the master station identity data generation module 301 has simple rules for setting the master station identity plaintext data, the data length is small, and the required resources are limited, so while ensuring the security of the master-slave communication process, it will not affect the work processing of data.
  • the master station identity data sending module 303 is used for sending the master station identity ciphertext data to the slave station.
  • the master station identity data sending module 303 can either broadcast the master station identity ciphertext data to all the slave stations by broadcasting, or send the master station identity ciphertext data to the corresponding slave stations by one-to-one broadcasting.
  • the master station identity data sending module 303 is used to send multiple times
  • the master station identity ciphertext data is sent to the slave station, and the number of times of sending can be set according to actual needs, such as 10 times.
  • the master station identity data generation module 301 separately generates the master station identity plaintext data and encrypts the data through the master station identity data encryption module 302 to It is used for authentication between the master and slave stations.
  • the master station can obtain the permission to communicate with the slave station normally. Since the separately generated master station identity plaintext data occupies a small space for the working data, it greatly increases the data transmission between the master station and the slave station without affecting the normal communication efficiency between the master station and the slave station. security.
  • the master station identity data sending module 303 can send the master station identity ciphertext data to the slave stations for many times, so as to avoid the failure of identity verification between the master and slave stations due to network reasons, and further strengthen the data between the master and slave stations. communication security.
  • the master station can also receive the identity ciphertext data sent by the slave station to verify the identity of the slave station.
  • the data transmission system further includes a slave station.
  • the station identity data receiving module 305, the slave station identity data decryption module 306 and the slave station identity data verification module 307, the master station identity data sending module 303 is also used to send the master station identity ciphertext data to the slave station
  • the slave station identity data receiving module 305 is called.
  • the slave station identity data receiving module 305 is configured to receive the slave station identity ciphertext data sent by the slave station, wherein, the way that the slave station identity data receiving module 305 receives the slave station identity ciphertext data may refer to the following embodiment 4.
  • the manner in which the master station identity data receiving module 405 receives the master station identity ciphertext data sent by the master station will not be repeated here.
  • the slave station identity data decryption module 306 is used to decrypt the slave station identity ciphertext data to generate the slave station identity plaintext data, wherein the slave station identity data decryption module 306 decrypts the slave station identity ciphertext data.
  • the method for decrypting the master station identity ciphertext data in the master station identity data decryption module 406 in step 4 will not be repeated here.
  • the slave station identity data verification module 307 is used to judge whether the slave station identity plaintext data is consistent with the preset slave station plaintext data, if so, confirm that the slave station's identity verification is successful; Authentication failed.
  • the specific verification method of the slave station identity data verification module 307 is to determine the target master station identifier Whether the character is consistent with the preset master station identity data, if so, confirm that the identity verification of the slave station is successful, if not, confirm that the identity verification of the slave station fails.
  • the specific verification method of the slave station identity data verification module 307 is to judge the target master station Whether the station identifier is consistent with the preset master station identity data, and judge whether the target slave station identifier is consistent with the preset slave station identity data, if both judgment results are yes, confirm that the identity verification of the slave station is successful , if not, confirm that the authentication of the slave has failed.
  • the slave station identity data verification module 307 specifically verifies The method is to judge whether the target master station identifier is consistent with the preset master station identity data, judge whether the target slave station identifier is consistent with the preset slave station identity data, and judge whether the master station random code obtained after decryption is generated with the master station identity data. Whether the random code of the master station generated by the module 301 is consistent, if the three judgment results are all yes, it confirms that the identity verification of the slave station is successful; if not, it confirms that the identity verification of the slave station fails.
  • the slave station identity data decryption module 306 fails to decrypt successfully, or if the slave station identity data verification module 307 judges that the slave station identity plaintext data is inconsistent with the preset slave station identity data, it is considered that the slave station is an unsafe master station, The communication between the master station and the slave station is prohibited, and the slave station authentication error message can be further generated to prompt the relevant personnel to deal with it.
  • the slave station identity data decryption module 306 can only verify the slave station through the target master station identifier obtained after decryption, which improves the verification speed and enhances the security of data transmission between the master and slave stations. In this embodiment, the slave station identity data decryption module 306 can further verify the slave station through the target slave station identifier obtained after decryption, thereby further improving the security of data transmission between the master and slave stations. In this embodiment, the slave station identity data decryption module 306 may further verify the slave station through the randomly generated master station random code previously sent by the master station, thereby further increasing the reliability and reliability of data transmission between the master and slave stations. safety.
  • the slave station identity data receiving module 305 is further configured to determine whether the slave station has received the data sent by the slave station within the first time threshold range.
  • the ciphertext data of the slave station identity if not, generate the slave station processing timeout information, if so, call the slave station identity data decryption module 306.
  • the slave station identity data receiving module does not receive the slave station identity ciphertext data sent by the slave station within the range of the first time threshold, it generates slave station processing timeout information, which can be used to remind relevant personnel to process , so as to strengthen the communication security while ensuring the efficiency of authentication between master and slave stations.
  • the master station authority token may also be preset in the master station.
  • the master station authority token is the first identifier, the master station has the authority to execute the data transmission system.
  • the master station does not have the authority to execute the data transmission system, and the data transmission system also includes the master station authority modification module 308, which is performed at the same time or before the master station identity data generation module 301 generates the master station identity plaintext data.
  • the master authority modification module 308 may be further invoked to set the master authority token to the first identifier.
  • the master authority modification module 308 may be further invoked to set the master authority token as the second identifier while or before the master station identity data sending module 303 sends the master station identity plaintext data.
  • slave station identity data receiving module 305 may further call the master station authority modification module 308 to set the master station authority token as the first identifier.
  • the master station authority modification module 308 can modify the operation authority of the master station by modifying the master station authority token. It should be understood that at the same time, only one of the master station and the slave station has the operation authority. The modification can prevent the master station and the slave station from processing the identity data of the master station and the slave station at the same time, ensure the synchronization of the identity-related data in the master station and the slave station, and further ensure the identity recognition between the master and slave stations. The process can be carried out efficiently.
  • the master station identity data generation module 301 in order to continuously ensure the security of data transmission between the master and slave stations, the master station identity data generation module 301, the master station identity data encryption module 302, the master station identity data transmission module 303, The master station identity data judgment module 304 , the slave station identity data receiving module 305 , the slave station identity data decryption module 306 , the slave station identity data verification module 307 and the master station authority modification module 308 .
  • the slave station identity data verification module 307 confirms the success of the slave station's identity verification for the first time after verification, it opens the data transmission authority of the slave station, that is, allows the master station Receive the work data sent by the corresponding slave station and allow the master station to further process the work data sent by the slave station.
  • the data transmission authority of the slave station is closed, that is, the master station is prohibited from receiving and processing the working data sent by the slave station.
  • the slave station identity data decryption module 306 may decrypt the slave station ciphertext data in multiple cycles in the following cycles. For example, in the second cycle, only 10% of the data is decrypted. In the third cycle, 20% of the data is decrypted, and in the fourth cycle, 20% of the data is decrypted. During the process of decrypting the data, the normal data processing between the master station and the slave station is still maintained. In one scenario , when the slave station identity data decryption module 306 completes the overall decryption of the slave station ciphertext data, the slave station identity data verification module 307 verifies the decrypted slave station plaintext data.
  • the slave station identity data verification The module 307 may also perform segment verification in the process of decrypting the slave station ciphertext data by the slave station identity data decryption module 306, for example, decrypting 10% means verifying 10%.
  • decrypting 10% means verifying 10%.
  • the slave station identity data verification module 307 considers that the slave station's identity verification fails.
  • the slave station's identity data verification module 307 will When the decrypted part of the data fails to be authenticated, it is considered that the authentication of the slave fails.
  • the identity data verification module 307 of the slave station enables the data transmission authority of the slave station after the first successful identity verification of the slave station. After the data transmission authority of the slave station to the master station is enabled, the slave station can Continuously send working data to the master station. During this period, only when the slave station identity data verification module 307 fails to authenticate the slave station in the verification process of the subsequent cycle, the slave station's data transmission authority will be closed. In this way, it can be ensured that after the first verification is successful, the normal data transmission between the master station and the slave station will not be affected, that is, the efficiency and real-time performance of normal data transmission will not be affected while ensuring the security of data transmission. .
  • This embodiment provides a field bus-based identification system.
  • the identification system is applied to a slave station.
  • the identification system includes: a master station identification data receiving module 405, a master station identification data decryption The module 406 and the master station identity data judgment module 304.
  • the master station identity data receiving module 405 is configured to receive the master station identity ciphertext data sent by the master station.
  • the master station identity ciphertext data received by the master station identity data receiving module 405 is the data sent by the master station identity data sending module 303 in the third embodiment.
  • the master station identity data receiving module 405 can receive the master station identity ciphertext data sent by the master station for many times, and the identity recognition system can also include the master station identity data judging module 304, which is used to judge the number of Whether there is a situation in which the data of the first preset number of times is inconsistent with other data in the data received next time, if yes, generate a master station identity error message, if not, call the master station identity data decryption module 406 .
  • the identity data receiving module 405 of the master station After the identity data receiving module 405 of the master station generates the identity error information, it can remind relevant personnel to check the network condition through the information, so as to avoid the influence of the identity verification between the master and slave stations due to network reasons.
  • the first preset number of times can be set according to the actual situation. Specifically, the first preset number of times can be set in proportion to the number of times sent by the master station identity data sending module 303 in Embodiment 3. For example, the first preset number of times can be set as The number of times is set to 1-0.7*the number of times of the above-mentioned sending.
  • the coefficient 0.7 here is just for illustration.
  • the specific setting can be arbitrarily selected according to the actual situation, such as 0.6, 0.8, 0.9 and so on.
  • the master station identity data receiving module 405 receives the master station identity ciphertext data multiple times, and judges whether the identity ciphertext data received multiple times are consistent, so as to avoid the failure of identity verification between the master and slave stations due to network reasons, It further strengthens the security of data communication between master and slave stations.
  • the master station identity data decryption module 406 is configured to decrypt the master station identity ciphertext data to obtain the master station identity plaintext data.
  • the master station identity data decryption module 406 uses a decryption method corresponding to the encryption method adopted by the master station identity data encryption module 302 in Embodiment 3 to decrypt the master station identity ciphertext data. For example, when the master station identity data encryption module 302 adopts the preset encoding rule and the preset encoding rule to rearrange the position of each character in the master station identity plaintext data to generate the master station identity ciphertext data, the master station identity data decryption module 406 adopts the Set the preset anti-encoding rule corresponding to the encoding rule to restore the position of each character in the master station identity ciphertext data to generate the master station identity plaintext data.
  • master station identity plaintext data For the master station identity plaintext data, reference may be made to the master station identity plaintext data generated by the master station identity data generating module 301 in Embodiment 3, which will not be repeated here.
  • the master station identity data verification module 407 is used to judge whether the master station identity plaintext data is consistent with the preset master station identity data. Authentication failed.
  • the slave station is allowed to receive and parse the working data sent by the corresponding master station. Permission for data communication.
  • the master station identity data decryption module 406 fails to decrypt successfully, or the master station identity data verification module 407 judges that the master station identity plaintext data is inconsistent with the preset master station identity data, the master station is considered to be an unsafe master station, Communication between the master station and the slave station is prohibited, and the master station identity data verification module 407 may further generate the master station identity verification error message and prompt the relevant personnel to deal with it.
  • the master station identity data verification module 407 can specifically determine whether the target master station identifier is consistent with the preset master station identity data, and if so, then Confirm that the identity verification of the master station is successful, if not, confirm that the identity verification of the master station fails.
  • the master station identity data verification module 407 can specifically judge whether the target master station identifier is consistent with the preset master station identity data and at the same time judge the target slave station Whether the identifier is consistent with the preset slave station identity data, if the above judgment results are all yes, it confirms that the identity verification of the master station is successful, and if any one of the judgment results is no, it confirms that the identity verification of the master station fails.
  • the master station identity data verification module 407 can only verify the master station through the target master station identifier obtained after decryption, which enhances the security of data transmission between the master and slave stations while improving the verification speed.
  • the identity data verification module 407 of the master station can further verify the master station through the target slave station identifier obtained after decryption, thereby further improving the security of data transmission between the master and slave stations.
  • the slave station can generate slave station identity ciphertext data for the master station to verify the identity of the slave station.
  • the identity recognition system may further Including: a slave station identity data generation module 401, a slave station identity data encryption module 402 and a slave station identity data sending module 403, the master station identity data verification module 407 is also used to confirm that the identity verification of the master station is successful and call the slave station identity Data generation module 401 .
  • the slave station identity data generating module 401 is used to generate the slave station identity plaintext data.
  • the plaintext data of the identity of the slave is data different from other data (referred to as working data in the text), and the plaintext data of the identity of the slave is the data extracted independently and used for the identity verification of the slave by the master.
  • the slave station identity plaintext data has multiple implementation manners, and the specific implementation manner may refer to the implementation manner of the master station plaintext data in Embodiment 3, which will not be repeated here.
  • the slave station identity plaintext data includes the target master station identifier, the target slave station identifier and the master station random code as an example.
  • the slave station The identity data generating module 401 generates the slave station identity plaintext data according to the target master station identifier received from the master station, the target slave station identifier and the master station random code received from the master station.
  • the slave station identity data generating module 401 may generate the slave station identity plaintext data according to the target slave station identifier received from the master station.
  • the target slave station identifier in the master station identity plaintext data generated by the master station identity data generation module 301 in Embodiment 3 is a randomly generated target slave station identifier, here from The station identity data generating module 401 updates the target slave station identifier according to the self identifier of the slave station, and generates the slave station identity plaintext data according to the updated target slave station identifier.
  • the slave station identity data generation module 401 can both generate an identifier for verifying the identity of the slave station.
  • the plaintext data of the slave stations thereby improving the applicability of the identity identification system in this embodiment, and improving the security of data transmission between the master and slave stations.
  • the slave station identity data encryption module 402 is used for encrypting the slave station identity plaintext data to generate the slave station identity ciphertext data, wherein the slave station identity data encryption module 402 encrypts the slave station identity plaintext data with reference to the embodiment.
  • the encryption system of the master station identity data encryption module 302 to the master station identity plaintext data in 3 will not be repeated here.
  • the slave station identity data sending module 403 is used to send the slave station identity ciphertext data to the master station, wherein, the way that the slave station identity data sending module 403 sends the slave station identity ciphertext data can be referred to in Embodiment 3 from the master station.
  • the system for sending the master station identity ciphertext data by the station identity data sending module will not be repeated here.
  • the slave station may also preset a slave station authority token.
  • the slave station authority token is the second identifier
  • the slave station has the authority to execute the identity recognition system.
  • the slave station does not have the authority to execute the identification system, and the identification system also includes a slave station authority modification module 408
  • the slave station identity data generation module 401 is further configured to call the slave station authority modification module 408 to set the slave station authority token as the second identifier.
  • the slave station identity data sending module 403 also uses to call the slave authority modification module 408 to set the slave authority token to the first identifier.
  • the slave station authority modification module 408 can modify the operation authority of the slave station by modifying the slave station authority token. It should be understood that at the same time, only one of the master station and the slave station has the operation authority. The modification can prevent the master station and the slave station from processing the identity data of the master station and the slave station at the same time, ensure the synchronization of the identity-related data in the master station and the slave station, and further ensure the identity recognition between the master and slave stations. The process can be carried out efficiently.
  • the slave station identity data generation module 401 in order to ensure the security of data transmission between the master and slave stations, the slave station identity data generation module 401, the slave station identity data encryption module 402, the slave station identity data transmission module 403, The slave station identity data judgment module 404 , the master station identity data receiving module 405 , the master station identity data decryption module 406 , the master station identity data verification module 407 and the slave station authority modification module 408 .
  • the master station identity data verification module 407 opens the master station's data transmission authority after confirming that the master station's identity verification is successful for the first time. That is, the slave station is allowed to receive the working data sent by the corresponding master station and allow the slave station to further process the working data sent by the master station.
  • the identity data verification module 407 of the master station is called for verification, if it is confirmed that the identity verification of the master station fails, the data transmission authority of the slave station is closed, that is, the slave station is prohibited from receiving and processing the working data sent by the master station.
  • the master station identity data verification module 407 may decrypt the master station ciphertext data in multiple cycles in the following cycles. For example, in the second cycle, only 10% of the data is decrypted. In the third cycle, 20% of the data is decrypted, and in the fourth cycle, 20% of the data is decrypted. In the process of decrypting the data, the normal data processing between the master station and the slave station is still maintained. In one scenario Next, the master station identity data verification module 407 verifies the decrypted master station plaintext data after the master station identity data decryption module 406 completes the overall decryption of the master station ciphertext data.
  • the station identity data decryption module 406 performs segment verification during the decryption process of the master station ciphertext data, for example, 10% decryption means 10% verification.
  • 10% decryption means 10% verification.
  • the master station identity data verification module 407 fails the overall verification of the master station plaintext data, it is considered that the master station's identity verification has failed.
  • the master station identity data verification module 407 If the decrypted part of the data fails to be authenticated, the authentication to the master station is considered to have failed.
  • the identity data verification module 407 of the master station enables the data transmission authority of the master station after the identity verification of the master station is successful for the first time. After the data transmission authority of the master station to the slave station is enabled, the master station can Continue to send working data to the slave station. During this period, only when the identity verification module 407 of the master station fails to authenticate the master station in the verification process of the subsequent cycle, the data transmission authority of the master station will be closed. In this way, it can be ensured that after the first verification is successful, the normal data transmission between the master station and the slave station will not be affected, that is, the efficiency of normal data transmission will not be affected while ensuring the security of data transmission.
  • An embodiment of the present invention provides an electronic device, which can be expressed in the form of a computing device (for example, a server device), and includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein processing When the computer executes the computer program, the Fieldbus-based data transmission method in Embodiment 1 or the Fieldbus-based identification method in Embodiment 2 of the present invention can be implemented.
  • a computing device for example, a server device
  • FIG. 10 shows a schematic diagram of the hardware structure of this embodiment.
  • the electronic device 9 specifically includes:
  • At least one processor 91 at least one memory 92, and a bus 93 for connecting different system components (including processor 91 and memory 92), wherein:
  • the bus 93 includes a data bus, an address bus and a control bus.
  • Memory 92 includes volatile memory, such as random access memory (RAM) 921 and/or cache memory 922 , and may further include read only memory (ROM) 923 .
  • RAM random access memory
  • ROM read only memory
  • the memory 92 also includes a program/utility 925 having a set (at least one) of program modules 924 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, examples of which are Each or some combination of these may include an implementation of a network environment.
  • program modules 924 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, examples of which are Each or some combination of these may include an implementation of a network environment.
  • the processor 91 executes various functional applications and data processing by running the computer program stored in the memory 92, such as the field bus-based data transmission method in the first embodiment of the present invention or the field bus-based identification method in the second embodiment of the present invention. .
  • the electronic device 9 may further communicate with one or more external devices 94 (eg, keyboards, pointing devices, etc.). Such communication may take place through input/output (I/O) interface 95 . Also, the electronic device 9 may communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN), and/or a public network such as the Internet) through a network adapter 96 . The network adapter 96 communicates with other modules of the electronic device 9 via the bus 93 .
  • I/O input/output
  • networks eg, a local area network (LAN), a wide area network (WAN), and/or a public network such as the Internet
  • the network adapter 96 communicates with other modules of the electronic device 9 via the bus 93 .
  • An embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the field bus-based data transmission method in Embodiment 1 of the present invention or the field-based data transmission method in Embodiment 2 of the present invention The steps of the bus identification method.
  • the readable storage media may include, but are not limited to, portable disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical storage devices, magnetic storage devices, or any of the above suitable combination.
  • the present invention can also be implemented in the form of a program product, which includes program codes, when the program product runs on a terminal device, the program code is used to cause the terminal device to execute the implementation The steps of the field bus-based data transmission method in the first embodiment of the present invention or the field bus-based identification method in the second embodiment of the present invention.
  • the program code for executing the present invention can be written in any combination of one or more programming languages, and the program code can be completely executed on the user equipment, partially executed on the user equipment, as an independent
  • the software package executes on the user's device, partly on the user's device, partly on the remote device, or entirely on the remote device.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Small-Scale Networks (AREA)

Abstract

Disclosed in the present invention are a field bus-based data transmission method and system, a field bus-based identity verification method and system, a device, and a medium. The data transmission method comprises: generating master station identity plaintext data; encrypting the master station identity plaintext data to generate master station identity ciphertext data; and sending the master station identity ciphertext data to a slave station. In the present invention, on the basis of original communication data of a master station and the slave station, the master station identity plaintext data is independently generated and encrypted for identity verification between the master station and the slave station, after the slave station receives the encrypted data sent by the master station, the master station can obtain a permission of normal communication with the slave station only after the data is successfully decrypted and verified, and since the independently generated master station identity plaintext data occupies a small space for working data, the security of data transmission between the master station and the slave station is greatly improved on the premise of not influencing the normal communication efficiency between the master station and the slave station.

Description

基于现场总线的数据传输方法、身份识别方法及系统Fieldbus-based data transmission method, identification method and system
本申请要求申请日为2020/11/25的中国专利申请2020113428978的优先权。本申请引用上述中国专利申请的全文。This application claims the priority of Chinese patent application 2020113428978 with an application date of 2020/11/25. This application cites the full text of the above Chinese patent application.
技术领域technical field
本发明涉及数字安全技术领域,特别涉及一种基于现场总线的数据传输方法、身份识别方法、系统、设备及介质。The invention relates to the technical field of digital security, in particular to a field bus-based data transmission method, an identification method, a system, equipment and a medium.
背景技术Background technique
现场总线以分布式、开放、互联、高可靠性和低成本的特点广泛地应用于工业控制系统中,例如在风电场控制系统中,通常使用现场总线以实现工业控制系统中各部件之间及场站级监控中心与风机机组之间的控制、监测和通讯作用。在一般的基于现场总线的工业控制系统中,具有数据处理速度较慢、实时性要求高的特点。Fieldbus is widely used in industrial control systems with the characteristics of distribution, openness, interconnection, high reliability and low cost. For example, in wind farm control systems, fieldbuses are usually used to achieve the Control, monitoring and communication between the station-level monitoring center and the fan unit. In the general industrial control system based on field bus, it has the characteristics of slow data processing speed and high real-time requirements.
图1示出了(SupervisoryControlAndDataAcquisition检测控制和数据采集)系统构架示意图,SCADA系统是一种分布式远程计算机控制系统,主要用来测量和控制分布范围比较广的设备,对其生产过程进行监控。如图1所示,风场与场站级集中监控中心、场站级集中监控中心与总部级远程监控中心可以互为主站与从站通过现场总线进行通讯以传输数据,Figure 1 shows a schematic diagram of the (SupervisoryControlAndDataAcquisition detection control and data acquisition) system architecture. The SCADA system is a distributed remote computer control system, which is mainly used to measure and control equipment with a wide distribution range and monitor its production process. As shown in Figure 1, the wind farm and the site-level centralized monitoring center, the site-level centralized monitoring center and the headquarters-level remote monitoring center can communicate with each other through the field bus between the master station and the slave station to transmit data.
但是现场总线的协议标准是公开的,其主站与从站设备之间为明文通讯,有可能会发生主从站身份伪装,进而发生数据被窃取、篡改、伪装成合法信息等情况,对风机系统的安全运行造成非常大的威胁。图2示出了工业控制系统的现场总线系统构架示意图所示,其中,监听/破坏者可能会伪装成某一从站节点或者伪装成主站,对主站与从站的正常传输进行破坏,而现有的数据传输方式难以保证主站与从站之间能够进行安全的数据传输。However, the protocol standard of the fieldbus is open, and the communication between the master station and the slave station equipment is in plain text, and the identity of the master and slave stations may be disguised, and then data will be stolen, tampered, disguised as legal information, etc. The safe operation of the system poses a very big threat. Figure 2 shows the schematic diagram of the fieldbus system architecture of the industrial control system, in which the listener/destroyer may disguise as a slave node or disguise as the master to destroy the normal transmission between the master and the slave. However, the existing data transmission methods are difficult to ensure safe data transmission between the master station and the slave station.
发明内容SUMMARY OF THE INVENTION
本发明要解决的技术问题是为了克服现有技术中通过现场总线进行数据传输时难以保证主站与从站间数据传输的安全性的缺陷,提供一种能够提高主站与从站间数据传输的安全性的基于现场总线的身份识别方法、数据传输方法、系统、设备及介质。The technical problem to be solved by the present invention is to overcome the defect in the prior art that it is difficult to ensure the safety of data transmission between the master station and the slave station when performing data transmission through the field bus, and to provide a method that can improve the data transmission between the master station and the slave station. Fieldbus-based identification method, data transmission method, system, device and medium for security.
本发明是通过下述技术方案来解决上述技术问题:The present invention solves the above-mentioned technical problems through the following technical solutions:
本发明提供了一种基于现场总线的数据传输方法,所述数据传输方法应用于主站中, 所述数据传输方法包括:The present invention provides a data transmission method based on a field bus. The data transmission method is applied in the master station, and the data transmission method includes:
生成主站身份明文数据;Generate master station identity plaintext data;
加密所述主站身份明文数据以生成主站身份密文数据,所述主站身份密文数据用于供从站对所述主站进行身份验证;Encrypting the master station identity plaintext data to generate master station identity ciphertext data, and the master station identity ciphertext data is used for the slave station to authenticate the master station;
发送所述主站身份密文数据至所述从站。Send the master station identity ciphertext data to the slave station.
较佳地,所述加密所述主站身份明文数据以生成主站身份密文数据的步骤中,通过预设编码规则重新排列所述主站身份明文数据中各字符的位置以生成主站身份密文数据。Preferably, in the step of encrypting the master station identity plaintext data to generate the master station identity ciphertext data, the position of each character in the master station identity plaintext data is rearranged by preset coding rules to generate the master station identity. Encrypted data.
较佳地,所述主站身份明文数据包括目标主站标识符。Preferably, the master station identity plaintext data includes the target master station identifier.
较佳地,所述发送所述主站身份密文数据至所述从站的步骤后还包括:Preferably, after the step of sending the master station identity ciphertext data to the slave station, the step further includes:
接收所述从站发送的从站身份密文数据;Receive the slave station identity ciphertext data sent by the slave station;
解密所述从站身份密文数据以生成从站身份明文数据;decrypting the slave identity ciphertext data to generate slave identity plaintext data;
判断所述从站身份明文数据是否与预设从站明文数据相符,若是,则确认所述从站的身份验证成功;Determine whether the plaintext data of the identity of the slave is consistent with the plaintext data of the preset slave, and if so, confirm that the identity verification of the slave is successful;
所述主站身份明文数据包括主站随机码,所述从站身份明文数据包括所述目标主站标识符及所述主站随机码,所述预设从站明文数据包括预设主站标识符及所述发送所述主站身份密文数据至所述从站的步骤中发送的目标主站标识符;The master station identity plaintext data includes a master station random code, the slave station identity plaintext data includes the target master station identifier and the master station random code, and the preset slave station plaintext data includes a preset master station identifier and the target master station identifier sent in the step of sending the master station identity ciphertext data to the slave station;
当所述目标主站标识符与预设主站标识符相符且所述主站随机码与所述发送所述主站身份密文数据至所述从站的步骤中发送的目标主站标识符时,判断所述从站身份明文数据与预设从站明文数据相符。When the target master station identifier matches the preset master station identifier and the master station random code matches the target master station identifier sent in the step of sending the master station identity ciphertext data to the slave station When , it is determined that the plaintext data of the slave station identity is consistent with the preset plaintext data of the slave station.
较佳地,所述主站身份明文数据还包括目标从站标识符,所述预设从站明文数据还包括预设从站标识符;Preferably, the master station identity plaintext data further includes a target slave station identifier, and the preset slave station plaintext data further includes a preset slave station identifier;
所述判断所述从站身份明文数据与预设从站明文数据相符还包括:所述目标从站标识符与所述预设从站标识符相符。The judging that the plaintext data of the slave station identity is consistent with the preset plaintext data of the slave station further includes: the target slave station identifier is consistent with the preset slave station identifier.
较佳地,所述目标从站标识符还用于供所述从站对所述主站进行身份验证。Preferably, the target slave station identifier is also used for the slave station to authenticate the master station.
较佳地,所述生成主站身份明文数据的步骤前还包括:随机生成目标从站标识符,在所述从站中更新后的所述目标从站标识符用于供所述主站对所述从站进行身份验证。Preferably, before the step of generating the master station identity plaintext data, the step further includes: randomly generating a target slave station identifier, and the target slave station identifier updated in the slave station is used for the master station to pair the target slave station identifier. The slave is authenticated.
较佳地,多次执行所述发送所述主站身份密文数据至从站的步骤。Preferably, the step of sending the master station identity ciphertext data to the slave station is performed multiple times.
较佳地,所述接收从站发送的从站身份密文数据的步骤包括:多次接收所述从站发送的从站身份密文数据,并统计在多次接收的数据中数据不一致的次数,判断所述次数是否大于第一预设次数,若是,则生成从站身份错误信息,若否,则执行所述解密所述从站身份密文数据以获取从站身份明文数据的步骤。Preferably, the step of receiving the slave station identity ciphertext data sent by the slave station includes: receiving the slave station identity ciphertext data sent by the slave station multiple times, and counting the number of times the data is inconsistent in the data received multiple times. , judging whether the number of times is greater than the first preset number of times, if so, generating slave station identity error information, if not, executing the step of decrypting the slave station identity ciphertext data to obtain the slave station identity plaintext data.
较佳地,所述接收所述从站发送的从站身份密文数据的步骤包括:Preferably, the step of receiving the slave station identity ciphertext data sent by the slave station includes:
判断在第一时间阈值范围内是否接收到所述从站发送的从站身份密文数据,若否,则生成从站处理超时信息,若是,则解密所述从站身份密文数据以生成从站身份明文数据。Determine whether the slave station identity ciphertext data sent by the slave station is received within the range of the first time threshold, if not, generate the slave station processing timeout information, if so, decrypt the slave station identity ciphertext data to generate the slave station identity ciphertext data. Station identity plaintext data.
较佳地,周期性执行生成主站身份明文数据、加密所述主站身份明文数据以生成主站身份密文数据及发送所述主站身份密文数据至从站的步骤。Preferably, the steps of generating the master station identity plaintext data, encrypting the master station identity plaintext data to generate the master station identity ciphertext data and sending the master station identity ciphertext data to the slave station are periodically performed.
较佳地,周期性执行所述接收所述从站发送的从站身份密文数据、所述解密所述从站身份密文数据以生成从站身份明文数据以及所述执行判断所述目标主站标识符是否与预设主站标识符相符判断的步骤,且在第一次确认所述从站的身份验证成功的步骤后,若在执行判断所述从站身份明文数据与预设从站身份数据是否相符的步骤中,判断结果为否时,则确认所述从站的身份验证失败。Preferably, the receiving of the slave station identity ciphertext data sent by the slave station, the decrypting of the slave station identity ciphertext data to generate the slave station identity plaintext data, and the execution of judging the target master are periodically performed. The step of judging whether the station identifier is consistent with the preset master station identifier, and after the first step of confirming that the identity verification of the slave station is successful, if the clear text data of the identity of the slave station is determined and the preset slave station is executed. In the step of whether the identity data is consistent, if the judgment result is no, it is confirmed that the identity verification of the slave station fails.
较佳地,所述主站包括主站权限令牌,当所述主站权限令牌为第一标识符时,所述主站具有执行所述数据传输方法的权限,当所述主站权限令牌为第二标识符时,所述主站不具有执行所述数据传输方法的权限;Preferably, the master station includes a master station authority token. When the master station authority token is the first identifier, the master station has the authority to execute the data transmission method. When the token is the second identifier, the master station does not have the authority to execute the data transmission method;
所述生成主站身份明文数据的步骤前还包括步骤:将所述主站权限令牌设置为第一标识符;The step of generating the master station identity plaintext data further includes the step of: setting the master station authority token as the first identifier;
所述发送所述主站身份密文数据至从站的步骤后还包括:将所述主站权限令牌设置为第二标识符。The step of sending the master station identity ciphertext data to the slave station further includes: setting the master station authority token as a second identifier.
本发明还提供了一种基于现场总线的身份识别方法,所述身份识别方法应用于从站中,所述身份识别方法包括:The present invention also provides a field bus-based identification method, the identification method is applied to the slave station, and the identification method includes:
接收主站发送的主站身份密文数据;Receive the master station identity ciphertext data sent by the master station;
解密所述主站身份密文数据以获取主站身份明文数据;Decrypt the master station identity ciphertext data to obtain the master station identity plaintext data;
判断所述主站身份明文数据是否与预设主站身份数据一致,若是,则确认所述主站的身份验证成功。It is judged whether the master station identity plaintext data is consistent with the preset master station identity data, and if so, it is confirmed that the identity verification of the master station is successful.
较佳地,所述解密所述身份密文数据的步骤中,通过与预设编码规则对应的预设反编码规则还原所述主站身份密文数据中各字符的位置以生成主站身份明文数据。Preferably, in the step of decrypting the identity ciphertext data, the position of each character in the master station identity ciphertext data is restored by the preset anti-encoding rule corresponding to the preset encoding rule to generate the master station identity plaintext. data.
较佳地,所述主站身份明文数据包括目标主站标识符,所述预设主站身份数据包括预设主站标识符,当所述主站身份明文数据与所述预设主站身份数据相符时,判断所述目标主站标识符与预设主站标识符相符。Preferably, the master station identity plaintext data includes a target master station identifier, the preset master station identity data includes a preset master station identifier, when the master station identity plaintext data and the preset master station identity When the data match, it is determined that the target master station identifier matches the preset master station identifier.
较佳地,所述主站身份明文数据还包括主站随机码,所述主站随机码用于供所述主站对所述从站进行身份验证,所述确认所述主站的身份验证成功的步骤后还包括:Preferably, the identity plaintext data of the master station further includes a random code of the master station, and the random code of the master station is used for the master station to perform the identity verification of the slave station, and the confirmation of the identity verification of the master station. After successful steps also include:
根据所述目标主站标识符及所述主站随机码生成从站身份明文数据,所述从站身份明文数据用于供所述主站对所述从站进行身份验证;Generate slave station identity plaintext data according to the target master station identifier and the master station random code, and the slave station identity plaintext data is used for the master station to authenticate the slave station;
加密所述从站身份明文数据以生成从站身份密文数据;encrypting the slave station identity plaintext data to generate slave station identity ciphertext data;
发送所述从站身份密文数据至所述主站。Send the slave station identity ciphertext data to the master station.
较佳地,所述主站身份明文数据还包括目标从站标识符,所述根据所述目标主站标识符及所述主站随机码生成从站身份明文数据的步骤中:根据所述目标主站标识符、所述目标从站标识符及所述主站随机码生成从站身份明文数据。Preferably, the master station identity plaintext data further includes a target slave station identifier, and in the step of generating the slave station identity plaintext data according to the target master station identifier and the master station random code: The master station identifier, the target slave station identifier and the master station random code generate slave station identity plaintext data.
较佳地,所述预设从站身份数据还包括预设从站标识符,所述判断所述目标主站标识符与预设主站标识符相符的还包括:Preferably, the preset slave station identity data further includes a preset slave station identifier, and the judging that the target master station identifier is consistent with the preset master station identifier further includes:
判断所述目标从站标识符与所述预设从站标识符相符。It is judged that the target slave station identifier is consistent with the preset slave station identifier.
较佳地,所述生成从站身份明文数据的步骤前还包括,根据所述从站的自身标识符更新所述目标从站标识符,更新后的所述目标从站标识符用于供所述主站对所述从站进行身份验证。Preferably, before the step of generating the identity plaintext data of the slave station, it further comprises: updating the target slave station identifier according to the self identifier of the slave station, and the updated target slave station identifier is used for all The master station authenticates the slave station.
较佳地,所述接收主站发送的主站身份密文数据的步骤包括:多次接收所述主站发送的主站身份密文数据,并判断在多次接收的数据中是否存在第一预设次数的数据与其他的数据不一致的情况,若是,则生成主站身份错误信息,若否,则执行所述解密所述主站身份密文数据以获取主站身份明文数据的步骤。Preferably, the step of receiving the master station identity ciphertext data sent by the master station includes: receiving the master station identity ciphertext data sent by the master station multiple times, and judging whether there is a first one in the multiple received data. If the data of the preset number of times is inconsistent with other data, if yes, generate the master station identity error message, if not, execute the step of decrypting the master station identity ciphertext data to obtain the master station identity plaintext data.
较佳地,所述发送所述从站身份密文数据至主站的步骤中:多次发送所述从站身份密文数据至主站。Preferably, in the step of sending the slave station identity ciphertext data to the master station: sending the slave station identity ciphertext data to the master station multiple times.
较佳地,所述发送所述从站身份密文数据至主站的步骤后包括:Preferably, after the step of sending the slave station identity ciphertext data to the master station includes:
判断在第二时间阈值范围内是否接收到所述主站发送的主站身份密文数据,若否,则生成主站处理超时信息。Determine whether the master station identity ciphertext data sent by the master station is received within the second time threshold range, and if not, generate master station processing timeout information.
较佳地,周期性执行接收主站发送的主站身份密文数据、解密所述主站身份密文数据以获取主站身份明文数据及判断所述主站身份明文数据是否与预设明文数据一致的步骤,且在第一次确认所述主站的身份验证成功后,允许接收并处理所述主站发送的工作数据,在第一次确认所述主站的身份验证成功的步骤后,若在执行判断所述主站身份明文数据与预设主站身份数据是否相符的步骤中,判断结果为否时,则确认所述主站的身份验证失败。Preferably, periodically perform receiving the master station identity ciphertext data sent by the master station, decrypting the master station identity ciphertext data to obtain the master station identity plaintext data and judging whether the master station identity plaintext data is the same as the preset plaintext data. Consistent steps, and after the first confirmation that the identity verification of the master station is successful, allow to receive and process the working data sent by the master station, and after the first step of confirming that the identity verification of the master station is successful, If in the step of judging whether the master station identity plaintext data is consistent with the preset master station identity data, if the judging result is no, it is confirmed that the identity verification of the master station fails.
较佳地,周期性执行所述生成从站身份明文数据、加密所述从站身份明文数据以生成从站身份密文数据以及所述发送所述从站身份密文数据至主站的步骤。Preferably, the steps of generating the slave station identity plaintext data, encrypting the slave station identity plaintext data to generate the slave station identity ciphertext data, and sending the slave station identity ciphertext data to the master station are periodically performed.
较佳地,其特征在于,所述从站包括从站权限令牌,当所述从站权限令牌为第二标 识符时,所述从站具有执行所述身份识别方法的权限,当所述从站权限令牌为第一标识符时,所述从站不具有执行所述身份识别方法的权限;Preferably, the slave station includes a slave station authority token, and when the slave station authority token is the second identifier, the slave station has the authority to execute the identification method, and when the slave station authority token is the second identifier When the slave station authority token is the first identifier, the slave station does not have the authority to execute the identification method;
所述生成从站身份明文数据的步骤前还包括步骤:将所述从站权限令牌设置为第二标识符;The step of generating the slave station identity plaintext data further includes the step of: setting the slave station authority token as a second identifier;
所述发送所述从站身份密文数据至从站的步骤后还包括:将所述从站权限令牌设置为第一标识符。The step of sending the slave station identity ciphertext data to the slave station further includes: setting the slave station authority token as a first identifier.
本发明还提供了一种基于现场总线的数据传输系统,所述数据传输系统应用于主站中,所述数据传输系统包括:主站身份数据生成模块、主站身份数据加密模块及主站身份数据发送模块;The invention also provides a field bus-based data transmission system, the data transmission system is applied in the master station, and the data transmission system includes: a master station identity data generation module, a master station identity data encryption module and a master station identity data sending module;
所述主站身份数据生成模块用于生成主站身份明文数据;The master station identity data generation module is used to generate the master station identity plaintext data;
所述主站身份数据加密模块及用于加密所述主站身份明文数据以生成主站身份密文数据,所述主站身份密文数据用于供从站对所述主站进行身份验证;Described master station identity data encryption module and is used for encrypting described master station identity plaintext data to generate master station identity ciphertext data, and described master station identity ciphertext data is used for slave station to carry out identity verification to described master station;
所述主站身份数据发送模块用于发送所述主站身份密文数据至所述从站。The master station identity data sending module is configured to send the master station identity ciphertext data to the slave station.
本发明还提供了一种基于现场总线的身份识别系统,所述身份识别系统应用于从站中,所述身份识别系统包括:主站身份数据接收模块、主站身份数据解密模块及主站身份数据判断模块;The invention also provides a field bus-based identity recognition system, the identity recognition system is applied to the slave station, and the identity recognition system includes: a master station identity data receiving module, a master station identity data decryption module and a master station identity Data judgment module;
所述主站身份数据接收模块用于接收主站发送的主站身份密文数据;The master station identity data receiving module is used for receiving the master station identity ciphertext data sent by the master station;
所述主站身份数据解密模块用于解密所述主站身份密文数据以获取主站身份明文数据;The master station identity data decryption module is used to decrypt the master station identity ciphertext data to obtain the master station identity plaintext data;
所述主站身份数据验证模块用于判断所述主站身份明文数据是否与预设主站身份数据一致,若是,则确认所述主站的身份验证成功。The master station identity data verification module is used for judging whether the master station identity plaintext data is consistent with the preset master station identity data, and if so, confirming that the master station's identity verification is successful.
本发明还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上所述的数据传输方法及身份识别方法的步骤。The present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the above-mentioned data transmission method and identity recognition method.
本发明的积极进步效果在于:本发明中,在主站与从站原有的通信数据的基础上,单独生成主站身份明文数据并对该数据进行加密以用于主从站之间进行身份验证,从站在接收主站发送的加密后的数据后,只有对数据解密成功并且对数据验证成功后,主站才能获得与从站进行正常通讯的权限,由于单独生成的主站身份明文数据对于工作数据而言数据所占空间小,因此,在不会影响主站与从站间的正常通讯效率的前提下,大大增加了主从站之间数据传输的安全性。The positive improvement effect of the present invention is: in the present invention, on the basis of the original communication data between the master station and the slave station, the master station identity plaintext data is separately generated and the data is encrypted for identification between the master station and the slave station. Verification, after the slave station receives the encrypted data sent by the master station, only after the data decryption is successful and the data verification is successful, the master station can obtain the authority to communicate with the slave station normally, because the master station identity plaintext data generated separately For working data, the data occupies a small space. Therefore, the security of data transmission between the master and slave stations is greatly increased without affecting the normal communication efficiency between the master station and the slave station.
附图说明Description of drawings
图1为SCADA系统的系统构架示意图。Figure 1 is a schematic diagram of the system architecture of the SCADA system.
图2为工业控制系统的现场总线系统构架示意。Figure 2 is a schematic diagram of the field bus system architecture of the industrial control system.
图3为本发明实施例1的基于现场总线的身份识别方法的流程图。FIG. 3 is a flowchart of a field bus-based identification method according to Embodiment 1 of the present invention.
图4为实施例1中的主站身份明文数据的格式示意图。FIG. 4 is a schematic diagram of the format of the master station identity plaintext data in Embodiment 1. FIG.
图5为实施例1中步骤104的实现方式的流程图。FIG. 5 is a flowchart of an implementation manner of step 104 in Embodiment 1. As shown in FIG.
图6为本发明实施例2的基于现场总线的身份识别方法的流程图。FIG. 6 is a flowchart of a field bus-based identification method according to Embodiment 2 of the present invention.
图7为实施例2的一种具体场景下的基于现场总线的身份识别方法流程示意图。FIG. 7 is a schematic flowchart of a fieldbus-based identification method in a specific scenario of Embodiment 2. FIG.
图8为本发明实施例3的基于现场总线的身份识别系统的模块示意图。FIG. 8 is a schematic block diagram of a field bus-based identification system according to Embodiment 3 of the present invention.
图9为本发明实施例4的基于现场总线的身份识别系统的模块示意图。FIG. 9 is a schematic block diagram of a field bus-based identification system according to Embodiment 4 of the present invention.
图10为本发明实施例5的电子设备的模块示意图。FIG. 10 is a schematic diagram of a module of an electronic device according to Embodiment 5 of the present invention.
具体实施方式Detailed ways
下面通过实施例的方式进一步说明本发明,但并不因此将本发明限制在所述的实施例范围之中。The present invention is further described below by means of examples, but the present invention is not limited to the scope of the described examples.
实施例1Example 1
本实施例提供了一种基于现场总线的数据传输方法,该数据传输方法应用于主站中,如图3所示,该数据传输方法包括:This embodiment provides a data transmission method based on a field bus. The data transmission method is applied in the master station. As shown in FIG. 3 , the data transmission method includes:
步骤101、生成主站身份明文数据。 Step 101 , generating the master station identity plaintext data.
其中,主站身份明文数据为与其他的数据(文中简称为工作数据)不同的数据,主站身份明文数据为单独抽离出的独立的用于供从站对主站进行身份验证的数据。Among them, the master station identity plaintext data is data different from other data (herein referred to as working data), and the master station identity plaintext data is independently extracted data for the slave station to authenticate the master station.
本实施例中,主站身份明文数据具有多种实现方式,在一种实现方式中,主站身份明文数据包括目标主站标识符,在另一种实现方式中,主站身份明文数据包括目标主站标识符及目标从站标识符,在一种实现方式中,主站身份明文数据包括主站标识符及主站随机码,在一种实现方式中,主站身份明文数据包括目标主站标识符、目标从站标识符及主站随机码,在一种实现方式中,主站身份明文数据包括目标从站标识符,在一种实现方式中,主站身份明文数据包括主站随机码。In this embodiment, the master station identity plaintext data has multiple implementation manners. In one implementation manner, the master station identity plaintext data includes the target master station identifier, and in another implementation manner, the master station identity plaintext data includes the target station identifier. The master station identifier and the target slave station identifier. In an implementation manner, the master station identity plaintext data includes the master station identifier and the master station random code. In an implementation manner, the master station identity plaintext data includes the target master station. Identifier, target slave station identifier and master station random code. In an implementation manner, the master station identity plaintext data includes the target slave station identifier, and in an implementation manner, the master station identity plaintext data includes the master station random code. .
为了便于对本实施例进行说明,下文以主站身份明文数据包括目标主站标识符、目标从站标识符及主站随机码的方式作为举例来进行说明。图4示出了在一种具体的实施方式下,主站身份明文数据的格式图,具体的,主站身份明文数据包含目标主站标识符B01,其数据长度为X bit(位);目标从站标识符B02,数据长度为Y bit;主站随机码B03,数据长度为Z bit。依据现场总线对主站、从站的数量及不同应用场合的需求,X、 Y和Z的数据长度可以选取任意合理的设置,如,X取4bit,Y取4bit,Z取8bit,则主站身份明文数据的长度为X+Y+Z=(4+4+8)bit=16bit。In order to facilitate the description of this embodiment, the following description will be given by taking a mode in which the master station identity plaintext data includes a target master station identifier, a target slave station identifier and a random code of the master station as an example. Figure 4 shows a format diagram of the master station identity plaintext data under a specific embodiment, specifically, the master station identity plaintext data includes the target master station identifier B01, and its data length is X bit (bit); The slave station identifier B02, the data length is Y bits; the master station random code B03, the data length is Z bits. According to the number of master stations and slave stations of the fieldbus and the requirements of different applications, the data lengths of X, Y and Z can be set arbitrarily. The length of the identity plaintext data is X+Y+Z=(4+4+8)bit=16bit.
其中,目标主站标识符B01为主站与从站约定好的数据,主站随机码B03为随机生成的数据。在第一种场景下,目标从站标识符B02为主站与从站约定好的数据,相互存储于主站与从站内;在第二种场景下,目标从站标识符B02为随机生成的数据。Among them, the target master station identifier B01 is the data agreed between the master station and the slave station, and the master station random code B03 is randomly generated data. In the first scenario, the target slave station identifier B02 is the agreed data between the master station and the slave station, and is mutually stored in the master station and the slave station; in the second scenario, the target slave station identifier B02 is randomly generated. data.
应当理解,主站身份明文数据的实现方式并不限于上文的方式,其可根据实际情况进行选择。It should be understood that the implementation manner of the master station identity plaintext data is not limited to the above manner, which can be selected according to the actual situation.
本实施例中,提供了多种主站身份明文数据的实现方式,在实际操作中可以根据实际情况进行选择,本实施例中对主站明文数据的设置方式具有广泛的适用性。In this embodiment, a variety of implementation manners of the master station identity plaintext data are provided, which can be selected according to actual conditions in actual operation. The setting manner of the master station plaintext data in this embodiment has wide applicability.
本实施例中,主站可以随机生成目标从站标识符,提高了身份明文数据的生成速度,进一步提高了本实施例中的数据传输方法的效率,本实施例中,主站可以通过与从站的预先约定,生成目标从站标识符以供从站进一步验证主站的身份,从而进一步提高了主从站之间的数据传输的安全性。In this embodiment, the master station can randomly generate the target slave station identifier, which improves the generation speed of identity plaintext data, and further improves the efficiency of the data transmission method in this embodiment. According to the pre-appointment of the station, the target slave station identifier is generated for the slave station to further verify the identity of the master station, thereby further improving the security of data transmission between the master and slave stations.
步骤102、加密主站身份明文数据以生成主站身份密文数据。Step 102: Encrypt the master station identity plaintext data to generate the master station identity ciphertext data.
其中,可以采用多种方式来加密主站身份明文数据,如可以采用现有技术中的加密算法来加密主站明文数据,如DES(数据加密标准算法)、3DES(三重数据加密标准算法)、IDEA(国际资料加密演算法)、AES(辅助编码器系统算法)、RC(Rivest Code一种加密算法)等对称加密算法或RSA(一种公钥密码算法)、DSA(数字签名算法)、Diffie-Hellman(一种确保共享钥匙安全穿越不安全网络的方法)等非对称法加密算法。Among them, a variety of ways can be used to encrypt the master station identity plaintext data, for example, the encryption algorithm in the prior art can be used to encrypt the master station plaintext data, such as DES (Data Encryption Standard Algorithm), 3DES (Triple Data Encryption Standard Algorithm), IDEA (International Data Encryption Algorithm), AES (Auxiliary Encoder System Algorithm), RC (Rivest Code an encryption algorithm) and other symmetric encryption algorithms or RSA (a public key encryption algorithm), DSA (Digital Signature Algorithm), Diffie - Asymmetric encryption algorithms such as Hellman (a method of ensuring the safe passage of shared keys across insecure networks).
但是由于主站及从站的处理器多为主频百兆赫兹级别的嵌入式芯片,其运算处理能力有限,所有任务的执行周期一般为1~20毫秒左右,包括处理数据采集、数据计算、数据通讯、时序逻辑、控制算法和故障保护等较为复杂的工作,有很高的实时性要求。而工业控制系统的现场总线设备的通讯速度一般为100kbit/s(千位每秒)~12Mbit/s,而一般要求在一个任务周期内完成主从站之间通讯数据的处理。However, because the processors of the master station and the slave station are mostly embedded chips with a main frequency of 100 MHz, their computing processing capabilities are limited, and the execution cycle of all tasks is generally about 1 to 20 milliseconds, including processing data acquisition, data calculation, Data communication, sequential logic, control algorithm and fault protection and other more complex work have high real-time requirements. The communication speed of the field bus device of the industrial control system is generally 100kbit/s (kilobits per second) ~ 12Mbit/s, and it is generally required to complete the communication data processing between the master and slave stations within a task cycle.
就保密性较高通讯数据加密算法,不管是前述对称加密算法还是非对称法加密算法,其要求计算量都非常大,目前多用于通讯数实时性要求不高的场合。若在嵌入式芯片1~20毫秒任务周期内,用上述加密算法完成通讯身份验证的数据加密和解密工作,会占用嵌入式芯片非常多的时间资源,导致执行周期内不能完成所有任务的执行,最终严重影响工业控制系统的基于现场总线的主站及从站间的通讯、监测、时序逻辑及控制等任务处理的实时性,不能满足风机机组的控制要求。As for the communication data encryption algorithm with high confidentiality, whether it is the aforementioned symmetric encryption algorithm or asymmetric encryption algorithm, the amount of calculation required is very large, and currently it is mostly used in occasions where the real-time requirement of communication data is not high. If the above-mentioned encryption algorithm is used to complete the data encryption and decryption of communication authentication within the embedded chip task cycle of 1 to 20 milliseconds, it will occupy a lot of time resources of the embedded chip, resulting in that the execution of all tasks cannot be completed within the execution cycle. In the end, it seriously affects the real-time performance of the communication, monitoring, sequential logic and control between the master station and the slave station based on the field bus of the industrial control system, and cannot meet the control requirements of the fan unit.
因此,本实施例中优先选择计算量较为简单的预设编码规则来对主站明文数据进行 加密来克服计算量大、计算耗时的缺陷,在提高数据传输安全性的同时,保证数据传输的实时性,其中预设编码规则用于重新排列主站身份明文数据中各字符的位置以生成主站身份密文数据。如:可以将主站随机码中的每一字符分别插入目标主站标识符及目标从站标识符的各个字符之间以改变主站身份明文数据中的各个字符间的位置关系。又如,可以打乱目标主站标识符、目标从站标识符及主站随机码中各个字符的顺序。应当理解,上述预设编码规则仅作为举例说明,不应当成为对本实施例的限制,实际中,还可以具有其他的方式来重新排列主站身份明文数据中各字符的位置以生成主站身份密文数据。Therefore, in this embodiment, a preset encoding rule with a relatively simple amount of calculation is preferentially selected to encrypt the plaintext data of the master station to overcome the defects of large amount of calculation and time-consuming calculation, and at the same time to improve the security of data transmission, ensure the safety of data transmission. Real-time, wherein the preset coding rules are used to rearrange the positions of each character in the master station identity plaintext data to generate the master station identity ciphertext data. For example, each character in the random code of the master station can be inserted into the respective characters of the target master station identifier and the target slave station identifier to change the positional relationship between the characters in the master station identity plaintext data. For another example, the sequence of each character in the identifier of the target master station, the identifier of the target slave station and the random code of the master station may be disrupted. It should be understood that the above-mentioned preset coding rules are only used as an example, and should not be a limitation to this embodiment. In practice, there may be other ways to rearrange the positions of each character in the master station identity plaintext data to generate the master station identity password. text data.
由于现有技术中,主站与从站之间为明文通讯,因此,破坏者容易通过伪装成主站需要通信的从站,以接收主站发送的数据从而对数据进行监听、窃取等不法行为。本实施例中,通过设置单独的主站身份明文数据,并且对身份明文数据进行加密,从站只有对主站身份密文数据进行解密并且解密成功后,才能继续接收及解析主站发送的工作数据,从而提高了主站与从站间通讯的安全性。Since in the prior art, the communication between the master station and the slave station is in plain text, it is easy for the saboteur to masquerade as the slave station that the master station needs to communicate with to receive the data sent by the master station to monitor and steal the data. . In this embodiment, by setting separate master station identity plaintext data and encrypting the identity plaintext data, the slave station can continue to receive and parse the work sent by the master station only after decrypting the master station identity ciphertext data and the decryption is successful. data, thereby improving the security of communication between the master station and the slave station.
本实施例中,可以通过简单的预设编码规则对主站身份明文数据进行加密,从而不仅提高了主站与从站间通讯过程的安全性,也保证了主站与从站间通讯过程的实时性。且本实施例中,主站身份明文数据设置规则简单,数据长度小,所需要的资源有限,因此在保证主从站通讯过程安全性的同时不会影响对工作数据的处理。In this embodiment, the identity plaintext data of the master station can be encrypted through a simple preset coding rule, thereby not only improving the security of the communication process between the master station and the slave station, but also ensuring the communication process between the master station and the slave station. real-time. Moreover, in this embodiment, the master station identity plaintext data setting rules are simple, the data length is small, and the required resources are limited, so the processing of working data will not be affected while ensuring the security of the master-slave communication process.
步骤103、发送主站身份密文数据至从站。Step 103: Send the master station identity ciphertext data to the slave station.
其中主站既可以通过广播的方式广播主站身份密文数据至所有的从站,也可以通过一对一点播的方式发送主站身份密文数据至对应的从站。The master station can either broadcast the master station identity ciphertext data to all slave stations by broadcasting, or send the master station identity ciphertext data to the corresponding slave stations by one-to-one broadcasting.
在一种具体的实施方式中,为了避免由于通信故障、网络堵塞等客观原因导致主站身份密文数据发送失败的情况发生,本实施例中,步骤103包括多次发送主站身份密文数据至从站,其中,发送次数可以根据实际需求进行设置,如10次。In a specific implementation, in order to avoid the failure of sending the master station identity ciphertext data due to objective reasons such as communication failures and network congestion, in this embodiment, step 103 includes sending the master station identity ciphertext data multiple times. To the slave station, the sending times can be set according to actual needs, such as 10 times.
本实施例中,在主站与从站原有的通信数据的基础上,单独生成主站身份明文数据并对该数据进行加密以用于主从站之间进行身份验证,从站在接收主站发送的加密后的数据后,只有对数据解密成功并且对数据验证成功后,主站才能获得与从站进行正常通讯的权限,由于单独生成的主站身份明文数据对于工作数据而言数据所占空间小,因此,在不会影响主站与从站间的正常通讯效率的前提下,大大增加了主从站之间数据传输的安全性。In this embodiment, on the basis of the original communication data between the master station and the slave station, the master station identity plaintext data is separately generated and encrypted for identity verification between the master station and the slave station, and the slave station receives the master station. After the encrypted data sent by the station, the master station can obtain the authority to communicate with the slave station normally only after the data is decrypted successfully and the data is verified successfully. Occupy small space, therefore, under the premise of not affecting the normal communication efficiency between the master station and the slave station, the security of data transmission between the master and slave stations is greatly increased.
本实施例中,可以多次发送主站身份密文数据至从站,从而避免由于网络原因导致主从站之间身份验证失败,进一步加强了主从站之间数据通讯的安全性。In this embodiment, the identity ciphertext data of the master station can be sent to the slave stations for many times, thereby avoiding the failure of authentication between the master and slave stations due to network reasons, and further enhancing the security of data communication between the master and slave stations.
由于数据通讯是一个相互的过程,在一种具体的实施方式中,主站还可以接收从站 发送的身份密文数据以对从站的身份进行验证,具体的,如图2所示,步骤103后还可以包括:Since data communication is a mutual process, in a specific implementation manner, the master station can also receive the identity ciphertext data sent by the slave station to verify the identity of the slave station. Specifically, as shown in Figure 2, the steps Post-103 can also include:
步骤104、接收从站发送的从站身份密文数据。Step 104: Receive the slave station identity ciphertext data sent by the slave station.
其中,从站身份密文数据的接收方式可以参考下文实施例2中步骤201中接收主站发送的主站身份密文数据的方式,此处便不再赘述。The method for receiving the slave station identity ciphertext data may refer to the method for receiving the master station identity ciphertext data sent by the master station in step 201 in Embodiment 2 below, which will not be repeated here.
步骤105、解密从站身份密文数据以生成从站身份明文数据。Step 105: Decrypt the ciphertext data of the slave station identity to generate the plaintext data of the slave station identity.
其中,从站解密从站身份密文数据的方式可以参考实施例2中步骤202中的解密主站身份密文数据的方式,此处便不再赘述。The method for decrypting the ciphertext data of the identity of the slave station by the slave station may refer to the method of decrypting the ciphertext data of the identity of the master station in step 202 in Embodiment 2, which will not be repeated here.
步骤106、判断从站身份明文数据是否与预设从站身份数据一致,若是,则执行步骤107,若否,则执行步骤108。 Step 106 , determine whether the plaintext data of the slave station identity is consistent with the preset slave station identity data, if yes, go to step 107 , if not, go to step 108 .
步骤107、确认从站的身份验证成功。Step 107: Confirm that the identity verification of the slave is successful.
步骤108、确认从站的身份验证失败。Step 108: Confirm that the authentication of the slave station fails.
具体的,当步骤103中主站发送至从站的主站密文数据仅包括加密后的目标主站身份标识符时,步骤106中的具体验证方式为判断目标主站标识符是否与预设主站身份数据一致,若是,则执行步骤107,若否,则执行步骤108。Specifically, when the master station ciphertext data sent by the master station to the slave station in step 103 only includes the encrypted target master station identity identifier, the specific verification method in step 106 is to determine whether the target master station identifier is the same as the preset identifier. If the identity data of the master station is consistent, if yes, go to step 107, if not, go to step 108.
当步骤103中主站发送至从站的主站密文数据包括加密后的目标主站身份标识符及目标从站标识符时,步骤106中的具体验证方式为判断目标主站标识符是否与预设主站身份数据一致,且判断目标从站标识符是否与预设从站身份数据一致,若二者的判断结果均为是,则执行步骤107,若否,则执行步骤108。When the master station ciphertext data sent by the master station to the slave station in step 103 includes the encrypted target master station identity identifier and the target slave station identifier, the specific verification method in step 106 is to determine whether the target master station identifier is the same as the target master station identifier. The preset master station identity data is consistent, and it is judged whether the target slave station identifier is consistent with the preset slave station identity data.
当步骤103中主站发送至从站的主站密文数据包括加密后的目标主站身份标识符及主站随机码时,步骤106中的具体验证方式为判断目标主站标识符是否与预设主站身份数据一致且判断解密后得到的主站随机码是否与步骤101中生成的主站随机码是否相符,若二者的判断结果均为是,则执行步骤107,若否,则执行步骤108。When the master station ciphertext data sent by the master station to the slave station in step 103 includes the encrypted target master station identity identifier and the master station random code, the specific verification method in step 106 is to determine whether the target master station identifier is the same as the predetermined one. It is assumed that the identity data of the master station is consistent, and it is judged whether the master station random code obtained after decryption is consistent with the master station random code generated in step 101, if the judgment results of both are yes, then execute step 107, if not, execute step 107 Step 108.
当步骤103中主站发送至从站的主站密文数据包括加密后的目标主站身份标识符、目标从站标识符及主站随机码时,步骤106中的具体验证方式为判断目标主站标识符是否与预设主站身份数据一致、判断目标从站标识符是否与预设从站身份数据一致且判断解密后得到的主站随机码是否与步骤101中生成的主站随机码是否相符,若三者的判断结果均为是,则执行步骤107,若否,则执行步骤108。When the master station ciphertext data sent by the master station to the slave station in step 103 includes the encrypted target master station identity identifier, the target slave station identifier and the master station random code, the specific verification method in step 106 is to judge the target master station. Whether the station identifier is consistent with the preset master station identity data, determine whether the target slave station identifier is consistent with the preset slave station identity data, and determine whether the master station random code obtained after decryption is the same as the master station random code generated in step 101. If the result of the three judgments is yes, then go to step 107; if not, go to step 108.
本实施例中,若步骤105中没有解密成功,或者步骤106中从站身份明文数据与预设从站身份数据不一致,则认为从站为不安全主站,禁止主站与从站之间进行通讯,还可以进一步生成从站身份验证错误信息已提示相关人员进行处理。In this embodiment, if the decryption is not successful in step 105, or if the plaintext data of the slave station identity in step 106 is inconsistent with the preset slave station identity data, the slave station is considered to be an unsafe master station, and the communication between the master station and the slave station is prohibited. Communication, you can further generate slave station authentication error information and prompt relevant personnel to deal with it.
本实施例中,主站可以仅通过解密后获得的目标主站标识符对从站进行验证,在提高验证速度的同时增强了主从站之间数据传输的安全性。本实施例中,主站可以进一步通过解密后获得的目标从站标识符对从站进行验证,从而进一步提高了主从站之间的数据传输的安全性。本实施例中,主站还可以进一步通过主站之前发送的随机生成的主站随机码来对从站进行验证,从而进一步增加了主从站之间数据传输的可靠性与安全性。In this embodiment, the master station can verify the slave station only through the target master station identifier obtained after decryption, which improves the verification speed and enhances the security of data transmission between the master and slave stations. In this embodiment, the master station can further verify the slave station through the target slave station identifier obtained after decryption, thereby further improving the security of data transmission between the master and slave stations. In this embodiment, the master station may further verify the slave station through the random code of the master station that is randomly generated before the master station, thereby further increasing the reliability and security of data transmission between the master and slave stations.
在一种具体的实施方式中,如图5所示,为了提高主站与从站间身份验证的效率,步骤104可以具体包括:In a specific implementation manner, as shown in FIG. 5 , in order to improve the efficiency of identity verification between the master station and the slave station, step 104 may specifically include:
步骤1041、判断在第一时间阈值范围内是否接收到从站发送的从站身份密文数据,若否,则执行步骤1042,若是,则执行步骤105。Step 1041: Determine whether the slave station identity ciphertext data sent by the slave station is received within the first time threshold range, if not, go to step 1042, if yes, go to step 105.
步骤1042、生成从站处理超时信息。Step 1042: Generate slave processing timeout information.
本实施例中,若主站在第一时间阈值范围内未收到从站发送的从站身份密文数据,则生成从站处理超时信息,可以通过该信息提醒相关人员进行处理,从而在加强通讯安全性的同时保障主从站间身份验证的效率。In this embodiment, if the master station does not receive the slave station identity ciphertext data sent by the slave station within the range of the first time threshold, it generates slave station processing timeout information, which can be used to remind relevant personnel to process, so as to strengthen the Communication security and at the same time guarantee the efficiency of authentication between master and slave stations.
在一种具体的实施方式中,主站中还可以预先设置主站权限令牌,当主站权限令牌为第一标识符时,主站具有执行数据传输方法的权限,当主站权限令牌为第二标识符时,主站不具有执行数据传输方法的权限,在步骤101生成主站身份明文数据的同时或之前还可以进一步包括将主站权限令牌设置为第一标识符的步骤。In a specific embodiment, the master station authority token may also be preset in the master station. When the master station authority token is the first identifier, the master station has the authority to execute the data transmission method. When the token is the second identifier, the master station does not have the authority to execute the data transmission method, and at the same time or before the generation of the master station identity plaintext data in step 101, it may further include the step of setting the master station authority token as the first identifier .
同样,在步骤103发送主站身份明文数据的同时或之前还可以进一步包括步将主站权限令牌设置为第二标识符的步骤。Likewise, the step of setting the master station authority token as the second identifier may be further included at the same time as or before the sending of the master station identity plaintext data in step 103 .
类似的,在步骤104接收从站身份密文数据时还可以进一步包括将主站权限令牌设置为第一标识符的步骤。Similarly, the step 104 of receiving the slave station identity ciphertext data may further include the step of setting the master station authority token as the first identifier.
本实施例中,通过修改主站权限令牌可以修改主站的操作权限,应当理解,在同一时刻,主站与从站中只有一个具有操作权限,通过对权限令牌的修改,可以避免主站与从站同时对主站身份数据对从站身份数据进行处理,保证主站与从站中与身份相关的数据的同步性,也进一步保证主从站间的身份识别过程能够有效进行。In this embodiment, the operation authority of the master station can be modified by modifying the authority token of the master station. It should be understood that at the same time, only one of the master station and the slave station has the operation authority. By modifying the authority token, the master station can be avoided. The station and the slave station process the identity data of the master station and the slave station at the same time to ensure the synchronization of the identity-related data in the master station and the slave station, and further ensure that the identification process between the master station and the slave station can be carried out effectively.
在一种具体的实施方式中,为了持续保证主从站间数据传输的安全性,可以周期性执行步骤101-步骤108,且在预设时间范围内,如24小时、48小时等等,第一次经过步骤106的验证确认从站的身份验证成功后,开启从站的数据传输权限,即允许主站接收对应从站发送的工作数据并允许主站对从站发送的工作数据进行进一步处理。In a specific implementation manner, in order to continuously ensure the security of data transmission between the master and slave stations, steps 101 to 108 may be performed periodically, and within a preset time range, such as 24 hours, 48 hours, etc., the third Once the verification in step 106 confirms that the identity verification of the slave is successful, the data transmission authority of the slave is enabled, that is, the master is allowed to receive the working data sent by the corresponding slave and the master is allowed to further process the working data sent by the slave. .
而在之后周期中执行步骤101-步骤108时,若在步骤106的验证过程中,确认从站的身份验证失败后,则关闭从站的数据传输权限,即禁止主站接收并处理从站发送的工 作数据。When steps 101 to 108 are executed in the subsequent cycle, if in the verification process of step 106, the identity verification of the slave station fails, the data transmission authority of the slave station is closed, that is, the master station is forbidden to receive and process the transmission from the slave station. work data.
应当理解,本实施例中,在之后的周期中可以分多个周期对从站密文数据进行解密,如在第二周期仅解密百分之10的数据,在第三周期再解密百分之20的数据,在第四周期再解密百分之20的数据,在对数据解密的过程中,仍然保持主站与从站间正常的数据处理,在一种场景下,当从站密文数据整体解密完毕后再对解密出的从站明文数据进行验证,在另一种场景下,也可以在对从站密文数据解密的过程中进行分段验证,如解密百分之10即验证百分之10。在第一种场景下,若对从站明文数据的整体验证失败,则认为对从站的身份验证失败,在第二种场景下,当对解密后的部分数据验证失败时,则认为对从站的身份验证失败。It should be understood that, in this embodiment, the ciphertext data of the slave station may be decrypted in multiple cycles in subsequent cycles. For example, only 10% of the data is decrypted in the second cycle, and then 10% of the data is decrypted in the third cycle. 20% of the data, and then decrypt 20% of the data in the fourth cycle. In the process of decrypting the data, the normal data processing between the master station and the slave station is still maintained. In one scenario, when the slave station ciphertext data After the overall decryption is completed, the decrypted plaintext data of the slave station is verified. In another scenario, segmental verification can also be performed in the process of decrypting the slave station ciphertext data. 10 out of 10. In the first scenario, if the overall verification of the plaintext data of the slave fails, it is considered that the authentication of the slave fails. In the second scenario, when the decrypted part of the data fails to be verified, it is considered that the slave The authentication of the station failed.
本实施例中,在第一次对从站的身份验证成功后,则开启从站的数据传输权限,在从站对主站的数据传输权限开启后,从站可以持续向主站发送工作数据,在此期间,仅当在后续周期的验证过程中,对从站的身份验证失败后,才会关闭从站的数据传输权限,在这种方式下,可以保证在第一次验证成功后,主站和从站之间的正常数据传输不受影响,即在保证数据传输安全性的同时不会影响到正常数据传输的效率与实时性。In this embodiment, after the identity verification of the slave station is successful for the first time, the data transmission authority of the slave station is enabled. After the data transmission authority of the slave station to the master station is enabled, the slave station can continue to send working data to the master station. During this period, the data transmission authority of the slave station will be closed only when the authentication of the slave station fails in the verification process of the subsequent cycle. In this way, it can be guaranteed that after the first verification is successful, The normal data transmission between the master station and the slave station is not affected, that is, the efficiency and real-time performance of normal data transmission will not be affected while ensuring the security of data transmission.
实施例2Example 2
本实施例提供了一种基于现场总线的身份识别方法,该身份识别方法应用于从站中,如图6所示,该身份识别方法包括:This embodiment provides a field bus-based identification method. The identification method is applied to a slave station. As shown in FIG. 6 , the identification method includes:
步骤201、接收主站发送的主站身份密文数据。Step 201: Receive the master station identity ciphertext data sent by the master station.
其中,步骤201接收的主站身份密文数据为实施例1中步骤103中主站发送的数据。Wherein, the master station identity ciphertext data received in step 201 is the data sent by the master station in step 103 in Embodiment 1.
在一种具体的实施方式中,步骤201中可以多次接收主站发送的主站身份密文数据,并判断在多次接收的数据中是否存在第一预设次数的数据与其他的数据不一致的情况,若是,则生成主站身份错误信息,若否,则执行步骤202。在生成身份错误信息后可以通过该信息提醒有关人员来检查网络情况,从而避免由于网络原因影响主从站之间的身份验证。In a specific implementation manner, in step 201, the master station identity ciphertext data sent by the master station may be received multiple times, and it is determined whether there is a first preset number of data in the multiple received data that is inconsistent with other data If yes, generate the master station identity error message, if not, go to step 202. After the identity error information is generated, the relevant personnel can be reminded to check the network situation through the information, so as to avoid affecting the identity verification between the master and slave stations due to network reasons.
其中,第一预设次数可以根据实际情况进行设定,具体的,第一预设次数可以与实施例1中步骤103中发送的次数成比例设置,如可以将第一预设次数设置为1-0.7*前述发送的次数,这里的系数0.7只是进行举例说明,具体设置时可以根据实际情况任意选择该系数,如0.6、0.8、0.9等等。The first preset number of times can be set according to the actual situation. Specifically, the first preset number of times can be set in proportion to the number of times sent in step 103 in Embodiment 1. For example, the first preset number of times can be set to 1 -0.7*The number of times of the above-mentioned sending, the coefficient 0.7 here is just for illustration, and the specific setting can be arbitrarily selected according to the actual situation, such as 0.6, 0.8, 0.9 and so on.
本实施例中,通过多次接收主站身份密文数据,并判断多次接收的身份密文数据是否相符,避免由于网络原因导致主从站之间身份验证失败,进一步加强了主从站之间数据通讯的安全性。In this embodiment, by receiving the identity ciphertext data of the master station multiple times, and judging whether the identity ciphertext data received multiple times are consistent, the authentication failure between the master and slave stations due to network reasons is avoided, and the communication between the master and slave stations is further strengthened. security of data communication between them.
步骤202、解密主站身份密文数据以获取主站身份明文数据。Step 202: Decrypt the master station identity ciphertext data to obtain the master station identity plaintext data.
其中,采用与实施例1中步骤102中的加密方式对应的解密方式来解密主站身份密文数据。如当步骤102中采用预设编码规则预设编码规则重新排列主站身份明文数据中各字符的位置以生成主站身份密文数据时,步骤202则采用与预设编码规则对应的预设反编码规则还原主站身份密文数据中各字符的位置以生成主站身份明文数据。Wherein, a decryption method corresponding to the encryption method in step 102 in Embodiment 1 is used to decrypt the master station identity ciphertext data. For example, when the preset encoding rule is used in step 102 to rearrange the position of each character in the master station identity plaintext data to generate master station identity ciphertext data, step 202 adopts the preset reverse encoding corresponding to the preset encoding rule The encoding rule restores the position of each character in the master station identity ciphertext data to generate the master station identity plaintext data.
其中,主站身份明文数据可以参考实施例1中步骤101生成的主站身份明文数据,此处便不再赘述。For the master station identity plaintext data, reference may be made to the master station identity plaintext data generated in step 101 in Embodiment 1, which will not be repeated here.
步骤203、判断主站身份明文数据是否与预设主站身份数据一致,若是,则执行步骤204,若否,则执行步骤205。Step 203: Determine whether the master station identity plaintext data is consistent with the preset master station identity data, if yes, go to step 204, if not, go to step 205.
步骤204、确认主站的身份验证成功。Step 204: Confirm that the identity verification of the master station is successful.
步骤205、确认主站的身份验证失败,流程结束。Step 205: Confirm that the identity verification of the master station fails, and the process ends.
本实施例中,在步骤204确认主站身份验证成功后,从站可以允许接收并解析对应主站发送的工作数据,换句话说,对应的主站由此获得与从站进行数据通讯的权限。In this embodiment, after confirming that the identity verification of the master station is successful in step 204, the slave station can be allowed to receive and parse the working data sent by the corresponding master station. In other words, the corresponding master station thus obtains the authority to conduct data communication with the slave station. .
本实施例中,若步骤202中没有解密成功,或者步骤203中主站身份明文数据与预设主站身份数据不一致,则认为主站为不安全主站,禁止主站与从站之间进行通讯,还可以进一步生成主站身份验证错误信息已提示相关人员进行处理。In this embodiment, if the decryption is not successful in step 202, or the master station identity plaintext data in step 203 is inconsistent with the preset master station identity data, the master station is considered to be an unsafe master station, and the communication between the master station and the slave station is prohibited. Communication, you can further generate the master station authentication error message and prompt the relevant personnel to deal with it.
具体的,本实施例中,当目标从站标识符B02为随机生成的数据时,步骤203可以具体判断目标主站标识符是否与预设主站身份数据一致,若是,则执行步骤204,若否,则执行步骤205。Specifically, in this embodiment, when the target slave station identifier B02 is randomly generated data, step 203 may specifically determine whether the target master station identifier is consistent with the preset master station identity data, and if so, execute step 204, if If not, step 205 is executed.
当目标从站标识符B02为主站与从站约定好的数据时,则步骤203具体可以在判断目标主站标识符是否与预设主站身份数据一致的同时判断目标从站标识符是否与预设从站身份数据一致,若前述判断结果均为是,则执行步骤204,若有任意一项的判断结果为否,则执行步骤205。When the target slave station identifier B02 is the data agreed between the master station and the slave station, then step 203 specifically can judge whether the target slave station identifier is consistent with the preset master station identity data while judging whether the target slave station identifier is consistent with the preset master station identity data. The preset identity data of the slave stations are consistent. If the above judgment results are all yes, then step 204 is executed, and if any one of the judgment results is negative, step 205 is executed.
本实施例中,从站可以仅通过解密后获得的目标主站标识符对主站进行验证,在提高验证速度的同时增强了主从站之间数据传输的安全性。本实施例中,从站可以进一步通过解密后获得的目标从站标识符对主站进行验证,从而进一步提高了主从站之间的数据传输的安全性。In this embodiment, the slave station can only verify the master station through the target master station identifier obtained after decryption, which improves the verification speed and enhances the security of data transmission between the master and slave stations. In this embodiment, the slave station can further verify the master station through the target slave station identifier obtained after decryption, thereby further improving the security of data transmission between the master and slave stations.
由于数据通讯是一个相互的过程,在一种具体的实施方式中,从站可以生成从站身份密文数据以供主站对从站进行身份进行验证,具体的,步骤204及步骤205后还可以进一步包括:Since data communication is a mutual process, in a specific implementation manner, the slave station can generate slave station identity ciphertext data for the master station to verify the identity of the slave station. Specifically, after steps 204 and 205, Can further include:
步骤206、生成从站身份明文数据。Step 206: Generate the slave station identity plaintext data.
其中,从站身份明文数据为与其他的数据(文中简称为工作数据)不同的数据,从站身份明文数据为单独抽离出的独立的用于供主站对从站进行身份验证的数据。Among them, the plaintext data of the identity of the slave is data different from other data (referred to as working data in the text), and the plaintext data of the identity of the slave is the data extracted independently and used for the identity verification of the slave by the master.
其中,从站身份明文数据具有多种实现方式,具体实现方式可以参考实施例1中主站明文数据的实现方式,此处便不再赘述。Among them, the slave station identity plaintext data has various implementation manners, and the specific implementation manner may refer to the implementation manner of the master station plaintext data in Embodiment 1, which will not be repeated here.
为了便于对本实施例进行说明,下文以从站身份明文数据包括目标主站标识符、目标从站标识符及主站随机码的方式作为举例来进行说明,具体的,本实施例中,根据从主站接收的目标主站标识符、目标从站标识符及从主站接收的主站随机码的来生成从站身份明文数据。In order to facilitate the description of this embodiment, the following description takes the way in which the slave station identity plaintext data includes the target master station identifier, the target slave station identifier and the master station random code as an example. Specifically, in this embodiment, according to the slave station identifier The target master station identifier received by the master station, the target slave station identifier and the master station random code received from the master station are used to generate the slave station identity plaintext data.
在一种具体的实施方式中,当实施例1中主站身份明文数据中的目标从站标识符为与从站的预先约定的目标从站标识符时,此处可以根据从主站接收的目标从站标识符来生成从站身份明文数据。In a specific implementation manner, when the target slave station identifier in the master station identity plaintext data in Embodiment 1 is the target slave station identifier pre-agreed with the slave station, the target slave station identifier received from the master station can be Target Slave Identifier to generate Slave Identity clear text data.
在另一种具体的实施方式中,当实施例1中主站身份明文数据中的目标从站标识符为随机生成的目标从站标识符时,此处则通过从站的自身标识符更新目标从站标识符,并根据更新后的目标从站标识符来生成从站身份明文数据。In another specific implementation, when the target slave station identifier in the master station identity plaintext data in Example 1 is a randomly generated target slave station identifier, here the target slave station identifier is updated by the self identifier of the slave station Slave identifier, and generate slave identity plaintext data according to the updated target slave identifier.
本实施例中,根据主站发送的主站身份明文数据的不同,提供了多种从站身份明文数据的实现方式,在实际操作中可以根据实际情况进行选择,本实施例中对从站明文数据的设置方式具有广泛的适用性。In this embodiment, according to the difference of the master station's identity plaintext data sent by the master station, various implementations of the slave station's identity plaintext data are provided, which can be selected according to the actual situation in actual operation. The way the data is set up has broad applicability.
本实施例中,在随机生成目标从站标识符以及根据预先约定生成目标从站标识符的情况下均可生成用于验证从站身份的从站明文数据,从而在提高本实施例中身份识别方法的适用性的同时,提高了主从站之间的数据传输的安全性。In this embodiment, in the case where the target slave station identifier is randomly generated and the target slave station identifier is generated according to a pre-agreed agreement, the slave station plaintext data for verifying the identity of the slave station can be generated, thereby improving the identity recognition in this embodiment. At the same time of the applicability of the method, the security of data transmission between the master and slave stations is improved.
步骤207、加密从站身份明文数据以生成从站身份密文数据。Step 207: Encrypt the slave station identity plaintext data to generate the slave station identity ciphertext data.
其中,对从站身份明文数据的加密方法以参考实施例1中步骤102对主站身份明文数据的加密方法,此处便不再赘述。Wherein, the method for encrypting the plaintext data of the identity of the slave station refers to the method for encrypting the plaintext data of the identity of the master station in step 102 in Embodiment 1, which will not be repeated here.
步骤208、发送从站身份密文数据至主站。Step 208: Send the slave station identity ciphertext data to the master station.
其中,发送从站身份密文数据的方法可以参考实施例1中步骤103中发送主站身份密文数据的方法,此处便不再赘述。The method for sending the ciphertext data of the identity of the slave may refer to the method for sending the ciphertext data of the identity of the master in step 103 in Embodiment 1, which will not be repeated here.
在一种具体的实施方式中,从站中还可以预先设置从站权限令牌,当从站权限令牌为第二标识符时,从站具有执行身份识别方法的权限,当从站权限令牌为第一标识符时,从站不具有执行身份识别方法的权限,在步骤201接收主站身份明文数据的同时或之前还可以进一步还可以进一步包括将从站权限令牌设置为第二标识符的步骤。In a specific implementation manner, the slave station may also preset a slave station authority token. When the slave station authority token is the second identifier, the slave station has the authority to execute the identification method. When the card is the first identifier, the slave station does not have the authority to execute the identification method, and at the same time or before receiving the master station identity plaintext data in step 201, it may further include setting the slave station authority token as the second identification. character steps.
同样,在步骤208接收主站身份密文数据时还可以进一步包括将从站权限令牌设置 为第二标识符的步骤。Likewise, the step 208 of receiving the master station identity ciphertext data may further include a step of setting the slave station authority token as the second identifier.
本实施例中,通过修改从站权限令牌可以修改从站的操作权限,在同一时刻,主站与从站中只有一个具有操作权限,通过对权限令牌的修改,可以从而避免主站与从站同时对主站身份数据对从站身份数据进行处理,保证主站与从站中与身份相关的数据的同步性,也进一步保证主从站间的身份识别过程能够有效进行。In this embodiment, the operation authority of the slave station can be modified by modifying the authority token of the slave station. At the same time, only one of the master station and the slave station has the operation authority. By modifying the authority token, the master station and the slave station can be avoided. At the same time, the slave station processes the identity data of the master station and the slave station identity data to ensure the synchronization of the identity-related data between the master station and the slave station, and further ensure that the identification process between the master and slave stations can be carried out effectively.
在一种具体的实施方式中,为了保证主从站之间数据传输的安全性,可以周期性执行步骤201-步骤208,且在预设时间范围内,如24小时、48小时等等,第一次经过步骤203的验证确认主站的身份验证成功后,开启主站的数据传输权限,即允许从站接收对应主站发送的工作数据并允许从站对主站发送的工作数据进行进一步处理。In a specific implementation manner, in order to ensure the security of data transmission between the master and slave stations, steps 201 to 208 may be performed periodically, and within a preset time range, such as 24 hours, 48 hours, etc., the first After the verification of step 203 confirms that the identity verification of the master station is successful, the data transmission authority of the master station is opened, that is, the slave station is allowed to receive the working data sent by the corresponding master station and the slave station is allowed to further process the working data sent by the master station. .
而在之后周期中执行步骤201-步骤208时,若在步骤203的验证过程中,确认主站的身份验证失败后,则关闭从站的数据传输权限,即禁止从站接收并处理主站发送的工作数据。When steps 201 to 208 are executed in the subsequent cycle, if in the verification process of step 203, after it is confirmed that the identity verification of the master station fails, the data transmission authority of the slave station is closed, that is, the slave station is prohibited from receiving and processing the transmission of the master station. work data.
应当理解,本实施例中,在之后的周期中可以在分多个周期对主站密文数据进行解密,如在第二周期仅解密百分之10的数据,在第三周期再解密百分之20的数据,在第四周期再解密百分之20的数据,在对数据解密的过程中,仍然保持主站与从站间正常的数据处理,在一种场景下,当主站密文数据整体解密完毕后再对解密出的主站明文数据进行验证,在另一种场景下,也可以在对主站密文数据解密的过程中进行分段验证,如解密百分之10即验证百分之10。在第一种场景下,若对主站明文数据的整体验证失败,则认为对主站的身份验证失败,在第二种场景下,当对解密后的部分数据验证失败时,则认为对主站的身份验证失败。It should be understood that, in this embodiment, the master station ciphertext data may be decrypted in multiple cycles in subsequent cycles. For example, only 10 percent of the data is decrypted in the second cycle, and 10 percent of the data is decrypted in the third cycle. Of the 20 percent of the data, decrypt 20 percent of the data in the fourth cycle. In the process of decrypting the data, the normal data processing between the master station and the slave station is still maintained. In one scenario, when the master station ciphertext After the data is decrypted as a whole, the decrypted plaintext data of the master station is verified. In another scenario, segmental verification can also be performed during the process of decrypting the master station ciphertext data. For example, 10% decryption means verification. 10 percent. In the first scenario, if the overall verification of the master station's plaintext data fails, it is considered that the master station's identity verification fails. In the second scenario, when the decrypted partial data verification fails, it is considered that the master The authentication of the station failed.
本实施例中,在第一次对主站的身份验证成功后,则开启主站的数据传输权限,在主站对从站的数据传输权限开启后,主站可以持续向从站发送工作数据,在此期间,仅当在后续周期的验证过程中,对主站的身份验证失败后,才会关闭主站的数据传输权限,在这种方式下,可以保证在第一次验证成功后,主站和从站之间的正常数据传输不受影响,即在保证数据传输安全性的同时不会影响到正常数据传输的效率。In this embodiment, after the identity verification of the master station is successful for the first time, the data transmission authority of the master station is enabled. After the data transmission authority of the master station to the slave station is enabled, the master station can continue to send working data to the slave station. , during this period, the data transmission authority of the master station will be closed only when the authentication of the master station fails in the verification process of the subsequent cycle. In this way, it can be guaranteed that after the first verification is successful, The normal data transmission between the master station and the slave station is not affected, that is, the efficiency of normal data transmission will not be affected while ensuring the security of data transmission.
为了更好的理解本实施例中的身份识别方法,下面通过一具体场景对本实施例进行说明:In order to better understand the identity recognition method in this embodiment, the following describes this embodiment through a specific scenario:
如图7所示,在主站和从站硬件搭建完毕,主站和从站成功建立通讯后,通过步骤201-步骤205对主站身份进行验证,在预设的时间范围内,若首次身份验证是否有效的判断结果为是,则对身份验证定时器+1,应当理解,身份验证定时器的默认值可以根据实际需求进行预设,若首次身份验证有效的判断结果为否,则主从站首次身份验证操作, 具体来说,即执行步骤202及203,接着对首次身份验证操作完成的结果进行判断,若判断结果为是,则进一步判断首次身份验证是否通过,若首次身份验证操作完成的判断结果为否,则结束流程,可能存在网络或者其他的故障,此时可以通知相关人员进行处理。As shown in Figure 7, after the hardware of the master station and the slave station is completed and the communication between the master station and the slave station is successfully established, the identity of the master station is verified through steps 201 to 205. If the judgment result of whether the verification is valid is yes, then the authentication timer is +1. It should be understood that the default value of the authentication timer can be preset according to actual needs. The first identity verification operation of the station, specifically, steps 202 and 203 are executed, and then the result of the completion of the first identity verification operation is judged. If the judgment result is yes, it is further judged whether the first identity verification is passed, and if the first identity verification operation is completed If the judgment result is no, the process ends. There may be network or other faults. At this time, relevant personnel can be notified for processing.
若首次身份验证是否通过的结果为是,则身份验证定时器清零,并且将首次身份验证标志设置为1,之后可以执行其他任务,如接收并解析主站传输的工作数据,应当理解,每间隔预设时间,则再次返回判断首次身份验证标志是否有效已进行巡回验证。If the result of whether the first authentication is passed is yes, then the authentication timer is cleared and the first authentication flag is set to 1. After that, other tasks can be performed, such as receiving and parsing the working data transmitted by the master station. It should be understood that each time If the interval is preset time, it will return again to determine whether the first authentication flag is valid or not, and the round-robin verification has been carried out.
在对身份验证定时器+1了后,可以进一步判断身份验证定时器是否到达上限值,若否,则认为身份验证的结果持续有效,可以进一步执行其他任务,若身份验证定时器是否到达上限值的判断结果为是,则可以再次执行步骤201-步骤205对主从站执行身份验证操作,本实施例具体为从站对主站身份进行验证,应当理解,因为此时首次身份验证已通过,在后来的周期中在对主站的身份进行验证的过程中(即身份验证操作是否完成的判断结果为否时),从站仍然可以执行其他任务进行正常的数据通讯,而当身份验证操作是否完成的判断结果为是时,则进一步判断非首次的身份验证是否通过,若是,则认为主站通过了身份验证,身份验证定时器清零,并且从站可以接着执行其他任务,若非首次的身份验证是否通过的结果为否,则报身份验证错误并中断通讯。After +1 is added to the authentication timer, it can be further judged whether the authentication timer has reached the upper limit. If not, the result of the authentication is considered to continue to be valid, and other tasks can be further performed. If the authentication timer has reached the upper limit The judgment result of the limit value is yes, then step 201-step 205 can be performed again to perform the identity verification operation on the master and slave stations. In this embodiment, the slave station verifies the identity of the master station. Through, in the process of verifying the identity of the master station in the subsequent cycle (that is, when the judgment result of whether the authentication operation is completed is no), the slave station can still perform other tasks for normal data communication. When the judgment result of whether the operation is completed is yes, it is further judged whether the non-first-time authentication has passed. If so, it is considered that the master has passed the authentication, the authentication timer is cleared, and the slave can continue to perform other tasks. If it is not the first time The result of whether the authentication is passed is no, then an authentication error is reported and the communication is interrupted.
应当理解,主站对从站的验证过程可以参考上述从站对主站的验证过程,此处便不再赘述。It should be understood that, for the verification process of the master station to the slave station, reference may be made to the above-mentioned verification process of the slave station to the master station, which will not be repeated here.
实施例3Example 3
本实施例提供了一种基于现场总线的数据传输系统,数据传输系统应用于主站中,如图8所示,该数据传输系统包括:主站身份数据生成模块301、主站身份数据加密模块302及主站身份数据发送模块303。This embodiment provides a data transmission system based on a field bus. The data transmission system is applied to the master station. As shown in FIG. 8 , the data transmission system includes: a master station identity data generation module 301 and a master station identity data encryption module 302 and the master station identity data sending module 303.
主站身份数据生成模块301用于生成主站身份明文数据。The master station identity data generating module 301 is used to generate the master station identity plaintext data.
其中,主站身份明文数据为与其他的数据(文中简称为工作数据)不同的数据,主站身份明文数据为单独抽离出的独立的用于供从站对主站进行身份验证的数据。Among them, the master station identity plaintext data is data different from other data (herein referred to as working data), and the master station identity plaintext data is independently extracted data for the slave station to authenticate the master station.
本实施例中,主站身份明文数据具有多种实现方式,在一种实现方式中,主站身份明文数据包括目标主站标识符,在另一种实现方式中,主站身份明文数据包括目标主站标识符及目标从站标识符,在一种实现方式中,主站身份明文数据包括主站标识符及主站随机码,在一种实现方式中,主站身份明文数据包括目标主站标识符、目标从站标识符及主站随机码,在一种实现方式中,主站身份明文数据包括目标从站标识符,在一种实现方式中,主站身份明文数据包括主站随机码。In this embodiment, the master station identity plaintext data has multiple implementation manners. In one implementation manner, the master station identity plaintext data includes the target master station identifier, and in another implementation manner, the master station identity plaintext data includes the target station identifier. The master station identifier and the target slave station identifier. In an implementation manner, the master station identity plaintext data includes the master station identifier and the master station random code. In an implementation manner, the master station identity plaintext data includes the target master station. Identifier, target slave station identifier and master station random code. In an implementation manner, the master station identity plaintext data includes the target slave station identifier, and in an implementation manner, the master station identity plaintext data includes the master station random code. .
为了便于对本实施例进行说明,下文以主站身份明文数据包括目标主站标识符、目 标从站标识符及主站随机码的方式作为举例来进行说明。图4示出了在一种具体的实施方式下,主站身份明文数据的格式图,具体的,具体主站身份明文数据的格式可以参考实施例1中主站明文数据的格式,此处便不再赘述。In order to facilitate the description of this embodiment, the following description will be given by taking the way in which the master station identity plaintext data includes the target master station identifier, the target slave station identifier and the master station random code as an example. FIG. 4 shows a format diagram of the master station identity plaintext data in a specific implementation manner. Specifically, for the specific master station identity plaintext data format, refer to the format of the master station plaintext data in Embodiment 1, and here is the No longer.
其中,目标主站标识符B01为主站与从站约定好的数据,主站随机码B03为随机生成的数据。在第一种场景下,目标从站标识符B02为主站与从站约定好的数据,相互存储于主站与从站内;在第二种场景下,目标从站标识符B02为随机生成的数据。Among them, the target master station identifier B01 is the data agreed between the master station and the slave station, and the master station random code B03 is randomly generated data. In the first scenario, the target slave station identifier B02 is the agreed data between the master station and the slave station, and is mutually stored in the master station and the slave station; in the second scenario, the target slave station identifier B02 is randomly generated. data.
应当理解,主站身份明文数据的实现方式并不限于上文的方式,其可根据实际情况进行选择。It should be understood that the implementation manner of the master station identity plaintext data is not limited to the above manner, which can be selected according to the actual situation.
本实施例中,提供了多种主站身份明文数据的实现方式,在实际操作中可以根据实际情况进行选择,本实施例中对主站明文数据的设置方式具有广泛的适用性。In this embodiment, a variety of implementation manners of the master station identity plaintext data are provided, which can be selected according to actual conditions in actual operation. The setting manner of the master station plaintext data in this embodiment has wide applicability.
本实施例中,主站身份数据生成模块301可以随机生成目标从站标识符,提高了身份明文数据的生成速度,进一步提高了本实施例中的数据传输系统的效率,本实施例中,主站身份数据生成模块301可以通过主站与从站的预先约定,生成目标从站标识符以供从站进一步验证主站的身份,从而进一步提高了主从站之间的数据传输的安全性。In this embodiment, the master station identity data generation module 301 can randomly generate the target slave station identifier, which improves the generation speed of the identity plaintext data and further improves the efficiency of the data transmission system in this embodiment. The station identity data generating module 301 can generate a target slave station identifier for the slave station to further verify the identity of the master station through the pre-appointment between the master station and the slave station, thereby further improving the security of data transmission between the master station and the slave station.
主站身份数据加密模块302用于加密主站身份明文数据以生成主站身份密文数据。The master station identity data encryption module 302 is used for encrypting the master station identity plaintext data to generate the master station identity ciphertext data.
其中,主站身份数据加密模块302可以采用多种方式来加密主站身份明文数据,如可以采用现有技术中的加密算法来加密主站明文数据,如DES、3DES、IDEA、AES、RC等对称加密算法或RSA、DSA、Diffie-Hellman等非对称法加密算法。Among them, the master station identity data encryption module 302 can use various methods to encrypt the master station identity plaintext data, for example, the encryption algorithm in the prior art can be used to encrypt the master station plaintext data, such as DES, 3DES, IDEA, AES, RC, etc. Symmetric encryption algorithm or asymmetric encryption algorithm such as RSA, DSA, Diffie-Hellman, etc.
但是由于主站及从站的处理器多为主频百兆赫兹级别的嵌入式芯片,其运算处理能力有限,所有任务的执行周期一般为1~20毫秒左右,包括处理数据采集、数据计算、数据通讯、时序逻辑、控制算法和故障保护等较为复杂的工作,有很高的实时性要求。而工业控制系统的现场总线设备的通讯速度一般为100kbit/s(千位每秒)~12Mbit/s,而一般要求在一个任务周期内完成主从站之间通讯数据的处理。However, because the processors of the master station and the slave station are mostly embedded chips with a main frequency of 100 MHz, their computing processing capabilities are limited, and the execution cycle of all tasks is generally about 1 to 20 milliseconds, including processing data acquisition, data calculation, Data communication, sequential logic, control algorithm and fault protection and other more complex work have high real-time requirements. The communication speed of the field bus device of the industrial control system is generally 100kbit/s (kilobits per second) ~ 12Mbit/s, and it is generally required to complete the communication data processing between the master and slave stations within a task cycle.
就保密性较高通讯数据加密算法,不管是前述对称加密算法还是非对称法加密算法,其要求计算量都非常大,目前多用于通讯数实时性要求不高的场合。若在嵌入式芯片1~20毫秒任务周期内,用上述加密算法完成通讯身份验证的数据加密和解密工作,会占用嵌入式芯片非常多的时间资源,导致执行周期内不能完成所有任务的执行,最终严重影响工业控制系统的基于现场总线的主站及从站间的通讯、监测、时序逻辑及控制等任务处理的实时性,不能满足风机机组的控制要求。As for the communication data encryption algorithm with high confidentiality, whether it is the aforementioned symmetric encryption algorithm or asymmetric encryption algorithm, the amount of calculation required is very large, and currently it is mostly used in occasions where the real-time requirement of communication data is not high. If the above-mentioned encryption algorithm is used to complete the data encryption and decryption of communication authentication within the embedded chip task cycle of 1 to 20 milliseconds, it will occupy a lot of time resources of the embedded chip, resulting in that the execution of all tasks cannot be completed within the execution cycle. In the end, it seriously affects the real-time performance of the communication, monitoring, sequential logic and control between the master station and the slave station based on the field bus of the industrial control system, and cannot meet the control requirements of the fan unit.
因此,本实施例中主站身份数据加密模块302优先选择计算量较为简单的预设编码规则来对主站明文数据进行加密来克服计算量大、计算耗时的缺陷,在提高数据传输安 全性的同时,保证数据传输的实时性,其中预设编码规则用于重新排列主站身份明文数据中各字符的位置以生成主站身份密文数据。如:可以将主站随机码中的每一字符分别插入目标主站标识符及目标从站标识符的各个字符之间以改变主站身份明文数据中的各个字符间的位置关系。又如,可以打乱目标主站标识符、目标从站标识符及主站随机码中各个字符的顺序。应当理解,上述预设编码规则仅作为举例说明,不应当成为对本实施例的限制,实际中,还可以具有其他的方式来重新排列主站身份明文数据中各字符的位置以生成主站身份密文数据。Therefore, in this embodiment, the master station identity data encryption module 302 preferentially selects a preset encoding rule with a relatively simple amount of calculation to encrypt the plaintext data of the master station to overcome the defects of large amount of calculation and time-consuming calculation, thereby improving the security of data transmission. At the same time, the real-time nature of data transmission is ensured, wherein the preset encoding rules are used to rearrange the positions of each character in the master station identity plaintext data to generate the master station identity ciphertext data. For example, each character in the random code of the master station can be inserted into the respective characters of the target master station identifier and the target slave station identifier to change the positional relationship between the characters in the master station identity plaintext data. For another example, the sequence of each character in the identifier of the target master station, the identifier of the target slave station and the random code of the master station may be disrupted. It should be understood that the above-mentioned preset coding rules are only used for illustration, and should not be a limitation to this embodiment. In practice, there may be other ways to rearrange the position of each character in the master station identity plaintext data to generate the master station identity password. text data.
由于现有技术中,主站与从站之间为明文通讯,因此,破坏者容易通过伪装成主站需要通信的从站,以接收主站发送的数据从而对数据进行监听、窃取等不法行为。本实施例中,主站明文数据生成模块通过设置单独的主站身份明文数据,并且主站身份数据加密模块302通过对身份明文数据进行加密,从站只有对主站身份密文数据进行解密并且解密成功后,才能继续接收及解析主站发送的工作数据,从而提高了主站与从站间通讯的安全性。Since in the prior art, the communication between the master station and the slave station is in plain text, it is easy for the saboteur to masquerade as the slave station that the master station needs to communicate with to receive the data sent by the master station to monitor and steal the data. . In this embodiment, the master station plaintext data generation module sets separate master station identity plaintext data, and the master station identity data encryption module 302 encrypts the identity plaintext data, and the slave station only decrypts the master station identity ciphertext data and Only after the decryption is successful, can the working data sent by the master station be continued to be received and analyzed, thereby improving the security of the communication between the master station and the slave station.
本实施例中,主站身份数据加密模块302可以通过简单的预设编码规则对主站身份明文数据进行加密,从而不仅提高了主站与从站间通讯过程的安全性,也保证了主站与从站间通讯过程的实时性。且本实施例中,主站身份数据生成模块301设置主站身份明文数据的规则简单,数据长度小,所需要的资源有限,因此在保证主从站通讯过程安全性的同时不会影响对工作数据的处理。In this embodiment, the master station identity data encryption module 302 can encrypt the master station identity plaintext data through a simple preset encoding rule, thereby not only improving the security of the communication process between the master station and the slave station, but also ensuring the master station The real-time nature of the communication process with the slaves. And in this embodiment, the master station identity data generation module 301 has simple rules for setting the master station identity plaintext data, the data length is small, and the required resources are limited, so while ensuring the security of the master-slave communication process, it will not affect the work processing of data.
主站身份数据发送模块303用于发送主站身份密文数据至从站。The master station identity data sending module 303 is used for sending the master station identity ciphertext data to the slave station.
主站身份数据发送模块303既可以通过广播的方式广播主站身份密文数据至所有的从站,也可以通过一对一点播的方式发送主站身份密文数据至对应的从站。The master station identity data sending module 303 can either broadcast the master station identity ciphertext data to all the slave stations by broadcasting, or send the master station identity ciphertext data to the corresponding slave stations by one-to-one broadcasting.
在一种具体的实施方式中,为了避免由于通信故障、网络堵塞等客观原因导致主站身份密文数据发送失败的情况发生,本实施例中,主站身份数据发送模块303用于多次发送主站身份密文数据至从站,其中,发送次数可以根据实际需求进行设置,如10次。In a specific implementation manner, in order to avoid the failure of sending the master station identity ciphertext data due to objective reasons such as communication failures, network congestion, etc., in this embodiment, the master station identity data sending module 303 is used to send multiple times The master station identity ciphertext data is sent to the slave station, and the number of times of sending can be set according to actual needs, such as 10 times.
本实施例中,在主站与从站原有的通信数据的基础上,主站身份数据生成模块301通过单独生成主站身份明文数据并通过主站身份数据加密模块302对该数据进行加密以用于主从站之间进行身份验证,从站在接收主站发送的加密后的数据后,只有对数据解密成功并且对数据验证成功后,主站才能获得与从站进行正常通讯的权限,由于单独生成的主站身份明文数据对于工作数据而言数据所占空间小,因此,在不会影响主站与从站间的正常通讯效率的前提下,大大增加了主从站之间数据传输的安全性。In this embodiment, on the basis of the original communication data between the master station and the slave station, the master station identity data generation module 301 separately generates the master station identity plaintext data and encrypts the data through the master station identity data encryption module 302 to It is used for authentication between the master and slave stations. After the slave station receives the encrypted data sent by the master station, only after the data decryption is successful and the data verification is successful, the master station can obtain the permission to communicate with the slave station normally. Since the separately generated master station identity plaintext data occupies a small space for the working data, it greatly increases the data transmission between the master station and the slave station without affecting the normal communication efficiency between the master station and the slave station. security.
本实施例中,主站身份数据发送模块303可以多次发送主站身份密文数据至从站, 从而避免由于网络原因导致主从站之间身份验证失败,进一步加强了主从站之间数据通讯的安全性。In this embodiment, the master station identity data sending module 303 can send the master station identity ciphertext data to the slave stations for many times, so as to avoid the failure of identity verification between the master and slave stations due to network reasons, and further strengthen the data between the master and slave stations. communication security.
由于数据通讯是一个相互的过程,在一种具体的实施方式中,主站还可以接收从站发送的身份密文数据以对从站的身份进行验证,具体的,该数据传输系统还包括从站身份数据接收模块305、从站身份数据解密模块306及从站身份数据验证模块307,所述主站身份数据发送模块303还用于发送所述主站身份密文数据至所述从站后调用所述从站身份数据接收模块305。Since data communication is a mutual process, in a specific implementation manner, the master station can also receive the identity ciphertext data sent by the slave station to verify the identity of the slave station. Specifically, the data transmission system further includes a slave station. The station identity data receiving module 305, the slave station identity data decryption module 306 and the slave station identity data verification module 307, the master station identity data sending module 303 is also used to send the master station identity ciphertext data to the slave station The slave station identity data receiving module 305 is called.
所述从站身份数据接收模块305用于接收所述从站发送的从站身份密文数据,其中,从站身份数据接收模块305接收从站身份密文数据的方式可以参考下文实施例4中主站身份数据接收模块405接收主站发送的主站身份密文数据的方式,此处便不再赘述。The slave station identity data receiving module 305 is configured to receive the slave station identity ciphertext data sent by the slave station, wherein, the way that the slave station identity data receiving module 305 receives the slave station identity ciphertext data may refer to the following embodiment 4. The manner in which the master station identity data receiving module 405 receives the master station identity ciphertext data sent by the master station will not be repeated here.
所述从站身份数据解密模块306用于解密所述从站身份密文数据以生成从站身份明文数据,其中,从站身份数据解密模块306解密从站身份密文数据的方式可以参考实施例4中主站身份数据解密模块406中的解密主站身份密文数据的方式,此处便不再赘述。The slave station identity data decryption module 306 is used to decrypt the slave station identity ciphertext data to generate the slave station identity plaintext data, wherein the slave station identity data decryption module 306 decrypts the slave station identity ciphertext data. The method for decrypting the master station identity ciphertext data in the master station identity data decryption module 406 in step 4 will not be repeated here.
所述从站身份数据验证模块307用于判断所述从站身份明文数据是否与预设从站明文数据相符,若是,则确认所述从站的身份验证成功,若否,则确认从站的身份验证失败。The slave station identity data verification module 307 is used to judge whether the slave station identity plaintext data is consistent with the preset slave station plaintext data, if so, confirm that the slave station's identity verification is successful; Authentication failed.
具体的,当主站身份数据发送模块303发送至从站的主站密文数据仅包括加密后的目标主站身份标识符时,从站身份数据验证模块307具体验证方式为判断目标主站标识符是否与预设主站身份数据一致,若是,则确认所述从站的身份验证成功,若否,则确认从站的身份验证失败。Specifically, when the master station ciphertext data sent by the master station identity data sending module 303 to the slave station only includes the encrypted target master station identity identifier, the specific verification method of the slave station identity data verification module 307 is to determine the target master station identifier Whether the character is consistent with the preset master station identity data, if so, confirm that the identity verification of the slave station is successful, if not, confirm that the identity verification of the slave station fails.
当主站身份数据发送模块303发送至从站的主站密文数据包括加密后的目标主站身份标识符及目标从站标识符时,从站身份数据验证模块307具体验证方式为判断目标主站标识符是否与预设主站身份数据一致,且判断目标从站标识符是否与预设从站身份数据一致,若二者的判断结果均为是,则确认所述从站的身份验证成功,若否,则确认从站的身份验证失败。When the master station ciphertext data sent by the master station identity data sending module 303 to the slave station includes the encrypted target master station identity identifier and the target slave station identifier, the specific verification method of the slave station identity data verification module 307 is to judge the target master station Whether the station identifier is consistent with the preset master station identity data, and judge whether the target slave station identifier is consistent with the preset slave station identity data, if both judgment results are yes, confirm that the identity verification of the slave station is successful , if not, confirm that the authentication of the slave has failed.
当主站身份数据发送模块303发送至从站的主站密文数据包括加密后的目标主站身份标识符、目标从站标识符及主站随机码时,从站身份数据验证模块307具体验证方式为判断目标主站标识符是否与预设主站身份数据一致、判断目标从站标识符是否与预设从站身份数据一致且判断解密后得到的主站随机码是否与主站身份数据生成模块301生成的主站随机码是否相符,若三者的判断结果均为是,确认所述从站的身份验证成功,若否,则确认从站的身份验证失败。When the master station ciphertext data sent by the master station identity data sending module 303 to the slave station includes the encrypted target master station identity identifier, the target slave station identifier and the master station random code, the slave station identity data verification module 307 specifically verifies The method is to judge whether the target master station identifier is consistent with the preset master station identity data, judge whether the target slave station identifier is consistent with the preset slave station identity data, and judge whether the master station random code obtained after decryption is generated with the master station identity data. Whether the random code of the master station generated by the module 301 is consistent, if the three judgment results are all yes, it confirms that the identity verification of the slave station is successful; if not, it confirms that the identity verification of the slave station fails.
本实施例中,若从站身份数据解密模块306没有解密成功,或者从站身份数据验证模块307判断从站身份明文数据与预设从站身份数据不一致,则认为从站为不安全主站,禁止主站与从站之间进行通讯,还可以进一步生成从站身份验证错误信息已提示相关人员进行处理。In this embodiment, if the slave station identity data decryption module 306 fails to decrypt successfully, or if the slave station identity data verification module 307 judges that the slave station identity plaintext data is inconsistent with the preset slave station identity data, it is considered that the slave station is an unsafe master station, The communication between the master station and the slave station is prohibited, and the slave station authentication error message can be further generated to prompt the relevant personnel to deal with it.
本实施例中从站身份数据解密模块306可以仅通过解密后获得的目标主站标识符对从站进行验证,在提高验证速度的同时增强了主从站之间数据传输的安全性。本实施例中,从站身份数据解密模块306可以进一步通过解密后获得的目标从站标识符对从站进行验证,从而进一步提高了主从站之间的数据传输的安全性。本实施例中,从站身份数据解密模块306还可以进一步通过主站之前发送的随机生成的主站随机码来对从站进行验证,从而进一步增加了主从站之间数据传输的可靠性与安全性。In this embodiment, the slave station identity data decryption module 306 can only verify the slave station through the target master station identifier obtained after decryption, which improves the verification speed and enhances the security of data transmission between the master and slave stations. In this embodiment, the slave station identity data decryption module 306 can further verify the slave station through the target slave station identifier obtained after decryption, thereby further improving the security of data transmission between the master and slave stations. In this embodiment, the slave station identity data decryption module 306 may further verify the slave station through the randomly generated master station random code previously sent by the master station, thereby further increasing the reliability and reliability of data transmission between the master and slave stations. safety.
在一种具体的实施方式中,为了提高主站与从站间身份验证的效率,所述从站身份数据接收模块305还用于判断在第一时间阈值范围内是否接收到所述从站发送的从站身份密文数据,若否,则生成从站处理超时信息,若是,则调用所述从站身份数据解密模块306。In a specific implementation manner, in order to improve the efficiency of identity verification between the master station and the slave station, the slave station identity data receiving module 305 is further configured to determine whether the slave station has received the data sent by the slave station within the first time threshold range. The ciphertext data of the slave station identity, if not, generate the slave station processing timeout information, if so, call the slave station identity data decryption module 306.
本实施例中,若从站身份数据接收模块在第一时间阈值范围内未收到从站发送的从站身份密文数据,则生成从站处理超时信息,可以通过该信息提醒相关人员进行处理,从而在加强通讯安全性的同时保障主从站间身份验证的效率。In this embodiment, if the slave station identity data receiving module does not receive the slave station identity ciphertext data sent by the slave station within the range of the first time threshold, it generates slave station processing timeout information, which can be used to remind relevant personnel to process , so as to strengthen the communication security while ensuring the efficiency of authentication between master and slave stations.
在一种具体的实施方式中,主站中还可以预先设置主站权限令牌,当主站权限令牌为第一标识符时,主站具有执行数据传输系统的权限,当主站权限令牌为第二标识符时,主站不具有执行数据传输系统的权限,该数据传输系统还包括主站权限修改模块308,在主站身份数据生成模块301生成主站身份明文数据的同时或之前还可以进一步调用主站权限修改模块308以将主站权限令牌设置为第一标识符。In a specific implementation manner, the master station authority token may also be preset in the master station. When the master station authority token is the first identifier, the master station has the authority to execute the data transmission system. When the card is the second identifier, the master station does not have the authority to execute the data transmission system, and the data transmission system also includes the master station authority modification module 308, which is performed at the same time or before the master station identity data generation module 301 generates the master station identity plaintext data. The master authority modification module 308 may be further invoked to set the master authority token to the first identifier.
同样,在主站身份数据发送模块303发送主站身份明文数据的同时或之前还可以进一步调用主站权限修改模块308以将主站权限令牌设置为第二标识符。Likewise, the master authority modification module 308 may be further invoked to set the master authority token as the second identifier while or before the master station identity data sending module 303 sends the master station identity plaintext data.
类似的,从站身份数据接收模块305接收从站身份密文数据时还可以进一步调用主站权限修改模块308以将主站权限令牌设置为第一标识符。Similarly, when the slave station identity data receiving module 305 receives the slave station identity ciphertext data, it may further call the master station authority modification module 308 to set the master station authority token as the first identifier.
本实施例中,主站权限修改模块308通过修改主站权限令牌可以修改主站的操作权限,应当理解,在同一时刻,主站与从站中只有一个具有操作权限,通过对权限令牌的修改,可以避免主站与从站同时对主站身份数据对从站身份数据进行处理,保证主站与从站中与身份相关的数据的同步性,也进一步保证主从站间的身份识别过程能够有效进行。In this embodiment, the master station authority modification module 308 can modify the operation authority of the master station by modifying the master station authority token. It should be understood that at the same time, only one of the master station and the slave station has the operation authority. The modification can prevent the master station and the slave station from processing the identity data of the master station and the slave station at the same time, ensure the synchronization of the identity-related data in the master station and the slave station, and further ensure the identity recognition between the master and slave stations. The process can be carried out efficiently.
在一种具体的实施方式中,为了持续保证主从站间数据传输的安全性,可以周期性 调用主站身份数据生成模块301、主站身份数据加密模块302、主站身份数据发送模块303、主站身份数据判断模块304、从站身份数据接收模块305、从站身份数据解密模块306、从站身份数据验证模块307及主站权限修改模块308。且在预设时间范围内,如24小时、48小时等等,从站身份数据验证模块307经过验证第一次确认从站的身份验证成功后,开启从站的数据传输权限,即允许主站接收对应从站发送的工作数据并允许主站对从站发送的工作数据进行进一步处理。In a specific embodiment, in order to continuously ensure the security of data transmission between the master and slave stations, the master station identity data generation module 301, the master station identity data encryption module 302, the master station identity data transmission module 303, The master station identity data judgment module 304 , the slave station identity data receiving module 305 , the slave station identity data decryption module 306 , the slave station identity data verification module 307 and the master station authority modification module 308 . And within the preset time range, such as 24 hours, 48 hours, etc., after the slave station identity data verification module 307 confirms the success of the slave station's identity verification for the first time after verification, it opens the data transmission authority of the slave station, that is, allows the master station Receive the work data sent by the corresponding slave station and allow the master station to further process the work data sent by the slave station.
而在之后周期中若在从站身份验证模块的验证过程中,确认从站的身份验证失败后,则关闭从站的数据传输权限,即禁止主站接收并处理从站发送的工作数据。In the subsequent cycle, if the authentication of the slave station fails, the data transmission authority of the slave station is closed, that is, the master station is prohibited from receiving and processing the working data sent by the slave station.
应当理解,本实施例中,在之后的周期中从站身份数据解密模块306可以分多个周期对从站密文数据进行解密,如在第二周期仅解密百分之10的数据,在第三周期再解密百分之20的数据,在第四周期再解密百分之20的数据,在对数据解密的过程中,仍然保持主站与从站间正常的数据处理,在一种场景下,从站身份数据解密模块306当对从站密文数据整体解密完毕后从站身份数据验证模块307再对解密出的从站明文数据进行验证,在另一种场景下,从站身份数据验证模块307也可以在从站身份数据解密模块306对从站密文数据解密的过程中进行分段验证,如解密百分之10即验证百分之10。在第一种场景下,从站身份数据验证模块307若对从站明文数据的整体验证失败,则认为对从站的身份验证失败,在第二种场景下,从站身份数据验证模块307当对解密后的部分数据验证失败时,则认为对从站的身份验证失败。It should be understood that in this embodiment, the slave station identity data decryption module 306 may decrypt the slave station ciphertext data in multiple cycles in the following cycles. For example, in the second cycle, only 10% of the data is decrypted. In the third cycle, 20% of the data is decrypted, and in the fourth cycle, 20% of the data is decrypted. During the process of decrypting the data, the normal data processing between the master station and the slave station is still maintained. In one scenario , when the slave station identity data decryption module 306 completes the overall decryption of the slave station ciphertext data, the slave station identity data verification module 307 verifies the decrypted slave station plaintext data. In another scenario, the slave station identity data verification The module 307 may also perform segment verification in the process of decrypting the slave station ciphertext data by the slave station identity data decryption module 306, for example, decrypting 10% means verifying 10%. In the first scenario, if the overall verification of the slave station's plaintext data fails, the slave station identity data verification module 307 considers that the slave station's identity verification fails. In the second scenario, the slave station's identity data verification module 307 will When the decrypted part of the data fails to be authenticated, it is considered that the authentication of the slave fails.
本实施例中,从站身份数据验证模块307在第一次对从站的身份验证成功后,则开启从站的数据传输权限,在从站对主站的数据传输权限开启后,从站可以持续向主站发送工作数据,在此期间,仅当在后续周期的验证过程中,从站身份数据验证模块307对从站的身份验证失败后,才会关闭从站的数据传输权限,在这种方式下,可以保证在第一次验证成功后,主站和从站之间的正常数据传输不受影响,即在保证数据传输安全性的同时不会影响到正常数据传输的效率与实时性。In this embodiment, the identity data verification module 307 of the slave station enables the data transmission authority of the slave station after the first successful identity verification of the slave station. After the data transmission authority of the slave station to the master station is enabled, the slave station can Continuously send working data to the master station. During this period, only when the slave station identity data verification module 307 fails to authenticate the slave station in the verification process of the subsequent cycle, the slave station's data transmission authority will be closed. In this way, it can be ensured that after the first verification is successful, the normal data transmission between the master station and the slave station will not be affected, that is, the efficiency and real-time performance of normal data transmission will not be affected while ensuring the security of data transmission. .
实施例4Example 4
本实施例提供了一种基于现场总线的身份识别系统,该身份识别系统应用于从站中,如图9所示,该身份识别系统包括:主站身份数据接收模块405、主站身份数据解密模块406及主站身份数据判断模块304。This embodiment provides a field bus-based identification system. The identification system is applied to a slave station. As shown in FIG. 9, the identification system includes: a master station identification data receiving module 405, a master station identification data decryption The module 406 and the master station identity data judgment module 304.
所述主站身份数据接收模块405用于接收主站发送的主站身份密文数据。The master station identity data receiving module 405 is configured to receive the master station identity ciphertext data sent by the master station.
其中,主站身份数据接收模块405接收的主站身份密文数据为实施例3中主站身份数据发送模块303发送的数据。Wherein, the master station identity ciphertext data received by the master station identity data receiving module 405 is the data sent by the master station identity data sending module 303 in the third embodiment.
在一种具体的实施方式中,主站身份数据接收模块405可以多次接收主站发送的主站身份密文数据,身份识别系统还可以包括主站身份数据判断模块304,用于判断在多次接收的数据中是否存在第一预设次数的数据与其他的数据不一致的情况,若是,则生成主站身份错误信息,若否,则调用所述主站身份数据解密模块406。主站身份数据接收模块405在生成身份错误信息后可以通过该信息提醒有关人员来检查网络情况,从而避免由于网络原因影响主从站之间的身份验证。In a specific implementation manner, the master station identity data receiving module 405 can receive the master station identity ciphertext data sent by the master station for many times, and the identity recognition system can also include the master station identity data judging module 304, which is used to judge the number of Whether there is a situation in which the data of the first preset number of times is inconsistent with other data in the data received next time, if yes, generate a master station identity error message, if not, call the master station identity data decryption module 406 . After the identity data receiving module 405 of the master station generates the identity error information, it can remind relevant personnel to check the network condition through the information, so as to avoid the influence of the identity verification between the master and slave stations due to network reasons.
其中,第一预设次数可以根据实际情况进行设定,具体的,可以第一预设次数与实施例3中主站身份数据发送模块303发送的次数成比例设置,如可以将第一预设次数设置为1-0.7*前述发送的次数,这里的系数0.7只是进行举例说明,具体设置时可以根据实际情况任意选择该系数,如0.6、0.8、0.9等等。The first preset number of times can be set according to the actual situation. Specifically, the first preset number of times can be set in proportion to the number of times sent by the master station identity data sending module 303 in Embodiment 3. For example, the first preset number of times can be set as The number of times is set to 1-0.7*the number of times of the above-mentioned sending. The coefficient 0.7 here is just for illustration. The specific setting can be arbitrarily selected according to the actual situation, such as 0.6, 0.8, 0.9 and so on.
本实施例中,主站身份数据接收模块405通过多次接收主站身份密文数据,并判断多次接收的身份密文数据是否相符,避免由于网络原因导致主从站之间身份验证失败,进一步加强了主从站之间数据通讯的安全性。In this embodiment, the master station identity data receiving module 405 receives the master station identity ciphertext data multiple times, and judges whether the identity ciphertext data received multiple times are consistent, so as to avoid the failure of identity verification between the master and slave stations due to network reasons, It further strengthens the security of data communication between master and slave stations.
所述主站身份数据解密模块406用于解密所述主站身份密文数据以获取主站身份明文数据。The master station identity data decryption module 406 is configured to decrypt the master station identity ciphertext data to obtain the master station identity plaintext data.
其中,主站身份数据解密模块406采用与实施例3中主站身份数据加密模块302采用的加密方式对应的解密方式来解密主站身份密文数据。如当主站身份数据加密模块302采用预设编码规则预设编码规则重新排列主站身份明文数据中各字符的位置以生成主站身份密文数据时,主站身份数据解密模块406采用与预设编码规则对应的预设反编码规则还原主站身份密文数据中各字符的位置以生成主站身份明文数据。The master station identity data decryption module 406 uses a decryption method corresponding to the encryption method adopted by the master station identity data encryption module 302 in Embodiment 3 to decrypt the master station identity ciphertext data. For example, when the master station identity data encryption module 302 adopts the preset encoding rule and the preset encoding rule to rearrange the position of each character in the master station identity plaintext data to generate the master station identity ciphertext data, the master station identity data decryption module 406 adopts the Set the preset anti-encoding rule corresponding to the encoding rule to restore the position of each character in the master station identity ciphertext data to generate the master station identity plaintext data.
其中,主站身份明文数据可以参考实施例3中主站身份数据生成模块301生成的主站身份明文数据,此处便不再赘述。For the master station identity plaintext data, reference may be made to the master station identity plaintext data generated by the master station identity data generating module 301 in Embodiment 3, which will not be repeated here.
所述主站身份数据验证模块407用于判断所述主站身份明文数据是否与预设主站身份数据一致,若是,则确认所述主站的身份验证成功,若否,则确认主站的身份验证失败。The master station identity data verification module 407 is used to judge whether the master station identity plaintext data is consistent with the preset master station identity data. Authentication failed.
本实施例中,主站身份数据验证模块407确认主站身份验证成功后,从站可以允许接收并解析对应主站发送的工作数据,换句话说,对应的主站由此获得与从站进行数据通讯的权限。In this embodiment, after the identity data verification module 407 of the master station confirms that the identity verification of the master station is successful, the slave station is allowed to receive and parse the working data sent by the corresponding master station. Permission for data communication.
本实施例中,若主站身份数据解密模块406没有解密成功,或者主站身份数据验证模块407判断主站身份明文数据与预设主站身份数据不一致,则认为主站为不安全主站,禁止主站与从站之间进行通讯,主站身份数据验证模块407还可以进一步生成主站身份 验证错误信息已提示相关人员进行处理。In this embodiment, if the master station identity data decryption module 406 fails to decrypt successfully, or the master station identity data verification module 407 judges that the master station identity plaintext data is inconsistent with the preset master station identity data, the master station is considered to be an unsafe master station, Communication between the master station and the slave station is prohibited, and the master station identity data verification module 407 may further generate the master station identity verification error message and prompt the relevant personnel to deal with it.
具体的,本实施例中,当目标从站标识符B02为随机生成的数据时,主站身份数据验证模块407可以具体判断目标主站标识符是否与预设主站身份数据一致,若是,则确认所述主站的身份验证成功,若否,则确认主站的身份验证失败。Specifically, in this embodiment, when the target slave station identifier B02 is randomly generated data, the master station identity data verification module 407 can specifically determine whether the target master station identifier is consistent with the preset master station identity data, and if so, then Confirm that the identity verification of the master station is successful, if not, confirm that the identity verification of the master station fails.
当目标从站标识符B02为主站与从站约定好的数据时,主站身份数据验证模块407具体可以在判断目标主站标识符是否与预设主站身份数据一致的同时判断目标从站标识符是否与预设从站身份数据一致,若前述判断结果均为是,则确认所述主站的身份验证成功,若有任意一项的判断结果为否确认主站的身份验证失败。When the target slave station identifier B02 is the data agreed between the master station and the slave station, the master station identity data verification module 407 can specifically judge whether the target master station identifier is consistent with the preset master station identity data and at the same time judge the target slave station Whether the identifier is consistent with the preset slave station identity data, if the above judgment results are all yes, it confirms that the identity verification of the master station is successful, and if any one of the judgment results is no, it confirms that the identity verification of the master station fails.
本实施例中,主站身份数据验证模块407可以仅通过解密后获得的目标主站标识符对主站进行验证,在提高验证速度的同时增强了主从站之间数据传输的安全性。本实施例中,主站身份数据验证模块407可以进一步通过解密后获得的目标从站标识符对主站进行验证,从而进一步提高了主从站之间的数据传输的安全性。In this embodiment, the master station identity data verification module 407 can only verify the master station through the target master station identifier obtained after decryption, which enhances the security of data transmission between the master and slave stations while improving the verification speed. In this embodiment, the identity data verification module 407 of the master station can further verify the master station through the target slave station identifier obtained after decryption, thereby further improving the security of data transmission between the master and slave stations.
由于数据通讯是一个相互的过程,在一种具体的实施方式中,从站可以生成从站身份密文数据以供主站对从站进行身份进行验证,具体的,该身份识别系统还可以进一步包括:从站身份数据生成模块401、从站身份数据加密模块402及从站身份数据发送模块403,主站身份数据验证模块407还用于确认所述主站的身份验证成功后调用从站身份数据生成模块401。Since data communication is a mutual process, in a specific implementation manner, the slave station can generate slave station identity ciphertext data for the master station to verify the identity of the slave station. Specifically, the identity recognition system may further Including: a slave station identity data generation module 401, a slave station identity data encryption module 402 and a slave station identity data sending module 403, the master station identity data verification module 407 is also used to confirm that the identity verification of the master station is successful and call the slave station identity Data generation module 401 .
所述从站身份数据生成模块401用于生成从站身份明文数据。The slave station identity data generating module 401 is used to generate the slave station identity plaintext data.
其中,从站身份明文数据为与其他的数据(文中简称为工作数据)不同的数据,从站身份明文数据为单独抽离出的独立的用于供主站对从站进行身份验证的数据。Among them, the plaintext data of the identity of the slave is data different from other data (referred to as working data in the text), and the plaintext data of the identity of the slave is the data extracted independently and used for the identity verification of the slave by the master.
其中,从站身份明文数据具有多种实现方式,具体实现方式可以参考实施例3中主站明文数据的实现方式,此处便不再赘述。Among them, the slave station identity plaintext data has multiple implementation manners, and the specific implementation manner may refer to the implementation manner of the master station plaintext data in Embodiment 3, which will not be repeated here.
为了便于对本实施例进行说明,下文以从站身份明文数据包括目标主站标识符、目标从站标识符及主站随机码的方式作为举例来进行说明,具体的,本实施例中,从站身份数据生成模块401根据从主站接收的目标主站标识符、目标从站标识符及从主站接收的主站随机码的来生成从站身份明文数据。In order to facilitate the description of this embodiment, the following takes the way in which the slave station identity plaintext data includes the target master station identifier, the target slave station identifier and the master station random code as an example. Specifically, in this embodiment, the slave station The identity data generating module 401 generates the slave station identity plaintext data according to the target master station identifier received from the master station, the target slave station identifier and the master station random code received from the master station.
在一种具体的实施方式中,当实施例3中主站身份数据生成模块301生成的主站身份明文数据中的目标从站标识符为与从站的预先约定的目标从站标识符时,此处从站身份数据生成模块401可以根据从主站接收的目标从站标识符来生成从站身份明文数据。In a specific implementation manner, when the target slave station identifier in the master station identity plaintext data generated by the master station identity data generation module 301 in Embodiment 3 is the target slave station identifier pre-agreed with the slave station, Here, the slave station identity data generating module 401 may generate the slave station identity plaintext data according to the target slave station identifier received from the master station.
在另一种具体的实施方式中,当实施例3中主站身份数据生成模块301生成的主站身份明文数据中的目标从站标识符为随机生成的目标从站标识符时,此处从站身份数据 生成模块401通过从站的自身标识符更新目标从站标识符,并根据更新后的目标从站标识符来生成从站身份明文数据。In another specific implementation manner, when the target slave station identifier in the master station identity plaintext data generated by the master station identity data generation module 301 in Embodiment 3 is a randomly generated target slave station identifier, here from The station identity data generating module 401 updates the target slave station identifier according to the self identifier of the slave station, and generates the slave station identity plaintext data according to the updated target slave station identifier.
本实施例中,根据主站身份数据发送模块303发送的加密后的主站身份明文数据的不同,提供了多种从站身份明文数据的实现方式,在实际操作中可以根据实际情况进行选择,本实施例中对从站明文数据的设置方式具有广泛的适用性。In this embodiment, according to the difference of the encrypted master station identity plaintext data sent by the master station identity data sending module 303, a variety of implementation modes of the slave station identity plaintext data are provided, which can be selected according to the actual situation in actual operation. This embodiment has wide applicability to the setting method of the plaintext data of the slave station.
本实施例中,在主站身份数据生成模块301随机生成目标从站标识符以及根据预先约定生成目标从站标识符的情况下从站身份数据生成模块401均可生成用于验证从站身份的从站明文数据,从而在提高本实施例中身份识别系统的适用性的同时,提高了主从站之间的数据传输的安全性。In this embodiment, when the master station identity data generation module 301 randomly generates the target slave station identifier and generates the target slave station identifier according to a pre-agreed agreement, the slave station identity data generation module 401 can both generate an identifier for verifying the identity of the slave station. The plaintext data of the slave stations, thereby improving the applicability of the identity identification system in this embodiment, and improving the security of data transmission between the master and slave stations.
所述从站身份数据加密模块402用于加密所述从站身份明文数据以生成从站身份密文数据,其中,从站身份数据加密模块402对从站身份明文数据的加密系统以参考实施例3中主站身份数据加密模块302对主站身份明文数据的加密系统,此处便不再赘述。The slave station identity data encryption module 402 is used for encrypting the slave station identity plaintext data to generate the slave station identity ciphertext data, wherein the slave station identity data encryption module 402 encrypts the slave station identity plaintext data with reference to the embodiment. The encryption system of the master station identity data encryption module 302 to the master station identity plaintext data in 3 will not be repeated here.
所述从站身份数据发送模块403用于发送所述从站身份密文数据至主站,其中,从站身份数据发送模块403发送从站身份密文数据的方式可以参考实施例3中从主站份数据发送模块发送主站身份密文数据的系统,此处便不再赘述。The slave station identity data sending module 403 is used to send the slave station identity ciphertext data to the master station, wherein, the way that the slave station identity data sending module 403 sends the slave station identity ciphertext data can be referred to in Embodiment 3 from the master station. The system for sending the master station identity ciphertext data by the station identity data sending module will not be repeated here.
在一种具体的实施方式中,从站中还可以预先设置从站权限令牌,当从站权限令牌为第二标识符时,从站具有执行身份识别系统的权限,当从站权限令牌为第一标识符时,从站不具有执行身份识别系统的权限,所述身份识别系统还包括从站权限修改模块408In a specific implementation, the slave station may also preset a slave station authority token. When the slave station authority token is the second identifier, the slave station has the authority to execute the identity recognition system. When the card is the first identifier, the slave station does not have the authority to execute the identification system, and the identification system also includes a slave station authority modification module 408
所述从站身份数据生成模块401还用于调用所述从站权限修改模块408以将所述从站权限令牌设置为第二标识符,同样,所述从站身份数据发送模块403还用于调用所述从站权限修改模块408以将所述从站权限令牌设置为第一标识符。The slave station identity data generation module 401 is further configured to call the slave station authority modification module 408 to set the slave station authority token as the second identifier. Similarly, the slave station identity data sending module 403 also uses to call the slave authority modification module 408 to set the slave authority token to the first identifier.
本实施例中,从站权限修改模块408通过修改从站权限令牌可以修改从站的操作权限,应当理解,在同一时刻,主站与从站中只有一个具有操作权限,通过对权限令牌的修改,可以避免主站与从站同时对主站身份数据对从站身份数据进行处理,保证主站与从站中与身份相关的数据的同步性,也进一步保证主从站间的身份识别过程能够有效进行。In this embodiment, the slave station authority modification module 408 can modify the operation authority of the slave station by modifying the slave station authority token. It should be understood that at the same time, only one of the master station and the slave station has the operation authority. The modification can prevent the master station and the slave station from processing the identity data of the master station and the slave station at the same time, ensure the synchronization of the identity-related data in the master station and the slave station, and further ensure the identity recognition between the master and slave stations. The process can be carried out efficiently.
在一种具体的实施方式中,为了保证主从站之间数据传输的安全性,可以周期性调用从站身份数据生成模块401、从站身份数据加密模块402、从站身份数据发送模块403、从站身份数据判断模块404、主站身份数据接收模块405、主站身份数据解密模块406、主站身份数据验证模块407及从站权限修改模块408。且在预设时间范围内,如24小时、48小时等等,主站身份数据验证模块407在验证的过程中,第一次确认主站的身份验证成功后,开启主站的数据传输权限,即允许从站接收对应主站发送的工作数据并允许从 站对主站发送的工作数据进行进一步处理。In a specific implementation, in order to ensure the security of data transmission between the master and slave stations, the slave station identity data generation module 401, the slave station identity data encryption module 402, the slave station identity data transmission module 403, The slave station identity data judgment module 404 , the master station identity data receiving module 405 , the master station identity data decryption module 406 , the master station identity data verification module 407 and the slave station authority modification module 408 . And within a preset time range, such as 24 hours, 48 hours, etc., during the verification process, the master station identity data verification module 407 opens the master station's data transmission authority after confirming that the master station's identity verification is successful for the first time. That is, the slave station is allowed to receive the working data sent by the corresponding master station and allow the slave station to further process the working data sent by the master station.
而在之后周期中调用主站身份数据验证模块407进行验证时,若确认主站的身份验证失败,则关闭从站的数据传输权限,即禁止从站接收并处理主站发送的工作数据。In the subsequent cycle, when the identity data verification module 407 of the master station is called for verification, if it is confirmed that the identity verification of the master station fails, the data transmission authority of the slave station is closed, that is, the slave station is prohibited from receiving and processing the working data sent by the master station.
应当理解,本实施例中,在之后的周期中主站身份数据验证模块407可以在分多个周期对主站密文数据进行解密,如在第二周期仅解密百分之10的数据,在第三周期再解密百分之20的数据,在第四周期再解密百分之20的数据,在对数据解密的过程中,仍然保持主站与从站间正常的数据处理,在一种场景下,主站身份数据验证模块407当主站身份数据解密模块406对主站密文数据整体解密完毕后再对解密出的主站明文数据进行验证,在另一种场景下,也可以在主站身份数据解密模块406对主站密文数据解密的过程中进行分段验证,如解密百分之10即验证百分之10。在第一种场景下,主站身份数据验证模块407若对主站明文数据的整体验证失败,则认为对主站的身份验证失败,在第二种场景下,主站身份数据验证模块407当对解密后的部分数据验证失败时,则认为对主站的身份验证失败。It should be understood that in this embodiment, the master station identity data verification module 407 may decrypt the master station ciphertext data in multiple cycles in the following cycles. For example, in the second cycle, only 10% of the data is decrypted. In the third cycle, 20% of the data is decrypted, and in the fourth cycle, 20% of the data is decrypted. In the process of decrypting the data, the normal data processing between the master station and the slave station is still maintained. In one scenario Next, the master station identity data verification module 407 verifies the decrypted master station plaintext data after the master station identity data decryption module 406 completes the overall decryption of the master station ciphertext data. The station identity data decryption module 406 performs segment verification during the decryption process of the master station ciphertext data, for example, 10% decryption means 10% verification. In the first scenario, if the master station identity data verification module 407 fails the overall verification of the master station plaintext data, it is considered that the master station's identity verification has failed. In the second scenario, the master station identity data verification module 407 If the decrypted part of the data fails to be authenticated, the authentication to the master station is considered to have failed.
本实施例中,主站身份数据验证模块407在第一次对主站的身份验证成功后,则开启主站的数据传输权限,在主站对从站的数据传输权限开启后,主站可以持续向从站发送工作数据,在此期间,仅当主站身份数据验证模块407在后续周期的验证过程中,对主站的身份验证失败后,才会关闭主站的数据传输权限,在这种方式下,可以保证在第一次验证成功后,主站和从站之间的正常数据传输不受影响,即在保证数据传输安全性的同时不会影响到正常数据传输的效率。In this embodiment, the identity data verification module 407 of the master station enables the data transmission authority of the master station after the identity verification of the master station is successful for the first time. After the data transmission authority of the master station to the slave station is enabled, the master station can Continue to send working data to the slave station. During this period, only when the identity verification module 407 of the master station fails to authenticate the master station in the verification process of the subsequent cycle, the data transmission authority of the master station will be closed. In this way, it can be ensured that after the first verification is successful, the normal data transmission between the master station and the slave station will not be affected, that is, the efficiency of normal data transmission will not be affected while ensuring the security of data transmission.
实施例5Example 5
本发明实施例提供一种电子设备,电子设备可以通过计算设备的形式表现(例如可以为服务器设备),包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中处理器执行计算机程序时可以实现本发明实施例1中的基于现场总线的数据传输方法或实施例2中基于现场总线的身份识别方法。An embodiment of the present invention provides an electronic device, which can be expressed in the form of a computing device (for example, a server device), and includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein processing When the computer executes the computer program, the Fieldbus-based data transmission method in Embodiment 1 or the Fieldbus-based identification method in Embodiment 2 of the present invention can be implemented.
图10示出了本实施例的硬件结构示意图,如图10所示,电子设备9具体包括:FIG. 10 shows a schematic diagram of the hardware structure of this embodiment. As shown in FIG. 10 , the electronic device 9 specifically includes:
至少一个处理器91、至少一个存储器92以及用于连接不同系统组件(包括处理器91和存储器92)的总线93,其中:At least one processor 91, at least one memory 92, and a bus 93 for connecting different system components (including processor 91 and memory 92), wherein:
总线93包括数据总线、地址总线和控制总线。The bus 93 includes a data bus, an address bus and a control bus.
存储器92包括易失性存储器,例如随机存取存储器(RAM)921和/或高速缓存存储器922,还可以进一步包括只读存储器(ROM)923。 Memory 92 includes volatile memory, such as random access memory (RAM) 921 and/or cache memory 922 , and may further include read only memory (ROM) 923 .
存储器92还包括具有一组(至少一个)程序模块924的程序/实用工具925,这样的 程序模块924包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。The memory 92 also includes a program/utility 925 having a set (at least one) of program modules 924 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, examples of which are Each or some combination of these may include an implementation of a network environment.
处理器91通过运行存储在存储器92中的计算机程序,从而执行各种功能应用以及数据处理,例如本发明实施例1中基于现场总线的数据传输方法或实施例2中基于现场总线的身份识别方法。The processor 91 executes various functional applications and data processing by running the computer program stored in the memory 92, such as the field bus-based data transmission method in the first embodiment of the present invention or the field bus-based identification method in the second embodiment of the present invention. .
电子设备9进一步可以与一个或多个外部设备94(例如键盘、指向设备等)通信。这种通信可以通过输入/输出(I/O)接口95进行。并且,电子设备9还可以通过网络适配器96与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。网络适配器96通过总线93与电子设备9的其它模块通信。应当明白,尽管图中未示出,可以结合电子设备9使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理器、外部磁盘驱动阵列、RAID(磁盘阵列)系统、磁带驱动器以及数据备份存储系统等。The electronic device 9 may further communicate with one or more external devices 94 (eg, keyboards, pointing devices, etc.). Such communication may take place through input/output (I/O) interface 95 . Also, the electronic device 9 may communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN), and/or a public network such as the Internet) through a network adapter 96 . The network adapter 96 communicates with other modules of the electronic device 9 via the bus 93 . It should be understood that, although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 9, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
应当注意,尽管在上文详细描述中提及了电子设备的若干单元/模块或子单元/模块,但是这种划分仅仅是示例性的并非强制性的。实际上,根据本申请的实施方式,上文描述的两个或更多单元/模块的特征和功能可以在一个单元/模块中具体化。反之,上文描述的一个单元/模块的特征和功能可以进一步划分为由多个单元/模块来具体化。It should be noted that although several units/modules or sub-units/modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. Indeed, according to embodiments of the present application, the features and functions of two or more units/modules described above may be embodied in one unit/module. Conversely, the features and functions of one unit/module described above may be further subdivided to be embodied by multiple units/modules.
实施例6Example 6
本发明实施例提供了一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现本发明实施例1中基于现场总线的数据传输方法或实施例2中基于现场总线的身份识别方法的步骤。An embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the field bus-based data transmission method in Embodiment 1 of the present invention or the field-based data transmission method in Embodiment 2 of the present invention The steps of the bus identification method.
其中,可读存储介质可以采用的更具体可以包括但不限于:便携式盘、硬盘、随机存取存储器、只读存储器、可擦拭可编程只读存储器、光存储器件、磁存储器件或上述的任意合适的组合。Wherein, the readable storage media may include, but are not limited to, portable disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical storage devices, magnetic storage devices, or any of the above suitable combination.
在可能的实施方式中,本发明还可以实现为一种程序产品的形式,其包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行实现本发明实施例1中基于现场总线的数据传输方法或实施例2中基于现场总线的身份识别方法的步骤。In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program codes, when the program product runs on a terminal device, the program code is used to cause the terminal device to execute the implementation The steps of the field bus-based data transmission method in the first embodiment of the present invention or the field bus-based identification method in the second embodiment of the present invention.
其中,可以以一种或多种程序设计语言的任意组合来编写用于执行本发明的程序代码,所述程序代码可以完全地在用户设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户设备上部分在远程设备上执行或完全在远程设备上执行。Wherein, the program code for executing the present invention can be written in any combination of one or more programming languages, and the program code can be completely executed on the user equipment, partially executed on the user equipment, as an independent The software package executes on the user's device, partly on the user's device, partly on the remote device, or entirely on the remote device.
虽然以上描述了本发明的具体实施方式,但是本领域的技术人员应当理解,这仅是 举例说明,本发明的保护范围是由所附权利要求书限定的。本领域的技术人员在不背离本发明的原理和实质的前提下,可以对这些实施方式做出多种变更或修改,但这些变更和修改均落入本发明的保护范围。Although the specific embodiments of the present invention have been described above, those skilled in the art should understand that this is only an illustration, and the scope of the present invention is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principle and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.

Claims (17)

  1. 一种基于现场总线的数据传输方法,其特征在于,所述数据传输方法应用于主站中,所述数据传输方法包括:A field bus-based data transmission method, characterized in that the data transmission method is applied in a master station, and the data transmission method comprises:
    生成主站身份明文数据;Generate master station identity plaintext data;
    加密所述主站身份明文数据以生成主站身份密文数据,所述主站身份密文数据用于供从站对所述主站进行身份验证;Encrypting the master station identity plaintext data to generate master station identity ciphertext data, and the master station identity ciphertext data is used for the slave station to authenticate the master station;
    发送所述主站身份密文数据至所述从站。Send the master station identity ciphertext data to the slave station.
  2. 如权利要求1所述的基于现场总线的数据传输方法,其特征在于,所述主站身份明文数据包括目标主站标识符。The data transmission method based on the field bus according to claim 1, wherein the master station identity plaintext data includes the target master station identifier.
  3. 如权利要求2所述的基于现场总线的数据传输方法,其特征在于,所述发送所述主站身份密文数据至所述从站的步骤后还包括:The fieldbus-based data transmission method according to claim 2, wherein the step of sending the master station identity ciphertext data to the slave station further comprises:
    接收所述从站发送的从站身份密文数据;Receive the slave station identity ciphertext data sent by the slave station;
    解密所述从站身份密文数据以生成从站身份明文数据;decrypting the slave identity ciphertext data to generate slave identity plaintext data;
    判断所述从站身份明文数据是否与预设从站明文数据相符,若是,则确认所述从站的身份验证成功;Determine whether the plaintext data of the identity of the slave is consistent with the plaintext data of the preset slave, and if so, confirm that the identity verification of the slave is successful;
    所述主站身份明文数据包括主站随机码,所述从站身份明文数据包括所述目标主站标识符及所述主站随机码,所述预设从站明文数据包括预设主站标识符及所述发送所述主站身份密文数据至所述从站的步骤中发送的目标主站标识符;The master station identity plaintext data includes a master station random code, the slave station identity plaintext data includes the target master station identifier and the master station random code, and the preset slave station plaintext data includes a preset master station identifier and the target master station identifier sent in the step of sending the master station identity ciphertext data to the slave station;
    当所述目标主站标识符与预设主站标识符相符且所述主站随机码与所述发送所述主站身份密文数据至所述从站的步骤中发送的目标主站标识符时,判断所述从站身份明文数据与预设从站明文数据相符。When the target master station identifier matches the preset master station identifier and the master station random code matches the target master station identifier sent in the step of sending the master station identity ciphertext data to the slave station When , it is determined that the plaintext data of the slave station identity is consistent with the preset plaintext data of the slave station.
  4. 如权利要求3所述的基于现场总线的数据传输方法,其特征在于,所述主站身份明文数据还包括目标从站标识符,所述预设从站明文数据还包括预设从站标识符;The fieldbus-based data transmission method according to claim 3, wherein the master station identity plaintext data further includes a target slave station identifier, and the preset slave station plaintext data further includes a preset slave station identifier ;
    所述判断所述从站身份明文数据与预设从站明文数据相符还包括:所述目标从站标识符与所述预设从站标识符相符。The judging that the plaintext data of the slave station identity is consistent with the preset plaintext data of the slave station further includes: the target slave station identifier is consistent with the preset slave station identifier.
  5. 如权利要求4所述的基于现场总线的数据传输方法,其特征在于,所述目标从站标识符还用于供所述从站对所述主站进行身份验证The fieldbus-based data transmission method according to claim 4, wherein the target slave station identifier is further used for the slave station to authenticate the master station
    和/或,and / or,
    所述生成主站身份明文数据的步骤前还包括:随机生成目标从站标识符,在所述从站中更新后的所述目标从站标识符用于供所述主站对所述从站进行身份验证;Before the step of generating the master station identity plaintext data, the step further includes: randomly generating a target slave station identifier, and the target slave station identifier updated in the slave station is used for the master station to identify the slave station. to authenticate;
    和/或,and / or,
    多次执行所述发送所述主站身份密文数据至从站的步骤。The step of sending the master station identity ciphertext data to the slave station is performed multiple times.
  6. 如权利要求3所述的基于现场总线的数据传输方法,其特征在于,所述接收从站发送的从站身份密文数据的步骤包括:多次接收所述从站发送的从站身份密文数据,并统计在多次接收的数据中数据不一致的次数,判断所述次数是否大于第一预设次数,若是,则生成从站身份错误信息,若否,则执行所述解密所述从站身份密文数据以获取从站身份明文数据的步骤;The fieldbus-based data transmission method according to claim 3, wherein the step of receiving the slave station identity ciphertext data sent by the slave station comprises: receiving the slave station identity ciphertext sent by the slave station multiple times data, and count the number of inconsistencies in the data received multiple times, and determine whether the number of times is greater than the first preset number of times, if so, generate slave station identity error information, if not, execute the decryption of the slave Steps for obtaining the identity ciphertext data from the slave station;
    和/或,and / or,
    所述接收所述从站发送的从站身份密文数据的步骤包括:The step of receiving the slave station identity ciphertext data sent by the slave station includes:
    判断在第一时间阈值范围内是否接收到所述从站发送的从站身份密文数据,若否,则生成从站处理超时信息,若是,则解密所述从站身份密文数据以生成从站身份明文数据;Determine whether the slave station identity ciphertext data sent by the slave station is received within the range of the first time threshold, if not, generate the slave station processing timeout information, if so, decrypt the slave station identity ciphertext data to generate the slave station identity ciphertext data. Station identity plaintext data;
    和/或,and / or,
    周期性执行接收所述从站发送的从站身份密文数据、解密所述从站身份密文数据以生成从站身份明文数据以及执行判断所述目标主站标识符是否与预设主站标识符相符判断的步骤,且在第一次确认所述从站的身份验证成功的步骤后,若在执行判断所述从站身份明文数据与预设从站身份数据是否相符的步骤中,判断结果为否时,则确认所述从站的身份验证失败。Periodically perform receiving the slave station identity ciphertext data sent by the slave station, decrypting the slave station identity ciphertext data to generate the slave station identity plaintext data, and executing judging whether the target master station identifier is the same as the preset master station identifier. If the step of judging whether the identity plaintext data of the slave station is consistent with the preset identity data of the slave station is executed after the step of confirming the success of the identity verification of the slave station for the first time, the result of the judgment is When no, it is confirmed that the authentication of the slave has failed.
  7. 如权利要求1-6任意一项所述的基于现场总线的数据传输方法,其特征在于,The fieldbus-based data transmission method according to any one of claims 1-6, wherein,
    周期性执行生成主站身份明文数据、加密所述主站身份明文数据以生成主站身份密文数据及发送所述主站身份密文数据至从站的步骤;Periodically perform the steps of generating the master station identity plaintext data, encrypting the master station identity plaintext data to generate the master station identity ciphertext data and sending the master station identity ciphertext data to the slave station;
    和/或,and / or,
    所述加密所述主站身份明文数据以生成主站身份密文数据的步骤中,通过预设编码规则重新排列所述主站身份明文数据中各字符的位置以生成主站身份密文数据;In the step of encrypting the master station identity plaintext data to generate the master station identity ciphertext data, rearrange the position of each character in the master station identity plaintext data by preset coding rules to generate the master station identity ciphertext data;
    和/或,and / or,
    所述主站包括主站权限令牌,当所述主站权限令牌为第一标识符时,所述主站具有执行所述数据传输方法的权限,当所述主站权限令牌为第二标识符时,所述主站不具有执行所述数据传输方法的权限;The master station includes a master station authority token. When the master station authority token is the first identifier, the master station has the authority to execute the data transmission method. When the master station authority token is the first identifier, the master station has the authority to execute the data transmission method. When there are two identifiers, the master station does not have the authority to execute the data transmission method;
    所述生成主站身份明文数据的步骤前还包括步骤:将所述主站权限令牌设置为所述第一标识符;The step of generating the master station identity plaintext data further includes the step of: setting the master station authority token as the first identifier;
    所述发送所述主站身份密文数据至从站的步骤后还包括:将所述主站权限令牌设置 为所述第二标识符。The step of sending the master station identity ciphertext data to the slave station further includes: setting the master station authority token as the second identifier.
  8. 一种基于现场总线的身份识别方法,其特征在于,所述身份识别方法应用于从站中,所述身份识别方法包括:A field bus-based identification method, characterized in that the identification method is applied to a slave station, and the identification method includes:
    接收主站发送的主站身份密文数据;Receive the master station identity ciphertext data sent by the master station;
    解密所述主站身份密文数据以获取主站身份明文数据;Decrypt the master station identity ciphertext data to obtain the master station identity plaintext data;
    判断所述主站身份明文数据是否与预设主站身份数据一致,若是,则确认所述主站的身份验证成功。It is judged whether the master station identity plaintext data is consistent with the preset master station identity data, and if so, it is confirmed that the identity verification of the master station is successful.
  9. 如权利要求8所述的基于现场总线的身份识别方法,其特征在于,所述主站身份明文数据包括目标主站标识符,所述预设主站身份数据包括预设主站标识符,当所述主站身份明文数据与所述预设主站身份数据相符时,判断所述目标主站标识符与预设主站标识符相符。The fieldbus-based identification method according to claim 8, wherein the master station identity plaintext data includes a target master station identifier, the preset master station identification data includes a preset master station identifier, and when When the master station identity plaintext data matches the preset master station identity data, it is determined that the target master station identifier matches the preset master station identifier.
  10. 如权利要求9所述的基于现场总线的身份识别方法,其特征在于,所述主站身份明文数据还包括主站随机码,所述主站随机码用于供所述主站对所述从站进行身份验证,所述确认所述主站的身份验证成功的步骤后还包括:The identification method based on the field bus according to claim 9, wherein the master station identity plaintext data further comprises a master station random code, and the master station random code is used for the master station to identify the slave station to the slave station. The identity verification of the master station further includes:
    根据所述目标主站标识符及所述主站随机码生成从站身份明文数据,所述从站身份明文数据用于供所述主站对所述从站进行身份验证;Generate slave station identity plaintext data according to the target master station identifier and the master station random code, and the slave station identity plaintext data is used for the master station to authenticate the slave station;
    加密所述从站身份明文数据以生成从站身份密文数据;encrypting the slave station identity plaintext data to generate slave station identity ciphertext data;
    发送所述从站身份密文数据至所述主站。Send the slave station identity ciphertext data to the master station.
  11. 如权利要求10所述的基于现场总线的身份识别方法,其特征在于,所述主站身份明文数据还包括目标从站标识符,所述根据所述目标主站标识符及所述主站随机码生成从站身份明文数据的步骤中:根据所述目标主站标识符、所述目标从站标识符及所述主站随机码生成从站身份明文数据。The identification method based on the field bus according to claim 10, wherein the master station identification plaintext data further includes a target slave station identifier, and the random station identifier is randomly selected according to the target master station identifier and the master station identifier. In the step of generating the slave station identity plaintext data from the code, the slave station identity plaintext data is generated according to the target master station identifier, the target slave station identifier and the master station random code.
  12. 如权利要求11所述的基于现场总线的身份识别方法,其特征在于,所述预设从站身份数据还包括预设从站标识符,所述判断所述目标主站标识符与预设主站标识符相符的步骤还包括:The identification method based on the field bus according to claim 11, wherein the preset slave station identification data further includes a preset slave station identifier, and the judgment of the target master station identifier and the preset master station identifier The step of matching the station identifiers also includes:
    判断所述目标从站标识符与所述预设从站标识符相符;Judging that the target slave station identifier is consistent with the preset slave station identifier;
    和/或,and / or,
    所述生成从站身份明文数据的步骤前还包括,根据所述从站的自身标识符更新所述目标从站标识符,更新后的所述目标从站标识符用于供所述主站对所述从站进行身份验证;Before the step of generating the slave station identity plaintext data, the step further includes: updating the target slave station identifier according to the self identifier of the slave station, and the updated target slave station identifier is used for the master station to pair. The slave performs authentication;
    和/或,and / or,
    所述接收主站发送的主站身份密文数据的步骤包括:多次接收所述主站发送的主站身份密文数据,并判断在多次接收的数据中是否存在第一预设次数的数据与其他的数据不一致的情况,若是,则生成主站身份错误信息,若否,则执行所述解密所述主站身份密文数据以获取主站身份明文数据的步骤。The step of receiving the master station identity ciphertext data sent by the master station includes: receiving the master station identity ciphertext data sent by the master station multiple times, and judging whether there is a first preset number of data in the multiple received data. If the data is inconsistent with other data, if yes, generate the master station identity error message, if not, execute the step of decrypting the master station identity ciphertext data to obtain the master station identity plaintext data.
  13. 如权利要求10所述的基于现场总线的身份识别方法,其特征在于,The identification method based on field bus according to claim 10, wherein,
    所述发送所述从站身份密文数据至主站的步骤中:多次发送所述从站身份密文数据至主站;In the step of sending the slave station identity ciphertext data to the master station: sending the slave station identity ciphertext data to the master station multiple times;
    和/或,and / or,
    所述发送所述从站身份密文数据至主站的步骤后包括:The step of sending the slave station identity ciphertext data to the master station includes:
    判断在第二时间阈值范围内是否接收到所述主站发送的主站身份密文数据,若否,则生成主站处理超时信息;Determine whether the master station identity ciphertext data sent by the master station is received within the second time threshold range, and if not, generate master station processing timeout information;
    和/或,and / or,
    周期性执行所述生成从站身份明文数据、加密所述从站身份明文数据以生成从站身份密文数据以及所述发送所述从站身份密文数据至主站的步骤。The steps of generating the slave station identity plaintext data, encrypting the slave station identity plaintext data to generate the slave station identity ciphertext data, and sending the slave station identity ciphertext data to the master station are periodically performed.
  14. 如权利要求8-13任意一项所述的基于现场总线的身份识别方法,其特征在于,周期性执行接收主站发送的主站身份密文数据、解密所述主站身份密文数据以获取主站身份明文数据及判断所述主站身份明文数据是否与预设明文数据一致的步骤,且在第一次确认所述主站的身份验证成功后,允许接收并处理所述主站发送的工作数据,在第一次确认所述主站的身份验证成功的步骤后,若在执行判断所述主站身份明文数据与预设主站身份数据是否相符的步骤中,判断结果为否时,则确认所述主站的身份验证失败;The fieldbus-based identification method according to any one of claims 8 to 13, characterized in that, periodically receiving the master station identity ciphertext data sent by the master station and decrypting the master station identity ciphertext data to obtain The master station identity plaintext data and the steps of judging whether the master station identity plaintext data is consistent with the preset plaintext data, and after confirming that the identity verification of the master station is successful for the first time, are allowed to receive and process the data sent by the master station. Working data, after the first step of confirming that the identity verification of the master station is successful, if the judgment result is no in the step of judging whether the master station identity plaintext data is consistent with the preset master station identity data, Then it is confirmed that the authentication of the master station fails;
    和/或,and / or,
    所述解密所述身份密文数据的步骤中,通过与预设编码规则对应的预设反编码规则还原所述主站身份密文数据中各字符的位置以生成主站身份明文数据;In the step of deciphering the identity ciphertext data, the position of each character in the master station identity ciphertext data is restored by the preset anti-encoding rule corresponding to the preset encoding rule to generate the master station identity plaintext data;
    和/或,and / or,
    所述从站包括从站权限令牌,当所述从站权限令牌为第二标识符时,所述从站具有执行所述身份识别方法的权限,当所述从站权限令牌为第一标识符时,所述从站不具有执行所述身份识别方法的权限;The slave station includes a slave station authority token, when the slave station authority token is the second identifier, the slave station has the authority to execute the identification method, and when the slave station authority token is the first identifier. When an identifier is used, the slave station does not have the authority to execute the identification method;
    所述生成从站身份明文数据的步骤前还包括步骤:将所述从站权限令牌设置为所述第二标识符;The step of generating the slave station identity plaintext data further includes the step of: setting the slave station authority token as the second identifier;
    所述发送所述从站身份密文数据至从站的步骤后还包括:将所述从站权限令牌设置为所述第一标识符。The step of sending the slave station identity ciphertext data to the slave station further includes: setting the slave station authority token as the first identifier.
  15. 一种基于现场总线的数据传输系统,其特征在于,所述数据传输系统应用于主站中,所述数据传输系统包括:主站身份数据生成模块、主站身份数据加密模块及主站身份数据发送模块;A field bus-based data transmission system, characterized in that the data transmission system is applied in a master station, and the data transmission system comprises: a master station identity data generation module, a master station identity data encryption module and a master station identity data sending module;
    所述主站身份数据生成模块用于生成主站身份明文数据;The master station identity data generation module is used to generate the master station identity plaintext data;
    所述主站身份数据加密模块及用于加密所述主站身份明文数据以生成主站身份密文数据,所述主站身份密文数据用于供从站对所述主站进行身份验证;Described master station identity data encryption module and is used for encrypting described master station identity plaintext data to generate master station identity ciphertext data, and described master station identity ciphertext data is used for slave station to carry out identity verification to described master station;
    所述主站身份数据发送模块用于发送所述主站身份密文数据至所述从站。The master station identity data sending module is configured to send the master station identity ciphertext data to the slave station.
  16. 一种基于现场总线的身份识别系统,其特征在于,所述身份识别系统应用于从站中,所述身份识别系统包括:主站身份数据接收模块、主站身份数据解密模块及主站身份数据判断模块;A field bus-based identity recognition system, characterized in that the identity recognition system is applied to a slave station, and the identity recognition system comprises: a master station identity data receiving module, a master station identity data decryption module and a master station identity data judgment module;
    所述主站身份数据接收模块用于接收主站发送的主站身份密文数据;The master station identity data receiving module is used for receiving the master station identity ciphertext data sent by the master station;
    所述主站身份数据解密模块用于解密所述主站身份密文数据以获取主站身份明文数据;The master station identity data decryption module is used to decrypt the master station identity ciphertext data to obtain the master station identity plaintext data;
    所述主站身份数据验证模块用于判断所述主站身份明文数据是否与预设主站身份数据一致,若是,则确认所述主站的身份验证成功。The master station identity data verification module is used for judging whether the master station identity plaintext data is consistent with the preset master station identity data, and if so, confirming that the master station's identity verification is successful.
  17. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的数据传输方法及权利要求8至14任一项所述的身份识别方法的步骤。A computer-readable storage medium on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the data transmission method according to any one of claims 1 to 7 and claims 8 to 14 are realized any one of the steps of the identification method.
PCT/CN2021/094641 2020-11-25 2021-05-19 Field bus-based data transmission method and system, and field bus-based identity verification method and system WO2022110688A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011342897.8 2020-11-25
CN202011342897.8A CN112468493A (en) 2020-11-25 2020-11-25 Data transmission method, identity recognition method and system based on field bus

Publications (1)

Publication Number Publication Date
WO2022110688A1 true WO2022110688A1 (en) 2022-06-02

Family

ID=74809677

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/094641 WO2022110688A1 (en) 2020-11-25 2021-05-19 Field bus-based data transmission method and system, and field bus-based identity verification method and system

Country Status (2)

Country Link
CN (1) CN112468493A (en)
WO (1) WO2022110688A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112468493A (en) * 2020-11-25 2021-03-09 上海电气风电集团股份有限公司 Data transmission method, identity recognition method and system based on field bus

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102010038323A1 (en) * 2010-07-23 2012-01-26 Siemens Aktiengesellschaft Method for identifying field device component of slave in field bus system of automation system utilized for connecting apparatus with control device, involves identifying apparatus based on transmitted identification data
CN105610837A (en) * 2015-12-31 2016-05-25 上海交通大学 Method and system for identity authentication between master station and slave station in SCADA (Supervisory Control and Data Acquisition) system
CN106790173A (en) * 2016-12-29 2017-05-31 浙江中控技术股份有限公司 A kind of method and system of SCADA system and its RTU controller bidirectional identity authentications
CN110300108A (en) * 2019-06-26 2019-10-01 国网山东省电力公司临朐县供电公司 A kind of power distribution automation message encryption transmission method, system, terminal and storage medium
CN112311553A (en) * 2020-08-24 2021-02-02 山东卓文信息科技有限公司 Equipment authentication method based on challenge response
CN112468493A (en) * 2020-11-25 2021-03-09 上海电气风电集团股份有限公司 Data transmission method, identity recognition method and system based on field bus

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1925392A (en) * 2006-09-08 2007-03-07 四川长虹电器股份有限公司 Method for identification of equipment validity
CN109862041B (en) * 2019-03-27 2021-06-15 深圳市网心科技有限公司 Digital identity authentication method, equipment, device, system and storage medium
CN110995729B (en) * 2019-12-12 2022-09-16 广东电网有限责任公司电力调度控制中心 Control system communication method and device based on asymmetric encryption and computer equipment
CN110971610A (en) * 2019-12-12 2020-04-07 广东电网有限责任公司电力调度控制中心 Control system identity verification method and device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102010038323A1 (en) * 2010-07-23 2012-01-26 Siemens Aktiengesellschaft Method for identifying field device component of slave in field bus system of automation system utilized for connecting apparatus with control device, involves identifying apparatus based on transmitted identification data
CN105610837A (en) * 2015-12-31 2016-05-25 上海交通大学 Method and system for identity authentication between master station and slave station in SCADA (Supervisory Control and Data Acquisition) system
CN106790173A (en) * 2016-12-29 2017-05-31 浙江中控技术股份有限公司 A kind of method and system of SCADA system and its RTU controller bidirectional identity authentications
CN110300108A (en) * 2019-06-26 2019-10-01 国网山东省电力公司临朐县供电公司 A kind of power distribution automation message encryption transmission method, system, terminal and storage medium
CN112311553A (en) * 2020-08-24 2021-02-02 山东卓文信息科技有限公司 Equipment authentication method based on challenge response
CN112468493A (en) * 2020-11-25 2021-03-09 上海电气风电集团股份有限公司 Data transmission method, identity recognition method and system based on field bus

Also Published As

Publication number Publication date
CN112468493A (en) 2021-03-09

Similar Documents

Publication Publication Date Title
US7773754B2 (en) Key management system and method
US7469338B2 (en) System and method for cryptographic control of system configurations
CN111181723B (en) Method and device for offline security authentication between Internet of things devices
CN103746815B (en) Safety communicating method and device
CN116074000A (en) Conversation key distribution method and system based on CAN bus
CN112866197A (en) Password edge calculation method and system for realizing security of terminal of Internet of things and terminal
WO2022110688A1 (en) Field bus-based data transmission method and system, and field bus-based identity verification method and system
CN113986470B (en) Batch remote proving method for virtual machines without perception of users
EP4080818A1 (en) Communication method and device, ecu, vehicle and storage medium
WO2012171283A1 (en) Method and system for third-party authentication and method for managing authentication state of terminal device
CN113591109A (en) Method and system for communication between trusted execution environment and cloud
US11716367B2 (en) Apparatus for monitoring multicast group
WO2023197529A1 (en) Online monitoring system, method and apparatus for power transmission line, and master station
CN112182551B (en) PLC equipment identity authentication system and PLC equipment identity authentication method
CN112995140B (en) Safety management system and method
CN113972998A (en) Method and device for updating pre-shared key PSK
Yang et al. Lightweight delegated authentication with identity fraud detection for cyber-physical systems
CN112866202B (en) Device authorization management method, system thereof, communication device and storage medium
CN115242468B (en) Safe communication system and method based on RS485 bus
CN111212042B (en) Data transmission method, device and system
CN111740819B (en) Time-based one-time password method and system suitable for PLC
Lu et al. Cryptography security designs and enhancements of dnp3-sa protocol based on trusted computing.
US20220393856A1 (en) Securely and reliably transmitting messages between network devices
WO2023236925A1 (en) Authentication method and communication device
WO2023151427A1 (en) Quantum key transmission method, device and system

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 30.10.2023).