Lightweight hopping key encryption system based on national cryptographic algorithm
By using the National Secretariat algorithm and preset jump rules to generate keys, and combining LSTM neural network and smart contract technology for key management and security analysis, the difficulties in key generation and management in the existing technology are solved, efficient data encryption and decryption are achieved, timely detection of attack modes and evaluation of system security.
Patent Information
- Application Number
- CN202510523780.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-06-13
AI Technical Summary
In the prior art, there are difficulties in generating initial keys and jump keys, difficulty in analyzing key jump mode detection abnormal states, difficulty in automating key management of smart contracts, difficulty in calculating security index for encrypted plaintext data, complex calculation of data verification index after decryption, difficulty in real-time monitoring of operating state detection attack modes, and difficulty in calculating comprehensive security evaluation values for evaluating defense capabilities and key jump validity.
The initial key is generated by the Guoxin algorithm, and the jump key is generated according to the preset jump rules. By constructing the LSTM neural network model, the key jump mode is analyzed in real time, the smart contract automatic key management is integrated with the Guoxin algorithm and cross-chain technology, the security index is calculated for encryption, the corresponding jump key is used for decryption and the data verification index is calculated, the running status is monitored in real time, and the generation of the adversarial network detection attack mode is used to evaluate the defense capabilities and key jump effectiveness and calculate the overall security evaluation value.
It improves the complexity and security of keys, realizes intelligent management of keys, ensures high security encryption and decryption efficiency of data, promptly detects and responds to potential security threats, enhances the system's defense capabilities, and provides an intuitive security status assessment.
Smart Images

Figure CN120150949A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data communication encryption, and specifically relates to a lightweight hopping key encryption system based on national cryptographic algorithms. Background Art
[0002] Since the release of the national cryptographic algorithms SM2, SM3, and SM4 in 2010, they have been proven to have high security. The comprehensive use of national cryptographic algorithms to replace outdated international cryptographic algorithms helps to comprehensively improve security. Aiming at the low computational efficiency, insufficient security, and security risks of single session keys in traditional key negotiation protocols, it is task-oriented to meet the lightweight requirements of Internet of Things devices. By applying national cryptographic algorithms, combining with the hopping key mechanism, and using smart contracts to automatically execute key hopping rules; by using blockchain technology and deep learning technology for blockchain storage and anomaly analysis.
[0003] The existing technologies have the following problems: it is difficult to generate initial keys and hopping keys; it is difficult to analyze key hopping patterns to detect abnormal states; it is difficult to perform smart contract automated key management; it is difficult to encrypt plaintext data based on the analyzed security index; it is difficult to decrypt the hopping key and analyze the data verification index for data verification; it is difficult to monitor the running state in real time to detect attack patterns; it is difficult to evaluate the defense ability and the effectiveness of key hopping and comprehensively evaluate the overall security evaluation value. Summary of the Invention
[0004] To solve the problems existing in the above-mentioned prior arts, the first aspect of the present invention provides a lightweight hopping key encryption system based on national cryptographic algorithms, including the following modules:
[0005] Key Generation Module: Generates an initial key using a national cryptographic algorithm and generates a hopping key according to a preset hopping rule;
[0006] Key Hopping Management Module: Constructs an LSTM neural network model to analyze key hopping patterns in real time and detect abnormal states; through the integration of national cryptographic algorithms and cross-chain technology, performs smart contract automated key management, and performs key management according to the abnormal state detection results;
[0007] Encryption Module: Obtains the currently used hopping key from the key hopping management module and encrypts the plaintext data by calculating the security index;
[0008] Decryption Module: After encryption, decrypts using the corresponding hopping key and performs data verification by calculating the data verification index based on the restored plaintext data;
[0009] Monitoring and Analysis Module: Monitor the running status in real time, and use the generative adversarial network to detect attack patterns; evaluate the defense ability and the effectiveness of key hopping according to the detection results and evaluate the overall security evaluation value.
[0010] Preferably, use the national cryptographic algorithm to generate the initial key, and generate the hopping key according to the preset hopping rules, including the following steps:
[0011] First, use the SM2 algorithm to generate the public-private key pair by using the elliptic curve encryption algorithm for identity authentication and key exchange; then use the SM3 algorithm to generate the intermediate key through SM3-KDF as the seed of the SM4 symmetric key; finally, use the SM4 algorithm to generate the symmetric key as the initial key actually used for data encryption;
[0012] Collect the physical data of the Internet of Things devices including: chip ID, clock deviation, and the environmental sensor data including: temperature and humidity; combine the physical data and the environmental sensor data with the initial key through the hash function to generate the dynamic hopping key; develop a key derivation function combined with geographical spatio-temporal features, hash the time stamp and Beidou positioning information to generate the key segment related to the geographical location and time;
[0013] The preset hopping rules include: taking the time stamp as the input parameter, calculating its hash value through the hash algorithm, using this as the seed, and combining with the random number generator to generate a new key; using an increasing counter value as the input parameter, and generating a new key through the SM3-KDF key derivation function in combination with the initial key;
[0014] Using the national cryptographic algorithm and the preset hopping rules, at each hopping, obtain the current time stamp and the current counter value; use the initial key, time stamp and counter value as the input, and perform operations through the SM3-KDF key derivation function; convert the time stamp and counter value into byte arrays, and then splice them with the initial key as the input seed data of SM3-KDF; through the SM3-KDF key derivation function, generate a new hopping key according to the input seed data and key length; generate an index list through the pseudo-random seed for key hopping;
[0015] At each hopping, obtain the current time stamp and the counter value; perform weighted summation calculation on the current time stamp and counter value to obtain the hopping interval value, and perform hopping according to the hopping interval value; after each hopping, increment the counter value, and the increment step is 1, 2 or 4;
[0016] After each hopping, the two communication parties perform key negotiation through the SM2-based key exchange protocol, use the newly generated hopping key as the basis for negotiation, and synchronously update the key to ensure that both parties use the same hopping key for communication;
[0017] Record the information of the newly generated hopping key, including the key identifier, generation time, and key digest, on the blockchain.
[0018] Preferably, construct an LSTM neural network model to analyze the key hopping pattern in real time and detect abnormal states, including the following steps:
[0019] Obtain the original data from the cross-chain verification log and key hopping record, including: timestamp, node ID, verification delay, hopping time, trigger condition, relay node broadcast delay, and smart contract execution time;
[0020] Extract the dynamic features from the original data, including: standard deviation of hopping interval, moving average of cross-chain verification delay, number of abnormal SM3 hash comparisons, relay node broadcast delay, and smart contract response time;
[0021] Preprocess the extracted dynamic features, including: data cleaning and standardization;
[0022] Input the preprocessed dynamic features into the LSTM neural network model for training, and input the dynamic features extracted from the real-time monitoring of the cross-chain verification log and key hopping record into the trained LSTM neural network model for abnormal state detection; output the confidence score p value according to the input dynamic features to detect whether the current state is abnormal;
[0023] According to the confidence score p value, set the threshold to 0.85; when the p value is less than the threshold, it is considered that the current state is abnormal, and when the p value is greater than or equal to the threshold, it is considered that the current state is not abnormal.
[0024] Preferably, through the integration of the national cryptographic algorithm and cross-chain technology, perform intelligent contract automated key management, and perform key management according to the abnormal state detection result, including the following steps:
[0025] Introduce a cross-chain verification interface and develop a heterogeneous chain key interoperability protocol. After the key completes hopping on the Hyperledger Fabric chain, generate a key migration certificate through a cross-chain smart contract, and the verification node of the Chang'an chain completes the legality verification;
[0026] Use the lightweight relay node Relay Node to real-time synchronously monitor the key hopping state, sign the broadcast message using the SM2 elliptic curve digital signature algorithm, and generate a timestamp protection field; use SM3 hash to prevent replay attacks;
[0027] According to the trained LSTM neural network model, when an abnormal state is detected, actively trigger key forced hopping, terminate the current session, and perform cross-chain consistency verification;
[0028] Trigger the key hopping operation at the set time interval or data volume threshold, update the currently used key to the next hopping key, and securely process the old key.
[0029] Preferably, obtain the currently used hopping key from the key hopping management module, and encrypt the plaintext data by calculating the security index, including the following steps:
[0030] Preprocess the plaintext data, including: data format verification and standardized padding;
[0031] Use the obtained hopping key and combine it with the encryption algorithm to encrypt the input plaintext data;
[0032] Among them, by collecting encryption parameters, including: the number of keys, key usage duration, key usage frequency, information entropy, time complexity, space complexity, and the number of known vulnerabilities, the security index calculation formula is:
[0033] Obtain the security index M; where K represents the number of keys, H is the information entropy, T is the key usage duration, F is the key usage frequency, C t is the time complexity, C s is the space complexity, q is the number of known vulnerabilities; w 1 、w 2 and w 3 respectively represent the weight coefficients of 0.4, 0.25, and 0.35, w 1 、w 2 and w 3 sum to 1;
[0034] According to the calculated security index M, set the threshold M 0 to 0.55; when M≥M 0 it is high security, and select the CBC mode of the encryption algorithm for encryption; when M<M 0 it is low security, select the ECB mode of the encryption algorithm and introduce a random padding algorithm for encryption; among them, on the basis of the CBC mode, combine the CFB or CTR mode for encryption;
[0035] Combine the encrypted ciphertext data with the encryption parameters into ciphertext information, and transmit the generated ciphertext information through a secure communication channel; after encrypting the plaintext data, use the zero-knowledge proof method to generate an encryption operation proof to verify whether the encryption process follows the security index formula and does not bypass the threshold judgment logic; record the encryption operation information on the blockchain.
[0036] Preferably, after encryption, use the corresponding hopping key for decryption, and perform data verification by calculating the data verification index based on the restored plaintext data, including the following steps:
[0037] Decrypt using the current hopping key according to the preset hopping rules; when the keys are out of sync, resynchronize the keys through the key negotiation protocol;
[0038] Use the SM4 algorithm and the current hopping key to decrypt the ciphertext data and restore the plaintext data; according to the decrypted plaintext data, count the occurrence times of each character in the plaintext data and calculate the Shannon entropy from the probabilities, and calculate the randomness coefficient formula of the plaintext data: Obtain the randomness coefficient S, where p i is the probability of each character's occurrence, and n is the total number of characters; use the hash algorithm to calculate the hash value of the plaintext data, and obtain the integrity coefficient of the plaintext data by calculating the ratio with the received hash value;
[0039] Calculate the data check index formula: Obtain the data check index Y, where S represents the randomness coefficient and Z represents the integrity coefficient; set the threshold to Y according to the data check index 0 When Y≥Y 0 it indicates that the data check passes; when Y<Y 0 it indicates that the data check fails;
[0040] After decrypting the ciphertext data using the hopping key, record the relevant information of the decryption result, including: the hash value of the decrypted plaintext data, the decryption time, and the hopping key identifier used, on the blockchain.
[0041] Preferably, monitor the running state in real time and use a generative adversarial network to detect attack patterns, including the following steps:
[0042] By deploying lightweight relay nodes, monitor and collect running state data in real time, including: encryption time consumption, decryption time consumption, encryption efficiency, decryption efficiency, hopping frequency of keys, network bandwidth utilization; preprocess the collected running state data, including: filtering and denoising and normalization;
[0043] Collect normal running state data and running state data in attack patterns, and integrate them into a training dataset. Among them, the attack patterns include: unauthorized access, identity impersonation, and data tampering; label the running state data in the training dataset, including: normal sample labels and attack sample labels; perform time series alignment on the normal running state data and the running state data in attack patterns;
[0044] Input the labeled training dataset into the generative adversarial network model for training; during the training process, use the semi-supervised generative adversarial network model for training and learning;
[0045] The operation status data collected through real-time monitoring and preprocessed is input into the trained generative adversarial network model to detect whether an attack pattern appears.
[0046] Preferably, according to the detection results, evaluate the defense ability and the effectiveness of key hopping, and evaluate and calculate the overall security evaluation value, including the following steps:
[0047] When the generative adversarial network model detects an attack pattern, record the ratio of the number of successfully intercepted attacks to the total number of attacks, and calculate the attack interception rate; record the time interval T between detecting the attack and making a response, and calculate the attack response delay formula: Obtain the attack response delay;
[0048] By counting the number of key hops and the number of defenses in the attack pattern, calculate the ratio of the number of defenses to the number of key hops to obtain the key hopping effectiveness coefficient;
[0049] By calculating the weighted average of the attack interception rate, attack response delay, and key hopping effectiveness coefficient, obtain the overall security evaluation value; according to the overall security evaluation value, when the overall security evaluation value is greater than or equal to 0.85, it indicates high security; when the overall security evaluation value is greater than 0.55 and less than 0.85, it indicates medium security; when the overall security evaluation value is less than or equal to 0.55, it indicates low security.
[0050] Compared with the prior art, the beneficial effects of the present invention are:
[0051] The present invention generates an initial key by using a national cryptographic algorithm and combines a preset hopping rule to generate a hopping key, which improves the complexity and security of the key and reduces the risk of the key being cracked.
[0052] The present invention constructs an LSTM neural network model to analyze the key hopping pattern in real time, can detect abnormal states in a timely manner, and realizes the intelligent management of keys by integrating the national cryptographic algorithm and cross-chain technology and using smart contracts to automate the management of keys.
[0053] The present invention selects different encryption modes by analyzing the security index, which not only ensures the encryption strength of high-security data but also takes into account the encryption efficiency of low-security data. At the same time, the decrypted data is verified through the data verification index to ensure the integrity and randomness of the data.
[0054] The present invention deploys lightweight relay nodes to monitor the system operation status in real time and uses a generative adversarial network to detect attack patterns, which can timely discover and respond to potential security threats and enhance the system's defense ability. By evaluating the system's defense ability and the effectiveness of key hopping according to the detection results and analyzing the overall security evaluation value, the security status of the system can be intuitively understood. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0056] Figure 1 It is the system module diagram of the present invention. Specific embodiments
[0057] The following will clearly and completely describe the technical solutions of the present invention in conjunction with the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0058] Please refer to Figure 1 , the first aspect embodiment of the present invention provides a lightweight hopping key encryption system based on the national cryptographic algorithm, including the following modules:
[0059] Key generation module: Generate an initial key using the national cryptographic algorithm and generate a hopping key according to a preset hopping rule;
[0060] Key hopping management module: Construct an LSTM neural network model to analyze the key hopping pattern in real time and detect abnormal states; Through the integration of the national cryptographic algorithm and cross-chain technology, intelligent contract automated key management is performed, and key management is carried out according to the detection results of abnormal states;
[0061] Encryption module: Obtain the currently used hopping key from the key hopping management module and encrypt the plaintext data by calculating the security index;
[0062] Decryption module: After encryption, use the corresponding hopping key for decryption, and perform data verification by calculating the data verification index based on the restored plaintext data;
[0063] Monitoring and analysis module: Monitor the running status in real time and use a generative adversarial network to detect attack patterns; Evaluate the defense ability and key hopping effectiveness according to the detection results and evaluate and calculate the overall security evaluation value.
[0064] Specifically, algorithms such as SM2, SM3, and SM4 in the national cryptographic algorithms are used to generate the initial key. Among them, SM2 is an asymmetric encryption algorithm based on ECC, and its signature speed and key generation speed are both faster than RSA; SM3 is a message digest algorithm; SM4 is a block data symmetric encryption algorithm for wireless local area network standards, and both the key length and the block length are 128 bits. An initial key pair, including a public key and a private key, is generated using the selected national cryptographic algorithm; according to the system security requirements and performance requirements, a key hopping rule is designed to trigger key hopping. An LSTM neural network model is constructed for real-time analysis of key hopping patterns. A large amount of historical key hopping data is collected as training data to train the LSTM model so that it can learn the normal key hopping rules and thus detect abnormal states. The automated management of keys is realized through smart contracts, and operations such as key generation, distribution, and update are deployed on the blockchain in the form of smart contracts. Using cross-chain technology, the key management between different blockchain networks can cooperate with each other to improve the flexibility and security of key management. The abnormal state results detected by the LSTM model are fed back to the smart contract, and the smart contract takes corresponding key management measures according to the abnormal situation. The hopping key currently in use is obtained from the key hopping management module. The plaintext data is encrypted using the obtained hopping key and the calculated security index. After encryption, the ciphertext is decrypted using the corresponding hopping key to restore the plaintext data. According to the restored plaintext data, a data verification index is calculated to verify the integrity and correctness of the data. The running state of the system is monitored in real time, including key generation, hopping, usage, the execution of encryption and decryption operations, network communication status, etc. A generative adversarial network is used for the detection of attack patterns. By training the generative adversarial network model, it can identify attack patterns. According to the monitored running state and the detected attack patterns, the defense ability of the system and the effectiveness of key hopping are evaluated. The overall security evaluation value is calculated to intuitively reflect the security status of the system.
[0065] In this embodiment, the national cryptographic algorithm is used to generate the initial key, and the hopping key is generated according to the preset hopping rule, including the following steps:
[0066] First, use the SM2 algorithm to generate a public-private key pair using the elliptic curve encryption algorithm for identity authentication and key exchange; then use the SM3 algorithm to generate an intermediate key through SM3-KDF as the seed for the SM4 symmetric key; finally, use the SM4 algorithm to generate a symmetric key as the initial key actually used for data encryption;
[0067] Collecting the physical data of IoT devices includes: chip ID, clock deviation, and environmental sensor data including: temperature and humidity; combining the physical data and environmental sensor data with the initial key through a hash function to generate a dynamic hopping key; developing a key derivation function that combines geographical spatio-temporal characteristics, hashing the spatio-timestamp and Beidou positioning information to generate a key fragment related to geographical location and time;
[0068] The preset hopping rules include: taking the timestamp as an input parameter, calculating its hash value through a hash algorithm, using this as a seed, and combining it with a random number generator to generate a new key; using an incrementing counter value as an input parameter, and combining it with the initial key through the SM3-KDF key derivation function to generate a new key;
[0069] Using the national cryptographic algorithm and the preset hopping rules, at each hopping, obtain the current timestamp and the current counter value; take the initial key, timestamp, and counter value as inputs and perform operations through the SM3-KDF key derivation function; convert the timestamp and counter value into byte arrays, and then splice them with the initial key as the input seed data of SM3-KDF; through the SM3-KDF key derivation function, generate a new hopping key according to the input seed data and key length; generate an index list through a pseudo-random seed for key hopping;
[0070] At each hopping, obtain the current timestamp and counter value; perform a weighted sum calculation on the current timestamp and counter value to obtain a hopping interval value, and perform hopping according to the hopping interval value; after each hopping, increment the counter value, and the increment step is 1, 2, or 4;
[0071] After each hopping, the two communicating parties perform key negotiation through the SM2-based key exchange protocol, use the newly generated hopping key as the basis for negotiation, and synchronously update the key to ensure that both parties use the same hopping key for communication;
[0072] Record the information of the newly generated hopping key, including: key identifier, generation time, key digest, on the blockchain.
[0073] Specifically, the SM2 algorithm is used to generate a public-private key pair based on the elliptic curve encryption mechanism, and this key pair is used for device identity authentication and key exchange. The key material generated by SM2 is processed using the key derivation function SM3-KDF of the SM3 algorithm to generate an intermediate key, which serves as the seed for the SM4 symmetric key. The SM4 algorithm is used to generate the final symmetric key for data encryption based on the intermediate key. Physical data of IoT devices, such as chip ID, clock deviation, etc., and environmental sensor data, such as temperature and humidity, are collected. The collected physical data and environmental sensor data are combined with the initial key through a hash function to generate a dynamic hopping key. A key derivation function that combines geographical spatio-temporal features is developed to perform a hash process on the spatio-timestamp and Beidou positioning information to generate a key segment related to geographical location and time. The preset hopping rules include using the timestamp as an input parameter, calculating its hash value through a hash algorithm, using this as a seed, and combining it with a random number generator to generate a new key. At the same time, an increasing counter value is used as an input parameter, and through the SM3-KDF key derivation function, it is combined with the initial key to generate a new key. At each hopping, the current timestamp and counter value are obtained. The initial key, timestamp, and counter value are used as inputs and operated through the SM3-KDF key derivation function. By converting the timestamp and counter value into byte arrays. The byte arrays are concatenated with the initial key to serve as the input seed data for SM3-KDF. Through the SM3-KDF key derivation function, a new hopping key is generated according to the input seed data and key length. An index list is generated through a pseudo-random seed for key hopping. At each hopping, the current timestamp and counter value are obtained, and their weighted sum is calculated to obtain a hopping interval value, and hopping is performed according to the hopping interval value. After each hopping, the counter value is incremented, and the increment step can be 1, 2, or 4. After each hopping, the communication parties perform key negotiation through a key exchange protocol based on SM2. The newly generated hopping key is used as the basis for negotiation to synchronously update the key to ensure that both parties use the same hopping key for communication. Information about the newly generated hopping key, including key identifier, generation time, key digest, etc., is recorded on the blockchain. This can be achieved through a smart contract, writing the key information as transaction data into the blockchain to ensure the immutability and traceability of the key information.
[0074] In this embodiment, an LSTM neural network model is constructed to analyze the key hopping pattern in real time and detect abnormal states, including the following steps:
[0075] The original data obtained from the cross-chain verification log and key hopping record includes: timestamp, node ID, verification delay, hopping time, trigger condition, relay node broadcast delay, and smart contract execution time;
[0076] Extracting the dynamic features from the original data includes: standard deviation of jump interval, moving average of cross-chain verification delay, number of abnormal times in SM3 hash comparison, relay node broadcast delay, and smart contract response time;
[0077] Preprocessing the extracted dynamic features includes: data cleaning and standardization;
[0078] Input the preprocessed dynamic features into the LSTM neural network model for training, and input the dynamic features extracted from real-time monitoring of cross-chain verification logs and key jump records into the trained LSTM neural network model for abnormal state detection; output the confidence score p value according to the input dynamic features for detecting whether the current state is abnormal;
[0079] According to the confidence score p value, set the threshold to 0.85; when the p value is less than the threshold, it is considered that the current state is abnormal, and when the p value is greater than or equal to the threshold, it is considered that the current state is not abnormal.
[0080] Specifically, obtain the original data from the cross-chain verification logs and key hopping records of the system. These data include information such as timestamps, node IDs, verification delays, hopping times, triggering conditions, relay node broadcast delays, and smart contract execution times. Dynamic feature extraction includes: calculating the standard deviation of the time intervals between adjacent key hops to reflect the fluctuations in the hopping intervals; performing a moving average calculation on the cross-chain verification delays to obtain their trend-changing characteristics; counting the number of abnormal occurrences in the SM3 hash comparison during the key hopping process as a security-related feature; directly extracting the data of the relay node broadcast delays to reflect the timeliness of information dissemination; recording the response time of the smart contract execution to evaluate the system execution efficiency. Clean the extracted dynamic feature data to remove outliers, missing values, etc., to ensure the quality of the data. Standardize the dynamic feature data with different ranges and dimensions so that they have the same scale, facilitating the training and convergence of the LSTM model. Common standardization methods include Min-Max standardization, Z-Score standardization, etc. Construct an LSTM neural network model, including an input layer, an LSTM layer, an output layer, etc. Determine the parameters such as the number of neurons and activation functions in each layer according to the data characteristics and problem requirements. Divide the preprocessed dynamic feature data into a training set and a test set, and use the training set to train the LSTM model. During the training process, optimize the parameters of the model so that the model can accurately learn the key hopping pattern under normal conditions. Use the test set to evaluate the trained LSTM model, and adjust the structure and parameters of the model according to the evaluation results to improve the performance and generalization ability of the model. During the operation of the system, extract dynamic features from the cross-chain verification logs and key hopping records in real time and perform preprocessing. Input the dynamically preprocessed features into the trained LSTM neural network model, and the model outputs a confidence score p value based on the input features. This p value reflects the degree of matching between the current state and the normal mode. Set the threshold to 0.85 according to the confidence score p value. When the p value is less than the threshold, the current state is considered abnormal; when the p value is greater than or equal to the threshold, the current state is considered not abnormal. The threshold can be dynamically adjusted according to the distribution of the confidence score p values in different states in the historical data, such as determining a more appropriate threshold based on statistical features such as the mean and variance of the p values in the normal state and the abnormal state to adapt to the actual operation situation and changes of the system.
[0081] In this embodiment, by integrating the national cryptographic algorithm and the cross-chain technology, automated key management for smart contracts is carried out, and key management is performed according to the abnormal state detection results, including the following steps:
[0082] Introduce a cross-chain verification interface and develop a heterogeneous chain key interoperability protocol. After the key completes hopping on the Hyperledger Fabric chain, a key migration certificate is generated through a cross-chain smart contract, and the legality verification is completed by the verification nodes of the Chang'an chain;
[0083] Utilize a lightweight relay node (Relay Node) to synchronously monitor the key hopping status in real time, sign the broadcast message using the SM2 elliptic curve digital signature algorithm, and generate a timestamp protection field; utilize SM3 hashing to prevent replay attacks;
[0084] According to the trained LSTM neural network model, when an abnormal state is detected, actively trigger key forced hopping, terminate the current session, and perform cross-chain consistency verification;
[0085] Trigger the key hopping operation at a set time interval or data volume threshold, update the currently used key to the next hopping key, and perform security processing on the old key.
[0086] Specifically, introduce a cross-chain verification interface for connecting different blockchain platforms, such as Hyperledger Fabric and Chang'an Chain; through this interface, realize data interaction and key management between different chains. Develop a key interoperability protocol suitable for heterogeneous blockchains to ensure that keys on different chains can be mutually recognized and verified. When the key hopping is completed on the Hyperledger Fabric chain, generate a key migration proof through a cross-chain smart contract, and the verification node of the Chang'an Chain completes the legality verification. Utilize a lightweight relay node (Relay Node) to synchronously monitor the key hopping status in real time. The relay node is responsible for listening and forwarding relevant information about key hopping to ensure the timeliness and accuracy of the information. Sign the broadcast message using the SM2 elliptic curve digital signature algorithm and generate a timestamp protection field to prevent the message from being tampered with and denied. At the same time, utilize the SM3 hashing-based mechanism to prevent replay attacks to ensure the security of the key hopping process. Integrate the trained LSTM neural network model into the key management system. Extract dynamic features from the cross-chain verification log and key hopping record in real time, perform preprocessing, and then input them into the LSTM model for abnormal state detection. According to the confidence score p value output by the LSTM model, set the threshold to 0.85. When the p value is less than the threshold, it is considered that the current state is abnormal, and the system actively triggers key forced hopping, terminates the current session, and performs cross-chain consistency verification to ensure the security and reliability of the system. According to the system security policy, trigger the key hopping operation at a set time interval or data volume threshold. For example, after a certain period of time or after transmitting a certain amount of data, the system automatically updates the currently used key to the next hopping key. When updating the key, perform security processing on the old key, such as key cancellation, key archiving, etc., to ensure that the old key is no longer used and improve the security of the system.
[0087] In this embodiment, obtain the currently used hopping key from the key hopping management module, and encrypt the plaintext data by calculating the security index, including the following steps:
[0088] The preprocessing of the plaintext data includes: data format verification and standard filling;
[0089] Using the obtained hopping key and combining with the encryption algorithm, encrypt the input plaintext data;
[0090] Among them, by collecting encryption parameters including: the number of keys, key usage duration, key usage frequency, information entropy, time complexity, space complexity, and the number of known vulnerabilities, the security index formula is calculated as:
[0091] Obtain the security index M; where K represents the number of keys, H is the information entropy, T is the key usage duration, F is the key usage frequency, C t is the time complexity, C s is the space complexity, q is the number of known vulnerabilities; w 1 、w 2 and w 3 represent the weight coefficients of 0.4, 0.25, and 0.35 respectively, and the sum of w 1 、w 2 and w 3 is 1;
[0092] According to the calculated security index M, set the threshold M 0 to 0.55; when M≥M 0 , it is high security, and select the CBC mode of the encryption algorithm for encryption; when M<M 0 , it is low security, and select the ECB mode of the encryption algorithm and introduce a random filling algorithm for encryption; among them, on the basis of the CBC mode, combine the CFB or CTR mode for encryption;
[0093] Combine the encrypted ciphertext data with the encryption parameters to form ciphertext information, and transmit the generated ciphertext information through a secure communication channel; after encrypting the plaintext data, use the zero-knowledge proof method to generate an encryption operation proof to verify whether the encryption process follows the security index formula and does not bypass the threshold judgment logic; record the encryption operation information on the blockchain.
[0094] Specifically, perform format verification on the plaintext data to ensure that the data meets the expected format requirements, including: checking whether the length, type, encoding, etc. of the data are correct. Perform standardized padding on the plaintext data to make its length meet the requirements of the encryption algorithm. Obtain the current hopping key being used from the key hopping management module; collect encryption parameters, including: the number of keys, key usage duration, key usage frequency, information entropy, time complexity, space complexity, the number of known vulnerabilities, etc. Calculate the security index based on the collected encryption parameters. Set the threshold to 0.55 according to the calculated security index M. When M ≥ 0.55, select the CBC mode of the encryption algorithm for encryption; when M < 0.55, select the ECB mode of the encryption algorithm and introduce a random padding algorithm for encryption. On the basis of the CBC mode, combine the CFB or CTR mode for encryption. Use the obtained hopping key and the selected encryption mode to encrypt the plaintext data. Combine the encrypted ciphertext data with the encryption parameters into ciphertext information. The encryption parameters can be stored or transmitted together with the ciphertext as metadata. Transmit the generated ciphertext information through a secure communication channel to ensure the security of the data during transmission. Use the zero-knowledge proof method to generate an encryption operation proof to verify whether the encryption process follows the security index formula and does not bypass the threshold judgment logic. The zero-knowledge proof can prove the correctness of the encryption operation without revealing the encryption details. Record the encryption operation information on the blockchain, including: encryption time, the key identifier used, the security index, the encryption mode, etc. Ensure the traceability and security of the encryption operation through the immutable feature of the blockchain. Through the above steps, it is possible to obtain the current hopping key from the key hopping management module, encrypt the plaintext data by calculating the security index, and ensure the security and reliability of the encryption process, where the security index threshold is dynamically adjusted according to the actual situation.
[0095] In this embodiment, after encryption, use the corresponding hopping key for decryption, and perform data verification by calculating the data verification index based on the restored plaintext data, including the following steps:
[0096] Decrypt using the current hopping key according to the preset hopping rule; when the keys are out of sync, resynchronize the keys through the key negotiation protocol;
[0097] Use the SM4 algorithm and the current hopping key to decrypt the ciphertext data to restore the plaintext data; according to the decrypted plaintext data, count the number of occurrences and probabilities of each character in the plaintext data to obtain the Shannon entropy, and calculate the randomness coefficient formula of the plaintext data: Obtain the randomness coefficient S, where, p iis the probability of each character's occurrence, and n is the total number of characters; calculate the hash value of the plaintext data using the hash algorithm, and obtain the integrity coefficient of the plaintext data by calculating the ratio with the received hash value;
[0098] Formula for calculating the data verification index: Obtain the data verification index Y, where S represents the randomness coefficient and Z represents the integrity coefficient; set the threshold to Y according to the data verification index 0 , when Y≥Y 0 it indicates that the data verification passes; when Y<Y 0 it indicates that the data verification fails;
[0099] After decrypting the ciphertext data using the hopping key, record the relevant information of the decryption result, including: the hash value of the decrypted plaintext data, the decryption time, and the hopping key identifier used, on the blockchain.
[0100] Specifically, decrypt using the current hopping key according to the preset hopping rule. When key asynchronization is detected, resynchronize the key through the key negotiation protocol. For example, the communication parties renegotiate and synchronize to the same hopping key through the SM2-based key exchange protocol. Decrypt the ciphertext data using the SM4 algorithm and the current hopping key to restore the plaintext data. Count the occurrence times and probabilities of each character in the plaintext data, calculate the Shannon entropy of the plaintext data according to the Shannon entropy formula, and calculate the randomness coefficient using the randomness coefficient formula; calculate the hash value of the plaintext data using the hash algorithm, and obtain the integrity coefficient of the plaintext data by calculating the ratio with the received hash value. Substitute the randomness coefficient and the integrity coefficient into the data verification index formula to calculate the data verification index. Set the threshold to 0.8 according to the data verification index, and the threshold is dynamically adjusted according to historical data and actual situations. When Y≥0.8, it indicates that the data verification passes; when Y<0.8, it indicates that the data verification fails. Among them, when the data verification passes, it indicates that the received data has not been tampered with or damaged during transmission, and the data integrity and randomness meet the expectations, and the data can be considered reliable and valid; when the data verification fails, it indicates that the data may have been tampered with or damaged during transmission, or there are problems in the encryption or decryption process. After decrypting the ciphertext data using the hopping key, record the relevant information of the decryption result on the blockchain. These information include the hash value of the decrypted plaintext data, the decryption time, the hopping key identifier used, etc. Construct the above decryption information into a blockchain transaction, and write this information into the blockchain through a smart contract. This ensures the traceability and immutability of the decryption operation. Through the above steps, it is possible to decrypt using the corresponding hopping key, perform data verification by calculating the data verification index based on the restored plaintext data, and at the same time record the relevant information of the decryption result on the blockchain, improving the security and reliability of data decryption and verification.
[0101] In this embodiment, the running state is monitored in real time, and a generative adversarial network is used to detect attack patterns, including the following steps:
[0102] By deploying lightweight relay nodes, the running state data is monitored and collected in real time, including: encryption time consumption, decryption time consumption, encryption efficiency, decryption efficiency, key hopping frequency, network bandwidth utilization; the collected running state data is preprocessed, including: filtering and denoising, and normalization;
[0103] Collect the running state data in the normal running state and the running state data in the attack mode, and integrate them into a training data set. Among them, the attack modes include: unauthorized access, identity impersonation, and data tampering; label the running state data in the training data set, including: normal sample labels and attack sample labels; perform time series alignment on the running state data in the normal running state and the running state data in the attack mode;
[0104] Input the labeled training data set into the generative adversarial network model for training; during the training process, use the semi-supervised generative adversarial network model for training and learning;
[0105] Input the preprocessed running state data collected by real-time monitoring into the trained generative adversarial network model to detect whether an attack pattern appears.
[0106] Specifically, lightweight relay nodes such as Netdata are deployed in the system to monitor and collect real-time operation status data, including: encryption time consumption, decryption time consumption, encryption efficiency, decryption efficiency, key hopping frequency, network bandwidth utilization, etc. Filter and denoise the collected operation status data to remove noise and interference in the data and improve the data purity. Methods such as Savitzky-Golay filters can be used. Normalize data with different dimensions and magnitudes to make the data comparable and facilitate subsequent model training and analysis. Common normalization methods include Min-Max normalization and Z-Score normalization. Collect data under normal operation status and data under attack modes. The attack modes include: unauthorized access, identity impersonation, data tampering, etc. Label each sample in the dataset, dividing it into normal sample labels and attack sample labels. Align the operation status data under normal operation status and attack modes in time series to ensure the consistency and comparability of the data in the time dimension. Use a semi-supervised generative adversarial network model for training and learning. This model combines the adversarial training of the generator and discriminator and uses a small amount of labeled data to improve the performance of the model. Input the labeled training dataset into the generative adversarial network model for training. During the training process, the generator attempts to generate realistic data samples to deceive the discriminator, while the discriminator tries to distinguish between real data and generated data and uses the labeled data for supervised learning to improve the recognition ability of the generative adversarial network model for attack modes. Input the real-time monitored, collected, and preprocessed operation status data into the trained generative adversarial network model. The generative adversarial network model determines whether an attack mode appears in the current operation status based on the input data features. If an attack mode is detected, the system can take corresponding security measures in a timely manner, such as alarming, blocking connections, etc. Through the above steps, the generative adversarial network model can be used to monitor the operation status of the system in real time, effectively detect attack modes, and improve the security and reliability of the system.
[0107] In this embodiment, the defense ability and key hopping effectiveness are evaluated according to the detection results and the overall security evaluation value is calculated, including the following steps:
[0108] When the generative adversarial network model detects an attack mode, record the ratio of the number of successfully intercepted attacks to the total number of attacks, and calculate the attack interception rate; record the time interval T between detecting an attack and making a response, and calculate the attack response delay through the attack response delay formula: Obtain the attack response delay;
[0109] By counting the number of key hops and the number of defenses in the attack mode, calculate the ratio of the number of defenses to the number of key hops to obtain the key hopping effectiveness coefficient;
[0110] The overall security evaluation value is obtained by calculating the weighted average of the attack interception rate, attack response latency, and key hopping effectiveness coefficient. According to the overall security evaluation value, when the overall security evaluation value is greater than or equal to 0.85, it indicates high security; when the overall security evaluation value is greater than 0.55 and less than 0.85, it indicates medium security; when the overall security evaluation value is less than or equal to 0.55, it indicates low security.
[0111] Specifically, when the generative adversarial network model detects an attack pattern, the number of successfully intercepted attacks and the total number of attacks are recorded, and the attack interception rate is calculated. By recording the time interval from detecting an attack to the system's response and substituting it into the attack response latency calculation, the attack response latency is obtained. The number of key hops and the number of defenses in the attack pattern are counted, and the ratio of the number of defenses to the number of key hops is calculated to obtain the key hopping effectiveness coefficient. The weights of the attack interception rate, attack response latency, and key hopping effectiveness coefficient are set to 0.4, 0.3, and 0.3 respectively, and the weight values are adjusted according to the historical overall security evaluation value and the actual situation. According to the overall security evaluation value, the security levels are divided as follows: when the overall security evaluation value is greater than or equal to 0.85, it indicates high security; when the overall security evaluation value is greater than 0.55 and less than 0.85, it indicates medium security; when the overall security evaluation value is less than or equal to 0.55, it indicates low security. According to the security level, the security policy of the system can be adjusted. For example, at the low security level, the key hopping frequency is increased, the attack detection model is optimized, etc. Through the above steps, the defense ability of the system and the key hopping effectiveness can be evaluated based on the detection results, and the overall security evaluation value can be calculated, so as to comprehensively understand the security status of the system and take corresponding measures.
[0112] The above embodiments are only used to illustrate the technical method of the present invention and not to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical method of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A lightweight jump key encryption system based on the national secret algorithm, characterized in that: Includes the following modules: Key generation module: uses the national secret algorithm to generate the initial key, and generates the jump key according to the preset jump rules; Key jump management module: builds an LSTM neural network model to analyze key jump patterns in real time and detect abnormal conditions; By integrating national encryption algorithms and cross-chain technology, smart contracts can be managed automatically, and keys can be managed based on abnormal status detection results; Encryption module: obtains the currently used jump key from the key jump management module and encrypts the plaintext data by calculating the security index; Decryption module: After encryption, the corresponding jump key is used for decryption, and data verification is performed by calculating the data verification index based on the restored plaintext data; Monitoring and analysis module: monitors the operating status in real time and uses generative adversarial networks to detect attack patterns; evaluates defense capabilities and key jump effectiveness based on detection results and calculates the overall security assessment value.
2. According to claim 1, a lightweight jump key encryption system based on a national secret algorithm is characterized in that: The national secret algorithm is used to generate the initial key, and the jump key is generated according to the preset jump rule, including the following steps: First, use the SM2 algorithm to generate a public-private key pair using the elliptic curve encryption algorithm for identity authentication and key exchange; then use the SM3 algorithm to generate an intermediate key through SM3-KDF as the seed for the SM4 symmetric key; finally, use the SM4 algorithm to generate a symmetric key as the initial key actually used for data encryption; Collect physical data of IoT devices including chip ID, clock deviation, and environmental sensor data including temperature and humidity; combine physical data and environmental sensor data with the initial key through hash function to generate dynamic jump key; develop key derivation function combining geographic time and space characteristics, hash time and space stamp and Beidou positioning information to generate key fragments related to geographic location and time; The preset jump rules include: using the timestamp as an input parameter, calculating its hash value through a hash algorithm, using it as a seed, and combining it with a random number generator to generate a new key; using an increasing counter value as an input parameter, combining it with the initial key through the SM3-KDF key derivation function to generate a new key; Using the national secret algorithm and the preset jump rules, the current timestamp and the current counter value are obtained at each jump; the initial key, timestamp and counter value are used as input and calculated through the SM3-KDF key derivation function; the timestamp and counter value are converted into a byte array, and then concatenated with the initial key as the input seed data of SM3-KDF; through the SM3-KDF key derivation function, a new jump key is generated according to the input seed data and key length; an index list is generated through a pseudo-random seed to perform key jump; At each jump, the current timestamp and counter value are obtained; the current timestamp and counter value are weighted and summed to obtain the jump interval value, and the jump is performed according to the jump interval value; after each jump, the counter value is incremented, and the increment step is 1, 2 or 4; After each hop, the communicating parties use the SM2-based key exchange protocol to negotiate keys, use the newly generated hop key as the basis for negotiation, and update the key synchronously to ensure that both parties use the same hop key for communication. The information of the newly generated jump key, including key identifier, generation time, and key summary, is recorded on the blockchain.
3. According to claim 1, a lightweight jump key encryption system based on a national secret algorithm is characterized in that: Constructing an LSTM neural network model to analyze key jump patterns in real time and detect abnormal conditions includes the following steps: The raw data obtained from the cross-chain verification log and key jump record include: timestamp, node ID, verification delay, jump time, trigger condition, relay node broadcast delay and smart contract execution time; The dynamic features extracted from the original data include: jump interval standard deviation, cross-chain verification delay moving average, SM3 hash comparison abnormal number, relay node broadcast delay, and smart contract response time; The extracted dynamic features are preprocessed including: data cleaning and standardization; The preprocessed dynamic features are input into the LSTM neural network model for training, and the dynamic features extracted from real-time monitoring of cross-chain verification logs and key jump records are input into the trained LSTM neural network model for abnormal state detection; the confidence score p value is output based on the input dynamic features to detect whether the current state is abnormal; According to the confidence score p value, the threshold is set to 0.85; when the p value is less than the threshold, the current state is considered abnormal, and when the p value is greater than or equal to the threshold, the current state is considered normal.
4. According to claim 3, a lightweight jump key encryption system based on a national secret algorithm is characterized in that: By integrating the national encryption algorithm and cross-chain technology, smart contract automatic key management is carried out, and key management is carried out according to the abnormal state detection results, including the following steps: Introduce cross-chain verification interface and develop heterogeneous chain key intercommunication protocol. When the key is changed on Hyperledger Fabric chain, the key migration certificate is generated through cross-chain smart contract, and the verification node of Changan Chain completes the legitimacy verification. Use lightweight relay nodes to monitor key jump status in real time, use SM2 elliptic curve digital signature algorithm to sign broadcast messages, and generate timestamp protection fields; use SM3 hashing to prevent replay attacks; According to the trained LSTM neural network model, when an abnormal state is detected, it will actively trigger the key forced jump, terminate the current session and perform cross-chain consistency verification; According to the set time interval or data volume threshold, the key jump operation is triggered, the currently used key is updated to the next jump key, and the old key is securely processed.
5. According to claim 1, a lightweight jump key encryption system based on a national secret algorithm is characterized in that: Obtain the currently used jump key from the key jump management module and encrypt the plaintext data by calculating the security index, including the following steps: Preprocessing of plaintext data includes: data format verification and standardized padding; Use the obtained jump key in combination with the encryption algorithm to encrypt the input plaintext data; Among them, by collecting encryption parameters including: number of keys, key usage time, key usage frequency, information entropy, time complexity, space complexity, and number of known vulnerabilities, the security index formula is calculated as follows: The security index M is obtained; where K represents the number of keys, H is the information entropy, T is the key usage time, F is the key usage frequency, and C t is the time complexity, C s is the space complexity, q is the number of known vulnerabilities; w1, w2 and w3 represent weight coefficients of 0.4, 0.25 and 0.35 respectively, and the sum of w1, w2 and w3 is 1; According to the calculated security index M, set the threshold M0 to 0.55; when M≥M0, it is high security, and the CBC mode of the encryption algorithm is selected for encryption; when M<M0, it is low security, and the ECB mode of the encryption algorithm is selected and a random padding algorithm is introduced for encryption; among them, on the basis of the CBC mode, it is combined with the CFB or CTR mode for encryption; Combine the encrypted ciphertext data with the encryption parameters to form ciphertext information, and transmit the generated ciphertext information through a secure communication channel; after encrypting the plaintext data, use the zero-knowledge proof method to generate an encryption operation proof to verify whether the encryption process follows the security index formula and does not bypass the threshold judgment logic; record the encryption operation information on the blockchain.
6. According to the lightweight jump key encryption system based on the national secret algorithm of claim 1, it is characterized in that: After encryption, use the corresponding hopping key for decryption, and perform data verification by calculating the data verification index based on the restored plaintext data, including the following steps: According to the preset hopping rule, use the current hopping key for decryption; when the keys are out of sync, resynchronize the keys through the key negotiation protocol; Use the SM4 algorithm and the current jump key to decrypt the ciphertext data and restore the plaintext data; according to the decrypted plaintext data, count the number of occurrences and probability of each character in the plaintext data to obtain the Shannon entropy, and calculate the randomness coefficient formula of the plaintext data: Get the randomness coefficient S, where p i is the probability of each character appearing, and n is the total number of characters; the hash value is calculated for the plaintext data using the hash algorithm, and the integrity coefficient of the plaintext data is obtained by calculating the ratio with the received hash value; Calculation formula for data verification index: Obtain the data verification index Y, where S represents the randomness coefficient and Z represents the integrity coefficient; set the threshold as Y0 according to the data verification index. When Y ≥ Y0, it indicates that the data verification passes; when Y < Y0, it indicates that the data verification fails. After decrypting the ciphertext data with the hopping key, record the relevant information of the decryption result, including: the hash value of the decrypted plaintext data, the decryption time, and the hopping key identifier used, on the blockchain.
7. According to claim 1, a lightweight jump key encryption system based on a national secret algorithm is characterized in that: Monitor the running status in real time and use the generative adversarial network to detect the attack mode, including the following steps: By deploying lightweight relay nodes, monitor and collect the running status data in real time, including: encryption time consumption, decryption time consumption, encryption efficiency, decryption efficiency, key hopping frequency, network bandwidth utilization; preprocess the collected running status data, including: filtering and denoising and normalization; Collect the running status data in the normal running state and the running status data in the attack mode, and integrate them into a training data set. Among them, the attack modes include: unauthorized access, identity impersonation, and data tampering; label the running status data in the training data set, including: normal sample labels and attack sample labels; align the running status data in the normal running state and the running status data in the attack mode in time series; Input the labeled training data set into the generative adversarial network model for training; during the training process, use the semi-supervised generative adversarial network model for training and learning; Input the preprocessed running status data collected by real-time monitoring into the trained generative adversarial network model to detect whether an attack mode appears.
8. A lightweight jump key encryption system based on a national secret algorithm according to claim 7, characterized in that: Evaluate the defense ability and the effectiveness of key hopping according to the detection results and evaluate the overall security evaluation value, including the following steps: When the generative adversarial network model detects an attack mode, it records the ratio of the number of successfully intercepted attacks to the total number of attacks, and calculates the attack interception rate; it records the time interval T from the detection of the attack to the response, and calculates the attack response delay formula: Get attack response delay; By counting the number of key hops and the number of defenses in the attack mode, calculate the ratio of the number of defenses to the number of key hops to obtain the key hopping effectiveness coefficient; Obtain the overall security evaluation value by calculating the weighted average of the attack interception rate, the attack response delay, and the key hopping effectiveness coefficient; according to the overall security evaluation value, when the overall security evaluation value is greater than or equal to 0.85, it indicates high security; when the overall security evaluation value is greater than 0.85 and less than 0.55, it indicates medium security; when the overall security evaluation value is less than or equal to 0.55, it indicates low security.
Citation Information
Cited By
Anti-tracking camouflage method, system and terminal for intelligent circulation box
CN120358033A
Multi-device key binding type data encryption storage system based on national secret algorithm
CN120498687A
Water conservancy information safety protection method and system
CN120639418A
Command and dispatch plan data secure transmission method based on edge computing
CN120956488A
Multi-band multi-channel unmanned aerial vehicle RID signal analysis system
CN121056021A
