The invention discloses a lightweight
key management method and
system based on a national cryptographic
algorithm, and relates to the technical field of
key management, comprising a user creation process, an information loading process, a secure connection process and a
key distribution process. Wherein the
key management server creates an SM4
white box for an intra-domain user, physically distributes the SM4
white box, creates a user according to a user name and a user
password, and generates
user information;
user information is loaded and stored in a hash bucket, an SM2 public key of a user is obtained, and the shared key is decrypted by using an SM4
white box; the method comprises the following steps: receiving a Hash bucket, loading local information, decrypting, creating a thread to communicate with a user, searching
user information in the Hash bucket after receiving a data packet sent by the user, verifying the user information, decrypting key information by using a shared key, and negotiating to obtain a
session key so as to establish a secure connection; and after a
key distribution request sent by a user is received, searching user information in the hash bucket and verifying the user information, decrypting the data packet by using the
session key, generating a
key distribution data packet and replying the key distribution data packet to the user.