Identification key management and authentication methods

By using the public and private key matrix and device identification ID to generate public and private keys in IoT devices, the efficiency and bandwidth problems of the PKI electronic authentication system in the IoT are solved, and efficient authentication and encryption and decryption between devices are realized, which is suitable for low-cost IoT devices. Power consumption and multi-node scenarios.

CN118368065BActive Publication Date: 2024-08-23SICHUAN DIGITAL CERTIFICATE AUTHENTICATION MANAGEMENT CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410799931.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-08-23
Estimated Expiration
2044-06-20

AI Technical Summary

Technical Problem

The existing PKI electronic authentication system has shortcomings in IoT applications such as low authentication efficiency, large signature data, high network transmission bandwidth requirements, complex encryption and decryption processes, and does not support point-to-point and offline encryption authentication. It is difficult to meet the efficient and secure communication needs of the IoT. .

Method used

The public and private key matrix is ​​used as the key seed, and the device identification ID is used as the key factor. The public and private keys of the device identification are generated through calculation to realize point-to-point authentication, signature verification and encryption and decryption between devices, simplifying the process of public key distribution and authenticity certification. , reducing dependence on CA institutions.

Benefits of technology

It realizes convenient and efficient authentication and encryption and decryption between devices, reduces network bandwidth requirements, supports authentication and offline authentication without third-party participation, is suitable for low-power consumption and multi-node scenarios of the Internet of Things, and improves the efficiency of secure communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118368065B
    Figure CN118368065B
Patent Text Reader

Abstract

The invention discloses an identification key management and authentication method, which relates to the field of information security technology. The public-private key matrix is ​​used as a key seed, the device identification ID is used as a key factor, and the device identification public-private key is generated by calculation, so as to realize the association and binding between the device identification and its identification public-private key, and is applied to point-to-point authentication, signature verification, encryption and decryption between devices. The invention solves the problems of public key distribution and public key authenticity proof under the public key system, and can be conveniently and efficiently applied to direct point-to-point authentication, signature verification, encryption and decryption between various devices in the Internet of Things.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security technology, and in particular to an identification key management and authentication method. Background Art

[0002] The current application areas of public key cryptography technology are mainly PKI / CA electronic authentication and signature technology. The PKI electronic authentication system is composed of terminal entities (individuals / institutions / devices), certificate certification authorities (CA), certificate registration authorities (RA) and key management authorities (KMC). The terminal entity generates a signature key and a certificate request, and submits a registration application to the RA. After the RA reviews and approves it, it applies to the CA for a digital certificate. The CA applies to the KMC for an encryption key. The CA binds the key to the terminal entity identity, generates a digital certificate signed by the CA, distributes it to the terminal entity, and publishes it to the certificate directory service (LDAP) and online status query (OCSP) system.

[0003] The message sender uses his own digital certificate private key to sign the message to be sent, and uses the receiver's digital certificate public key to encrypt the message; the message receiver uses the sender's digital certificate public key to verify the signature of the received message, and uses his own digital certificate private key to decrypt the message. In these links, users or relying parties are usually required to frequently access the CA certificate issuance system to download digital certificates and certificate revocation lists (CRLs) for signature verification, encryption, and checking whether the certificate is valid.

[0004] The current PKI electronic authentication system is a trust domain established by each terminal entity based on the common trust in the same CA organization. When entities send a message of any size for digital signature, the additional signature value is usually greater than 2K bytes. The additional data occupies a large amount of network transmission bandwidth and storage. When verifying the signature, it is necessary not only to verify whether the message signature has been tampered with, but also to verify whether the certificate chain of the sender's digital certificate is valid and whether the certificate is issued by a trusted CA organization. The verification process is relatively time-consuming.

[0005] The current rapid development of IoT applications has high requirements for secure communication efficiency. The shortcomings of traditional PKI certificate authentication technology in IoT identity authentication, data authentication, and encrypted transmission have gradually emerged, mainly manifested in low authentication efficiency, large signature data, high network transmission bandwidth requirements, complex encryption and decryption processes, and no support for point-to-point and offline encryption authentication. Summary of the invention

[0006] In order to solve the problems existing in the prior art, the purpose of the present invention is to provide an identification key management and authentication method. The present invention solves the problems of public key distribution and public key authenticity proof under the public key system, and can be conveniently and efficiently applied to direct point-to-point authentication, signature verification, encryption and decryption between various devices in the Internet of Things.

[0007] To achieve the above purpose, the technical solution adopted by the present invention is: an identification key management and authentication method, which uses the public-private key matrix as the key seed, uses the device identification ID as the key factor, generates the device identification public-private key by calculation, realizes the association and binding of the device identification and its identification public-private key, and is applied to point-to-point authentication, signature verification, encryption and decryption between devices, and specifically includes the following steps:

[0008] S100, initializing the system master key and the public and private key matrix key seeds, and encrypting and storing the private key matrix;

[0009] S200, the device generates a protection public and private key, signs the device identification ID with the protection private key, and applies to the key management system for the identification public and private keys. The key management system maps the device identification ID to the corresponding rows and columns of the public and private key matrix, calculates the public and private keys through combination operations, and distributes them to the device securely as the device's identification public and private keys;

[0010] S300, the message sender uses its own protection private key and identification private key to calculate the combined private key, and uses it to sign the message to be sent. The message receiver calculates the sender's identification public key based on the common public key matrix, and uses the sender's protection public key and identification public key to calculate the sender's combined public key, and uses it to verify the sender's message signature;

[0011] S400, the message sender calculates the recipient's identification public key based on the recipient's device identification ID and the common public key matrix, uses it to encrypt the message to be sent, and the message recipient uses its own identification private key to decrypt the message;

[0012] S500, the ciphertext encrypted in S400 is used as the original text to be signed in S300, so as to realize the encryption and signing of the message sending, the signature verification and decryption of the message receiving.

[0013] As a further improvement of the present invention, the S100 specifically includes the following steps:

[0014] S101, initializing the system master key: the key management system calls the server cryptographic machine to initialize the system master key, namely the asymmetric key SMK_SM2 and the symmetric key SMK_SM4. The asymmetric key SMK_SM2 includes the master private key SMK_SM2_Pri and the master public key SMK_SM2_Pub;

[0015] S102, initialize the system key matrix: the key management system calls the server cipher machine to generate N*N random SM2 public and private key pairs, which are stored in the private key matrix Matrix_Pri[N,N] and the public key matrix Matrix_Pub[N,N] of size N*N;

[0016] S103, encrypt the private key matrix and store the matrix ciphertext in the database: the key management system calls the server cipher machine, uses SMK_SM4 to encrypt the private key matrix Matrix_Pri, and obtains the private key matrix ciphertext Encrypted_Matrix_Pri, Encrypted_Matrix_Pri=SM4Enc(Matrix_Pri, SMK_SM4); the key management system uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, recorded as Matrix_ID=SM3(Matrix_Pub); the key management system calls the server cipher machine, uses SMK_SM2_Pri to sign Matrix_Pub||SMK_SM2_Pub, where || is a concatenation operation, and obtains the public key matrix signature value Matrix_Pub_Si gnValue=SM2Sign(Matrix_Pub||SMK_SM2_Pub,SMK_SM2_Pri), then concatenate the public key matrix and signature value data to form a public key matrix data file, recorded as Matrix_Pub_File, Matrix_Pub_File=Matrix_Pub||SMK_SM2_Pub||Matrix_Pub_SignValue; the key management system stores Matrix_ID, SMK_SM2_Pub, Encrypted_Matrix_Pri, Matrix_Pub, and Matrix_Pub_File in the database; the private key matrix is ​​only used for internal calls of the key management system; the public key matrix file is issued to legally registered devices and is open and shared to devices in the same trust domain.

[0017] As a further improvement of the present invention, in S102, the private key in the N*N random SM2 public-private key pair is recorded as r, and the public key is recorded as R, that is, R i,j =r i,j *G, i, j ∈ [1, 2, ..., N], G is the base point of the elliptic curve; and the private key Matrix_Pri[r i,j ] with the public key Matrix_Pub[R i,j ] correspond one to one.

[0018] As a further improvement of the present invention, the S200 specifically includes the following steps:

[0019] S201. Device A initiates a registration application to the key management system: Device A uses the SM2 algorithm to generate a protection key pair, which includes a protection private key and a protection public key. The protection private key is recorded as A_Protect_SM2_Pri and the protection public key is recorded as A_Protect_SM2_Pub. Device A obtains its own unique identification ID a, use A_Protect_SM2_Pri to ID a ||A_Protect_SM2_Pub signature, get the signature value Enroll_SignValue=SM2Sign(ID a ||A_Protect_SM2_Pub,A_Protect_SM2_Pri), change the ID a ||A_Protect_SM2_Pub and Enroll_SignValue are sent to the key management system to apply for the device A identification key, including the identification private key and the identification public key;

[0020] S202: The key management system calculates the private key and public key of device A based on the ID of device A. The key management system obtains the ID sent by device A. a ||After A_Protect_SM2_Pub and Enroll_SignValue, verify the signature first. If the signature verification is successful, save the ID in the database a , A_Protect_SM2_Pub, proceed to the next step; if the signature verification fails, terminate the device application process;

[0021] The key management system uses the SM3 algorithm to identify a Calculate the HASH value, recorded as HASHedID a 1=SM3(ID a );

[0022] The key management system uses Matrix_ID as the key and uses the HMAC-SM3 algorithm to encode the ID. a Calculate the HASH value, recorded as HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID);

[0023] Key management system for HASHedID a 1 and HASHedID a 2 is split into N multi-bit numbers, denoted as W1 i and W2 i , where i∈[1,2,…,N], and W1 i and W2 i Shift left or right by n bits to get X i , Y i ;

[0024] The key management system calls the server cryptographic machine to use SMK_SM4 to decrypt the private key matrix ciphertext Encrypted_Matrix_Pri to obtain the plaintext private key matrix Matrix_Pri, Matrix_Pri=SM4Dec (Encrypted_Matrix_Pri, SMK_SM4);

[0025] The key management system will be X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and N private keys are selected from Matrix_Pri for modular addition operation. Finally, the identification private key of the device is obtained, which is recorded as isk a ;

[0026] The key management system converts X i Value, Y i The values ​​are used as row coordinates and column coordinates, and N public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve. Finally, the device identification public key is obtained, which is recorded as IPK a , IPK a with isk a Construct a new SM2 public-private key pair;

[0027] S203, the key management system sends identification key data to device A: the key management system splices isk a ||IPK a ||Matrix_Pub_File, recorded as IDKey a =isk a ||IPK a ||Matrix_Pub_File, call the server cipher machine, use SMK_SM2_Pri to IDKey a Sign and get the signature value, recorded as IDKey a _SignValue, IDKey a _SignValue=SM2Sign(IDKey a ,SMK_SM2_Pri), and then spliced ​​to form a key file with identification A, recorded as KeyData=IDKey a ||IDKey a _SignValue.

[0028] The key management system calls the server cryptographic machine to generate a random symmetric key SymKey, encrypts KeyData using the SM4 encryption algorithm, obtains the identification key ciphertext data of device A Encrypted_KeyData = SM4_Enc (KeyData, SymKey), encrypts SymKey using the protection public key A_Protect_SM2_Pub of device A and the SM2 encryption algorithm, obtains the ciphertext of the random symmetric key Encrypted_SymKey = SM2_Enc (SymKey, A_Protect_SM2_Pub), and sends Encrypted_SymKey and Encrypted_KeyData to device A;

[0029] S204. Device A decrypts the identification key data: Device A receives Encrypted_SymKey and Encrypted_KeyData, decrypts Encrypted_SymKey using its own protection private key A_Protect_SM2_Pri to obtain SymKey = SM2_Dec (Encrypted_SymKey, A_Protect_SM2_Pri), and decrypts Encrypted_KeyData using SymKey to obtain KeyData = SM4_Dec (Encrypted_KeyData, SymKey);

[0030] S205, device A verifies the integrity of the identification private key, identification public key and public key matrix file: Device A extracts IDKey from KeyData a 、IDKey a _SignValue, SMK_SM2_Pub, first IDKey a Verify the signature. If the verification is successful, extract the IDKey a isk a 、IPK a , Matrix_Pub_File, extract Matrix_Pub, Matrix_Pub_SignValue, SMK_SM2_Pub in Matrix_Pub_File, and then verify the signature of Matrix_Pub. If any of the signature verification fails, the device application process is terminated.

[0031] S206, device A writes the identification private key, identification public key and public key matrix file: device A writes the identification private key isk a Write to the private area of ​​device A and identify the public key IPK a, the public key matrix Matrix_Pub, the public key matrix signature value Matrix_Pub_SignValue, and the key management system master public key SMK_SM2_Pub are written into the public area of ​​device A;

[0032] S207. Repeat S201-S206 to obtain identification key data of other devices.

[0033] As a further improvement of the present invention, in S300, it is assumed that device A sends a signed message to device B, and the identifier obtained by device B through S201-S206 is recorded as ID b , the protection private key is recorded as B_Protect_SM2_Pri, the protection public key is recorded as B_Protect_SM2_Pub, and the identification private key is recorded as isk b , the public key is marked as IPK b , the S300 specifically includes the following steps:

[0034] S301, device A calculates the combined private key and generates a digital signature for the message to be sent: device A calculates the combined private key A_Protect_SM2_Pri and the identification private key isk a Perform modular addition to obtain the combined private key, recorded as A_Comb_SM2_Pri;

[0035] Device A reads its own ID a , use SM3 algorithm to splice ID of original message M a and A_Protect_SM2_Pub and then calculate the HASH value, recorded as H=SM3(M||ID a ||A_Protect_SM2_Pub), use the combined private key A_Comb_SM2_Pri and SM2 encryption algorithm to encrypt H, recorded as Encrypted_H=SM2_Enc(H,A_Comb_SM2_Pri), splice M||ID a ||A_Protect_SM2_Pub||Encrypted_H, recorded as SignPack, SignPack=M||ID a ||A_Protect_SM2_Pub||Encrypted_H, sent to device B;

[0036] S302, device B calculates the public key of device A based on the identification of device A: Device B obtains SignPack, extracts M, ID a , A_Protect_SM2_Pub, Encrypted_H, use SM3 algorithm to protect ID a Calculate the HASH value, recorded as HASHedID a1=SM3(ID a );

[0037] Device B reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, and obtains Matrix_ID=SM3(Matrix_Pub). Using Matrix_ID as the key, it uses the HMAC-SM3 algorithm to hash ID. a Calculate the HASH value HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID);

[0038] Device B HASHedID a 1 and HASHedID a 2 is split into N multi-bit numbers, denoted as W1 i and W2 i , where i∈[1,2,…,N], and W1 i and W2 i Shift left or right by n bits to get X i , Y i ;

[0039] Device B will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and N public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device A is obtained. a ;

[0040] S303, device B calculates the combined public key of device A: device B's protection public key A_Protect_SM2_Pub and identification public key IPK of device A a Do some addition to get the combined public key of device A, recorded as A_Comb_SM2_Pub=A_Protect_SM2_Pub+IPK a ;

[0041] S304, device B verifies the digital signature of device A: device B uses the combined public key A_Comb_SM2_Pub and the SM2 decryption algorithm to decrypt Encrypted_H and obtain H=SM2_Dec(Encrypted_H,A_Comb_SM2_Pub);

[0042] Device B uses the SM3 algorithm to concatenate the original message M with the ID a and A_Protect_SM2_Pub and then calculate the HASH value, recorded as H′=SM3(M||ID a||A_Protect_SM2_Pub), compare H′ and H to see if they are equal. If they are equal, it means that the original message M is indeed sent by device A and has not been tampered with during the transmission process.

[0043] As a further improvement of the present invention, in S400, assuming that device B sends an encrypted message to device A, S400 specifically includes the following steps:

[0044] S401, device B calculates the HASHedID of device A a 1: Device B obtains the ID of device A a , use SM3 algorithm to identify a Calculate the HASH value, recorded as HASHedID a 1=SM3(ID a );

[0045] S402, device B calculates the HASHedID of device A a 2: Device B reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, and obtains Matrix_ID=SM3(Matrix_Pub). Using Matrix_ID as the key, use the HMAC-SM3 algorithm to hash ID a Calculate the HASH value HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID);

[0046] S403, device B calculates the public key of device A according to the identifier of device A: device B calculates the public key of device A according to the identifier of device A. a 1 and HASHedID a 2 is split into N multi-bit numbers, denoted as W1 i and W2 i , where i∈[1,2,…,N], and W1 i and W2 i Shift left or right by n bits to get X i , Y i ;

[0047] Device B will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and N public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device A is obtained. a ;

[0048] S404, device B uses the identification public key of device A in combination with symmetric encryption to encrypt the message to be sent: device B generates a random symmetric key SymKey, uses the SM4 encryption algorithm to encrypt the message M to be sent, and obtains the ciphertext data Encrypted_M = SM4_Enc(M, SymKey), and uses the identification public key IPK of device A a And SM2 encryption algorithm to encrypt SymKey, get the random symmetric key ciphertext Encrypted_SymKey=SM2_Enc(SymKey,IPK a ), concatenate Encrypted_SymKey||Encrypted_M as the ciphertext data to be sent, EncryptedData=Encrypted_SymKey||Encrypted_M;

[0049] S405, device B sends the ciphertext data EncryptedData to device A;

[0050] S406. Device A uses the identification private key combined with symmetric encryption to decrypt the ciphertext data: Device A receives EncryptedData, extracts Encrypted_SymKey and Encrypted_M, and uses the identification private key isk a And SM2 decryption algorithm decrypts Encrypted_SymKey, and obtains SymKey=SM2_Dec(Encrypted_SymKey,isk a ), use SymKey to decrypt Encrypted_M to get the plaintext M=SM4_Dec(Encrypted_M, SymKey).

[0051] As a further improvement of the present invention, in S500, assuming that device B sends an encrypted and signed message to device A, S500 specifically includes the following steps:

[0052] S501, repeat S401-S404 to encrypt the message to be sent;

[0053] S502, device B calculates the combined private key and generates a digital signature for the message to be sent: Device B calculates the combined private key B_Protect_SM2_Pri and the identification private key isk b Perform modular addition to obtain the combined private key, recorded as B_Comb_SM2_Pri;

[0054] Device B reads its own ID b , use SM3 algorithm to concatenate the ciphertext data EncryptedData in S404 with ID band B_Protect_SM2_Pub and then calculate the HASH value, recorded as H=SM3(EncryptedData||ID b ||B_Protect_SM2_Pub), use the combined private key B_Comb_SM2_Pri and SM2 encryption algorithm to encrypt H, recorded as Encrypted_H=SM2_Enc(H,B_Comb_SM2_Pri), splice EncryptedData||ID b ||B_Protect_SM2_Pub||Encrypted_H, recorded as SignPack, SignPack=EncryptedData||ID b ||B_Protect_SM2_Pub||Encrypted_H;

[0055] S503, device B sends the ciphertext signature data packet SignPack to device A;

[0056] S504. Device A calculates the public key of device B based on the identifier of device B: Device A obtains SignPack and extracts EncryptedData, ID b , B_Protect_SM2_Pub, Encrypted_H, use SM3 algorithm to protect ID b Calculate the HASH value, recorded as HASHedID b 1=SM3(ID b );

[0057] Device A reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, recorded as Matrix_ID=SM3(Matrix_Pub), uses Matrix_ID as the key, and uses the HMAC-SM3 algorithm to hash ID. b Calculate the HASH value HASHedID b 2 = HMAC-SM3(ID b , Matrix_ID);

[0058] Device A HASHedID a 1 and HASHedID a 2 is split into N multi-bit numbers, denoted as W1 i and W2 i , where i∈[1,2,…,N], and W1 i and W2 i Shift left or right by n bits to get X i , Y i ;

[0059] Device A will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and N public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device B is obtained. b ;

[0060] S505. Device A calculates the combined public key of device B: device A's protection public key B_Protect_SM2_Pub and identification public key IPK for device B b Do some addition to get the combined public key of device B, recorded as B_Comb_SM2_Pub;

[0061] S506. Device A verifies the digital signature of device B: Device A uses the combined public key B_Comb_SM2_Pub and the SM2 decryption algorithm to decrypt Encrypted_H, and obtains H=SM2_Dec(Encrypted_H,B_Comb_SM2_Pub);

[0062] Device A uses the SM3 algorithm to concatenate the ciphertext data EncryptedData with the ID b After calculating the HASH value with B_Protect_SM2_Pub, we get H′=SM3(EncryptedData||ID b ||B_Protect_SM2_Pub), compare H′ and H to see if they are equal. If they are equal, it means that the ciphertext data EncryptedData is indeed sent by device B and has not been tampered with during the transmission process, and then proceed to the next step; if they are not equal, it means that the data has been tampered with, and the process is terminated;

[0063] S507: Repeat S406 to decrypt the ciphertext data.

[0064] The present invention is based on the SM2 asymmetric public key cryptography system and utilizes the mathematical properties of elliptic curve cryptography to construct a public-private key combination matrix, which is used as a key seed. The IoT device identifier is mapped into factors for distributing public and private keys through transformation, and the public and private keys corresponding to the device are generated by mathematical calculation of the key seed and the factors. A secure self-certification system is formed through the key seed, the association and binding of the identifier and the key is realized, and the problems of public key distribution and public key authenticity certification under the public key system are solved.

[0065] In the digital signature link of the present invention, since the device protection key is a random key, the random key is a random number sequence that is independent of each other, each device protection key is different, and the identification key of each device is also different, so the actual signature key calculated by this combination must also be different, and it is only necessary to generate it by synthetic calculation when signing and verifying the signature. The signature key has high security and no collusion threat.

[0066] In the encryption and decryption link of the present invention, the identification key is used as the encryption key. When the device sender only knows the identification ID of the receiver, the identification public key of the receiver can be calculated through the public key matrix, and the identification public key is used as the encryption public key to encrypt the message to be sent. The receiver can decrypt it using the private identification private key. In this process, the sender does not need to obtain the encryption public key of the receiver additionally, which reduces the number of information exchanges and has high encryption and decryption efficiency.

[0067] The beneficial effects of the present invention are:

[0068] 1. The present invention has the advantages of no need for third-party participation in authentication, low power consumption, low network bandwidth requirements, and compatibility with PKI / CA system. It can realize direct authentication and authorization between two points, efficient offline authentication, and meet the requirements of multiple nodes, wide distribution, and low power consumption of the Internet of Things. It is suitable for narrowband communications such as NB-IoT and LoRa of the Internet of Things, and establishes an active security defense system for Internet of Things applications.

[0069] 2. The present invention does not require the support of the certificate library and public key library of the central system, which is not only conducive to improving efficiency and reducing resource consumption, but also will not cause the paralysis of related systems due to failures of the central system and unexpected disasters. At the same time, the management and distribution of keys are efficient, easy to use, and simple to deploy. It meets the core security mechanisms and key disaster recovery requirements of industrial control, terminal authentication, data transmission, etc. in the "smart transformation and digital transformation" of industrial enterprises, and is more flexible and effective for secure access and security defense of the Industrial Internet and the Internet of Things. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] Figure 1 A schematic diagram of the system structure of identification key management and authentication in an embodiment of the present invention;

[0071] Figure 2 The figure is a flowchart of identification key management and authentication in an embodiment of the present invention. DETAILED DESCRIPTION

[0072] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0073] Example

[0074] The invention discloses an identification key management and authentication method, which is applicable to the identification key management and authentication of the Internet of Things identity authentication and secure communication scenarios. The method utilizes the mathematical characteristics of elliptic curve cryptography to construct a public-private key combination matrix, which is used as a key seed. The unique identification ID of a device, terminal or system in the Internet of Things is used as a factor for calculating a key pair. The public-private key corresponding to the device is generated by mathematical calculation of the key seed and the factor, thereby realizing the association and binding between the device identification and its public-private key, solving the problems of public key distribution and public key authenticity proof under the public key system, and can be conveniently and efficiently applied to direct point-to-point authentication, signature verification, encryption and decryption between various devices in the Internet of Things.

[0075] like Figure 1 As shown, this embodiment consists of a key management system, a server cryptographic machine and an Internet of Things terminal device.

[0076] like Figure 2 As shown, the specific steps include:

[0077] S100: The key management system initializes the system key: initializes the system master key and the public and private key matrix key seeds, and encrypts and stores the private key matrix.

[0078] S101: Initialize the system master key.

[0079] The key management system calls the server cryptographic machine to initialize the system master key, namely the asymmetric key SMK_SM2 and the symmetric key SMK_SM4. The asymmetric key SMK_SM2 includes the master private key SMK_SM2_Pri and the master public key SMK_SM2_Pub.

[0080] S102: Initialize the system key matrix.

[0081] The key management system calls the server cryptographic machine to generate 32*32 random SM2 public and private key pairs (private key is denoted by r, public key is denoted by R, i.e. R i,j = r i,j *G, i, j ∈ [1, 2…32], G is the base point of the elliptic curve), and is stored in the private key matrix Matrix_Pri [32, 32] and the public key matrix Matrix_Pub [32, 32] of size 32*32. The private key Matrix_Pri [r i,j ] need to be compatible with the public key Matrix_Pub[R i,j ] one by one, as shown below:

[0082]

[0083] S103: Encrypt the private key matrix and store the matrix ciphertext in the database.

[0084] The key management system calls the server cryptographic machine and uses SMK_SM4 to encrypt the private key matrix Matrix_Pri to obtain the private key matrix ciphertext Encrypted_Matrix_Pri, Encrypted_Matrix_Pri = SM4Enc (Matrix_Pri, SMK_SM4).

[0085] The key management system uses the SM3 algorithm to calculate the HASH value of Matrix_Pub and obtains Matrix_ID = SM3 (Matrix_Pub).

[0086] The key management system calls the server cipher machine and uses SMK_SM2_Pri to sign Matrix_Pub|| SMK_SM2_Pub to obtain the public key matrix signature value Matrix_Pub_SignValue=SM2Sign(Matrix_Pub||SMK_SM2_Pub,SMK_SM2_Pri), and then concatenates the public key matrix and signature value data to form a public key matrix data file, recorded as Matrix_Pub_File, Matrix_Pub_File=Matrix_Pub||SMK_SM2_Pub||Matrix_Pub_SignValue.

[0087] The key management system stores Matrix_ID, SMK_SM2_Pub, Encrypted_Matrix_Pri, Matrix_Pub, and Matrix_Pub_File in the database. The private key matrix is ​​only used internally by the key management system and does not leave the system; the public key matrix file is issued to legally registered devices and is open and shared to IoT devices in the same trust domain.

[0088] S200: Device applies for identification key: The device generates protection public and private keys, signs the device identification ID with the protection private key, and applies for identification public and private keys from the key management system. The key management system maps the device identification ID to the corresponding rows and columns of the public and private key matrix, calculates the public and private keys through combination operations, and distributes them securely to the device as the device's identification public and private keys.

[0089] S201: Device A initiates a registration application to the key management system.

[0090] Device A uses the SM2 algorithm to generate a protection key pair (protection private key and protection public key), the protection private key is recorded as A_Protect_SM2_Pri, the protection public key is recorded as A_Protect_SM2_Pub, and obtains its own unique identification ID a , use A_Protect_SM2_Pri to ID a||A_Protect_SM2_Pub signature, get the signature value Enroll_SignValue=SM2Sign(ID a ||A_Protect_SM2_Pub,A_Protect_SM2_Pri), change the ID a ||A_Protect_SM2_Pub and Enroll_SignValue are sent to the key management system to apply for the device identification key (identification private key and identification public key).

[0091] S202: The key management system calculates the identification private key and identification public key of device A according to the identification of device A.

[0092] The key management system obtains the ID sent by device A a ||After A_Protect_SM2_Pub and Enroll_SignValue, verify the signature first. If the signature verification is successful, save the ID in the database a , A_Protect_SM2_Pub, and proceed to the next step; if the signature verification fails, terminate the device application process.

[0093] The key management system uses the SM3 algorithm to identify a Calculate the HASH value and get the HASHedID a 1=SM3(ID a );

[0094] The key management system uses Matrix_ID as the key and uses the HMAC-SM3 algorithm to encode the ID. a Calculate the HASH value HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID);

[0095] Key management system for HASHedID a 1 The byte string is split into 32 8-bit numbers from high to low, recorded as W1 i {where i∈[1,2…32]}, W1 i Shift right 3 bits to get X i = W1 i >>3{where i∈[1,2…32]}; for HASHedID a 2 The byte string is split into 32 8-bit numbers from high to low, recorded as W2 i {where i∈[1,2…32]}, W2 i Shift right 3 bits to get Y i = W2 i>>3{where i∈[1,2…32]};

[0096] The key management system calls the server cryptographic machine to use SMK_SM4 to decrypt the private key matrix ciphertext Encrypted_Matrix_Pri to obtain the plaintext private key matrix Matrix_Pri, Matrix_Pri=SM4Dec (Encrypted_Matrix_Pri, SMK_SM4);

[0097] The key management system will be X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and 32 private keys are selected from Matrix_Pri for modular addition operation. Finally, the identification private key of device A is obtained, which is recorded as isk a ,

[0098]

[0099] The key management system converts X i Value, Y i The values ​​are used as row and column coordinates, and 32 public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve. Finally, the identification public key of device A is obtained, which is recorded as IPK a:

[0100]

[0101] According to the composite law of elliptic curve cryptography, "the sum of any number of public and private keys can form a new public and private key pair", the above IPK a with isk a A new SM2 public-private key pair can be formed.

[0102] S203: The key management system sends identification key data to device A.

[0103] Key management system splicing isk a ||IPK a ||Matrix_Pub_File, recorded as IDKey a =isk a ||IPK a ||Matrix_Pub_File, call the server cipher machine, use SMK_SM2_Pri to IDKey a Sign and get the signature value, recorded as IDKey a _SignValue, IDKey a _SignValue=SM2Sign(IDKey a,SMK_SM2_Pri), and then spliced ​​to form a key file with identification A, recorded as KeyData=IDKey a ||IDKey a _SignValue.

[0104] The key management system calls the server cryptographic machine to generate a random symmetric key SymKey, encrypts KeyData using the SM4 encryption algorithm, obtains the identification key ciphertext data of device A Encrypted_KeyData = SM4_Enc (KeyData, SymKey), encrypts SymKey using the protection public key A_Protect_SM2_Pub of device A and the SM2 encryption algorithm, obtains the ciphertext of the random symmetric key Encrypted_SymKey = SM2_Enc (SymKey, A_Protect_SM2_Pub), and sends Encrypted_SymKey and Encrypted_KeyData to device A;

[0105] S204: Device A decrypts the identification key data.

[0106] Device A receives Encrypted_SymKey and Encrypted_KeyData, decrypts Encrypted_SymKey using its own private key A_Protect_SM2_Pri to obtain SymKey = SM2_Dec (Encrypted_SymKey, A_Protect_SM2_Pri), and decrypts Encrypted_KeyData using SymKey to obtain KeyData = SM4_Dec (Encrypted_KeyData, SymKey).

[0107] S205: Device A verifies the integrity of the identification private key, the identification public key and the public key matrix file.

[0108] Device A extracts IDKey from KeyData a 、IDKey a _SignValue, SMK_SM2_Pub, first IDKey a Verify the signature. If the verification is successful, extract the IDKey a isk a 、IPK a , Matrix_Pub_File, extract Matrix_Pub, Matrix_Pub_SignValue, SMK_SM2_Pub in Matrix_Pub_File, and then verify the signature of Matrix_Pub. If any of the signature verification fails, the device application process is terminated.

[0109] S206: Device A writes the identification private key, identification public key and public key matrix file.

[0110] Device A will identify the private key isk a Write to the private area of ​​device A and identify the public key IPK a , public key matrix Matrix_Pub, public key matrix signature value Matrix_Pub_SignValue, and key management system master public key SMK_SM2_Pub are written into the public area of ​​device A.

[0111] S207: Other devices use the same process as device A to obtain identification key data.

[0112] Other IoT devices use the same process as device A to obtain their own unique identification, generate a protection key pair, and apply for the identification private key, identification public key, public key matrix Matrix_Pub, public key matrix signature value Matrix_Pub_SignValue, and key management system master public key SMK_SM2_Pub. Take device B as an example: the identification is recorded as ID b , the protection private key is recorded as B_Protect_SM2_Pri, the protection public key is recorded as B_Protect_SM2_Pub, and the identification private key is recorded as isk b , the public key is marked as IPK b .

[0113] S300: Sending signed messages between devices: The message sender uses its own protection private key and identification private key to calculate a combined private key, and uses it to sign the message to be sent. The message receiver calculates the sender's identification public key based on a common public key matrix, and uses the sender's protection public key and identification public key to calculate the sender's combined public key, and uses it to verify the sender's message.

[0114] Take device A sending a signed message to device B as an example.

[0115] S301: Device A calculates a combined private key and generates a digital signature for the message to be sent.

[0116] Device A protects the private key A_Protect_SM2_Pri and identifies the private key isk a Perform modular addition to obtain the combined private key, recorded as A_Comb_SM2_Pri=(A_Protect_SM2_Pri+isk a ) mod N.

[0117] Device A reads its own ID a , use SM3 algorithm to splice ID of original message M aand A_Protect_SM2_Pub and then calculate the HASH value, and get H=SM3(M||ID a ||A_Protect_SM2_Pub), use the combined private key A_Comb_SM2_Pri and SM2 encryption algorithm to encrypt H, and get Encrypted_H=SM2_Enc(H,A_Comb_SM2_Pri), splice M||ID a ||A_Protect_SM2_Pub||Encrypted_H, recorded as SignPack, SignPack=M||ID a ||A_Protect_SM2_Pub||Encrypted_H, sent to device B;

[0118] S302: Device B calculates the identification public key of device A according to the identification of device A.

[0119] Device B obtains SignPack and extracts M and ID a , A_Protect_SM2_Pub, Encrypted_H, use SM3 algorithm to protect ID a Calculate the HASH value and get the HASHedID a 1=SM3(ID a );

[0120] Device B reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, and obtains Matrix_ID=SM3(Matrix_Pub). Using Matrix_ID as the key, it uses the HMAC-SM3 algorithm to hash ID. a Calculate the HASH value HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID);

[0121] Device B HASHedID a 1 The byte string is split into 32 8-bit numbers from high to low, recorded as W1 i {where i∈[1,2…32]}, W1 i Shift right 3 bits to get X i = W1 i >>3{where i∈[1,2…32]}; for HASHedID a 2 The byte string is split into 32 8-bit numbers from high to low, recorded as W2 i {where i∈[1,2…32]}, W2 iShift right 3 bits to get Y i = W2 i >>3{where i∈[1,2…32]};

[0122] Device B will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and 32 public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device A is obtained. a ,

[0123]

[0124] S303: Device B calculates the combined public key of device A.

[0125] Device B's protection public key A_Protect_SM2_Pub and identification public key IPK for device A a Do some addition to get the combined public key of device A, recorded as A_Comb_SM2_Pub=A_Protect_SM2_Pub+IPK a (Click to add).

[0126] S304: Device B verifies the digital signature of device A.

[0127] Device B uses the combined public key A_Comb_SM2_Pub and the SM2 decryption algorithm to decrypt Encrypted_H and obtain H=SM2_Dec(Encrypted_H,A_Comb_SM2_Pub);

[0128] Device B uses the SM3 algorithm to concatenate the original message M with the ID a and A_Protect_SM2_Pub and then calculate the HASH value to get H′=SM3(M||ID a ||A_Protect_SM2_Pub), compare H′ and H to see if they are equal. If they are equal, it means that the original message M is indeed sent by device A and has not been tampered with during the transmission process.

[0129] S400: Sending encrypted messages between devices: The message sender calculates the recipient's identification public key based on the recipient's device identification ID and the common public key matrix, and uses it to encrypt the message to be sent. The message recipient uses its own identification private key to decrypt the message.

[0130] Take device B sending an encrypted message to device A as an example.

[0131] S401: Device B calculates the HASHedID of device A a 1.

[0132] Device B obtains the ID of device A a , use SM3 algorithm to identify a Calculate the HASH value and get the HASHedID a 1=SM3(ID a );

[0133] S402: Device B calculates the HASHedID of device A a 2.

[0134] Device B reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, and obtains Matrix_ID=SM3(Matrix_Pub). Using Matrix_ID as the key, it uses the HMAC-SM3 algorithm to hash ID. a Calculate the HASH value HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID);

[0135] S403: Device B calculates the identification public key of device A according to the identification of device A.

[0136] Device B HASHedID a 1 The byte string is split into 32 8-bit numbers from high to low, recorded as W1 i {where i∈[1,2…32]}, W1 i Shift right 3 bits to get X i = W1 i >>3{where i∈[1,2…32]}; for HASHedID a 2 The byte string is split into 32 8-bit numbers from high to low, recorded as W2 i {where i∈[1,2…32]}, W2 i Shift right 3 bits to get Y i = W2 i >>3{where i∈[1,2…32]};

[0137] Device B will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and 32 public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device A is obtained. a ,

[0138]

[0139] S404: Device B uses the identification public key of device A in combination with symmetric encryption to encrypt the message to be sent.

[0140] Device B generates a random symmetric key SymKey, uses the SM4 encryption algorithm to encrypt the message M to be sent, and obtains the ciphertext data Encrypted_M = SM4_Enc(M, SymKey), using the identification public key IPK of device A a And SM2 encryption algorithm to encrypt SymKey, get the random symmetric key ciphertext Encrypted_SymKey=SM2_Enc(SymKey,IPK a ), concatenate Encrypted_SymKey||Encrypted_M as the ciphertext data EncryptedData to be sent, EncryptedData=Encrypted_SymKey||Encrypted_M.

[0141] S405: Device B sends the encrypted data to device A.

[0142] Device B sends the encrypted data EncryptedData to device A.

[0143] S406: Device A decrypts the ciphertext data using the identification private key in combination with symmetric encryption.

[0144] Device A receives EncryptedData, extracts Encrypted_SymKey and Encrypted_M, and uses the private key isk a And SM2 decryption algorithm decrypts Encrypted_SymKey, and obtains SymKey=SM2_Dec(Encrypted_SymKey,isk a ), use SymKey to decrypt Encrypted_M to get the plaintext M=SM4_Dec(Encrypted_M, SymKey).

[0145] S500: Sending encrypted and signed messages between devices: The ciphertext encrypted in S400 is used as the original text to be signed in S300, so as to realize encryption and signing of message sending, signature verification and decryption of message receiving.

[0146] For example, device B sends an encrypted and signed message to device A.

[0147] S501: Same as S401.

[0148] S502: Same as S402.

[0149] S503: Same as S403.

[0150] S504: Same as S404.

[0151] S505: Device B calculates the combined private key and generates a digital signature for the message to be sent.

[0152] Device B protects the private key B_Protect_SM2_Pri and the identification private key isk b Perform modular addition to obtain the combined private key, recorded as B_Comb_SM2_Pri=(B_Protect_SM2_Pri+isk b ) mod N.

[0153] Device B reads its own ID b , use SM3 algorithm to concatenate the ciphertext data EncryptedData in S404 with ID b After calculating the HASH value with B_Protect_SM2_Pub, we get H=SM3(EncryptedData||ID b ||B_Protect_SM2_Pub), use the combined private key B_Comb_SM2_Pri and SM2 encryption algorithm to encrypt H, and get Encrypted_H=SM2_Enc(H,B_Comb_SM2_Pri), splice EncryptedData||ID b ||B_Protect_SM2_Pub||Encrypted_H, recorded as SignPack, SignPack=EncryptedData||ID b ||B_Protect_SM2_Pub||Encrypted_H.

[0154] S506: Device B sends the encrypted signature data packet to device A.

[0155] Device B sends the ciphertext signature data packet SignPack to device A.

[0156] S507: Device A calculates the identification public key of device B according to the identification of device B.

[0157] Device A obtains SignPack and extracts EncryptedData and ID b , B_Protect_SM2_Pub, Encrypted_H, use SM3 algorithm to protect ID b Calculate the HASH value and get the HASHedID b 1=SM3(ID b );

[0158] Device A reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, and obtains Matrix_ID=SM3(Matrix_Pub). Using Matrix_ID as the key, it uses the HMAC-SM3 algorithm to hash ID. b Calculate the HASH value HASHedID b 2 = HMAC-SM3(ID b , Matrix_ID);

[0159] Device A HASHedID b 1 The byte string is split into 32 8-bit numbers from high to low, recorded as W1 i {where i∈[1,2…32]}, W1 i Shift right 3 bits to get X i = W1 i >>3{where i∈[1,2…32]}; for HASHedID b 2 The byte string is split into 32 8-bit numbers from high to low, recorded as W2 i {where i∈[1,2…32]}, W2 i Shift right 3 bits to get Y i = W2 i >>3{where i∈[1,2…32]};

[0160] Device A will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and 32 public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device B is obtained. b :

[0161]

[0162] S508: Device A calculates the combined public key of device B.

[0163] Device A's protection public key B_Protect_SM2_Pub and identification public key IPK for device B b Do some addition to get the combined public key of device B, recorded as B_Comb_SM2_Pub=B_Protect_SM2_Pub+IPK b (Click to add).

[0164] S509: Device A verifies the digital signature of device B.

[0165] Device A uses the combined public key B_Comb_SM2_Pub and the SM2 decryption algorithm to decrypt Encrypted_H and obtain H=SM2_Dec(Encrypted_H,B_Comb_SM2_Pub);

[0166] Device A uses the SM3 algorithm to concatenate the ciphertext data EncryptedData with the ID b After calculating the HASH value with B_Protect_SM2_Pub, we get H′=SM3(EncryptedData||ID b ||B_Protect_SM2_Pub), compare H′ and H to see if they are equal. If they are equal, it means that the ciphertext data EncryptedData is indeed sent by device B and has not been tampered with during the transmission process, and then proceed to the next step; if they are not equal, it means that the data has been tampered with, and the process is terminated.

[0167] S510: Same as S406.

[0168] The above-mentioned embodiments only express the specific implementation of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. An identification key management and authentication method, It is characterized in that The public-private key matrix is ​​used as the key seed, and the device ID is used as the key factor. The device ID public-private key is generated by calculation to achieve the association and binding of the device ID with its public-private key. It is applied to point-to-point authentication, signature verification, encryption and decryption between devices. Specifically, the following steps are included: S100, initializing the system master key and the public and private key matrix key seeds, and encrypting and storing the private key matrix; S200, the device generates a protection public and private key, signs the device identification ID with the protection private key, and applies to the key management system for the identification public and private keys. The key management system maps the device identification ID to the corresponding rows and columns of the public and private key matrix, calculates the public and private keys through combination operations, and distributes them to the device securely as the device's identification public and private keys; S300, the message sender uses its own protection private key and identification private key to calculate the combined private key, and uses it to sign the message to be sent. The message receiver calculates the sender's identification public key based on the common public key matrix, and uses the sender's protection public key and identification public key to calculate the sender's combined public key, and uses it to verify the sender's message signature; S400, the message sender calculates the recipient's identification public key based on the recipient's device identification ID and the common public key matrix, uses it to encrypt the message to be sent, and the message recipient uses its own identification private key to decrypt the message; S500, the ciphertext encrypted in S400 is used as the original text to be signed in S300, so as to realize the encryption and signing of the message sending, the signature verification and decryption of the message receiving.

2. The identification key management and authentication method according to claim 1, It is characterized in that The S100 specifically includes the following steps: S101, initializing the system master key: the key management system calls the server cryptographic machine to initialize the system master key, namely the asymmetric key SMK_SM2 and the symmetric key SMK_SM4. The asymmetric key SMK_SM2 includes the master private key SMK_SM2_Pri and the master public key SMK_SM2_Pub; S102, initialize the system key matrix: the key management system calls the server cipher machine to generate N*N random SM2 public and private key pairs, which are stored in the private key matrix Matrix_Pri[N,N] and the public key matrix Matrix_Pub[N,N] of size N*N; S103, encrypt the private key matrix and store the matrix ciphertext in the database: the key management system calls the server cipher machine, uses SMK_SM4 to encrypt the private key matrix Matrix_Pri, and obtains the private key matrix ciphertext Encrypted_Matrix_Pri, Encrypted_Matrix_Pri=SM4Enc(Matrix_Pri, SMK_SM4); the key management system uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, recorded as Matrix_ID=SM3(Matrix_Pub); the key management system calls the server cipher machine, uses SMK_SM2_Pri to sign Matrix_Pub||SMK_SM2_Pub, where || is a concatenation operation, and obtains the public key matrix signature value Matrix_Pub_Si gnValue=SM2Sign(Matrix_Pub||SMK_SM2_Pub,SMK_SM2_Pri), then concatenate the public key matrix and signature value data to form a public key matrix data file, recorded as Matrix_Pub_File, Matrix_Pub_File=Matrix_Pub||SMK_SM2_Pub||Matrix_Pub_SignValue; the key management system stores Matrix_ID, SMK_SM2_Pub, Encrypted_Matrix_Pri, Matrix_Pub, and Matrix_Pub_File in the database; the private key matrix is ​​only used for internal calls of the key management system; the public key matrix file is issued to legally registered devices and is open and shared to devices in the same trust domain.

3. The identification key management and authentication method according to claim 2, It is characterized in that In S102, the private key in the N*N random SM2 public-private key pair is recorded as r, and the public key is recorded as R, that is, R i,j =r i,j *G, i, j ∈ [1, 2, ..., N], G is the base point of the elliptic curve; and the private key Matrix_Pri[r i,j ] with the public key Matrix_Pub[R i,j ] correspond one to one.

4. The identification key management and authentication method according to claim 3, It is characterized in that The S200 specifically includes the following steps: S201. Device A initiates a registration application to the key management system: Device A uses the SM2 algorithm to generate a protection key pair, which includes a protection private key and a protection public key. The protection private key is recorded as A_Protect_SM2_Pri and the protection public key is recorded as A_Protect_SM2_Pub. Device A obtains its own unique identification ID a , use A_Protect_SM2_Pri to ID a ||A_Protect_SM2_Pub signature, get the signature value Enroll_SignValue=SM2Sign(ID a ||A_Protect_SM2_Pub,A_Protect_SM2_Pri), change the ID a ||A_Protect_SM2_Pub and Enroll_SignValue are sent to the key management system to apply for the device A identification key, including the identification private key and the identification public key; S202: The key management system calculates the private key and public key of device A based on the ID of device A. The key management system obtains the ID sent by device A. a ||After A_Protect_SM2_Pub and Enroll_SignValue, verify the signature first. If the signature verification is successful, save the ID in the database a , A_Protect_SM2_Pub, proceed to the next step; if the signature verification fails, terminate the device application process; The key management system uses the SM3 algorithm to identify a Calculate the HASH value, recorded as HASHedID a 1=SM3(ID a ); The key management system uses Matrix_ID as the key and uses the HMAC-SM3 algorithm to encode the ID. a Calculate the HASH value, recorded as HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID); Key management system for HASHedID a 1 and HASHedID a 2 is split into N multi-bit numbers, denoted as W1 i and W2 i , where i∈[1,2,…,N], and W1 i and W2 i Shift left or right by n bits to get X i , Y i ; The key management system calls the server cryptographic machine to use SMK_SM4 to decrypt the private key matrix ciphertext Encrypted_Matrix_Pri to obtain the plaintext private key matrix Matrix_Pri, Matrix_Pri=SM4Dec (Encrypted_Matrix_Pri, SMK_SM4); The key management system will be X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and N private keys are selected from Matrix_Pri for modular addition operation. Finally, the identification private key of the device is obtained, which is recorded as isk a ; The key management system converts X i Value, Y i The values ​​are used as row coordinates and column coordinates, and N public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve. Finally, the device identification public key is obtained, which is recorded as IPK a , IPK a with isk a Construct a new SM2 public-private key pair; S203, the key management system sends identification key data to device A: the key management system splices isk a ||IPK a ||Matrix_Pub_File, recorded as IDKey a =isk a ||IPK a ||Matrix_Pub_File, call the server cipher machine, use SMK_SM2_Pri to IDKey a Sign and get the signature value, recorded as IDKey a _SignValue, IDKey a _SignValue=SM2Sign(IDKey a ,SMK_SM2_Pri), and then spliced ​​to form a key file with identification A, recorded as KeyData=IDKey a ||IDKey a _SignValue; The key management system calls the server cryptographic machine to generate a random symmetric key SymKey, encrypts KeyData using the SM4 encryption algorithm, obtains the identification key ciphertext data of device A Encrypted_KeyData = SM4_Enc (KeyData, SymKey), encrypts SymKey using the protection public key A_Protect_SM2_Pub of device A and the SM2 encryption algorithm, obtains the ciphertext of the random symmetric key Encrypted_SymKey = SM2_Enc (SymKey, A_Protect_SM2_Pub), and sends Encrypted_SymKey and Encrypted_KeyData to device A; S204. Device A decrypts the identification key data: Device A receives Encrypted_SymKey and Encrypted_KeyData, decrypts Encrypted_SymKey using its own protection private key A_Protect_SM2_Pri to obtain SymKey = SM2_Dec (Encrypted_SymKey, A_Protect_SM2_Pri), and decrypts Encrypted_KeyData using SymKey to obtain KeyData = SM4_Dec (Encrypted_KeyData, SymKey); S205, device A verifies the integrity of the identification private key, identification public key and public key matrix file: Device A extracts IDKey from KeyData a 、IDKey a _SignValue, SMK_SM2_Pub, first IDKey a Verify the signature. If the verification is successful, extract the IDKey a isk a 、IPK a , Matrix_Pub_File, extract Matrix_Pub, Matrix_Pub_SignValue, SMK_SM2_Pub in Matrix_Pub_File, and then verify the signature of Matrix_Pub. If any of the signature verification fails, the device application process is terminated; S206, device A writes the identification private key, identification public key and public key matrix file: device A writes the identification private key isk a Write to the private area of ​​device A and identify the public key IPK a , the public key matrix Matrix_Pub, the public key matrix signature value Matrix_Pub_SignValue, and the key management system master public key SMK_SM2_Pub are written into the public area of ​​device A; S207. Repeat S201-S206 to obtain identification key data of other devices.

5. The identification key management and authentication method according to claim 4, It is characterized in that In S300, it is assumed that device A sends a signed message to device B, and the identifier obtained by device B through S201-S206 is recorded as ID b , the protection private key is recorded as B_Protect_SM2_Pri, the protection public key is recorded as B_Protect_SM2_Pub, and the identification private key is recorded as isk b , the public key is marked as IPK b , the S300 specifically includes the following steps: S301, device A calculates the combined private key and generates a digital signature for the message to be sent: device A calculates the combined private key A_Protect_SM2_Pri and the identification private key isk a Perform modular addition to obtain the combined private key, recorded as A_Comb_SM2_Pri; Device A reads its own ID a , use SM3 algorithm to splice ID of original message M a and A_Protect_SM2_Pub and then calculate the HASH value, recorded as H=SM3(M||ID a ||A_Protect_SM2_Pub), use the combined private key A_Comb_SM2_Pri and SM2 encryption algorithm to encrypt H, recorded as Encrypted_H=SM2_Enc(H,A_Comb_SM2_Pri), splice M||ID a ||A_Protect_SM2_Pub||Encrypted_H, recorded as SignPack, SignPack=M||ID a ||A_Protect_SM2_Pub||Encrypted_H, sent to device B; S302, device B calculates the public key of device A based on the identification of device A: Device B obtains SignPack, extracts M, ID a , A_Protect_SM2_Pub, Encrypted_H, use SM3 algorithm to protect ID a Calculate the HASH value, recorded as HASHedID a 1=SM3(ID a ); Device B reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, and obtains Matrix_ID=SM3(Matrix_Pub). Using Matrix_ID as the key, it uses the HMAC-SM3 algorithm to hash ID. a Calculate the HASH value HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID); Device B HASHedID a 1 and HASHedID a 2 is split into N multi-bit numbers, denoted as W1 i and W2 i , where i∈[1,2,…,N], and W1 i and W2 i Shift left or right by n bits to get X i , Y i ; Device B will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and N public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device A is obtained. a ; S303, device B calculates the combined public key of device A: device B's protection public key A_Protect_SM2_Pub and identification public key IPK of device A a Do some addition to get the combined public key of device A, recorded as A_Comb_SM2_Pub=A_Protect_SM2_Pub+IPK a ; S304, device B verifies the digital signature of device A: device B uses the combined public key A_Comb_SM2_Pub and the SM2 decryption algorithm to decrypt Encrypted_H and obtain H=SM2_Dec(Encrypted_H,A_Comb_SM2_Pub); Device B uses the SM3 algorithm to concatenate the original message M with the ID a and A_Protect_SM2_Pub and then calculate the HASH value, recorded as H′=SM3(M||ID a ||A_Protect_SM2_Pub), compare H′ and H to see if they are equal. If they are equal, it means that the original message M is indeed sent by device A and has not been tampered with during the transmission process.

6. The identification key management and authentication method according to claim 5, It is characterized in that In S400, it is assumed that device B sends an encrypted message to device A. S400 specifically includes the following steps: S401, device B calculates the HASHedID of device A a 1: Device B obtains the ID of device A a , use SM3 algorithm to identify a Calculate the HASH value, recorded as HASHedID a 1=SM3(ID a ); S402, device B calculates the HASHedID of device A a 2: Device B reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, and obtains Matrix_ID=SM3(Matrix_Pub). Using Matrix_ID as the key, use the HMAC-SM3 algorithm to hash ID a Calculate the HASH value HASHedID a 2 = HMAC-SM3(ID a , Matrix_ID); S403, device B calculates the public key of device A according to the identifier of device A: device B calculates the public key of device A according to the identifier of device A. a 1 and HASHedID a 2 is split into N multi-bit numbers, denoted as W1 i and W2 i , where i∈[1,2,…,N], and W1 i and W2 i Shift left or right by n bits to get X i , Y i ; Device B will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and N public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device A is obtained. a ; S404, device B uses the identification public key of device A combined with symmetric encryption to encrypt the message to be sent: device B generates a random symmetric key SymKey, uses the SM4 encryption algorithm to encrypt the message M to be sent, and obtains the ciphertext data Encrypted_M = SM4_Enc (M, SymKey), and uses the identification public key IPK of device A a And SM2 encryption algorithm to encrypt SymKey, get the random symmetric key ciphertext Encrypted_SymKey=SM2_Enc(SymKey,IPK a ), concatenate Encrypted_SymKey||Encrypted_M as the ciphertext data to be sent, EncryptedData=Encrypted_SymKey||Encrypted_M; S405, device B sends the ciphertext data EncryptedData to device A; S406. Device A uses the identification private key combined with symmetric encryption to decrypt the ciphertext data: Device A receives EncryptedData, extracts Encrypted_SymKey and Encrypted_M, and uses the identification private key isk a And SM2 decryption algorithm decrypts Encrypted_SymKey, and obtains SymKey=SM2_Dec(Encrypted_SymKey,isk a ), use SymKey to decrypt Encrypted_M to get the plaintext M=SM4_Dec(Encrypted_M, SymKey).

7. The identification key management and authentication method according to claim 6, It is characterized in that In S500, it is assumed that device B sends an encrypted and signed message to device A. S500 specifically includes the following steps: S501, repeat S401-S404 to encrypt the message to be sent; S502, device B calculates the combined private key and generates a digital signature for the message to be sent: Device B calculates the combined private key B_Protect_SM2_Pri and the identification private key isk b Perform modular addition to obtain the combined private key, recorded as B_Comb_SM2_Pri; Device B reads its own ID b , use SM3 algorithm to concatenate the ciphertext data EncryptedData in S404 with ID b and B_Protect_SM2_Pub and then calculate the HASH value, recorded as H=SM3(EncryptedData||ID b ||B_Protect_SM2_Pub), use the combined private key B_Comb_SM2_Pri and SM2 encryption algorithm to encrypt H, recorded as Encrypted_H=SM2_Enc(H,B_Comb_SM2_Pri), splice EncryptedData||ID b ||B_Protect_SM2_Pub||Encrypted_H, recorded as SignPack, SignPack=EncryptedData||ID b ||B_Protect_SM2_Pub||Encrypted_H; S503, device B sends the ciphertext signature data packet SignPack to device A; S504. Device A calculates the public key of device B based on the identifier of device B. Device A obtains SignPack and extracts EncryptedData, ID b , B_Protect_SM2_Pub, Encrypted_H, use SM3 algorithm to protect ID b Calculate the HASH value, recorded as HASHedID b 1=SM3(ID b ); Device A reads the public key matrix Matrix_Pub stored in itself, uses the SM3 algorithm to calculate the HASH value of Matrix_Pub, recorded as Matrix_ID=SM3(Matrix_Pub), uses Matrix_ID as the key, and uses the HMAC-SM3 algorithm to hash the ID b Calculate the HASH value HASHedID b 2 = HMAC-SM3(ID b , Matrix_ID); Device A HASHedID a 1 and HASHedID a 2 is split into N multi-bit numbers, denoted as W1 i and W2 i , where i∈[1,2,…,N], and W1 i and W2 i Shift left or right by n bits to get X i , Y i ; Device A will X i Value, Y i The values ​​are used as row coordinates and column coordinates respectively, and N public keys are selected from Matrix_Pub to perform point addition operations on the elliptic curve, and finally the identification public key IPK of device B is obtained. b ; S505. Device A calculates the combined public key of device B: device A's protection public key B_Protect_SM2_Pub and identification public key IPK for device B b Do some addition to get the combined public key of device B, recorded as B_Comb_SM2_Pub; S506. Device A verifies the digital signature of device B: Device A uses the combined public key B_Comb_SM2_Pub and the SM2 decryption algorithm to decrypt Encrypted_H, and obtains H=SM2_Dec(Encrypted_H,B_Comb_SM2_Pub); Device A uses the SM3 algorithm to concatenate the ciphertext data EncryptedData with the ID b After calculating the HASH value with B_Protect_SM2_Pub, we get H′=SM3(EncryptedData||ID b ||B_Protect_SM2_Pub), compare H′ and H to see if they are equal. If they are equal, it means that the ciphertext data EncryptedData is indeed sent by device B and has not been tampered with during the transmission process, and then proceed to the next step; if they are not equal, it means that the data has been tampered with, and the process is terminated; S507: Repeat S406 to decrypt the ciphertext data.