Communication encryption method and system, storage medium and electronic equipment
Establishing the root CA certificate and HMAC value through the TPM chip simplifies the identity verification between the management and control system and the equipment, solves the problems of identity fraud and cumbersome verification, and improves connection security and efficiency.
Patent Information
- Application Number
- CN202410974736.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-07-19
AI Technical Summary
In the network management and control process of telecommunications transmission networks, there are problems of identity fraud and cumbersome verification methods when the management and control system is connected to equipment, and equipment is connected to equipment, resulting in reduced security and low authentication efficiency.
Use the TPM chip as the root of trust to establish a root CA certificate, generate a symmetric key and HMAC value, and perform identity verification by comparing the HMAC value to simplify the verification process of the certificate chain and improve connection security and efficiency.
Authentication is performed by comparing HMAC values, which improves the security of the connection between the control system and the device, and between the device and the device, simplifies the authentication process, eliminates the cumbersome process of layer-by-layer search of the certificate chain in the traditional mode, and improves communication encryption. Process hardware environment security.
Smart Images

Figure CN118764282A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the field of communication technology, and in particular, relates to a communication encryption method, system, storage medium and electronic device. Background Art
[0002] In the process of network control of telecommunications transmission network, the control system controls the equipment and the connection between equipment needs to be established through broadcast and response. Specifically, the control system broadcasts messages to a specific IP segment. After receiving the message, the device sends a response to the IP of the control system. After receiving the response from the device, the control system establishes a TCP connection with the device, thereby realizing the connection and control of the device. Similarly, the connection between devices is established by a TCP connection between two devices through broadcast and response.
[0003] In the above process, the following problems may occur:
[0004] 1. Identity fraud: When the control system is connected to devices or devices are connected to each other, the identities of the devices and the control system may be misused, resulting in reduced security when the control system is connected to devices or devices are connected to each other.
[0005] 2. The verification method is cumbersome: During the verification process, it is necessary to verify the certificate chain, searching from the leaf node certificate upward layer by layer until the two certificate chains of the management and control system and the device find the same root node, in order to determine whether the identity of the management and control system and the device is legal.
[0006] Therefore, there is an urgent need for a communication encryption method, system, storage medium and electronic device to improve security and identity authentication efficiency during the connection between the management system and equipment, and between equipment. Summary of the invention
[0007] To solve the above problems, the present disclosure provides a communication encryption method, system, storage medium and electronic device, which can improve security and connection efficiency when establishing connections between a management system and a device, and between devices.
[0008] The present invention is achieved through the following technical solutions:
[0009] In a first aspect, an embodiment of the present disclosure provides a communication encryption method, the method comprising:
[0010] Using the TPM chip as the root of trust, a root CA certificate is established; a sub-CA is established under the root CA; a symmetric key is created using the TPM chip, and the HMAC value of the root CA and the HMAC values of all sub-CAs are calculated;
[0011] According to the sub-CA to which the control system or device belongs, the corresponding terminal certificate and the HMAC value of the terminal certificate are sent to the control system or device;
[0012] Receive the HMAC value of the device certificate that needs to establish a connection, and compare it with the calculated or saved theoretical HMAC value of the device certificate. When the comparison result meets the preset conditions, send the control system certificate and the HMAC value of the control system certificate to the device;
[0013] The device receives the HMAC value of the control system certificate sent back by the control system and compares it with the calculated or saved theoretical HMAC value of the control system certificate. When the comparison result meets the preset conditions, the device successfully establishes a connection.
[0014] Furthermore,
[0015] Generate a first public-private key pair, the first public-private key pair including a first private key and a first public key, store the first private key in the TPM chip and make it unremovable; receive the certificate information sent by the root CA, and use the first private key stored in the TPM chip to sign the certificate information; send the signature and the first public key to the root CA, and the root CA assembles the certificate information and the received signature and the first public key to obtain the root CA certificate;
[0016] Divide the root CA into first-level sub-CAs, and divide each first-level sub-CA into second-level sub-CAs;
[0017] The symmetric key is created using the TPM chip, and the HMAC value of the root CA, the HMAC values of all first-level sub-CAs, and the HMAC values of all second-level sub-CAs are calculated.
[0018] Furthermore,
[0019] Generate a second public-private key pair, the second public-private key pair including a second public key and a second private key, retain the second private key, pass the second public key to the root CA, the root CA encrypts the symmetric key using the received second public key, and returns the ciphertext to the management and control system or device;
[0020] Apply for a certificate from the root CA, and calculate the HMAC value of the control system certificate or the HMAC value of the device certificate according to the sub-CA to which the control system or device belongs;
[0021] Use the symmetric key to encrypt the HMAC value of the sub-CA corresponding to the control system or device applying for the certificate and send it to the control system or device. At the same time, the control system certificate and the HMAC value of the control system certificate or the device certificate and the HMAC value of the device certificate are sent to the control system or device applying for the certificate.
[0022] Furthermore,
[0023] Discover the device and establish a TCP connection, and receive the device certificate and the HMAC value of the device certificate sent by the device;
[0024] Calculate the theoretical HMAC value of the device certificate and compare it with the HMAC value of the received device certificate;
[0025] When the comparison result of the theoretical HMAC value of the device certificate and the HMAC value of the received device certificate is the same, the corresponding control system certificate and the HMAC value of the control system certificate are sent to the device.
[0026] Furthermore,
[0027] Calculate or call the theoretical HMAC value of the control system certificate, and compare the theoretical HMAC value of the control system certificate with the HMAC value of the received control system certificate;
[0028] When the comparison result of the theoretical HMAC value of the control system certificate and the HMAC value of the received control system certificate are the same, the device successfully establishes a connection.
[0029] Furthermore,
[0030] The first device discovers the second device and establishes a TCP connection, and the first device receives the HMAC value of the control system sub-CA sent by the second device;
[0031] Determine whether the HMAC value of the control system sub-CA corresponding to the second device and the HMAC value of the control system sub-CA corresponding to the first device meet the preset conditions. If the preset conditions are met, the first device sends a second device connection request to the corresponding control system.
[0032] Furthermore,
[0033] The HMAC value of the root CA certificate is set to HMAC0; wherein HMAC0=(K, root CA certificate);
[0034] The HMAC value of the first-level sub-CA is set to HMAC1 x; where HMAC1 x = (K, HMAC0 + first-level sub-CA certificate), x = 1, 2 to n, where n is the number of first-level sub-CAs;
[0035] The HMAC value of the secondary sub-CA is set to HMAC2y; where HMAC2y = (K, HMAC1 x + secondary sub-CA certificate), y = 1, 2, 3 to m, where m is the number of secondary sub-CAs;
[0036] Wherein, K is the symmetric key.
[0037] In a second aspect, an embodiment of the present disclosure provides a communication encryption system, the communication encryption system comprising: a root CA and a TPM chip;
[0038] The root CA is used to assemble a root CA certificate, establish a sub-CA, and use the TPM chip to create a first public-private key pair and a symmetric key;
[0039] The TPM chip is used as the trust root of the root CA, stores the first private key of the first public-private key pair in the TPM chip and cannot be removed, and calculates the HMAC value of the root CA and the HMAC values of all sub-CAs.
[0040] In a third aspect, an embodiment of the present disclosure provides a computer storage medium storing one or more programs, wherein:
[0041] When the one or more programs are executed, any of the above-mentioned communication encryption methods can be implemented.
[0042] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, including a processor, a communication interface, the above-mentioned computer-readable storage medium and a communication bus; wherein the processor, the communication interface, and the computer-readable storage medium communicate with each other via the communication bus;
[0043] in,
[0044] The processor is configured to execute a program stored in a computer-readable storage medium.
[0045] Compared with the prior art, the present invention has the following advantages:
[0046] 1. When establishing a connection between the control system and the device, or between the devices, the HMAC value corresponding to the control system is compared with the HMAC value corresponding to the device to determine whether the conditions for establishing a connection are met, thereby improving security and eliminating the tedious process of searching from the leaf node certificate upward layer by layer in the traditional mode.
[0047] 2. The TPM chip is used as the root of trust of the root CA, and the TPM chip is used to store the private key of the asymmetric key, calculate and store the symmetric key, calculate the HMAC value corresponding to the management and control system and the HMAC value corresponding to the device, thereby improving the security of the hardware environment during the communication encryption process.
[0048] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or be understood by implementing the present disclosure. The purpose and other advantages of the present disclosure can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 It is a flowchart of the communication encryption method in the embodiment of the present disclosure;
[0051] Figure 2 A schematic diagram of a process for establishing a root CA certificate in an embodiment of the present disclosure;
[0052] Figure 3 It is a schematic diagram of the structure of the root CA and the sub-CA in the embodiment of the present disclosure;
[0053] Figure 4 A schematic diagram of the process of obtaining certificates and HMAC values for devices and control systems in an embodiment of the present disclosure;
[0054] Figure 5 A schematic diagram of a process for establishing a connection between a device and a management and control system in an embodiment of the present disclosure;
[0055] Figure 6 The present invention is a flow chart of establishing a connection between devices in an embodiment of the present invention. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0057] Figure 1 FIG. 1 is a flow chart of a communication encryption method in an embodiment of the present disclosure. Figure 1 As shown, the communication encryption method of the embodiment of the present disclosure includes:
[0058] S1: Use the TPM chip as the root of trust to establish a root CA certificate; establish a sub-CA under the root CA; use the TPM chip to create a symmetric key, and calculate the HMAC value of the root CA and the HMAC values of all sub-CAs.
[0059] Specifically, the root CA uses the TPM chip as the root of trust and uses the TPM chip to create symmetric keys, which improves the security of the communication encryption process. The root CA is the highest level of certificate authority (Cert ifi cate Author ity), which can be regarded as a logical entity; in actual work, building a root CA, issuing a root CA certificate, and establishing a sub-CA under the root CA usually need to be completed on a hardware entity in combination with software, such as: a server combined with a certificate authority software.
[0060] S2: According to the sub-CA to which the management and control system or device belongs, the corresponding terminal certificate and the HMAC value of the terminal certificate are sent to the management and control system or device.
[0061] Specifically, the control system and the device correspond to their own sub-CAs. When the control system and the device apply for a certificate, they need to apply for a certificate under the corresponding sub-CA. The root CA sends the corresponding terminal certificate and the HMAC value of the terminal certificate to the control system and the device. The control system receives its own terminal certificate and the HMAC value of the terminal certificate. The device receives its own terminal certificate and the HMAC value of the terminal certificate. At the same time, the device can also receive and save the HMAC value of the corresponding control system sub-CA. When the device is connected to the device, it can determine whether to establish a connection by judging the HMAC value of the control system sub-CA.
[0062] S3: Receive the HMAC value of the device certificate for which a connection needs to be established, and compare it with the calculated or saved theoretical HMAC value of the device certificate. When the comparison result meets the preset conditions, send the control system certificate and the HMAC value of the control system certificate to the device.
[0063] Specifically, in order to improve the security during the communication process, in the embodiment of the present disclosure, two-way authentication is implemented. The management and control system receives the HMAC value of the device certificate sent by the device that needs to establish a connection. After judgment, if it meets the preset comparison result, the management and control system sends the HMAC value of the management and control system certificate to the device applying to establish a connection.
[0064] S4: Receive the HMAC value of the control system certificate sent back by the control system, and compare it with the calculated or saved theoretical HMAC value of the control system certificate. When the comparison result meets the preset conditions, the device successfully establishes a connection.
[0065] Specifically, the device receives the control system certificate and the HMAC value of the control system certificate, calculates the theoretical HMAC value of the control system certificate, and compares the calculated theoretical HMAC value of the control system certificate with the received HMAC value of the control system certificate. When the comparison results are the same, the two-way authentication between the device and the control system is completed, and the device and the control system are securely connected. When the device saves the HMAC value of the corresponding control system certificate, it can directly call the saved HMAC value of the control system certificate without calculation. When the device is connected to the device, steps S3 and S4 also need to be executed.
[0066] In some examples, a root CA certificate is established with a TPM chip as the root of trust; a sub-CA is established under the root CA; a symmetric key is created using the TPM chip, and the HMAC value of the root CA and the HMAC values of all sub-CAs are calculated, specifically including:
[0067] S11: Generate a first public-private key pair, which includes a first private key and a first public key. The first private key is stored in the TPM chip and cannot be removed. Receive the certificate information sent by the root CA, and use the first private key stored in the TPM chip to sign the certificate information. Send the signature and the first public key to the root CA, and the root CA assembles the certificate information and the received signature and the first public key to obtain the root CA certificate.
[0068] Specifically, Figure 2 FIG. 1 is a flow chart of establishing a root CA certificate in an embodiment of the present disclosure. Figure 2 As shown, the root CA sends certificate information to the TPM chip, wherein the certificate information may include information of the certificate issuing authority, information of the certificate holder, validity period of the certificate, etc. The TPM chip is used to generate an asymmetric key, which includes a first public-private key pair (P, V). The first private key V in the first public-private key pair is stored in the TPM chip and cannot be removed; the first public key P can be removed and used in the subsequent root CA certificate creation process. The TPM chip uses the stored first private key V to sign the certificate information, and sends the signature and the first public key P to the root CA, wherein the first private key V is used to sign the certificate information to verify the identity of the root CA certificate holder, and the first public key P is used to verify the authenticity of the signature of the first private key V. The root CA assembles the certificate information, the received signature and the first public key P to obtain an X.509 certificate, which is the root CA certificate.
[0069] S12: Divide the root CA into first-level sub-CAs, and divide each first-level sub-CA into second-level sub-CAs.
[0070] Specifically, when establishing a first-level sub-CA, it is divided according to hardware and software. In the embodiment of the present disclosure, the first-level sub-CA is divided into a control system sub-CA and a device sub-CA. The control system sub-CA and the device sub-CA are established, and the control system sub-CA certificate and the device sub-CA certificate are applied for at the same time. When establishing a second-level sub-CA, it is divided according to the business form. In the embodiment of the present disclosure, the control system sub-CA is divided into OTN control system sub-CA, PTN control system sub-CA and hybrid control system sub-CA as second-level sub-CAs, OTN control system sub-CA, PTN control system sub-CA and hybrid control system sub-CA are established, and OTN control system sub-CA, PTN control system sub-CA and hybrid control system sub-CA are applied for at the same time; the device sub-CA is divided into OTN device sub-CA, PTN device sub-CA and hybrid device sub-CA as second-level sub-CAs, OTN device sub-CA, PTN device sub-CA and hybrid device sub-CA are established, and OTN device sub-CA, PTN device sub-CA and hybrid device sub-CA are applied for at the same time. It is understandable that the number and level of sub-CAs can be changed according to actual conditions.
[0071] S13: Use the TPM chip to create a symmetric key, and calculate the HMAC value of the root CA, the HMAC values of all first-level sub-CAs, and the HMAC values of all second-level sub-CAs.
[0072] Specifically, the root CA uses the TPM chip to create a symmetric key, first calculating the HMAC value of the root CA, and then calculating the HMAC value of the sub-CA level by level. The HMAC value of the root CA certificate is set to HMAC0, HMAC0 = (K, root CA certificate); the HMAC value of the first-level sub-CA is set to HMAC1 x, HMAC1 x = (K, HMAC0 + first-level sub-CA certificate), x = 1, 2 to n, where n is the actual number of first-level sub-CAs; the HMAC value of the second-level sub-CA is set to HMAC2y, HMAC2y = (K, HMAC1 x + second-level sub-CA certificate), y = 1, 2, 3 to m, where m is the actual number of second-level sub-CAs. And so on, starting from the root CA, the HMAC values of each level of sub-CA are calculated layer by layer. Among them, K is a symmetric key.
[0073] Figure 3 FIG. 1 is a schematic diagram of the structure of the root CA and the sub-CA in the embodiment of the present disclosure. Figure 3 As shown, in the embodiment of the present disclosure, a first-level sub-CA and a second-level sub-CA are included. The first-level sub-CA includes: a control system sub-CA and a device sub-CA. The second-level sub-CA includes: an OTN control system sub-CA, a PTN control system sub-CA and a hybrid control system sub-CA, as well as an OTN device sub-CA, a PTN device sub-CA and a hybrid device sub-CA. Starting from the root CA, the specific calculation method for calculating the HMAC value of each level of sub-CA layer by layer is as follows:
[0074] First, the HMAC value of the root CA certificate is calculated. The HMAC value of the root CA is HMAC0, and HMAC0=HMAC(K, root CA certificate).
[0075] Then calculate the HMAC value of each first-level sub-CA. The HMAC value of the control system sub-CA is HMAC11, HMAC11=HMAC(K, HMAC0+control system sub-CA certificate); the HMAC value of the device sub-CA is HMAC12, HMAC12=HMAC(K, HMAC0+device sub-CA certificate).
[0076] Finally, the HMAC value of the secondary sub-CA is calculated. The HMAC value of the OTN control system sub-CA is HMAC21, HMAC21 = HMAC (K, HMAC11 + OTN control system sub-CA certificate); the HMAC value of the PTN control system sub-CA is HMAC22, HMAC22 = HMAC (K, HMAC11 + PTN control secondary sub-CA certificate); the HMAC value of the hybrid control system sub-CA is HMAC23, HMAC23 = HMAC (K, HMAC11 + hybrid control secondary sub-CA certificate); the HMAC value of the OTN equipment secondary sub-CA is HMAC24, HMAC24 = HMAC (K, HMAC12 + OTN equipment sub-CA certificate), the HMAC value of the PTN equipment secondary sub-CA is HMAC25, HMAC25 = HMAC (K, HMAC12 + PTN equipment sub-CA certificate), and the HMAC value of the hybrid equipment secondary sub-CA is HMAC26, HMAC26 = HMAC (K, HMAC12 + hybrid equipment sub-CA certificate). Among them, K is a symmetric key.
[0077] In some examples, Figure 4 The following is a flow chart of how the device and the control system obtain the certificate and HMAC value in the embodiment of the present disclosure. Figure 4 As shown, according to the sub-CA to which the control system or device belongs, the corresponding terminal certificate and the HMAC value of the terminal certificate are sent to the control system or device, specifically including:
[0078] S21: Generate a second public-private key pair, the second public-private key pair includes a second public key and a second private key, retain the second private key, pass the second public key to the root CA, the root CA uses the received second public key to encrypt the symmetric key, and returns the ciphertext to the management and control system or device.
[0079] Specifically, the device or management and control system applying for the certificate generates its own second public-private key pair, and obtains a symmetric key through the interaction of the second public key between the device and the root CA, and between the management and control system and the root CA.
[0080] It should be noted that the first public-private key pair includes a first public key and a first private key, which are used to establish a root CA certificate. The second public-private key pair includes a second public key and a second private key, which are used when the control system applies for a control system certificate and the device applies for a device certificate.
[0081] S22: Apply for a certificate from the root CA, and calculate the HMAC value of the control system certificate or the HMAC value of the device certificate according to the sub-CA to which the control system or device belongs.
[0082] Specifically, after obtaining the symmetric key, the management and control system and device applying for the certificate apply for the certificate from the root CA. The root CA calculates the HMAC value of the management and control system certificate or the HMAC value of the device certificate based on the sub-CA to which the management and control system or device belongs. Figure 3 , the calculation method of the HMAC value of the control system certificate and the HMAC value of the device certificate is similar to the HMAC value of the aforementioned sub-CA. The control system certificate and the device certificate are both terminal certificates. The HMAC value of the terminal certificate is set to HMAC3z, HMAC3z = (K, the HMAC value of the sub-CA corresponding to the terminal certificate + the terminal certificate), z = 1, 2, 3 to j, where j is the actual number of terminal certificates. Taking the calculation of the HMAC value of the OTN control system certificate and the HMAC value of the OTN device certificate as an example, the HMAC value of the OTN control system certificate is HMAC31, HMAC31 = (K, HMAC21 + OTN control system certificate), and the HMAC value of the OTN device certificate is HMAC32, HMAC32 = (K, HMAC24 + OTN device certificate), where K is a symmetric key.
[0083] S23: Use the symmetric key to encrypt the HMAC value of the sub-CA corresponding to the control system or device applying for the certificate and send it to the control system or device. At the same time, send the control system certificate and the HMAC value of the control system certificate or the device certificate and the HMAC value of the device certificate to the control system or device applying for the certificate.
[0084] Specifically, the root CA uses a symmetric key to encrypt the HMAC value of the sub-CA corresponding to the control system or device applying for the certificate, and sends the control system certificate and the HMAC value of the control system certificate or the device certificate and the HMAC value of the device certificate to the control system or device applying for the certificate. The control system or device applying for the certificate decrypts the symmetric key obtained in step S21 to obtain the HMAC value of the corresponding sub-CA.
[0085] In order to make step S2 more clear, the following uses the process of the management and control system and equipment corresponding to the secondary sub-CA applying for a certificate from the root CA as an example for further specific explanation.
[0086] Continue to refer Figure 4 The secondary sub-CAs included in the embodiment of the present disclosure include an OTN management and control system sub-CA and an OTN equipment sub-CA.
[0087] When the OTN control system wants to obtain a certificate, the OTN control system generates a second public-private key pair (P2, V2). The second private key V2 is saved by the OTN control system itself, and the second public key P2 is sent to the root CA. The root CA uses the received second public key P2 to encrypt the symmetric key K, and then sends the ciphertext to the OTN control system. The OTN control system uses the second private key V2 to decrypt the ciphertext, obtain the symmetric key K and save it. The OTN control system applies for a certificate from the root CA. The root CA determines the secondary sub-CA to which the control system belongs according to the business form of the control system. The OTN control system applies for a certificate under the OTN control system sub-CA. The root CA calculates the HMAC value of the OTN control system certificate, and sends the HMAC value of the OTN control system sub-CA, the OTN control system certificate, and the HMAC value of the OTN control system certificate to the OTN control system. At this time, the HMAC value of the OTN control system certificate is HMAC31. After receiving the HMAC value of the OTN control system sub-CA encrypted with the symmetric key K, the OTN control system uses the previously saved symmetric key K to decrypt it and obtain HMAC21.
[0088] When the OTN device wants to obtain a certificate, the OTN device generates a second public-private key pair (P1, V1). The second private key V1 is saved by the OTN device itself, and the second public key P1 is sent to the root CA. The root CA uses the received second public key P1 to encrypt the symmetric key K, and then sends the ciphertext to the OTN device. The OTN device uses the second private key V1 to decrypt the ciphertext, obtains the symmetric key K and saves it. The OTN device applies for a certificate from the root CA. The root CA determines the secondary sub-CA to which the device belongs based on the service form of the device. The OTN device applies for a certificate under the OTN device sub-CA and fills in the SN number of the device in the applied certificate. The root CA calculates the HMAC value of the OTN device certificate and sends the HMAC value of the OTN device sub-CA, the OTN device certificate, and the HMAC value of the OTN device certificate to the OTN device. At this time, the HMAC value of the OTN device certificate is HMAC32. After receiving the HMAC value of the OTN device sub-CA encrypted with the symmetric key K, the OTN device uses the previously saved symmetric key K to decrypt it and obtain HMAC24.
[0089] In some examples, such as Figure 5 As shown, the HMAC value of the device certificate to be connected is received and compared with the theoretical HMAC value of the calculated or saved device certificate. When the comparison result meets the preset conditions, the control system certificate and the HMAC value of the control system certificate are sent to the device, specifically including:
[0090] S31: Discover the device and establish a TCP connection, and receive the device certificate and the HMAC value of the device certificate sent by the device.
[0091] Specifically, the management and control system discovers the device that needs to establish a connection, establishes a TCP connection, and receives the device certificate and the HMAC value of the device certificate sent by the device.
[0092] S32: Calculate the theoretical HMAC value of the device certificate and compare it with the HMAC value of the received device certificate.
[0093] Specifically, the management and control system verifies the received device certificate and calculates a theoretical HMAC value of the device certificate. The management and control system compares the HMAC value of the received device certificate with the calculated theoretical HMAC value of the device certificate.
[0094] S33: When the comparison result of the theoretical HMAC value of the device certificate and the HMAC value of the received device certificate is the same, the corresponding control system certificate and the HMAC value of the control system certificate are sent to the device.
[0095] Specifically, after comparing the theoretical HMAC value of the device certificate calculated by the management and control system with the HMAC value of the device certificate received by the management and control system, if the comparison result obtained by the management and control system is the same, the management and control system sends its own management and control system certificate and the HMAC value of the device certificate to the device; if the comparison result is different, the management and control system and the device fail to establish a connection.
[0096] In some examples, such as Figure 5 As shown, the HMAC value of the control system certificate sent back by the control system is received and compared with the calculated or saved theoretical HMAC value of the control system certificate. When the comparison result meets the preset conditions, the device successfully establishes a connection, including:
[0097] S41: Calculate or call the theoretical HMAC value of the control system certificate, and compare the theoretical HMAC value of the control system certificate with the HMAC value of the received control system certificate.
[0098] Specifically, the device calculates or directly calls the saved theoretical HMAC value of the control system certificate, and the device compares the theoretical HMAC value of the control system certificate with the HMAC value of the received control system certificate.
[0099] S42: When the comparison result of the theoretical HMAC value of the control system certificate and the HMAC value of the received control system certificate is the same, the device successfully establishes a connection.
[0100] Specifically, when the comparison result of the theoretical HMAC value of the control system certificate and the HMAC value of the received control system certificate are the same, the two-way authentication of the device and the control system is completed. At this time, the device and the control system have established a secure connection and can connect to other devices under the control system.
[0101] In order to make the disclosure of step S3 and step S4 clearer, in the embodiment of the present disclosure, an OTN management and control system and an OTN device are taken as an example for specific description.
[0102] The OTN control system corresponds to the control system secondary sub-CA, and the HMAC value of the OTN control system sub-CA is HMAC21; the OTN equipment corresponds to the equipment secondary sub-CA, and the HMAC value of the OTN equipment sub-CA is HMAC24. The HMAC value of the OTN control system certificate is HMAC31, and the HMAC value of the OTN equipment certificate is HMAC32.
[0103] The OTN control system discovers the OTN device, and the OTN control system receives the OTN device certificate and HMAC32 sent by the OTN device. The OTN control system calculates the theoretical HMAC value of the OTN device certificate, and compares the calculated theoretical HMAC value of the OTN device certificate with the received HMAC32. When the comparison result is the same, the OTN control system sends the certificate and HMAC31 of the OTN control system to the OTN device. The OTN device calculates the theoretical HMAC value of the OTN control system certificate, and compares the calculated theoretical HMAC value of the OTN control system certificate with the received HMAC31. When the comparison result is the same, the two-way authentication is successful, and the device successfully establishes a connection with the control system. It is understandable that the control system can save the theoretical HMAC value of the corresponding device certificate, and the device can also save the theoretical HMAC value of the control system certificate to save the calculation step. When the saved theoretical HMAC value is the same as the received HMAC value and the two-way authentication is completed, the connection is allowed to be established.
[0104] In some examples, when devices are connected, HMAC values are also used for two-way authentication to determine whether the conditions for establishing a connection are met. When a second device is connected to a first device, the first device and the second device first determine whether the conditions for establishing a connection are met. If the conditions for establishing a connection are met, the second device applies to the control system corresponding to the first device to establish a connection, thereby completing the connection between the first device and the second device.
[0105] In some examples, such as Figure 6As shown, the HMAC value of the device sub-CA to be connected is received and compared with the calculated or saved theoretical HMAC value of the device sub-CA. When the comparison result meets the preset conditions, before sending the control system certificate and the HMAC value of the control system sub-CA to the device, the following is also included:
[0106] S31': The first device discovers the second device and establishes a TCP connection, and the first device receives the HMAC value of the control system sub-CA sent by the second device.
[0107] Specifically, when the second device wants to connect to the first device, the first device discovers the second device and establishes a TCP connection. The second device sends the HMAC value of the control system sub-CA corresponding to the second device to the first device. The first device and the second device store the HMAC values of the control system sub-CAs corresponding to each device.
[0108] S32': Determine whether the HMAC value of the control system sub-CA corresponding to the second device and the HMAC value of the control system sub-CA corresponding to the first device meet the preset conditions. If the preset conditions are met, the first device sends a second device connection request to the corresponding control system.
[0109] Specifically, the first device receives the HMAC value of the control system sub-CA sent by the second device, and compares it with the HMAC value of the control system sub-CA corresponding to the first device. When the comparison result meets the preset conditions, the first device sends a second device connection request to the corresponding control system. When the comparison result does not meet the preset conditions, the second device fails to establish a connection. The preset conditions include the same and some specific situations.
[0110] In the disclosed embodiment, when devices are connected to each other, the corresponding control system also needs to control the devices. During the communication between devices, the HMAC value is also judged to achieve two-way authentication. The following is a further specific description taking the first device as an OTN device as an example.
[0111] like Figure 6As shown, taking the first device as an OTN device and the second device as a PTN device as an example, the OTN device corresponds to the OTN control system, and the HMAC value of the OTN control system sub-CA is HMAC21; the HMAC value of the PTN control system sub-CA corresponding to the PTN device is HMAC22. The OTN device discovers the PTN device and establishes a TCP connection. The OTN device receives the HMAC22 of the PTN control system sub-CA sent by the PTN device. The OTN device compares the HMAC22 received from the PTN device with the HMAC21 of the OTN control system sub-CA stored in itself. Since the PTN device and the OTN device are two different services, the corresponding HMAC values of the control system sub-CA are different, so the two do not meet the preset conditions, so the PTN device, that is, the second device, fails to establish a connection.
[0112] Continue to refer Figure 6 , take the first device as an OTN device and the second device as a hybrid device as an example, where the OTN device corresponds to the OTN control system, and the HMAC value of the sub-CA of the OTN control system is HMAC21; the HMAC value of the sub-CA of the hybrid control system corresponding to the hybrid device is HMAC23. The OTN device discovers the hybrid device and establishes a TCP connection. The OTN device receives the HMAC23 of the sub-CA of the hybrid control system sent by the hybrid device. The OTN device compares the HMAC23 sent by the hybrid device with the HMAC21 of the sub-CA of the OTN control system saved by itself. Since the service of the hybrid device includes the service of the OTN device, the two meet the preset conditions, so the hybrid device, that is, the second device, successfully establishes the connection. When the hybrid device is connected to the OTN device, the hybrid device and the OTN device determine that the conditions for establishing a connection are met, and the hybrid device applies to the OTN control system corresponding to the OTN device to establish a connection, thereby realizing the connection between the OTN device and the hybrid device.
[0113] The communication encryption method in the embodiment of the present disclosure has the following advantages:
[0114] 1. When establishing a connection between the control system and the device, or between the devices, the HMAC value corresponding to the control system is compared with the HMAC value corresponding to the device to determine whether the conditions for establishing a connection are met, thereby improving security and eliminating the tedious process of searching from the leaf node certificate upward layer by layer in the traditional mode.
[0115] 2. The TPM chip is used as the root of trust of the root CA, and the TPM chip is used to store the private key of the asymmetric key, calculate and store the symmetric key, calculate the HMAC value corresponding to the management and control system and the HMAC value corresponding to the device, thereby improving the security of the hardware environment during the communication encryption process.
[0116] In the second aspect, based on the same inventive concept, the embodiment of the present disclosure also provides a communication encryption system corresponding to the above method, and the communication encryption system includes: a root CA and a TPM chip. The root CA is used to assemble the root CA certificate, establish a sub-CA, and use the TPM chip to create a first public-private key pair and a symmetric key. The TPM chip is used as the root of trust of the root CA, and the first private key of the first public-private key pair is stored in the TPM chip and cannot be removed, and the HMAC value of the root CA and the HMAC values of all sub-CAs are calculated.
[0117] On the third aspect, based on the same inventive concept, the embodiment of the present disclosure also provides a computer-readable storage medium, storing one or more programs, which, when executed, can implement the aforementioned communication encryption method.
[0118] In a fourth aspect, based on the same inventive concept, an embodiment of the present disclosure further provides a device, including a processor, a communication interface, a memory, and a communication bus. The processor, the communication interface, and the memory communicate with each other via the communication bus. The processor is used to execute the program stored in the aforementioned computer-readable storage medium.
[0119] It should be noted that the electrical connection between the above-mentioned units does not necessarily mean the connection between lines. An indirect connection method can be applied to the embodiments of the present disclosure as long as the purpose of the present disclosure is achieved.
[0120] Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A communication encryption method, It is characterized in that The method comprises: Using the TPM chip as the root of trust, a root CA certificate is established; a sub-CA is established under the root CA; a symmetric key is created using the TPM chip, and the HMAC value of the root CA and the HMAC values of all sub-CAs are calculated; According to the sub-CA to which the control system or device belongs, the corresponding terminal certificate and the HMAC value of the terminal certificate are sent to the control system or device; Receive the HMAC value of the device certificate that needs to establish a connection, and compare it with the calculated or saved theoretical HMAC value of the device certificate. When the comparison result meets the preset conditions, send the control system certificate and the HMAC value of the control system certificate to the device; The device receives the HMAC value of the control system certificate sent back by the control system and compares it with the calculated or saved theoretical HMAC value of the control system certificate. When the comparison result meets the preset conditions, the device successfully establishes a connection.
2. The method according to claim 1, It is characterized in that The TPM chip is used as the root of trust to establish a root CA certificate; Establish a sub-CA under the root CA; Use the TPM chip to create a symmetric key and calculate the HMAC value of the root CA and the HMAC values of all sub-CAs, including: Generate a first public-private key pair, the first public-private key pair including a first private key and a first public key, store the first private key in the TPM chip and make it unremovable; receive the certificate information sent by the root CA, and use the first private key stored in the TPM chip to sign the certificate information; send the signature and the first public key to the root CA, and the root CA assembles the certificate information and the received signature and the first public key to obtain the root CA certificate; Divide the root CA into first-level sub-CAs, and divide each first-level sub-CA into second-level sub-CAs; The symmetric key is created using the TPM chip, and the HMAC value of the root CA, the HMAC values of all first-level sub-CAs, and the HMAC values of all second-level sub-CAs are calculated.
3. The method according to claim 1 or 2, It is characterized in that The sending of the corresponding terminal certificate and the HMAC value of the terminal certificate to the control system or device according to the sub-CA to which the control system or device belongs includes: Generate a second public-private key pair, the second public-private key pair including a second public key and a second private key, retain the second private key, pass the second public key to the root CA, the root CA encrypts the symmetric key using the received second public key, and returns the ciphertext to the management and control system or device; Apply for a certificate from the root CA, and calculate the HMAC value of the control system certificate or the HMAC value of the device certificate according to the sub-CA to which the control system or device belongs; Use the symmetric key to encrypt the HMAC value of the sub-CA corresponding to the control system or device applying for the certificate and send it to the control system or device. At the same time, the control system certificate and the HMAC value of the control system certificate or the device certificate and the HMAC value of the device certificate are sent to the control system or device applying for the certificate.
4. The method according to claim 1, It is characterized in that The receiving the HMAC value of the device certificate for which a connection needs to be established, and comparing it with the calculated or saved theoretical HMAC value of the device certificate, and when the comparison result meets the preset conditions, sending the control system certificate and the HMAC value of the control system certificate to the device, includes: Discover the device and establish a TCP connection, and receive the device certificate and the HMAC value of the device certificate sent by the device; Calculate the theoretical HMAC value of the device certificate and compare it with the HMAC value of the received device certificate; When the comparison result of the theoretical HMAC value of the device certificate and the HMAC value of the received device certificate is the same, the corresponding control system certificate and the HMAC value of the control system certificate are sent to the device.
5. The method according to claim 1, It is characterized in that The receiving the HMAC value of the control system certificate returned by the control system and comparing it with the calculated or saved theoretical HMAC value of the control system certificate, when the comparison result meets the preset conditions, the device successfully establishes the connection, including: Calculate or call the theoretical HMAC value of the control system certificate, and compare the theoretical HMAC value of the control system certificate with the HMAC value of the received control system certificate; When the comparison result of the theoretical HMAC value of the control system certificate and the HMAC value of the received control system certificate are the same, the device successfully establishes a connection.
6. The method according to claim 1, It is characterized in that The receiving of the HMAC value of the device sub-CA to be connected and comparing it with the calculated or saved theoretical HMAC value of the device sub-CA, when the comparison result meets the preset conditions, before sending the control system certificate and the HMAC value of the control system sub-CA to the device, further includes: The first device discovers the second device and establishes a TCP connection, and the first device receives the HMAC value of the control system sub-CA sent by the second device; Determine whether the HMAC value of the control system sub-CA corresponding to the second device and the HMAC value of the control system sub-CA corresponding to the first device meet the preset conditions. If the preset conditions are met, the first device sends a second device connection request to the corresponding control system.
7. The method according to claim 2, It is characterized in that The calculating the HMAC value of the root CA, the HMAC values of all first-level sub-CAs, and the HMAC values of all second-level sub-CAs includes: The HMAC value of the root CA certificate is set to HMAC0; wherein HMAC0=(K, root CA certificate); The HMAC value of the first-level sub-CA is set to HMAC1 x; where HMAC1 x = (K, HMAC0 + first-level sub-CA certificate), x = 1, 2 to n, where n is the number of first-level sub-CAs; The HMAC value of the secondary sub-CA is set to HMAC2y; where HMAC2y = (K, HMAC1 x + secondary sub-CA certificate), y = 1, 2, 3 to m, where m is the number of secondary sub-CAs; Wherein, K is the symmetric key.
8. A communication encryption system, It is characterized in that The communication encryption system includes: a root CA and a TPM chip; The root CA is used to assemble a root CA certificate, establish a sub-CA, and use the TPM chip to create a first public-private key pair and a symmetric key; The TPM chip is used as the trust root of the root CA, stores the first private key of the first public-private key pair in the TPM chip and cannot be removed, and calculates the HMAC value of the root CA and the HMAC values of all sub-CAs.
9. A computer storage medium storing one or more programs. It is characterized in that When the one or more programs are executed, the communication encryption method described in any one of claims 1 to 7 can be implemented.
10. An electronic device comprising a processor, a communication interface, the computer-readable storage medium of claim 9, and a communication bus; in, The processor, the communication interface, and the computer-readable storage medium communicate with each other via a communication bus; It is characterized in that The processor is configured to execute a program stored in a computer-readable storage medium.
Citation Information
Patent Citations
Product multi-tenant security credit granting method and system, and electronic equipment
CN111241492A
Digital certificate verification method, apparatus and device, and computer readable storage medium
CN116938466A
Digital certificate verification method, apparatus, device and system, and readable storage medium
CN116938495A
Equipment remote management method and device, equipment, medium and product
CN118282677A
Data transmission method, and electronic apparatus
JP2009124520A
