Electric energy metering data safety communication method based on coding and decoding technology

By adopting a method based on encoding and decoding technology in the secure communication of power metering data, using the Transformer model and dynamic key generation mechanism, the security and computing overhead of AI encryption methods in the secure communication of power metering data in the prior art are solved, and high security and efficient data encryption and decryption are achieved.

CN119834978APending Publication Date: 2025-04-15国网安徽省电力有限公司营销服务中心
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510208477.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

When the prior art applies AI encryption method to secure communication of power metering data, the security is general and the calculation overhead is large, making it difficult to reduce the calculation overhead while ensuring security.

Method used

The secure communication method of electrical energy metering data based on encoding and decoding technology is adopted, and a unique key is generated through a dynamic key generation mechanism, and the Transformer encoder and decoder models are used for encryption and decryption. Combined with a pseudo-random number generator to enhance randomness, and optimize the encoder and decoder through an adversarial training mechanism.

Benefits of technology

It realizes high security encryption and efficient decryption of power metering data, effectively resists data tampering, eavesdropping and man-in-the-middle attacks, and supports large-scale distributed applications to ensure the stable operation of the power system and the privacy protection of user data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119834978A_ABST
    Figure CN119834978A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data security communication, in particular to an electric energy metering data security communication method based on a coding and decoding technology. According to the technical scheme, the method comprises the following steps that electric energy metering data are collected, wherein the data comprise voltage, current, power and timestamps; a unique key is generated through a dynamic key generation mechanism, the key is based on a timestamp, an equipment unique identifier and a hash value of a data abstract, features are extracted through a Transform encoder, and then the randomness is enhanced in combination with a pseudo-random number generator; and inputting the electric energy metering data and the dynamic key into an encryption encoder model. Through dynamic key generation, a Transform codec model and an adversarial training mechanism, high-security encryption and efficient decryption of electric energy metering data are realized, data tampering, eavesdropping and man-in-the-middle attack are effectively resisted, large-scale distributed application is supported, and stable operation of a power system and privacy protection of user data are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data security communication, and in particular to a method for secure communication of electric energy metering data based on coding and decoding technology. Background Art

[0002] In modern power systems, energy metering devices are core equipment used to record and transmit users' electricity consumption data. The energy metering data generated by them is of great significance for the stable operation of the power system, user billing, electricity consumption analysis, and transaction fairness. However, with the rapid development of smart grid and Internet of Things technologies, the transmission and storage of energy metering data are facing more and more security threats, such as data tampering, theft, forgery, and illegal access. Some users may steal electricity by tampering with metering devices or modifying transmission data, and power supply companies may also cause users' trust crisis due to the opacity of data processing. Therefore, the trust issue between power supply companies and users has always been an important problem that plagues both parties.

[0003] Although traditional data encryption methods can provide a certain degree of data protection, they are insufficient in terms of data transmission integrity, confidentiality, and computational efficiency in the face of complex and ever-changing network environments and high-frequency and diverse attack methods. For example, encryption methods based on fixed keys are vulnerable to the threat of key leakage, and the data quantization process may lead to increased transmission overhead and prone to bit errors. In addition, traditional encryption methods often lack flexibility when dealing with dynamically changing scenarios, making it difficult to meet the needs of real-time communication and efficient metering in smart grids.

[0004] In recent years, artificial intelligence technology has shown broad application prospects in the field of data encryption. By introducing an encrypted communication method based on codec technology, the security and transmission efficiency of electric energy metering data can be effectively improved. In particular, the use of artificial intelligence models, which regard encryption as an encoding process and decryption as a decoding process, can not only achieve dynamic key generation and efficient encryption, but also enhance the anti-attack ability of the encryption process through the high nonlinear characteristics of deep learning models. However, the current research on the efficient application of AI encryption methods to secure communication of electric energy metering data is still not perfect, and how to reduce computing overhead while ensuring security is still a problem that needs to be solved urgently.

[0005] In summary, the present application proposes a method for secure communication of electric energy metering data based on coding and decoding technology. Summary of the invention

[0006] The purpose of the present invention is to propose a method for secure communication of electric energy metering data based on encoding and decoding technology in view of the problems in the background technology that the current AI encryption method is efficiently applied to secure communication of electric energy metering data, but the security is general and the computational overhead is large.

[0007] The technical solution of the present invention is a method for secure communication of electric energy metering data based on coding and decoding technology, comprising the following steps:

[0008] Collecting electric energy metering data, including voltage, current, power and timestamp;

[0009] Generate a unique key through a dynamic key generation mechanism, which is based on the hash value of the timestamp, device unique identifier and data digest, and enhances randomness by extracting features through a Transformer encoder combined with a pseudo-random number generator;

[0010] The electric energy metering data and the dynamic key are input into the encryption encoder model, and the model is sequentially transformed through a high-dimensional projection layer, a dot product layer and a Transformer encoder module to generate an encrypted message; wherein the Transformer encoder module captures the long-range dependency of the data through a self-attention mechanism and enhances the nonlinear features using a feedforward network;

[0011] Transmitting the encrypted message to a decryption end through a communication channel;

[0012] At the decryption end, the encrypted message and the dynamic key are input into the decryption decoder model, and the model gradually restores the original electric energy metering data through the reverse high-dimensional projection layer, the dot product layer and the Transformer decoder module; the Transformer decoder module realizes data recovery by combining the key features with the masked multi-head self-attention mechanism and the cross-attention mechanism;

[0013] Based on preset time intervals or usage thresholds, keys are updated through a dynamic key management mechanism, and secure storage and hash chain technology are used to ensure key integrity and resistance to replay attacks.

[0014] Optionally, the high-dimensional projection layer is transformed by a linear transformation formula:

[0015] X W [i,j]=x[i]·W p [j]+b p [j]

[0016] K W [i,j]=k[i]·W k [j]+b k [j]

[0017] Map the input data and key to a high-dimensional space, where x[i] represents the i-th element of the input energy metering data, k[i] represents the i-th element of the key, and W p and W k are the projection weight matrices of data and key, respectively,p and b k is the corresponding bias vector, X W , K W They are the data matrix and key matrix after projection to high dimension respectively.

[0018] Optionally, the output Y of the dot product layer D The formula is:

[0019] Y D [i,j]=X W [i,j]·K W [i,j]+b d [j]

[0020] Among them, b d is the bias term of the dot product layer; the coupling relationship between data and key is strengthened through element-by-element dot product operation, and the bias b is introduced d To increase encryption complexity.

[0021] Optionally, the self-attention mechanism of the Transformer encoder module dynamically adjusts the data weights by the following formula:

[0022]

[0023] Among them, Q is the query vector, K is the key vector, and V is the value vector. is the transpose of the key vector, Q, K, V are respectively the projected data matrix Y D Generate, d k To query the dimension of the vector, normalize it to avoid gradient explosion.

[0024] Dynamically adjust data weights and combine with feedforward networks:

[0025] FFN(z)=ReLU(zW1+b1)W2+b2

[0026] Among them, W1 and W2 are weight matrices, b1 and b2 are bias terms, and the self-attention mechanism and the feedforward network jointly generate highly random ciphertext to resist statistical analysis attacks;

[0027] Implement multi-layer nonlinear transformations to generate highly random encrypted messages that are resistant to statistical analysis.

[0028] Optionally, the cross attention mechanism of the decryption decoder module is expressed as:

[0029] z'=LayerNorm(z+CrossMultiHeadAttention(z,K W ))

[0030] Among them, K Wis the high-dimensional projection matrix of the key, CrossMultiHeadAttention extracts the associated features of the key and the encrypted message through the multi-head attention mechanism, and LayerNorm is used to standardize the intermediate output;

[0031] Combined with the key matrix K W features and gradually restore the high-dimensional representation of the original data.

[0032] Optionally, in the dynamic key generation mechanism, a pseudo-random number generator (PRNG) performs a bitwise XOR operation:

[0033] k rand =k enc ⊕PRNG(seed)

[0034] Among them, k enc is the key feature output by the Transformer encoder, ⊕ represents a bitwise XOR operation, and PRNG(seed) is a pseudo-random sequence generated based on a secure seed;

[0035] k=k rand [:L k ]

[0036] Among them, the key length is fixed to L k , enhance the unpredictability of the key, and fix the key length through the trimming operation.

[0037] Optionally, the dynamic key management mechanism includes:

[0038] Time-based update strategy: Update the key every time interval T. The formula is:

[0039] k new =f(k old ,timestamp);

[0040] Update strategy based on the number of uses, where k new , k old are the keys before and after the update, timestamp is the current timestamp, and f is the update function based on the hash chain. When the number of times the key is used reaches N max Updated when k new =F(k old ,N use ), where N use The number of times the current key has been used.

[0041] Optionally, the method optimizes the encoder and decoder through an adversarial training mechanism, specifically including:

[0042] Construct an attack model to simulate eavesdropping and minimize decryption errors Among them, θ E Represents the parameters of Eve decryption network;

[0043] The encoder and decoder are trained jointly, and the objective function is:

[0044] L=L enc-dec -βL Eve

[0045] in, is the joint loss function of the encoder, x is the plaintext energy metering data, is the data successfully decrypted by the decoder, y is the encrypted output of the encoder, L enc-dec Ensure the correct decryption of the decoder, L Eve is the decryption error of the attack model, and β is the adversarial weight parameter, which is used to balance the defense strength and decryption accuracy.

[0046] Optionally, the encrypted message passes through a normalization function: Converted to transmission format, the output of the back-projection layer Mapped to the range [-1,1].

[0047] Optionally, the method is applied to an electric vehicle charging network to resist man-in-the-middle attacks and data tampering by encrypting charging data in real time and combining it with a dynamic key update strategy.

[0048] Optionally, the method strengthens data trust through the following mechanisms:

[0049] Digital signature: Add a digital signature based on elliptic curve cryptography to the encrypted message to verify the legitimacy of the data source;

[0050] Authentication: Combines the device’s unique identifier with a secure hardware module to store keys and prevent unauthorized access.

[0051] Optionally, the method supports large-scale application through the following design:

[0052] Lightweight model: Uses depthwise separable convolution to compress the Transformer module parameters and reduce computational overhead;

[0053] Distributed key distribution: secure key synchronization based on P2P network to meet the distributed metering requirements of smart grid.

[0054] Compared with the prior art, the present invention has at least one of the following beneficial technical effects:

[0055] 1. The attention model is used as the core architecture for encryption encoding and decryption decoding, and its powerful feature representation capability is used to ensure the security and integrity of electricity metering data in complex environments.

[0056] 2. By combining the Transformer encoding unit with the pseudo-random number generator, keys are dynamically generated and regularly updated to enhance the system's anti-attack capabilities and prevent key leakage and replay attacks.

[0057] 3. Design and introduce simulated attack models, and use adversarial training methods to improve the robustness of the encoder and decoder to ensure that the system remains secure in the face of known and unknown attack methods.

[0058] 4. Combine multi-level encryption strategies such as high-dimensional projection, self-attention mechanism, and back-projection normalization to ensure the security of data during transmission and storage, and improve the ability to resist eavesdropping and tampering.

[0059] 5. Supports real-time encryption and decryption of large-scale electricity metering data, and has good scalability to adapt to more complex data environments in the future.

[0060] The present invention realizes high-security encryption and efficient decryption of electric energy metering data through dynamic key generation, Transformer codec model and adversarial training mechanism, effectively resists data tampering, eavesdropping and man-in-the-middle attacks, and supports large-scale distributed applications, ensuring the stable operation of the power system and the privacy protection of user data. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 It is a flow chart of a method for secure communication of electric energy metering data based on coding and decoding technology;

[0062] Figure 2 This is the architecture diagram of the encryption encoder model;

[0063] Figure 3 Schematic diagram for dynamic key generation and update. DETAILED DESCRIPTION

[0064] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and specific embodiments.

[0065] Example 1

[0066] like Figure 1 As shown, the present invention proposes a method for secure communication of electric energy metering data based on coding and decoding technology, and the specific steps of the method are described in detail below.

[0067] 1. Data Encryption Encoder Model

[0068] The encryption model is designed based on a deep neural network. It takes the energy metering data x and the randomly generated dynamic key k as input, and combines the high-dimensional projection layer, dot product layer, and Transformer encoder module to generate the encrypted message y. The main goal of the model is to generate a unique and irreversible encrypted message through multiple layers of nonlinear transformation and dynamic key injection to ensure the confidentiality and anti-attack capability of the data. The input energy metering data x is defined as follows:

[0069] x=[v,i,p,t]

[0070] The energy metering data contained in it are voltage, current, power and a timestamp for recording the acquisition time. The dynamic key k is a length of N k A vector of randomness used to introduce randomness into the encryption process.

[0071] 1.1 High-dimensional projection layer

[0072] Project the input data x and key k into a high-dimensional space and represent them using a linear layer. The formula is:

[0073] X W [i,j]=x[i]·W p [j]+b p [j]

[0074] K W [i,j]=k[i]·W k [j]+b k [j]

[0075] Among them, W p , W k are the weight matrices of the linear projection layer, b p , b k are the bias vectors of the linear projection layer, X W , K W They are the data matrix and key matrix after projection to high dimensions. The projection layer can increase the dimension of the data and provide a richer feature space for subsequent nonlinear transformations.

[0076] 1.2. Dot Product Layer

[0077] By performing high-dimensional linear projection on the power metering data and the key, we can obtain X W , K W After that, X W , K W Perform element-by-element dot product operations and add bias b d :

[0078] Y D [i,j]=X W [i,j]·K W[i,j]+b d [j]

[0079] The dot product operation can strengthen the coupling relationship between data and key, and the nonlinear operation of dot product can increase the complexity of data encryption.

[0080] 1.3 Transformer Encoder Module

[0081] The output Y of the dot product layer D As input, it enters the Transformer encoder module for processing, including:

[0082] (1) Self-Attention

[0083] The Transformer encoder uses the self-attention mechanism to capture long-range dependencies in the data. The formula is as follows:

[0084]

[0085] By adding Y D The attention matrix is ​​generated by processing the query vector Q, key vector K and value vector V respectively, and the dimension d of the query vector is used k To perform normalization, dynamically adjust the weights between data, extract key features, enhance the correlation within encrypted data, and ensure the hidden nature of information.

[0086] (2) Feed-Forward Network (FFN)

[0087] The data processed by the self-attention mechanism is further transformed nonlinearly through the feedforward network:

[0088] FFN(z)=ReLU(zW1+b1)W2+b2

[0089] The expressiveness and nonlinear complexity of the encoder can be further enhanced.

[0090] 1.4. Back-projection layer and encrypted data generation

[0091] The output Y of the Transformer encoder T The back-projection layer is used to restore the target dimension to form the final encrypted message:

[0092]

[0093] By restoring high-dimensional data to low-dimensional space, transmission consumption is reduced, while retaining the key characteristics introduced in the encoding process.

[0094] Finally, the result of the back projection layer output The normalization function g is used to convert the encrypted message into one suitable for transmission:

[0095]

[0096] The normalization function uses the tanh function, and y is the encoded encrypted data sent to the decoding end.

[0097] 2. Data Decryption Decoder Model

[0098] The decryption model is designed to receive encrypted data y and combine it with the dynamic key k to gradually restore the original energy metering data x through the decryption network. The decryption process is the reverse operation of the encryption process. The model design focuses on the accuracy and efficiency of decryption to ensure that the original data can be accurately restored only when the legitimate key is provided.

[0099] 2.1 Input Data

[0100] The input of the decryption network consists of the encrypted message y and the dynamic key k. y is generated by the encryption model and transmitted to the decryption end through the communication channel. k is the key shared by the decryption end and the encryption end to ensure the consistency of the decryption operation. Assume that y is of length N b The encrypted message vector, k is the length N k The key vector is:

[0101]

[0102] 2.2 Decoding process

[0103] (1) High-dimensional projection layer

[0104] In the decryption process, the encrypted message y and the key k need to be reprojected into the high-dimensional space of the encryption process to ensure that the characteristics of the key can be correctly injected into the decoder network. The projection layer operation formula is as follows:

[0105] Y W [i,j]=y[i]·W y [j]+b y [j]

[0106] K W [i,j]=k[i]·W k [j]+b k [j]

[0107] The same high-dimensional projection processing is used as in the decoder, keeping the encrypted message y and the key k in the same high dimension.

[0108] (2) Dot Product Layer

[0109] Through the element-by-element dot product operation, the projected data matrix X is restored W :

[0110] X W [i,j]=Y W [i,j]·K W [i,j]+b d [j]

[0111] The core function of the inverse operation of the dot product layer is to use the key matrix K W The encrypted data is restored to the initial decrypted data matrix X W .

[0112] (3) Transformer Decoder

[0113] Projected data X W After being processed by the Transformer decoder, the high-dimensional features of the original measurement data are further restored. The decoder also uses the self-attention mechanism, but the decoding process combines the characteristics of the key to ensure that it is only valid for legal encrypted messages. The formula is as follows:

[0114] z=LayerNorm(X W +MaskedMultiHeadAttention(X W ))

[0115] z'=LayerNorm(z+CrossMultiHeadAttention(z,K W ))

[0116]

[0117] Masked Multi-Head Attention is used in the decoder to capture the encrypted message X W The multi-head cross-attention is used to combine the characteristics of the decryption key, extract key information from k, and interact with the encrypted message y to generate high-level features. The data processed by the attention mechanism is further nonlinearly transformed through the feedforward network to obtain the decrypted intermediate data output by the Transformer decoder

[0118] (4) Back-projection layer and decoding results

[0119] The output of the Transformer decoder is reduced in dimension through the back-projection layer and finally restored to the original power metering data.

[0120]

[0121] The result after decryption Represents the reconstructed value of the original energy metering data:

[0122]

[0123] in, They represent the voltage, current, power and timestamp after decryption and restoration respectively. By comparing and the real data x, the accuracy of the decryption process can be verified.

[0124] 3. Dynamic Key Generation and Management

[0125] The generation and management of dynamic keys is a key step in ensuring communication security. Keys are not only used in the encryption process, but also in the decryption process to perform cross-attention operations with encrypted data to restore the original data. A reasonable key generation and management mechanism can effectively defend against eavesdropping and replay attack threats, while improving the flexibility and security of the system.

[0126] 3.1 Dynamic Key Generation Method

[0127] The dynamic key generation adopts the Transformer encoder-based method to map the input features into a high-dimensional key vector to ensure the complexity and randomness of the key. The basic process of generating the key is as follows:

[0128] k input =[timestamp,device ID,hash(x)]

[0129] Where timestamp is the current timestamp, and device ID is the number that uniquely identifies the device. hash(x) is the data summary, usually using the SHA-256 algorithm. The input features are passed through the Transformer encoder to extract key features and generate a key:

[0130] k enc =Encoder(k input )

[0131] The randomness of the key is further enhanced by introducing a pseudo-random number generator (PRNG) to prevent prediction attacks:

[0132] k rand =k enc ⊕PRNG(seed)

[0133] Where ⊕ represents a bitwise XOR operation, and PRNG (seed) is a random sequence generated by the system security seed. The final key length is fixed to L k , use the following formula for clipping:

[0134] k=k rand [:L k ]

[0135] 3.2 Key Management Mechanism

[0136] Key management involves key storage, update, distribution and revocation. For dynamic keys, a time-based update strategy and a usage-based update strategy are used simultaneously to ensure their security and effectiveness. For time-based updates, new keys are regenerated at fixed time intervals T:

[0137] k new =f(k old ,timestamp)

[0138] For updates based on usage count, when the key is used a certain number of times N, max Automatically update when:

[0139] k new =f(k old ,N use )

[0140] The key is stored in a secure storage area of ​​the device (such as TPM or HSM) to prevent unauthorized access. The integrity of the key is ensured using a hash chain. When the device is lost or a security threat is detected, the key can be revoked remotely.

[0141] 3.3 Key Security Analysis

[0142] To evaluate the security of the key, the entropy of the key is evaluated to measure its randomness, and the following formula is used for evaluation:

[0143]

[0144] where p i Represents the probability of the i-th symbol appearing in the key. The birthday attack (Birthday Attack is an attack method in probability theory, based on the birthday paradox principle, mainly used for collision attacks, especially for hash collisions in hash functions and encryption algorithms) is used to analyze the probability of key collision:

[0145]

[0146] Where N is the number of keys generated, L k is the size of the key space. The dynamic key k can effectively resist common attacks such as brute force, dictionary attacks, and side channel attacks.

[0147] 4. System Anti-Attack Capability

[0148] In the process of energy metering data communication, malicious attackers may try to decipher encrypted data through various means, thereby destroying the confidentiality, integrity and availability of the data. In order to improve the system's anti-attack capability, it is necessary to design corresponding defense strategies for possible attack methods, such as eavesdropping attacks, known plaintext attacks, and man-in-the-middle attacks.

[0149] 4.1 Attack Model Design

[0150] The decryption network aims to steal the plaintext information x of the encrypted communication. Its model structure usually does not rely on the shared key k, but trains the decryption model by observing a large amount of encrypted data y to minimize the decryption error. Eve's decryption process can be modeled as:

[0151]

[0152] Among them, y is the encrypted output (ciphertext) of the encoder, Represents the projection layer of the attack model simulation, The decoder layer representing the attack model simulation (usually using a deep learning model), The back-projection layer simulated for the attack model, Plaintext energy metering data that the attack model attempts to recover.

[0153] 4.2 Codec and Attack Model Training

[0154] In order to ensure the security of AI encrypted communication systems, it is necessary to jointly train the encoder and decoder models, build an attack decryption model, simulate possible attack methods, and evaluate the system's anti-attack capabilities.

[0155] (1) Joint training of codec

[0156] The encoder and decoder need to share the key k and jointly optimize to maximize the information integrity of the energy metering data x during the encrypted transmission process, while enhancing the randomness of the ciphertext, making it difficult for the attack model to crack. The joint loss function of encoding and decoding can be expressed as:

[0157]

[0158] Where x is the plain text electric energy metering data, is the data successfully decrypted by the decoder, y is the encrypted output (ciphertext) of the encoder, the first term measures the decryption error of the decoder, the second term measures the entropy of the ciphertext to ensure that the data has high randomness, and λ is a hyperparameter that weighs the decryption accuracy and ciphertext randomness.

[0159] (2) Training of attack models

[0160] The goal of the attack model is to reconstruct the original data x using the observed ciphertext y without knowing the key k. Its training goal is to minimize the decryption error:

[0161]

[0162] Among them, θ E Represents the parameters of Eve decryption network. The attack model architecture can use deep neural networks, such as self-attention mechanism, RNN or Transformer, to improve the ability to fit the encryption pattern.

[0163] (3) Joint confrontation training

[0164] In order to enhance the system's anti-attack capability, we can use the generative adversarial training (GAN-like) method to increase the defense capability of the attack model during the training of the encoder and decoder. The goal is to make the encoder generate ciphertext that is more difficult to crack while improving the decryption accuracy of the decoder. The objective function of the joint adversarial training is as follows:

[0165] L=L enc-dec -βL Eve

[0166] Where L enc-dec Ensure the correct decryption of the decoder, L Eve This makes the decryption effect of the attack model the worst, and β is the adversarial weight parameter to prevent overfitting.

[0167] The training process is to first fix the decoder and encoder parameters, train the attack model, and observe its attack decryption effect; then fix the attack model parameters and optimize the decoder parameters to reduce the decryption accuracy of the attack model; alternate training to finally achieve the optimal balance between defense and decryption.

[0168] It is worth noting that if Figure 1As shown in the figure, the system architecture diagram clearly shows the connection between power metering data acquisition, dynamic key generation, encoder encrypted data, simulated attack decryption, decoder decrypted data, and received power metering data. The power metering data is first collected by the acquisition device, and a dynamic key is generated based on the data information, and transmitted to the encoder module for encryption processing. The encryption process adopts an encoder model based on the self-attention mechanism to ensure the security and privacy of the data. Subsequently, the encrypted data enters the simulated attack decryption module, which simulates potential attack behaviors such as man-in-the-middle attacks and eavesdropping to verify the system's anti-attack capabilities. The decryptor module receives the data sent by the encoder after encryption, and uses the corresponding decoding strategy to restore the data to ensure the integrity and availability of the data. Finally, the decrypted power metering data is accurately transmitted to the receiving end to support subsequent power analysis and application. The entire process adopts dynamic key management, deep learning encryption technology, and anti-attack training strategies to ensure the secure transmission and accurate decoding of power data in complex environments.

[0169] like Figure 2 As shown, in the present invention, the connection relationship between the input data and the key, the high-dimensional projection layer, the dot product layer, the self-attention encoding layer, the back-projection and normalization layer, and the encoded encrypted data in the encoder structure is shown. First, the electric energy metering data and the dynamic key are used as input and enter the high-dimensional projection layer, which maps the input data to a higher-dimensional feature space through a linear transformation to enhance the representation ability of the data. Then, after the dot product layer, the similarity between the input data is calculated to provide a weighted basis for the subsequent attention mechanism. Subsequently, the self-attention encoding layer uses a multi-head self-attention mechanism to perform deep feature extraction on the data, mine the correlation and pattern inside the data, and improve the confidentiality and anti-attack ability of the encoding. After that, the data passes through the back-projection and normalization layer to map the high-dimensional features back to the original data dimension, and normalizes the data at the same time to maintain the consistency and stability of the data. Finally, the encoded encrypted data is output to provide security for subsequent data transmission and storage. The whole process relies on the powerful feature learning ability of the deep learning model to ensure the secure encryption and efficient transmission of electric energy metering data. The decoder structure is roughly the same as the encoder, except that the self-attention-based decoding layer is different from the encoder's self-attention layer encoding layer, and cross attention is used for decoding.

[0170] like Figure 3As shown in the figure, the process of inputting electric energy metering metadata, Transformer encoding unit, pseudo-random number generator, random clipping to fixed length, obtaining dynamic keys, and updating based on time intervals or usage times is shown. First, the electric energy metering metadata is taken as input and enters the Transformer encoding unit, which extracts the deep features of the metadata through a deep self-attention mechanism, captures the temporal correlation and implicit patterns in the data, and ensures the randomness and diversity of key generation. Subsequently, the extracted features are passed to the pseudo-random number generator (PRNG), which generates highly random sequences based on the input features, providing a basis for the generation of dynamic keys. Next, the generated sequence stream will be randomly clipped to a fixed length to ensure that the key meets the length requirements of the encryption system and reduces redundant data while maintaining sufficient security. Finally, the system obtains the dynamic key and makes a key update decision based on the preset time interval or number of uses to ensure the timeliness and security of the key and prevent security risks caused by long-term use. This dynamic key generation and update mechanism effectively enhances the security and flexibility of electric energy metering data encryption and provides the system with stronger anti-attack capabilities.

[0171] The present invention adopts the attention model as the core architecture of encryption encoding and decryption decoding, and uses its powerful feature representation ability to ensure the security and integrity of electric energy metering data in complex environments. By combining the Transformer encoding unit with the pseudo-random number generator, the key is dynamically generated and regularly updated to enhance the system's anti-attack capability and prevent key leakage and replay attacks.

[0172] The present invention designs and introduces a simulated attack model, and uses adversarial training to improve the robustness of the encoder and decoder, ensuring that the system remains secure in the face of known and unknown attack methods. Combined with multi-level encryption strategies such as high-dimensional projection, self-attention mechanism, and back-projection normalization, the security of data during transmission and storage is ensured, and the ability to resist eavesdropping and tampering is improved. The present invention supports real-time encryption and decryption of large-scale electric energy metering data, and has good scalability to adapt to more complex data environments in the future.

[0173] The above specific embodiments are only several optional embodiments of the present invention. Based on the technical solutions of the present invention and the relevant inspirations of the above embodiments, those skilled in the art can make various alternative improvements and combinations to the above specific embodiments.

Claims

1. A method for secure communication of electric energy metering data based on coding and decoding technology, characterized in that: The following steps are involved: Collect power metering data, including voltage, current, power and timestamp; Generate a unique key through a dynamic key generation mechanism, which is based on the hash value of the timestamp, device unique identifier and data digest, and enhances randomness by extracting features through a Transformer encoder combined with a pseudo-random number generator; The electric energy metering data and the dynamic key are input into an encryption encoder model, and the model is sequentially transformed nonlinearly through a high-dimensional projection layer, a dot product layer, and a Transformer encoder module to generate an encrypted message; Transmitting the encrypted message to a decryption end through a communication channel; At the decryption end, the encrypted message and the dynamic key are input into a decryption decoder model, and the model gradually restores the original electric energy metering data through the reverse high-dimensional projection layer, the dot product layer and the Transformer decoder module; Based on preset time intervals or usage thresholds, keys are updated through a dynamic key management mechanism, and secure storage and hash chain technology are used to ensure key integrity and resistance to replay attacks.

2. According to claim 1, a method for secure communication of electric energy metering data based on coding and decoding technology is characterized in that: The high-dimensional projection layer is transformed by the linear transformation formula: X W [i,j]=x[i]·W p [j]+b p [j] K W [i,j]=k[i]·W k [j]+b k [j] Map the input data and key to a high-dimensional space, where x[i] represents the i-th element of the input energy metering data, k[i] represents the i-th element of the key, and W p and W k are the projection weight matrices of data and key, respectively, p and b k is the corresponding bias vector, X W , K W They are the data matrix and key matrix after projection to high dimension respectively.

3. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 2 is characterized in that: The output Y of the dot product layer D The formula is: Y D [i,j]=X W [i,j]·K W [i,j]+b d [j] Among them, b d is the bias term of the dot product layer; the coupling relationship between data and key is strengthened through element-by-element dot product operation, and the bias b is introduced d To increase encryption complexity.

4. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 3 is characterized in that: The self-attention mechanism of the Transformer encoder module dynamically adjusts the data weights through the following formula: Among them, Q is the query vector, K T is the transpose of the key vector, K is the key vector, V is the value vector, Q, K, V are respectively the projected data matrix Y D Generate, d k To query the dimension of the vector, normalize it to avoid gradient explosion. Dynamically adjust data weights and combine with feedforward networks: FFN(z)=ReLU(zW1+b1)W2+b2 Among them, W1 and W2 are weight matrices, b1 and b2 are bias terms, and the self-attention mechanism and the feedforward network jointly generate highly random ciphertext; Implement multi-layer nonlinear transformations to generate highly random encrypted messages that are resistant to statistical analysis.

5. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 4 is characterized in that: The cross attention mechanism of the decryption decoder module is expressed as: z'=LayerNorm(z+CrossMultiHeadAttention(z,K W )) Among them, K W is the high-dimensional projection matrix of the key, CrossMultiHeadAttention extracts the associated features of the key and the encrypted message through the multi-head attention mechanism, and LayerNorm is used to standardize the intermediate output; Combined with the key matrix K W features and gradually restore the high-dimensional representation of the original data.

6. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 1 is characterized in that: In the dynamic key generation mechanism, the pseudo-random number generator performs a bitwise XOR operation: Among them, k enc is the key feature output by the Transformer encoder, Represents a bitwise XOR operation, and PRNG is a pseudo-random sequence generated based on a secure seed; k=k rand [:L k ] Among them, the key length is fixed to L k , enhance the unpredictability of the key, and fix the key length through the trimming operation.

7. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 1 is characterized in that: The dynamic key management mechanism includes: Time-based update strategy: Update the key every time interval T. The formula is: k new =f(k old ,timestamp); Update strategy based on the number of uses, where k new , k old are the keys before and after the update, timestamp is the current timestamp, and f is the update function based on the hash chain. When the number of times the key is used reaches N max Updated when k new =f(k old ,N use ), where N use The number of times the current key has been used.

8. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 1, characterized in that: The encoder and decoder are optimized through adversarial training mechanism, including: Construct an attack model to simulate eavesdropping and minimize decryption errors Among them, θ E Represents the parameters of Eve decryption network; The encoder and decoder are trained jointly, and the objective function is: L=L enc-dec -βL Eve in, is the joint loss function of the encoder, x is the plaintext energy metering data, is the data successfully decrypted by the decoder, y is the encrypted output of the encoder, L enc-dec Ensure the correct decryption of the decoder, L Eve is the decryption error of the attack model, and β is the adversarial weight parameter, which is used to balance the defense strength and decryption accuracy.

9. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 1, characterized in that: The encrypted message passes through the normalization function: Converted to transmission format, the output of the back-projection layer Mapped to the range [-1,1].

10. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 1, characterized in that: The method is applied to an electric vehicle charging network, and resists man-in-the-middle attacks and data tampering by encrypting charging data in real time and combining a dynamic key update strategy.

11. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 1, characterized in that: The method described strengthens data trust through the following mechanisms: Digital signature: Add a digital signature based on elliptic curve cryptography to the encrypted message to verify the legitimacy of the data source; Authentication: Combines the device’s unique identifier with a secure hardware module to store keys and prevent unauthorized access.

12. The method for secure communication of electric energy metering data based on coding and decoding technology according to claim 1, characterized in that: The method is designed to support large-scale applications by: Lightweight model: Uses depthwise separable convolution to compress the Transformer module parameters and reduce computational overhead; Distributed key distribution: secure key synchronization based on P2P network to meet the distributed metering requirements of smart grid.

Citation Information

Cited By

  • Sensing data chip-level dynamic key negotiation method

    CN120433934A

  • Chip-level dynamic key negotiation method for sensor data

    CN120433934B