Train master-slave secure communication method, device, storage medium and computer program
By using the master key pair signature and slave key pair encryption in train communication, combined with hashing processing, the problem of train communication security risks in the prior art is solved, the security of data transmission is improved, and the forgery and tampering is prevented. , reduces the risk of attack.
Patent Information
- Application Number
- CN202411181677.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2025-01-03
AI Technical Summary
Existing train owners have security risks from communications. Master transmits messages and passive address information through broadcast, resulting in data being easily forged and tampered by attackers, and cannot ensure communication security.
Use the master key pair to sign the initial transmission message, obtain the signed message, and encrypt the initial transmission message based on the slave key to generate an encrypted message, combine the signed message and the encrypted message to hash it, and determine Encrypted information to be received and transmitted to the receiving end to verify legality.
Signing the initial transmission packets with an encryption key different from the slave key through the master key improves the security of message transmission, reduces the risk of secure communication between train owner and slave devices, and prevents data from being attacked by attackers Listen, tamper with and decipher.
Smart Images

Figure CN119254440A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of train communication technology, and in particular to a train master-slave safety communication method, device, storage medium and computer program. Background Art
[0002] In the SPI communication protocol, the Master is the device responsible for initiating communication, while the Slave is the device that passively responds to the Master's request and performs data transmission. This communication is full-duplex, which means that both the Master and the Slave can send and receive data at the same time.
[0003] In the prior art, the communication between Master and Slave has the characteristics of short frame data structure, non-destructive bus arbitration technology, flexible communication mode, etc., which can meet the requirements of real-time and reliability of train communication.
[0004] However, the existing Master-Slave communication has the following security risks. Specifically: First, the Master transmits messages by broadcasting, and the messages are short frame structures, so all Slaves can receive messages from the Master; Second, there is no passive address information in the messages transmitted by the Master, so the Slaves receiving the messages cannot confirm whether the received data is original data, and the authenticity of the data cannot be determined. This makes it easy for the Master data and the Slave data to be forged and tampered by attackers, making communication security unguaranteed. Summary of the invention
[0005] Based on this, it is necessary to provide a train master-slave safety communication method, device, storage medium and computer program to address the above technical problems.
[0006] In a first aspect, the present disclosure provides a train master-slave safety communication method, comprising:
[0007] Obtaining an initial transmission message, wherein the initial transmission message refers to message information that the transmission end needs to transmit to the receiving end;
[0008] Signing the initial transmission message based on the master key pair to obtain a signed message;
[0009] Encrypting the initial transmission message based on the slave key to obtain an encrypted message;
[0010] Determining encrypted information to be received based on the signed message and the encrypted message;
[0011] The encrypted message is transmitted to the receiving end, wherein the encrypted message includes the encrypted information to be received, the signed message and the encrypted message.
[0012] In one embodiment, after the step of obtaining the initial transmission message, the method further includes:
[0013] Obtain a set of master key pairs to be selected and a set of slave key pairs to be selected;
[0014] At intervals of a first preset period, a candidate key pair is selected from the candidate master key pair set to be determined as the master key pair;
[0015] At intervals of a second preset period, a candidate slave key is selected from the candidate slave key set and determined as the slave key.
[0016] In one of the embodiments, the master key pair includes a first private key and a second private key, and the slave key includes a first sub-public key and a second sub-public key;
[0017] The step of obtaining a set of master key pairs to be selected and a set of slave key pairs to be selected comprises:
[0018] Obtaining identification information of the master device, identification information of the slave device and system parameters;
[0019] Generate at least one first private key based on the identification information of the master device and the system parameters;
[0020] Based on the identification information of the slave device and the system parameters, generate at least one first sub-public key and at least one second private key;
[0021] Detecting whether the first sub-public key and the second private key comply with a first preset rule;
[0022] When the first sub-public key and the second private key meet a first preset rule, generating a set of to-be-selected master key pairs based on the first private key and the second private key;
[0023] Determine a second sub-public key based on the first sub-public key;
[0024] A set of slave keys to be selected is generated based on the first sub-public key and the second sub-public key.
[0025] In one embodiment, the step of signing the initial transmission message based on the master key pair to obtain the signed message includes:
[0026] Based on the first private key and the second private key, hash processing, point multiplication operation on the elliptic curve and addition operation are performed on the data message in the initial transmission message to obtain a signature message.
[0027] In one embodiment, the step of encrypting the initial transmission message based on the slave key to obtain the encrypted message includes:
[0028] Based on the first sub-public key and the second sub-public key, the identity authentication message in the initial transmission message is hashed and XORed to obtain an encrypted message.
[0029] In one of the embodiments, an encrypted message transmitted by a transmission end is obtained, wherein the encrypted message includes encrypted information to be received, a signed message, and an encrypted message, the signed message is obtained by signing based on a master key, and the encrypted message is obtained by encrypting based on a slave key;
[0030] Performing hash processing and XOR processing on the signed message and the encrypted message to determine decryption verification information;
[0031] Detecting whether the decryption verification information is the same as the encrypted information to be received;
[0032] When the decryption verification information is the same as the encrypted information to be received, the encrypted message is decrypted.
[0033] In one of the embodiments, the master key pair includes a first private key and a second private key, and the slave key includes a first sub-public key and a second sub-public key;
[0034] When the decryption verification information is the same as the encrypted information to be received, the step of decrypting the encrypted message comprises:
[0035] Based on the first sub-public key and the second sub-public key, the signature message is verified to obtain a verification signature message;
[0036] Based on the first private key and the second private key, performing hash processing and XOR processing on the encrypted message to obtain a decrypted message;
[0037] An initial transmission message is determined based on the verification signature message and the decrypted message.
[0038] In a second aspect, the present disclosure provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described in the above aspect.
[0039] In a third aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method described in the above aspects when executed by a processor.
[0040] In a fourth aspect, the present disclosure provides a computer program product, including a computer program / instructions, which implements the steps of the method described in the above aspects when the computer program is executed by a processor.
[0041] The present disclosure provides a train master-slave secure communication method, device, storage medium and computer program, which signs the initial transmission message based on the master key pair to obtain a signed message, and encrypts the initial transmission message based on the slave key to obtain an encrypted message, and then performs hash processing and XOR processing on the signed message and the encrypted message to determine the encrypted information to be received, and transmits the encrypted information to be received, the signed message and the encrypted message to the receiving end. In this way, by using the master key pair and the encryption key different from the slave key to sign the initial transmission message respectively, the security of message transmission is improved, and the risk of secure communication between the train master device and the slave device is effectively reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1A A schematic diagram of a flow chart of a train master-slave safety communication method in one embodiment;
[0043] Figure 1B The figure is a flow chart of a train master-slave safety communication method in another embodiment.
[0044] Figure 2 is a structural block diagram of a train master-slave safety communication device in one embodiment;
[0045] Figure 3 is an internal structure diagram of an electronic device in an embodiment; DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0047] Embodiment 1
[0048] In this embodiment, Figure 1A As shown, a train master-slave safety communication method is provided, comprising:
[0049] Step 110: Acquire an initial transmission message, wherein the initial transmission message refers to message information that the transmission end needs to transmit to the receiving end.
[0050] In this embodiment, the transmitting end refers to the master device (Master) in the train control system, the receiving end refers to the slave device (Slave) in the train control system, and the initial transmission message refers to the message information that the transmitting end needs to transmit to the receiving end, that is, the initial transmission message is the message information transmitted from the master device to the slave device.
[0051] Step 120: Sign the initial transmission message based on the master key pair to obtain a signed message.
[0052] In this embodiment, the master key pair is generated by the information sender (i.e., the transmission end). In the train control system, in order to realize the communication between the transmission end and the receiving end, the initial transmission message is signed based on the master key pair, so as to confirm the identity of the transmission end when the receiving end receives the message later, ensure the integrity of the message information, and prevent the message information from being forged. After the initial transmission message is signed based on the master key pair, a signed message is obtained.
[0053] Step 130: Encrypt the initial transmission message based on the secondary key to obtain an encrypted message.
[0054] In this embodiment, in the train control system, in order to realize the communication between the transmission end and the receiving end, the initial transmission message is encrypted based on the slave key to protect the confidentiality of the data when the subsequent receiving end receives the message and prevent the data from being tampered with. After the initial transmission message is encrypted based on the slave key, an encrypted message is obtained. By using the master key pair and the encryption key different from the slave key to sign the initial transmission message respectively, the security of the message transmission is improved, and the risk of secure communication between the train master device and the slave device is greatly reduced, so as to prevent the message content from being monitored, tampered and deciphered by attackers.
[0055] Step 140: Determine the encrypted information to be received based on the signed message and the encrypted message.
[0056] In this embodiment, after obtaining the signed message and the encrypted message, the signed message and the encrypted message are hashed and XORed to obtain the processed result, and the obtained result is used as the encrypted information to be received to verify the legitimacy of the subsequent message information.
[0057] Step 150: Transmit the encrypted message to the receiving end, wherein the encrypted message includes the encrypted information to be received, the signed message and the encrypted message.
[0058] In this embodiment, after obtaining the encrypted information to be received, the signed message and the encrypted message, the encrypted information to be received, the signed message and the encrypted message are sent to the receiving end, that is, the encrypted message is transmitted to the receiving end. In addition, the encrypted information to be received is used to facilitate the receiving end to judge the legitimacy of the encrypted message received from the transmitting end, thereby helping to distinguish real data from the attacker's forged data.
[0059] In the above embodiment, the initial transmission message is signed based on the master key pair to obtain a signed message, and the initial transmission message is encrypted based on the slave key to obtain an encrypted message, and then the signed message and the encrypted message are hashed and XORed to determine the encrypted information to be received, and the encrypted information to be received, the signed message and the encrypted message are transmitted to the receiving end. In this way, by using the master key pair and the encryption key different from the slave key to sign the initial transmission message respectively, the security of message transmission is improved, and the risk of secure communication between the train master device and the slave device is effectively reduced.
[0060] In one embodiment, after the step of obtaining the initial transmission message, the method further includes:
[0061] Obtain a set of master key pairs to be selected and a set of slave key pairs to be selected;
[0062] At intervals of a first preset period, a candidate key pair is selected from the candidate master key pair set to be determined as the master key pair;
[0063] At intervals of a second preset period, a candidate slave key is selected from the candidate slave key set and determined as the slave key.
[0064] In this embodiment, the set of master key pairs to be selected includes several master key pairs, each of which is used as a master key pair to be selected; the set of slave keys to be selected includes several slave keys, each of which is used as a slave key to be selected. In some embodiments, several master key pairs and several slave keys are generated according to a preset key generation algorithm, a set of master key pairs to be selected is generated based on several master key pairs, and a set of slave keys to be selected is generated based on several slave keys. In order to further improve the security and reliability of data transmission, after obtaining the set of master key pairs to be selected and the set of slave keys to be selected, at intervals of a first preset period, a key pair to be selected is selected from the set of master key pairs to be selected and determined as a master key pair, and at intervals of a second preset period, a slave key to be selected is selected from the set of slave keys to be selected and determined as a slave key. In some embodiments, the first preset period and the second preset period can be the same period or different periods.
[0065] In one embodiment, the master key pair includes a first private key and a second private key, and the slave key includes a first sub-public key and a second sub-public key;
[0066] The step of obtaining a set of master key pairs to be selected and a set of slave key pairs to be selected comprises:
[0067] Obtaining identification information of the master device, identification information of the slave device and system parameters;
[0068] Generate at least one first private key based on the identification information of the master device and the system parameters;
[0069] Based on the identification information of the slave device and the system parameters, generate at least one first sub-public key and at least one second private key;
[0070] Detecting whether the first sub-public key and the second private key comply with a first preset rule;
[0071] When the first sub-public key and the second private key meet a first preset rule, generating a set of to-be-selected master key pairs based on the first private key and the second private key;
[0072] Determine a second sub-public key based on the first sub-public key;
[0073] A set of slave keys to be selected is generated based on the first sub-public key and the second sub-public key.
[0074] In this embodiment, the identification information of the master device refers to the IP address of the master device, the identification information of the slave device refers to the IP address of the slave device, and the system parameter refers to the public parameter of the system. Based on the identification information of the master device and the system parameter, at least one first private key is generated, wherein the first private key is selected by the following relationship:
[0075]
[0076] In addition, based on the identification information and system parameters of the slave device, at least one first sub-public key and at least one second private key are generated, wherein the KGC (Key Generation Center) is randomly selected according to the following relationship:
[0077]
[0078] The first child public key R i It is calculated by the following relationship:
[0079] R i =r i P, h i =H1(ID i ,R i );
[0080] By binding the first sub-public key of the transmission end and its identity ID together, the amount of computation required for subsequent calculations can be reduced, and attacks by forging the identity of the transmission end can also be prevented.
[0081] The second private key S i It is calculated by the following relationship:
[0082] S i =(r i +h i s)mod q;
[0083] After getting the first child public key R i and the second private key S i Afterwards, the KGC transmits the first sub-public key and the second private key to the slave device through a secure channel, detects whether the first sub-public key and the second private key comply with the first preset rule, and detects their correctness through the first preset rule. In some embodiments, the first preset rule is set as the following relationship:
[0084] S i P=(r i +h i s)P=R i +h i P pub ;
[0085] When the first sub-public key and the second private key meet the first preset rule, a master key pair SK is generated based on the first private key and the second private key. i =(S i , x i ), and generate a set of candidate master key pairs based on multiple master key pairs.
[0086] Determine the second sub-public key based on the first sub-public key, where the second sub-public key Q i It is obtained through the following relationship:
[0087] P i =x i P,u i =H2(ID i ,P i );
[0088] Q i =R i +u i P i ;
[0089] Generate a slave key PK based on the first sub-public key and the second sub-public key i =(R i , Q i ), and generate a set of slave keys to be selected based on multiple slave keys. It should be noted that in the above relationship, except for x i , R i , S i , Q i In addition, other parameters are intermediate parameters for the convenience of reasoning and will not be described in detail here.
[0090] In one embodiment, the step of signing the initial transmission message based on the master key pair to obtain the signed message includes:
[0091] Based on the first private key and the second private key, hash processing, point multiplication operation on the elliptic curve and addition operation are performed on the data message in the initial transmission message to obtain a signature message.
[0092] In this embodiment, the initial transmission message includes a data message and an identity authentication message. After obtaining the first private key and the second private key, the first private key and the second private key and the data message in the initial transmission message are hashed, point multiplication and addition operations are performed on the elliptic curve to obtain a corresponding hash value, and then the master key of the transmission end is used to sign the hash value to sign the data message, thereby obtaining a signed message, so as to confirm the identity of the transmission end when the subsequent receiving end receives the message, ensure the integrity of the message information, and prevent the message information from being forged. In some embodiments, the identity authentication message in the initial transmission message can also be signed to obtain a signed message.
[0093] In one embodiment, the step of encrypting the initial transmission message based on the slave key to obtain the encrypted message includes:
[0094] Based on the first sub-public key and the second sub-public key, the identity authentication message in the initial transmission message is hashed and XORed to obtain an encrypted message.
[0095] In this embodiment, the initial transmission message includes a data message and an identity authentication message. After obtaining the first sub-public key and the second sub-public key, the transmission end performs hash processing and XOR processing on the first sub-public key and the second sub-public key of the receiving end and the identity authentication message in the initial transmission message to reduce the amount of calculation and ensure the integrity of the data, and then encrypts the identity authentication message to obtain an encrypted message, in order to prevent the identity of the transmission end from being forged and leaked, and to protect the confidentiality of the data when the receiving end receives the message later, and to prevent the data from being tampered with. In some embodiments, the data message in the initial transmission message can also be encrypted to obtain an encrypted message.
[0096] In some embodiments, when signing and encrypting the initial transmission message, V A The sender of the signed message, Master, is the transmission end, ID A is the identification information (i.e. IP address), and the public key of the transmission end is PK A =(R A , Q A ), the private key of the transmission end is SK A =(S A , x A ). Set V B The recipient of the signed message, i.e. the receiving end, ID B is the identification information (i.e. IP address), and the public key of the receiving end is PK B=(R B , Q B ), the private key of the receiver is SK B =(S B , x B ).
[0097] V A Enter system parameters PP to generate private key SK A =(S A , x A ) (i.e. master key pair), the initial transmission message is M, V B The public key PK B =(R B , Q B )(i.e. from the key), V A Select random number
[0098] When signing and encrypting the initial transmission message, V A Using V A The master key pair of V is used to sign the initial transmission message. A Using V B The initial transmission message is encrypted with the slave key; specifically, the steps are as follows:
[0099] (1)V A Calculate T = tP = (T x ,T y ),T x ,T y They are the x-axis coordinate value and y-axis coordinate value of point T respectively;
[0100] (2) V A Set r = T x mod q, and calculate:
[0101] P A =x A P,h A =H1(ID A ,X B ,P B ),v A =H3(ID A ,m,h A ,PK A ,T);
[0102] (3)τ=t -1 (v A +r(S A +x A ))mod q;
[0103] (4) Y = x A (QB -R B );
[0104] (5)w=H4(ID A ,ID B ,Y);
[0105] (6) C = M ⊕ w;
[0106] V A Send the signcrypted message (i.e. the encrypted message) δ = (T, τ, C) to V B .
[0107] It should be noted that in the above relationship, except for R A , Q A , S A 、x A , R B , Q B 、ID A 、ID B , T, and other parameters are intermediate parameters for the convenience of reasoning and will not be elaborated here.
[0108] It should be understood that although Figure 1A The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1A At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0109] Embodiment 2
[0110] In this embodiment, Figure 1B As shown, a train master-slave safety communication method is provided, comprising:
[0111] Step 210, obtaining an encrypted message transmitted by the transmission end, wherein the encrypted message includes encrypted information to be received, a signed message and an encrypted message, the signed message is obtained by signing based on a master key, and the encrypted message is obtained by encrypting based on a slave key.
[0112] In this embodiment, the encrypted message is the message information obtained by signing and encrypting the initial transmission message, and the transmission end transmits the encrypted message to the receiving end, and the receiving end obtains the encrypted message. Among them, the transmission end refers to the master device (Master) in the train control system, and the receiving end refers to the slave device (Slave) in the train control system.
[0113] Step 220: Perform hash processing and XOR processing on the signed message and the encrypted message to determine decryption verification information.
[0114] In this embodiment, the encrypted message includes the encrypted information to be received, the signed message and the encrypted message. After the encrypted message is obtained, the encrypted information to be received is verified to determine whether the encrypted message is legal. Specifically, the signed message and the encrypted message are hashed and XORed to obtain the decryption verification information.
[0115] Step 230: Detect whether the decryption verification information is the same as the encrypted information to be received.
[0116] In this embodiment, after the decryption verification information is obtained, the decryption verification information is compared with the encrypted information to be received to detect whether the decryption verification information is the same as the encrypted information to be received, so as to determine whether the encrypted message is legal.
[0117] Step 240: When the decryption verification information is the same as the encrypted information to be received, decrypt the encrypted message.
[0118] In this embodiment, it is detected whether the decryption verification information is the same as the encrypted information to be received. When the decryption verification information is the same as the encrypted information to be received, it is determined that the received encrypted message is legal, and the encrypted message is decrypted. When the decryption verification information is different from the encrypted information to be received, it is determined that the received encrypted message is illegal, and the decryption of the encrypted message is stopped, and the received encrypted message is discarded.
[0119] In the above embodiment, based on the signature message and the encrypted message, the decryption verification information is determined, and then it is detected whether the decryption verification information is the same as the encrypted information to be received. When the decryption verification information is the same as the encrypted information to be received, the encrypted message is decrypted. In this way, by using the master key pair and the key different from the slave key to decrypt the encrypted message respectively, the real data and the attacker's forged data are effectively distinguished, and the security of message transmission is improved.
[0120] In one embodiment, the master key pair includes a first private key and a second private key, and the slave key includes a first sub-public key and a second sub-public key;
[0121] When the decryption verification information is the same as the encrypted information to be received, the step of decrypting the encrypted message comprises:
[0122] Based on the first sub-public key and the second sub-public key, the signature message is verified to obtain a verification signature message;
[0123] Based on the first private key and the second private key, performing hash processing and XOR processing on the encrypted message to obtain a decrypted message;
[0124] An initial transmission message is determined based on the verification signature message and the decrypted message.
[0125] In this embodiment, after obtaining the first sub-public key and the second sub-public key, the first sub-public key and the second sub-public key corresponding to the locally stored master key and the signature message are hashed, multiplied on the elliptic curve, and added to verify the signature of the signature message to obtain a verification signature message. In addition, after obtaining the first private key and the second private key, the locally stored first private key and the second private key are hashed and XORed to the encrypted message to decrypt the encrypted message to obtain a decrypted message, wherein the verification signature message is used to determine whether the decrypted decrypted message is legal. When the verification signature message determines that the decrypted decrypted message is legal, the encrypted message continues to be decrypted, and after the decryption is completed, the decrypted message is determined as the initial transmission message, thereby ensuring the integrity and authenticity of the data and preventing the data from being tampered with during the transmission process. When the verification signature message determines that the decrypted decrypted message is illegal, the decryption of the encrypted message is stopped and the received encrypted message is deleted.
[0126] In some embodiments, when verifying the signature and decrypting the encrypted message, V is set B The recipient of the signed message, i.e. the receiving end, ID B is the identification information (i.e. IP address), and the public key of the receiving end is PK B =(R B , Q B ), the private key of the transmission end is SK B =(S B , x B ). Set V A The sender of the signed message, Master, is the transmission end, ID A is the identification information (i.e. IP address), and the public key of the transmission end is PK A =(R A , Q A ), the private key of the transmission end is SK A =(S A , x A ).
[0127] V B Enter system parameters PP to generate private key SK B =(S B , x B )(i.e., master key pair), the encrypted message is δ, V A The public key PK A =(R A , Q A ) (i.e. from the key).
[0128] When signing and encrypting the initial transmission message, V B Using V A The slave key verifies the signature of the initial transmission message, V B Using V B The master key pair is used to decrypt the initial transmission message; specifically, the steps are as follows:
[0129] (1) Calculate τT = v A P+r(Q A +h A P pub ) is true, if so, the signature is verified to be correct.
[0130] (2)Y * =x B (Q A -R A ), P B =x B P, v B =H3(ID B ,m,h B ,PK B ,T);
[0131] (3)ω * =H4(ID A ,ID B ,Y * );
[0132] (4) If the signature verification is correct, restore the original information M = C ⊕ ω * , otherwise, the encrypted message is rejected.
[0133] It should be understood that although Figure 1B The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1BAt least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0134] Embodiment 3
[0135] In this embodiment, a train master-slave safety communication method is provided, including:
[0136] In step 11, a first key pair and a second key are determined.
[0137] In a preferred embodiment of the present invention, the first key pair consists of the Master's long-term private key and a temporary private key, and the temporary private key is difficult to be inferred, wherein the temporary private key is randomly generated, and the long-term private key is generally fixed and unchanged, and both are generated by the information sender. Therefore, applying it to the communication between the train Master and Slave can help the Slave judge the authenticity of the data source and resist forgery attacks.
[0138] Specifically, the process of generating the private and public keys of the Master and Slave is as follows:
[0139] Key generation algorithm
[0140] (1) Enter the real identities of the Master and Slave (such as IP addresses) and the system's public parameter pp, and the Slave randomly selects as its temporary private key.
[0141] (2) Input parameter value pp, KGC randomly selects Calculate the partial public key R i =r i P, h i =H1(ID i ,R i ), part of the long-term private key S i =(r i +h i s)mod q;
[0142] (3) KGC sends (S i ,R i ) is sent to the Slave, which verifies equation S i P=R i +h i P pub Is it true? If it is true, it is accepted and the Slave private key pair (i.e. master key pair) SK is generated. i =(Si , x i ). If not, reject. Proof of correctness: S i P=(r i +h i s)P=R i +h i P pub .
[0143] (4) Master and Slave calculate the partial public key Q i =R i +u i P i , generate the public key (i.e. from the secret key) as PK i =(R i , Q i ).
[0144] Signcryption algorithm
[0145] V A Master, the sender of the signcrypted message, ID A For its identity, public key PK A =(R A , Q A ), private key SK A =(S A , x A ). B The recipient of the signed message, Slave, ID B For its identity, public key PK B =(R B , Q B ), private key SK B =(S B , x B ).
[0146] Sender V A , input system parameters PP, generate private key SK A (i.e. master key pair), message to be sent M, V B The public key PK B (i.e. from the key), the sender V A Select random number , the data sender performs the signing and encryption steps:
[0147] (1)V A Calculate T = tP = (T x ,T y ), T x ,T y They are the x-axis coordinate value and y-axis coordinate value of point T respectively;
[0148] (2) VA Set r = T x mod q, and calculate:
[0149] P A =x A P,h A =H1(ID A ,X B ,P B ),v A =H3(ID A ,m,h A ,PK A ,T);
[0150] (3)τ=t -1 (v A +r(S A +x A ))mod q;
[0151] (4) Y = x A (Q B -R B );
[0152] (5)w=H4(ID A ,ID B ,Y);
[0153] (6) C = M ⊕ w;
[0154] V A Send the signcrypted message (i.e. the encrypted message) δ = (T, τ, C) to V B .
[0155] In addition, in order to further improve the security and reliability of data transmission, the first key pair can periodically update the key. Specifically, according to the above-mentioned preset rules, each key set is generated, and then a key pair (i.e., the master key to be selected) is periodically extracted from the first key set (i.e., the master key pair to be selected), and the key pair is determined as the first key pair (i.e., the master key pair).
[0156] In step 12, the key is used to sign each data part in the Master message. Specifically:
[0157] By performing hash processing, point multiplication operation on the elliptic curve and addition operation on the first key pair obtained in step 11 and the data message in the Master message to be encrypted (i.e., the data message in the initial transmission message), the data message in the Master message to be encrypted is signed to obtain a signed data message (i.e., the signed message).
[0158] By hashing and XORing the second key obtained in step 11 and the ID message in the Master message to be encrypted (i.e., the identity authentication message in the initial transmission message), the ID message in the Master message to be encrypted is encrypted to obtain an encrypted ID message (i.e., the encrypted message).
[0159] In step 13, the signed data message and the encrypted ID message are used to generate a receiving end signcryption message (i.e., the encrypted information to be received). The signed data message and the encrypted ID message obtained in step 12 are hashed and XORed, and the result is used as the receiving end signcryption message.
[0160] After the above encryption step is completed, the encrypted Master message is determined and sent. The encrypted Master message includes the signed data message, the encrypted ID message and the receiving end signcryption message.
[0161] According to the risk analysis of the above-mentioned train Master and Slave communication technology in practical application, the present invention proposes to apply the Beidou navigation communication signcryption method to the train field, increase the difficulty of deciphering Master message data and ID message, and add source address information verification method to prevent attackers from eavesdropping and tampering with Master message data and ID message, and enable the receiving end to confirm the authenticity of the received message, so as to achieve the technical effect of improving the security of Master and Slave communication.
[0162] It can be seen that the embodiment of the present invention uses different keys to sign the data message and identity authentication message of the Master message respectively, which improves the security of message transmission and greatly reduces the risk of the communication content between the train Master and Slave being monitored, tampered with and deciphered by attackers. In addition, the signed Master message sent to the receiving end by the embodiment of the present invention includes a signature message of the receiving end, so that the receiving end can judge the legitimacy of the signed Master message received from the sending end, thereby helping to distinguish real data from the attacker's forged data. The sign-encryption and decryption method of this embodiment has simple steps, consumes less computing resources, has obvious encryption effect, and does not require additional hardware cost.
[0163] In some embodiments, the specific process of decryption is as follows:
[0164] Signcryption message receiver V B Enter system parameters PP to generate private key SK B (i.e. master key pair), the encrypted message is δ, V A The public key PK A (i.e. from the key). Data receiver V B Perform the following steps:
[0165] (1) Calculate τT = v A P+r(Q A +h A P pub ) is true, if so, the signature is verified to be correct.
[0166] (2)Y * =x B (Q A -R A ), P B =x B P, v B =H3(ID B ,m,h B ,PK B ,T);
[0167] (3)ω * =H4(ID A ,ID B ,Y * );
[0168] (4) If the signature verification is correct, restore the original information M = C ⊕ ω * , otherwise, the encrypted message is rejected.
[0169] In addition to the above-mentioned secure signcryption method for train Master and Slave communication, the present invention also includes a secure decryption method for train Master and Slave communication. The secure decryption method for train Master and Slave communication in this embodiment mainly includes the following steps 21 to 23.
[0170] In step 21, the receiving end first receives the signed Master message (i.e., the encrypted message). Here, the signed Master message includes the signed message of the receiving end (i.e., the encrypted information to be received), the signed data message (i.e., the signed message) obtained by signing the first key pair, and the encrypted ID message (i.e., the encrypted message) obtained by encrypting the second key.
[0171] In step 22, the signed encrypted message of the receiving end is verified to determine whether the signed encrypted Master message is legal, and decryption verification information is obtained.
[0172] Specifically, the signed data message and the encrypted ID message in the received signed Master message are hashed and XORed, and the result is compared with the receiving end signed message in the received signed Master message to obtain decryption verification information.
[0173] When the comparison result (ie, the decryption verification information) indicates that the result is the same as the signcrypted message of the receiving end, it is determined that the received signcrypted Master message is legal, and the decryption of the encrypted Master message continues.
[0174] When the comparison result is different from the sign-encrypted message of the receiving end, it is determined that the received sign-encrypted Master message is illegal. At this time, the de-signencryption of the data is stopped and the received message is discarded.
[0175] In step 23, when it is determined that the signed Master message is legal, the Master message is de-signed.
[0176] Specifically, the signature of the signed data message is verified by performing hash processing, point multiplication operation on the elliptic curve, and addition operation on the signed data message using the long-term public key (i.e., the first sub-public key) and the temporary public key (i.e., the second sub-public key) corresponding to the locally stored first key pair (i.e., the master key pair);
[0177] The encrypted ID message is decrypted by performing hash processing and XOR processing on the locally stored second key (ie, the first private key and the second private key) and the encrypted ID message.
[0178] After the above decryption step is completed, the Master message that the communication system wants to transmit to the receiving end can be obtained.
[0179] As can be seen from the above decryption method embodiment, the present invention determines the legitimacy of the received Master message by first verifying the signed message after receiving the Master message. This step can effectively distinguish real data from the attacker's forged data, thereby improving the security of message transmission. After determining that the received Master message is a legitimate message, different keys are used to decrypt the data message and the identity authentication message of the Master message respectively. The signcryption and decryption method of this embodiment has simple steps, consumes less computing resources, has obvious encryption effect, and does not require additional hardware cost.
[0180] Embodiment 4
[0181] In this embodiment, Figure 2 As shown, a train master-slave safety communication device is provided, comprising:
[0182] A first acquisition module 310 is used to acquire an initial transmission message, wherein the initial transmission message refers to message information that the transmission end needs to transmit to the receiving end;
[0183] The signing module 320 is used to sign the initial transmission message based on the master key pair to obtain a signed message;
[0184] The encryption module 330 is used to encrypt the initial transmission message based on the secondary key to obtain an encrypted message;
[0185] A first determination module 340, configured to determine the encrypted information to be received based on the signed message and the encrypted message;
[0186] The transmission module 350 is used to transmit the encrypted message to the receiving end, wherein the encrypted message includes the encrypted information to be received, the signed message and the encrypted message.
[0187] In one embodiment, the first acquisition module 210 includes:
[0188] A set acquisition unit, used to acquire a set of master key pairs to be selected and a set of slave key pairs to be selected;
[0189] A master selection unit, configured to select a candidate key pair from the candidate master key pair set at intervals of a first preset period to determine the candidate key pair as the master key pair;
[0190] The slave selection unit is used to select a slave key to be selected from the set of slave keys to be selected as the slave key at intervals of a second preset period.
[0191] In one embodiment, the collection acquisition unit includes:
[0192] an identification acquisition subunit, configured to acquire identification information of the master device, identification information of the slave device, and system parameters, wherein the master key pair includes a first private key and a second private key, and the slave key includes a first sub-public key and a second sub-public key;
[0193] A first generating subunit, configured to generate at least one first private key based on the identification information of the master device and the system parameter;
[0194] A second generating sub-unit, configured to generate at least one of the first sub-public keys and at least one of the second private keys based on the identification information of the slave device and the system parameters;
[0195] A detection subunit, used to detect whether the first sub-public key and the second private key comply with a first preset rule;
[0196] a master set generating subunit, configured to generate a set of master key pairs to be selected based on the first private key and the second private key when the first sub-public key and the second private key meet a first preset rule;
[0197] A determination subunit, configured to determine a second sub-public key based on the first sub-public key;
[0198] The slave set generating subunit is used to generate a slave key set to be selected based on the first sub-public key and the second sub-public key.
[0199] In one embodiment, the signature module 220 is further used to perform hash processing, point multiplication operation on an elliptic curve, and addition operation on the data message in the initial transmission message based on the first private key and the second private key to obtain a signature message.
[0200] In one embodiment, the encryption module 230 is further used to perform hash processing and XOR processing on the identity authentication message in the initial transmission message based on the first sub-public key and the second sub-public key to obtain an encrypted message.
[0201] In one embodiment, the train master-slave safety communication device further includes:
[0202] A second acquisition module is used to acquire an encrypted message transmitted by the transmission end, wherein the encrypted message includes the encrypted information to be received, the signed message and the encrypted message, the signed message is obtained by signing based on the master key, and the encrypted message is obtained by encrypting based on the slave key;
[0203] A second determination module is used to perform hash processing and XOR processing on the signed message and the encrypted message to determine decryption verification information;
[0204] A detection module, used to detect whether the decryption verification information is the same as the encrypted information to be received;
[0205] A decryption module is used to decrypt the encrypted message when the decryption verification information is the same as the encrypted information to be received.
[0206] In one embodiment, the decryption module includes:
[0207] a verification signature unit, configured to verify the signature of the signature message based on the first sub-public key and the second sub-public key to obtain a verification signature message, wherein the master key pair includes a first private key and a second private key, and the slave key includes a first sub-public key and a second sub-public key;
[0208] A decryption unit, configured to perform a hash process and an XOR process on the encrypted message based on the first private key and the second private key to obtain a decrypted message;
[0209] A determination unit is used to determine an initial transmission message based on the verification signature message and the decryption message.
[0210] For the specific definition of the train master-slave safety communication device, please refer to the definition of the train master-slave safety communication method above, which will not be repeated here. Each unit in the above-mentioned train master-slave safety communication device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned units can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned units.
[0211] Embodiment 5
[0212] like Figure 3 As shown, based on the above embodiments, this embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the method described in the above embodiments.
[0213] In some implementations of this embodiment, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the method described in the above embodiment are implemented.
[0214] In some implementations of this embodiment, a computer program product is provided, including a computer program / instructions, characterized in that when the computer program is executed by a processor, the steps of the method described in the above embodiment are implemented.
[0215] The processor may include, but is not limited to, one or more processors or microprocessors, etc. Each processor may be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components to execute the methods in the above embodiments.
[0216] The computer-readable storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, and the computer-readable storage medium may include but is not limited to, for example, random access memory (RAM), read-only memory (ROM), flash memory, EPROM memory, EEPROM memory, registers, computer storage media (e.g., hard disk, floppy disk, solid-state drive, removable disk, CD-ROM, DVD-ROM, Blu-ray disc, etc.).
[0217] The computer-readable storage medium may also store at least one computer executable program / instruction, which may be, for example, a computer-readable instruction. The computer-readable storage medium includes, but is not limited to, for example, a volatile memory and / or a non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The computer-readable storage medium may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. For example, a non-transitory computer-readable storage medium may be connected to a computing device such as a computer, and then, when the computing device runs the computer-readable instructions stored on the computer-readable storage medium, the various methods described above may be performed.
[0218] In addition, the electronic device may also include (but not limited to) a data bus, an input / output (I / O) bus, a display, and input / output devices (eg, keyboard, mouse, speaker, etc.), etc.
[0219] The processor may communicate with external devices via an I / O bus via a wired or wireless network.
[0220] In one embodiment, the at least one computer executable instruction may also be compiled into or constitute a software product / computer program product, wherein one or more computer executable instructions are executed by a processor to perform the various functions and / or method steps in the embodiments described in the present technology.
[0221] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0222] It should be noted that in the present disclosure, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element limited by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0223] Although the embodiments disclosed in the present disclosure are as above, the above contents are only embodiments adopted for facilitating the understanding of the present disclosure and are not intended to limit the present disclosure. Any technician in the technical field to which the present disclosure belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present disclosure, but the scope of patent protection of the present disclosure shall still be subject to the scope defined in the attached claims.
Claims
1. A train master-slave safety communication method, characterized in that: include: Obtaining an initial transmission message, wherein the initial transmission message refers to message information that the transmission end needs to transmit to the receiving end; Signing the initial transmission message based on the master key pair to obtain a signed message; Encrypting the initial transmission message based on the slave key to obtain an encrypted message; Determining encrypted information to be received based on the signed message and the encrypted message; The encrypted message is transmitted to the receiving end, wherein the encrypted message includes the encrypted information to be received, the signed message and the encrypted message.
2. The train master-slave safety communication method according to claim 1, characterized in that: After the step of obtaining the initial transmission message, the method further includes: Obtain a set of master key pairs to be selected and a set of slave key pairs to be selected; At intervals of a first preset period, a candidate key pair is selected from the candidate master key pair set to be determined as the master key pair; At intervals of a second preset period, a candidate slave key is selected from the candidate slave key set and determined as the slave key.
3. The train master-slave safety communication method according to claim 2, characterized in that: The master key pair includes a first private key and a second private key, and the slave key includes a first sub-public key and a second sub-public key; The step of obtaining a set of master key pairs to be selected and a set of slave key pairs to be selected comprises: Obtaining identification information of the master device, identification information of the slave device and system parameters; Generate at least one first private key based on the identification information of the master device and the system parameters; Based on the identification information of the slave device and the system parameters, generate at least one first sub-public key and at least one second private key; Detecting whether the first sub-public key and the second private key comply with a first preset rule; When the first sub-public key and the second private key meet a first preset rule, generating a set of to-be-selected master key pairs based on the first private key and the second private key; Determine a second sub-public key based on the first sub-public key; A set of slave keys to be selected is generated based on the first sub-public key and the second sub-public key.
4. The train master-slave safety communication method according to claim 3, characterized in that: The step of signing the initial transmission message based on the master key pair to obtain the signed message comprises: Based on the first private key and the second private key, hash processing, point multiplication operation on the elliptic curve and addition operation are performed on the data message in the initial transmission message to obtain a signature message.
5. The train master-slave safety communication method according to claim 3, characterized in that: The step of encrypting the initial transmission message based on the slave key to obtain the encrypted message comprises: Based on the first sub-public key and the second sub-public key, the identity authentication message in the initial transmission message is hashed and XORed to obtain an encrypted message.
6. A train master-slave safety communication method, characterized in that: include: Obtaining an encrypted message transmitted by the transmission end, wherein the encrypted message includes encrypted information to be received, a signed message, and an encrypted message, wherein the signed message is obtained by signing based on a master key, and the encrypted message is obtained by encrypting based on a slave key; Performing hash processing and XOR processing on the signed message and the encrypted message to determine decryption verification information; Detecting whether the decryption verification information is the same as the encrypted information to be received; When the decryption verification information is the same as the encrypted information to be received, the encrypted message is decrypted.
7. The train master-slave safety communication method according to claim 6, characterized in that: The master key pair includes a first private key and a second private key, and the slave key includes a first sub-public key and a second sub-public key; When the decryption verification information is the same as the encrypted information to be received, the step of decrypting the encrypted message comprises: Based on the first sub-public key and the second sub-public key, verify the signature of the signature message to obtain a verification signature message; Based on the first private key and the second private key, performing hash processing and XOR processing on the encrypted message to obtain a decrypted message; An initial transmission message is determined based on the verification signature message and the decrypted message.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
