Power data key negotiation and symmetric encryption method, system, device and medium
Through the method of generating dynamic S-boxes by grayscale calculation and chaotic system, the problems of security and inefficiency in power data transmission are solved, and efficient and secure power data encryption is achieved.
Patent Information
- Application Number
- CN202510551348.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-05
AI Technical Summary
There are problems in the transmission of existing power data, such as large computing overhead, complex key management, and insufficient security of key distribution. Traditional encryption methods are inefficient and difficult to meet the security needs of power systems.
The key negotiation and symmetric encryption method based on grayscale calculation is adopted, and the first preprocessing and second preprocessing of the power data is performed, and the grayscale matrix is generated and the shared key generation permutation structure is used for encryption, and the dynamic S box is initialized by the grayscale difference factor and the chaotic system to initialize the dynamic S box for key negotiation and encryption.
It improves the security and efficiency of power data transmission, ensures that data is not stolen or tampered during transmission, simplifies the encryption process, and is suitable for all kinds of power systems.
Smart Images

Figure CN120433923A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power data transmission, and in particular to a method, system, device and medium for power data key negotiation and symmetric encryption. Background Art
[0002] With the rapid development of smart grids and energy internet, the secure transmission of power system data has become a core requirement. Power data is characterized by strong real-time performance, large scale, and high heterogeneity. Traditional encryption methods (such as asymmetric encryption such as RSA and ECC) have problems such as high computational overhead and complex key management. Symmetric encryption, while highly efficient, faces the challenge of insufficient key distribution security. In the existing technology, solutions based on chaos theory or quantum key distribution have the defects of high implementation complexity and strong hardware dependence in power scenarios. Therefore, there is an urgent need for an encryption method that is lightweight, highly secure, and adaptable to the characteristics of power data.
[0003] Grayscale measurement, a technology based on data feature extraction, is widely used in image processing and signal analysis. Its core idea is to generate dynamic keys by quantifying the local features of data. However, no research has yet combined grayscale measurement with power data encryption. This application proposes a key negotiation and symmetric encryption method based on grayscale measurement. This method generates a shared key from the dynamic features of power data and designs a lightweight encryption process that combines security and efficiency. Summary of the Invention
[0004] In view of the above existing problems, this application is proposed.
[0005] Therefore, the present application provides a method, system, device and medium for power data key negotiation and symmetric encryption, which can solve the problem of insufficient security of power data transmission in the prior art.
[0006] To solve the above technical problems, this application provides the following technical solutions:
[0007] In a first aspect, the present application provides a method for power data key negotiation and symmetric encryption, comprising:
[0008] Acquiring target power data, and performing a first preprocessing on the target power data;
[0009] The first preprocessing includes performing a first division and a first conversion on the target power data;
[0010] The first division is used to divide the target power data into a plurality of data blocks of fixed length;
[0011] The first conversion converts the first division result into a grayscale matrix;
[0012] performing a second preprocessing on the target power data;
[0013] The second preprocessing includes calculating a grayscale difference factor and obtaining a target shared key through the grayscale difference factor;
[0014] Obtaining target statistical features of the grayscale matrix according to the first preprocessing result, and generating a first permutation structure in combination with the target shared key obtained after the second preprocessing;
[0015] The target power data is encrypted according to the first permutation structure.
[0016] As a preferred solution of the power data key negotiation and symmetric encryption method described in this application, the first preprocessing further includes:
[0017] A preset time window is dynamically adjusted according to the sampling rate;
[0018] Dividing the target power data into a plurality of data blocks of fixed length according to the time window;
[0019] Perform three-level feature fusion on several fixed-length data blocks after the first division result to obtain a grayscale matrix.
[0020] As a preferred solution of the power data key negotiation and symmetric encryption method described in this application, the second preprocessing of the target power data includes:
[0021] Determine the two communicating parties for power data transmission and obtain the power data of the two communicating parties;
[0022] Establishing a grayscale difference factor expression based on the two communicating parties, wherein the grayscale difference factor is obtained by the grayscale value of the center pixel and the neighboring pixel values;
[0023] Select several data blocks from both communicating parties for parameter exchange and generate a target shared key.
[0024] As a preferred solution of the power data key negotiation and symmetric encryption method described in this application, wherein: the three-level feature fusion includes first-level features, second-level features, and third-level features;
[0025] The first-level features are amplitude features of each data block;
[0026] The second-level features are differential features of each data block;
[0027] The third level features are frequency domain features of each data block;
[0028] A grayscale mapping function of three-level feature fusion is obtained, and the grayscale mapping function is converted into a grayscale matrix.
[0029] This preferred solution can more comprehensively extract the characteristic information of the target power data, improving the accuracy and security of key negotiation. By fusing features at different levels, a richer data representation can be obtained, thereby enhancing the complexity and unpredictability of the key and effectively preventing unauthorized users from cracking and stealing power data.
[0030] As a preferred solution of the power data key negotiation and symmetric encryption method described in this application, the third-level features include:
[0031] Improved Fourier transform is used for non-uniform sampling to obtain harmonic analysis results with increased accuracy.
[0032] performing frequency band extraction on the harmonic analysis result with increased accuracy;
[0033] The frequency band extraction is performed by introducing a 1 / 3 octave filter bank;
[0034] The root mean square value of each frequency band after the frequency band extraction operation is calculated as the frequency domain feature vector.
[0035] As a preferred solution of the power data key negotiation and symmetric encryption method described in this application, wherein: obtaining the target statistical features of the grayscale matrix according to the first preprocessing result, and generating a first permutation structure in combination with the target shared key obtained after the second preprocessing includes:
[0036] The target statistical features include the mean, variance and local texture features of the grayscale matrix;
[0037] The first permutation structure is a dynamic S-box, and the dynamic S-box is generated by initialization of a chaotic system;
[0038] Generate an initial seed value of the S-box based on the target shared key and the target statistical characteristics of the grayscale matrix in combination with the HMAC-SM3 algorithm;
[0039] Based on the dynamic S-box, an 8×8 permutation network is constructed, and its connection matrix is dynamically generated by a chaotic sequence.
[0040] As a preferred solution of the power data key negotiation and symmetric encryption method described in this application, wherein: generating the first permutation structure includes:
[0041] Each element of the connection matrix is limited to the range of [0, 255] [0, 255] by a modulo operation;
[0042] Perform cryptographic performance tests on the generated S-boxes, including nonlinearity, differential uniformity, and avalanche effect evaluation;
[0043] If the test result does not reach the preset safety threshold, the chaotic system parameters or target statistical feature weights are readjusted until the safety requirements are met;
[0044] The first permutation structure is finally output in the form of a dynamic S-box and used for subsequent encryption operations.
[0045] In a second aspect, the present application provides a power data key negotiation and symmetric encryption system, including:
[0046] a first preprocessing module, configured to obtain target power data and perform a first preprocessing on the target power data;
[0047] The first preprocessing includes performing a first division and a first conversion on the target power data;
[0048] The first division is used to divide the target power data into a plurality of data blocks of fixed length;
[0049] The first conversion converts the first division result into a grayscale matrix;
[0050] A second preprocessing module, configured to perform a second preprocessing on the target power data;
[0051] The second preprocessing includes calculating a grayscale difference factor and obtaining a target shared key through the grayscale difference factor;
[0052] a structure acquisition module, configured to acquire target statistical features of the grayscale matrix according to the first preprocessing result, and generate a first permutation structure in combination with a target shared key obtained after the second preprocessing;
[0053] An encryption module is configured to encrypt the target power data according to the first replacement structure.
[0054] In a third aspect, the present application provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described above when executing the computer program.
[0055] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method described above when the computer program is executed by a processor.
[0056] Compared with the prior art, the beneficial effects of the present application are as follows: the present application proposes a method for power data key negotiation and symmetric encryption, obtains target power data, and performs a first preprocessing on the target power data; performs a second preprocessing on the target power data; obtains the target statistical characteristics of the gray matrix based on the first preprocessing result, and generates a first permutation structure in combination with the target shared key obtained after the second preprocessing; and encrypts the target power data according to the first permutation structure. The present application greatly improves the security of power data. During the power data transmission process, the method of the present application can ensure that the data is not stolen or tampered with during the transmission process, effectively preventing the risk of data leakage. At the same time, the implementation steps of the method are concise and clear, and it is easy to promote and apply in various power systems, providing a strong guarantee for the stable operation of the power system.
[0057] Specifically, obtaining target power data and performing a first preprocessing on the target power data may include converting the target power data into a digital signal to facilitate subsequent processing. Performing a second preprocessing on the target power data may include data compression to reduce the bandwidth and time required for data transmission. The specific steps and algorithms for the first and second preprocessing can be selected and adjusted based on actual needs to ensure the smooth progress of subsequent key negotiation and encryption processes. Furthermore, the target statistical features of the grayscale matrix may be key indicators reflecting the characteristics of the power data, such as mean, variance, kurtosis, etc. These features are crucial for the subsequent generation of the permutation structure and encryption process.
[0058] In summary, the design concept of this application, which comprehensively considers data security, transmission efficiency and encryption effect, gives this application significant advantages and broad application prospects in the field of power system data protection. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0060] Figure 1 A flowchart of a method for power data key negotiation and symmetric encryption provided in one embodiment of the present application. DETAILED DESCRIPTION
[0061] To make the above-mentioned purposes, features, and advantages of this application more clearly understood, the following detailed description of the specific embodiments of this application is given in conjunction with the accompanying drawings. It is obvious that the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary persons in this field without creative work should fall within the scope of protection of this application.
[0062] Example 1, with reference to Figure 1 , which is the first embodiment of the present application, provides a power data key negotiation and symmetric encryption method, including:
[0063] There are some problems in existing related technologies, such as complex key negotiation process, low encryption efficiency, insufficient data security, etc. These problems limit the security and reliability of power data during transmission and storage.
[0064] This application provides a method that can effectively solve the above-mentioned problems. Next, we will explain in detail how to implement the power data key negotiation and symmetric encryption method in combination with multiple embodiments.
[0065] Figure 1 A method flow chart of a power data key negotiation and symmetric encryption method is shown, including:
[0066] S101, acquiring target power data and performing a first preprocessing on the target power data;
[0067] It should be noted that in order to achieve the transmission of power data between communicating parties, the data architecture and data exchange format between the two parties need to be clearly defined. By obtaining the target power data of the communicating parties and designing a preprocessing step to analyze the target power data, the data architecture and data exchange format between the communicating parties can be clearly obtained.
[0068] In an optional embodiment, the first preprocessing step, aimed at obtaining the data architecture and data exchange format, can be performed by format conversion and standardization of the target power data. Specifically, the target power data can be converted from its original format into a unified, standardized data format for subsequent processing and analysis. This format conversion ensures data consistency and comparability, thereby improving the efficiency and accuracy of data processing. Furthermore, standardization can remove redundant information from the data, further simplifying the data structure and facilitating subsequent data exchange and key negotiation.
[0069] It should be noted that general preprocessing methods cannot meet the requirements of this application. Therefore, this application designs the operation of performing a first division and a first conversion on the target power data in order to more efficiently extract key information and provide a more accurate data basis for the subsequent key negotiation process.
[0070] In an optional embodiment, the first partitioning operation may divide the target power data into multiple subsets based on the attributes or characteristics of the data, with each subset containing data items with similar attributes or characteristics. This can make subsequent processing and analysis more targeted and improve processing efficiency.
[0071] In an optional embodiment, the first conversion operation further transforms the partitioned subsets, such as normalizing and discretizing the data, to better adapt it to the subsequent key agreement algorithm. This preprocessing ensures that the data input to the key agreement algorithm is high-quality and highly relevant, thereby improving the efficiency and security of key agreement.
[0072] In an embodiment of the present application, the first preprocessing includes performing a first division and a first conversion on the target power data.
[0073] In the embodiment of the present application, the first division is used to divide the target power data into several data blocks of fixed length.
[0074] In the embodiment of the present application, the first conversion converts the first division result into a grayscale matrix.
[0075] In the embodiment of the present application, the first preprocessing further includes:
[0076] Preset time window, which is dynamically adjusted according to the sampling rate;
[0077] Divide the target power data into several fixed-length data blocks according to the time window;
[0078] Perform three-level feature fusion on several fixed-length data blocks after the first division result to obtain a grayscale matrix.
[0079] In an optional embodiment, the first division can be performed based on the timeliness, importance, or other custom rules of the data. For example, the target power data can be divided into data subsets of different time periods according to timestamps, or divided into high-priority and low-priority subsets according to the urgency of the data.
[0080] However, in this application, a preset time window is used as the basis for division to ensure that the division of data blocks meets the time continuity requirements and reflects the real-time change characteristics of the data.
[0081] In an optional embodiment, the size of the time window can be flexibly set according to the actual operation of the power system and the sampling rate. For example, during a time period when the power load changes frequently, the time window can be appropriately narrowed to capture data changes more accurately.
[0082] In another optional embodiment, during periods of relatively stable load, the time window can be appropriately expanded to reduce the complexity of data processing. This division method can make the subsequent feature fusion and key negotiation processes more efficient and accurate.
[0083] In the embodiment of the present application, the three-level feature fusion includes first-level features, second-level features, and third-level features;
[0084] The first-level features are the amplitude features of each data block;
[0085] The second-level features are the differential features of each data block;
[0086] The third level features are the frequency domain features of each data block;
[0087] Get the grayscale mapping function of the three-level feature fusion and convert the grayscale mapping function into a grayscale matrix.
[0088] It should be noted that the first-level feature is the time domain feature, which directly uses the original data D i (t), retaining the data amplitude information.
[0089] It should be noted that the differential features are calculated using the 5-point central difference method. The specific example is as follows:
[0090]
[0091] Among them, D i is the data block, i represents the i-th data block, t is the current time, and Δt represents the sampling interval.
[0092] In the embodiment of the present application, the third level features include:
[0093] Improved Fourier transform is used for non-uniform sampling to obtain harmonic analysis results with increased accuracy.
[0094] Perform frequency band extraction on the harmonic analysis results with increased accuracy;
[0095] Frequency band extraction is performed by introducing a 1 / 3 octave filter bank;
[0096] The root mean square value of each frequency band after the frequency band extraction operation is calculated as the frequency domain feature vector.
[0097] Specifically, an improved Chirp-Z transform (CZT) is used to perform non-uniform sampling FFT to improve the accuracy of harmonic analysis;
[0098] A 1 / 3 octave filter bank is introduced to extract 12 characteristic frequency bands in the 10Hz-10kHz frequency band;
[0099] The root mean square (RMS) value of each frequency band is calculated as the frequency domain feature vector.
[0100] In an optional embodiment, the power data stream (such as voltage and current time series signals) is divided into fixed-length data blocks D according to the time window. i (The window length used in this invention is 100-500ms, which is dynamically adjusted according to the data sampling rate.) Each data block is converted into a grayscale matrix G by the grayscale mapping function of the three-level feature fusion. i :
[0101]
[0102] Among them, G i (x, y) represents the grayscale matrix, α, β, γ represent the weight ratio of each feature, D i (f) represents the frequency domain characteristics.
[0103] In an optional embodiment, the weight ratio parameter can be optimized by particle swarm optimization (PSO), and the specific design of this application is as follows:
[0104] Number of particles: 30;
[0105] Maximum number of iterations: 50;
[0106] Inertia weight: linearly decreases from 0.9 to 0.4;
[0107] Acceleration factor: c1=c2=2.05;
[0108] Optimization objective function:
[0109] Fitness=Entropy(G i )+θ·Corr(G A ,G B )
[0110] Where θ = 0.3 is the balance factor, and Corr is the Pearson correlation coefficient of the grayscale matrices of both parties.
[0111] In an optional embodiment, the first preprocessing may also include salt and pepper noise suppression based on a median filter (window size 5×5); contrast enhancement using adaptive histogram equalization (CLAHE); outlier identification using the IQR method with a threshold of Q3 + 1.5 IQR; and automatic Kalman filter compensation for abnormal data blocks.
[0112] It should be noted that acquiring target power data and performing a first preprocessing on it can improve data accuracy and reliability, laying a solid foundation for subsequent data processing and analysis. This first preprocessing removes noise and outliers from the data, making it smoother and more stable, thereby ensuring the effectiveness and security of key negotiation and symmetric encryption. Furthermore, this first preprocessing can format or normalize the data as needed, ensuring it better meets the requirements of subsequent algorithms and improving overall processing efficiency and accuracy.
[0113] S102, performing a second preprocessing on the target power data;
[0114] It should be noted that the first preprocessing has converted the target power data into several specific data blocks and obtained the target grayscale matrix. Therefore, subsequent processing is required based on the grayscale matrix obtained by the first preprocessing. However, directly processing the grayscale matrix cannot meet the actual needs of this application. Therefore, it is necessary to introduce a difference factor for the grayscale matrix to optimize the grayscale matrix after the first preprocessing.
[0115] In an optional embodiment, the difference factor can utilize edge detection operators from common image processing techniques, such as the Sobel operator, Prewitt operator, or Laplacian operator. These operators can detect edge information in a grayscale matrix, highlighting differences between data blocks, thereby improving the accuracy and efficiency of data processing. By applying these operators to the grayscale matrix, a difference matrix can be obtained, the element values of which reflect the degree of difference between adjacent pixels.
[0116] In an optional embodiment, the difference factor can also be generated using a machine learning-based algorithm. For example, algorithms such as support vector machines (SVMs), decision trees, or neural networks can be used to train and learn the grayscale matrix to obtain a classifier or regression model that accurately reflects the differences between data blocks. This classifier or regression model is then applied to the grayscale matrix to obtain the difference factor. This method can be adaptively adjusted and optimized based on the actual data conditions, improving the accuracy and reliability of the difference factor.
[0117] However, the difference factor obtained by the above operation may be affected by various factors such as noise, illumination changes, image quality, etc., resulting in insufficient stability and robustness of the difference factor. To solve this problem, the present application proposes the following processing method.
[0118] In an embodiment of the present application, the second preprocessing includes calculating a grayscale difference factor and obtaining a target shared key through the grayscale difference factor.
[0119] In the embodiment of the present application, performing the second preprocessing on the target power data includes:
[0120] Determine the two communicating parties for power data transmission and obtain the power data of the two communicating parties;
[0121] Establish an expression for the grayscale difference factor based on the two communicating parties. The grayscale difference factor is obtained by the grayscale value of the central pixel and the values of the neighboring pixels.
[0122] Select several data blocks from both communicating parties for parameter exchange and generate a target shared key.
[0123] In an optional embodiment, the grayscale difference factor expression may be as follows:
[0124]
[0125] where g c is the gray value of the center pixel, g i Neighborhood pixel value, s(x) = 1 if x ≥ 0, otherwise 0. We can also introduce an adaptive threshold: Threshold = μ + 3σ (μ is the mean, σ is the standard deviation) only when |g i -g c When |>Threshold, difference calculation is performed to improve noise resistance.
[0126] In an optional embodiment, selecting several data blocks of the communicating parties for parameter exchange may be performed as follows:
[0127] Each party selects 128 LBP eigenvalues of the first 5 data blocks for exchange. The specific formula is:
[0128]
[0129] Among them, Nonce A is a random number, and Permute is a permutation operation based on the key.
[0130] Furthermore, elliptic curve cryptography (ECC) is used to protect exchange parameters, and key negotiation is based on the ECDH protocol to ensure the security of the communication channel.
[0131] Furthermore, the modulus selection: m takes the value of 128 or 256, and is dynamically adjusted according to the security level. The formula is:
[0132]
[0133] Furthermore, the intermediate result is hashed twice:
[0134]
[0135] Time_Stamp is the Unix timestamp with millisecond granularity.
[0136] Furthermore, both parties calculate the verification code: Code =Hash(K||Device_ID).
[0137] Furthermore, verification codes are exchanged through out-of-band channels (such as power line carriers) to ensure key consistency.
[0138] In the embodiment of the present application, the specific operation of obtaining the target shared key by the grayscale difference factor is as follows:
[0139] The communicating parties (A and B) each calculate the grayscale difference factor ΔG of their local data blocks, exchange some grayscale parameters through a public channel, and generate a shared key K using the following formula:
[0140]
[0141] Among them, ΔG A,k and ΔG B,k is the grayscale difference value of the kth data block between the two parties, It is an XOR operation, and Hash is a one-way hash function (the present invention uses SM3 or SHA-3-256).
[0142] It should be noted that performing a second preprocessing on the target power data can improve the accuracy and security of key negotiation. This second preprocessing further reduces noise and interference in the power data, making the grayscale difference factors calculated by both parties closer, thereby generating a more consistent shared key. This not only enhances the reliability of key negotiation but also provides a stronger guarantee for subsequent symmetric encryption. Furthermore, this second preprocessing helps improve the efficiency of the entire encryption process, making data transmission and storage more secure and efficient.
[0143] S103, obtaining target statistical features of the gray matrix according to the first preprocessing result, and generating a first permutation structure in combination with the target shared key obtained after the second preprocessing;
[0144] In an embodiment of the present application, obtaining target statistical features of the grayscale matrix according to the first preprocessing result and generating a first permutation structure in combination with the target shared key obtained after the second preprocessing includes:
[0145] The target statistical features include the mean, variance and local texture features of the grayscale matrix;
[0146] The first permutation structure is a dynamic S-box, which is generated by initializing the chaotic system;
[0147] According to the target shared key and the target statistical characteristics of the gray matrix, the initial seed value of the S box is generated in combination with the HMAC-SM3 algorithm;
[0148] Based on the dynamic S-box, an 8×8 permutation network is constructed, and its connection matrix is dynamically generated by a chaotic sequence.
[0149] In an embodiment of the present application, generating the first replacement structure includes:
[0150] Each element of the connection matrix is limited to the range of [0,255][0,255] through modulo operation;
[0151] Perform cryptographic performance tests on the generated S-boxes, including nonlinearity, differential uniformity, and avalanche effect evaluation;
[0152] If the test result does not reach the preset safety threshold, the chaotic system parameters or target statistical feature weights are readjusted until the safety requirements are met;
[0153] The first permutation structure is finally output in the form of a dynamic S-box and used for subsequent encryption operations.
[0154] In an optional embodiment, a shared key K is used to initialize a chaotic system (Logistic map), and an S-box is dynamically generated in combination with the statistical characteristics of the gray matrix (such as mean and variance):
[0155] S box (x)=Chaos_Permute(K,Mean(G i ),Var(G i ))
[0156] in,
[0157]
[0158] Specifically, use the improved Logistic mapping:
[0159] x n+1 =μ·x n ·(1-x n )+δ·sin(2πx n )
[0160] Among them, μ = 3.999, δ = 0.1, which effectively expands the traversal range of the chaotic sequence.
[0161] Furthermore, the chaotic sequence is processed to generate 1024 chaotic values, discarding the first 100 to eliminate the initial transient state; the real number sequence is mapped to the integer range [0, 255] using the hyperbolic tangent function; and a three-level XOR operation is used to enhance randomness:
[0162] Furthermore, the high-order statistical features of the grayscale matrix are calculated:
[0163]
[0164] Furthermore, the mean, variance, skewness, and kurtosis are fused according to the weights:
[0165] Gray Param =0.4·Mean+0.3·Var+0.2·Skew+0.1·Kurt
[0166] Furthermore, the S-box generation process and seed generation are as follows:
[0167] Seed=KDF(K||Gray_param||Time_Stamp)
[0168] KDF is a key derivation function that uses the HMAC-SM3 algorithm.
[0169] Furthermore, a dynamic permutation network is designed, in which an 8×8 permutation network (P-box) is designed, and its connection matrix is dynamically generated by a chaotic sequence:
[0170] P(x)=Permute(x,Chaos_Sequence)
[0171] Furthermore, the nonlinear layer is optimized using the improved Tanh activation function:
[0172]
[0173] In the embodiment of the present application, a 4-stage pipeline structure is used in the ASIC to generate S-boxes; BRAM is used to store chaotic sequences, and the access delay is reduced to 2ns; a parallel computing architecture is used to generate 16 S-box elements in a single cycle.
[0174] S104: Encrypt the target power data according to the first replacement structure.
[0175] In an optional embodiment, the power data block D i Using improved AES-CTR mode encryption:
[0176]
[0177] Among them, the grayscale feedback value is the grayscale feature hash value of the previous ciphertext:
[0178] Feedback value = Hash(C i-1 ||ΔG i )
[0179] The specific implementation details are as follows:
[0180] Step 1: Improved AES-CTR mode design and counter structure optimization:
[0181] The 128-bit counter is divided into two parts:
[0182] Counter = Nonce (64 bits) || Block_index (64 bits)
[0183] Block_index is the data block index, which increases by 1 each time a data block is encrypted.
[0184] Grayscale feedback integration:
[0185] Introducing the feedback confusion module: Ensure that the encryption key stream of each data block is dynamically bound to the data characteristics.
[0186] Step 2: Grayscale feedback value calculation
[0187] Feature extraction:
[0188] For the previous ciphertext C i-1 Perform the following processing:
[0189] (1) Calculate the four texture features of gray-level co-occurrence matrix (GLCM): energy, contrast, correlation, and entropy;
[0190] (2) Use discrete cosine transform (DCT) to extract low-frequency component features;
[0191] (3) Calculate the local variance features based on the sliding window.
[0192] Use double hash function: feedback value = SM3(SHA3-256(C i-1 ||ΔG i )), improve the anti-collision ability of hash results.
[0193] Step 3: Block Adaptive Strategy
[0194] Dynamically adjust block size based on data complexity:
[0195]
[0196] In an optional embodiment, an inter-block dependency mechanism is introduced to implement cross-block verification: Ensure data integrity between blocks.
[0197] In summary, the present application proposes a method for key negotiation and symmetric encryption of power data, which obtains target power data and performs a first preprocessing on the target power data; performs a second preprocessing on the target power data; obtains the target statistical characteristics of the gray matrix based on the first preprocessing result, and generates a first permutation structure in combination with the target shared key obtained after the second preprocessing; and encrypts the target power data according to the first permutation structure. The present application greatly improves the security of power data. During the power data transmission process, the method of the present application can ensure that the data is not stolen or tampered with during the transmission process, effectively preventing the risk of data leakage. At the same time, the implementation steps of the method are concise and clear, and it is easy to promote and apply in various power systems, providing a strong guarantee for the stable operation of the power system.
[0198] Example 2: In a preferred embodiment, a data transmission link is deployed between a provincial power grid dispatching center and its five subordinate substations, mainly protecting the real-time monitoring data (voltage, current, power factor, etc.) of the power SCADA system. The data sampling rate is 10kHz, the communication bandwidth is 100Mbps, and the encryption throughput is required to be ≥1Gbps and the key update period is ≤100ms.
[0199] The system architecture is as follows:
[0200] 1. Hardware Platform
[0201] Transmitter: Edge computing node based on Xilinx Zynq UltraScale+ MPSoC (including 2xARM Cortex-A53 cores and FPGA logic resources);
[0202] Receiving end: Domestic encryption server deployed in the dispatching center (Feitian FT-2000 / 4 processor + National Encryption SM4 accelerator card);
[0203] Communication link: OPGW optical fiber private network, bit error rate <10 -9 .
[0204] 2. Software Implementation
[0205] Key negotiation module: implemented in C language, compiled with optimization level -O3;
[0206] Encryption module: implemented in FPGA using Verilog, with a clock frequency of 200MHz;
[0207] Grayscale feature extraction: C++ implementation based on OpenCV 4.5.5 library.
[0208] The specific implementation steps based on the above architecture are as follows:
[0209] 1. Key negotiation phase
[0210] (1) Data preprocessing:
[0211] Divide the voltage signal (10kV bus) into 200ms data blocks (about 2000 sampling points);
[0212] A fifth-order Butterworth low-pass filter (cut-off frequency 1 kHz) was used to remove high-frequency noise.
[0213] (2) Grayscale mapping:
[0214] The weight coefficients were optimized by PSO and obtained as α = 0.4, β = 0.3, and γ = 0.3;
[0215] Generate a 512×512 grayscale matrix with an average information entropy of 7.6 bits / byte.
[0216] (3) Key generation:
[0217] Exchange the LBP features of the first 5 data blocks (128 bytes per block);
[0218] Generate a 128-bit shared key K. The key generation time is 4.8ms (including ECC encryption transmission time).
[0219] 2. Symmetric encryption stage
[0220] (1) Dynamic S-box generation:
[0221] The first 8 bytes of the initial value x0=K of the chaotic system are converted into floating point numbers;
[0222] Fusion grayscale mean (128.5), variance (452.3), skewness (0.2), kurtosis (0.5);
[0223] The generated S-box passes the NIST SP 800-22 randomness test with a pass rate of 99.8%.
[0224] (2) Block encryption:
[0225] The data block size is dynamically adjusted to 256 bytes (data entropy value 6.8 bits / byte);
[0226] Encrypted throughput reaches 1.23Gbps and latency is 7.9μs;
[0227] Grayscale feedback value calculation includes features such as GLCM energy (0.85) and contrast (0.62).
[0228] The following multi-scenario verification experiment is conducted. First, the microgrid scenario is tested using the application method, as follows:
[0229] Application scenario: A microgrid in a new energy demonstration park, including 50kW photovoltaic power generation, 20kW energy storage, and 30 residential loads, with a data sampling rate of 1kHz and a communication bandwidth of 10Mbps.
[0230] The hardware platform includes the following:
[0231] Edge node: Raspberry Pi 4B (1.5GHz quad-core ARM Cortex-A72) + FPGA coprocessor (Xilinx Artix-7)
[0232] Main site: Domestic server (Feitian S2500 processor + SM9 password card)
[0233] The experimental results are shown in the following table:
[0234] index Microgrid scenario Provincial power grid scenario Key negotiation time 5.2ms 4.8ms Encrypted throughput 890Mbps 1.23Gbps Decryption bit error rate 0 <![CDATA[≤10 -6 ]]> Voltage fluctuation resistance 99.7%@±15% 99.9%@±10%
[0235] In an optional embodiment, the method of the present application is used to test a smart meter scenario, as follows:
[0236] Application scenario: Low-voltage distribution network area, including 1,000 smart meters (RS485 bus), data update cycle of 5 seconds, and communication bandwidth of 2Mbps.
[0237] The hardware platform includes the following:
[0238] Concentrator: STM32H743 microcontroller (240MHz main frequency) + LoRa module
[0239] Main station: Industrial control computer (Intel i7-11700)
[0240] The experimental results are shown in the following table:
[0241] index Smart meter scenario Provincial power grid scenario Key update frequency 50 times / second 100 times / second Terminal power consumption 1.2W 2.8W Data packet loss rate 0.002% 0 Protocol compatibility Support DL / T 645 Support IEC 61850
[0242] In an optional embodiment, the method of the present application is used to test a quantum attack simulation experiment, as follows:
[0243] The experimental setup includes the attack algorithm: Grover quantum search algorithm (simulated based on the Qiskit framework)
[0244] The experimental parameters include the following:
[0245] Number of qubits: 50 qubits (simulation 2 25 Quantum state space)
[0246] Iterations: 1000 (each iteration includes quantum amplitude amplification)
[0247] Key length: 128 bits (SM3 hash output)
[0248] The comparison scheme is set up as follows: the dynamic key of the present invention (grayscale + chaos) versus the traditional static key (fixed AES-128);
[0249] Existing quantum resistance solutions (such as CRYSTALS-Kyber)
[0250] The key recovery probability in the experimental results is shown below:
[0251] plan Number of qubits Number of attacks Probability of recovery Solution of the present invention 50 1000 <![CDATA[8.7×10 -21 ]]> Traditional AES-128 50 1000 <![CDATA[1.2×10 -16 ]]> CRYSTALS-Kyber 50 1000 <![CDATA[2.3×10 -19 ]]>
[0252] In an optional embodiment, the calculation is based on the following:
[0253] The key recovery probability formula is:
[0254]
[0255] Where k is the number of iterations, N = 2 128 The present invention expands the effective key space to 2 by dynamic S-box and grayscale feedback. 256 , the actual recovery probability is:
[0256]
[0257] In an optional embodiment, the adaptability of the present invention method is analyzed in multiple scenarios, and its universality is verified as follows:
[0258] (1) Data feature comparison:
[0259]
[0260] (2) Robustness of the solution:
[0261] By adopting an adaptive block strategy and multimodal feature fusion, the key matching success rate in different scenarios is >98% (a decrease of 15-20% compared to traditional single-feature solutions).
[0262] The present invention dynamically modulates the chaotic system through grayscale parameters, so that quantum attacks need to simultaneously crack: the power data feature extraction process (a classical computing problem), the nonlinear transformation of the chaotic sequence (limited quantum acceleration), and the collision resistance of the hash function (the quantum security of SM3). Tests by the China Electric Power Research Institute have shown that in a 50-qubit environment, the key recovery time of the present invention is 230 times that of traditional solutions, meeting the requirements of the "Technical Specifications for Quantum Secure Communication in Power Systems."
[0263] The experimental results are as follows:
[0264] 1. Performance indicators
[0265] index Measured value Standard requirements Key negotiation time 4.8ms ≤10ms Encrypted throughput 1.23Gbps ≥1Gbps Decryption bit error rate 0 <![CDATA[≤10 -6 ]]> Key update frequency 100 times / second ≥50 times / second
[0266] 2. Security Verification
[0267] Anti-differential attack: No signature is leaked after 128 rounds of differential attack (traditional AES-CTR shows a pattern after 64 rounds);
[0268] Key space: 2^256 (based on a combination of improved Logistic mapping and grayscale features);
[0269] Quantum resistance: Through quantum computing simulation attack test, the probability of key recovery is <10 -20 .
[0270] 3. Hardware resource consumption
[0271] FPGA implementation: occupies 38% logic units, 12% BRAM, and 5% DSP;
[0272] Server CPU utilization: Average load during encryption is 27% (traditional encryption solutions require 58%).
[0273] The comparative experimental data are shown below:
[0274] 1. Comparison with the traditional ECDH+AES solution
[0275]
[0276] 2. Robustness in different noise environments
[0277] Signal-to-noise ratio (SNR) Key matching success rate Feature retention rate 20dB 99.99% 98.7% 10dB 99.87% 95.2% 5dB 98.65% 89.3%
[0278] In summary, the key negotiation time is reduced by 40%, meeting the millisecond-level communication requirements of the power system. The dynamic S-box and grayscale feedback mechanism improve the system's resistance to differential attacks by 100%. It is seamlessly integrated into the existing IEC 61850 communication protocol without the need to modify existing infrastructure.
[0279] Embodiment 3: This embodiment also provides a power data key negotiation and symmetric encryption system, including:
[0280] a first preprocessing module, configured to obtain target power data and perform a first preprocessing on the target power data;
[0281] The first preprocessing includes performing a first division and a first conversion on the target power data;
[0282] The first division is used to divide the target power data into a number of fixed-length data blocks;
[0283] The first conversion converts the first division result into a grayscale matrix;
[0284] A second preprocessing module, configured to perform a second preprocessing on the target power data;
[0285] The second preprocessing includes calculating a grayscale difference factor and obtaining a target shared key through the grayscale difference factor;
[0286] a structure acquisition module, configured to acquire target statistical features of the grayscale matrix according to the first preprocessing result, and generate a first permutation structure in combination with the target shared key obtained after the second preprocessing;
[0287] The encryption module is configured to encrypt the target power data according to the first replacement structure.
[0288] The above-mentioned unit modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the corresponding operations of the above-mentioned modules.
[0289] This embodiment also provides an electronic device, which may be a terminal. The electronic device includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be achieved through WIFI, an operator network, NFC (near field communication), or other technologies. When the computer program is executed by the processor, a power data key negotiation and symmetric encryption method is implemented. The display screen of the electronic device may be a liquid crystal display or an electronic ink display screen. The input device of the electronic device may be a touch layer covering the display screen, or a key, trackball, or touchpad provided on the electronic device housing, or an external keyboard, touchpad, or mouse.
[0290] This embodiment further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the following steps are implemented:
[0291] Acquiring target power data and performing a first preprocessing on the target power data;
[0292] The first preprocessing includes performing a first division and a first conversion on the target power data;
[0293] The first division is used to divide the target power data into a number of fixed-length data blocks;
[0294] The first conversion converts the first division result into a grayscale matrix;
[0295] performing a second preprocessing on the target power data;
[0296] The second preprocessing includes calculating a grayscale difference factor and obtaining a target shared key through the grayscale difference factor;
[0297] Obtaining target statistical features of the grayscale matrix according to the first preprocessing result, and generating a first permutation structure in combination with the target shared key obtained after the second preprocessing;
[0298] The target power data is encrypted according to the first permutation structure.
[0299] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application, and all of these should be included in the scope of the claims of the present application.
[0300] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiment of the present application can be implemented in various computer languages.
[0301] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0302] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0303] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0304] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0305] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A method for power data key negotiation and symmetric encryption, characterized in that: include: Acquiring target power data, and performing a first preprocessing on the target power data; The first preprocessing includes performing a first division and a first conversion on the target power data; The first division is used to divide the target power data into a plurality of data blocks of fixed length; The first conversion converts the first division result into a grayscale matrix; performing a second preprocessing on the target power data; The second preprocessing includes calculating a grayscale difference factor and obtaining a target shared key through the grayscale difference factor; Obtaining target statistical features of the grayscale matrix according to the first preprocessing result, and generating a first permutation structure in combination with the target shared key obtained after the second preprocessing; The target power data is encrypted according to the first permutation structure.
2. The method for power data key negotiation and symmetric encryption according to claim 1, wherein: The first preprocessing further includes: A preset time window is dynamically adjusted according to the sampling rate; Dividing the target power data into a plurality of data blocks of fixed length according to the time window; Perform three-level feature fusion on several fixed-length data blocks after the first division result to obtain a grayscale matrix.
3. The method for power data key negotiation and symmetric encryption according to claim 2, wherein: The performing second preprocessing on the target power data includes: Determine the two communicating parties for power data transmission and obtain the power data of the two communicating parties; Establishing a grayscale difference factor expression based on the two communicating parties, wherein the grayscale difference factor is obtained by the grayscale value of the center pixel and the neighboring pixel values; Select several data blocks from both communicating parties for parameter exchange and generate a target shared key.
4. The method for power data key negotiation and symmetric encryption according to claim 3, wherein: The three-level feature fusion includes first-level features, second-level features and third-level features; The first-level features are amplitude features of each data block; The second-level features are differential features of each data block; The third level features are frequency domain features of each data block; A grayscale mapping function of three-level feature fusion is obtained, and the grayscale mapping function is converted into a grayscale matrix.
5. The method for power data key negotiation and symmetric encryption according to claim 4, wherein: The third level features include: Improved Fourier transform is used for non-uniform sampling to obtain harmonic analysis results with increased accuracy. performing frequency band extraction on the harmonic analysis result with increased accuracy; The frequency band extraction is performed by introducing a 1 / 3 octave filter bank; The root mean square value of each frequency band after the frequency band extraction operation is calculated as the frequency domain feature vector.
6. The method for power data key negotiation and symmetric encryption according to claim 5, wherein: The step of obtaining target statistical features of the grayscale matrix according to the first preprocessing result and generating a first permutation structure in combination with the target shared key obtained after the second preprocessing includes: The target statistical features include the mean, variance and local texture features of the grayscale matrix; The first permutation structure is a dynamic S-box, and the dynamic S-box is generated by initialization of a chaotic system; Generate an initial seed value of the S-box based on the target shared key and the target statistical characteristics of the grayscale matrix in combination with the HMAC-SM3 algorithm; Based on the dynamic S-box, an 8×8 permutation network is constructed, and its connection matrix is dynamically generated by a chaotic sequence.
7. The method for power data key negotiation and symmetric encryption according to claim 6, wherein: Generating the first replacement structure includes: Each element of the connection matrix is limited to the range of [0, 255] [0, 255] by a modulo operation; Perform cryptographic performance tests on the generated S-boxes, including nonlinearity, differential uniformity, and avalanche effect evaluation; If the test result does not reach the preset safety threshold, the chaotic system parameters or target statistical feature weights are readjusted until the safety requirements are met; The first permutation structure is finally output in the form of a dynamic S-box and used for subsequent encryption operations.
8. A power data key negotiation and symmetric encryption system, applying the method according to any one of claims 1 to 7, characterized in that: include: a first preprocessing module, configured to obtain target power data and perform a first preprocessing on the target power data; The first preprocessing includes performing a first division and a first conversion on the target power data; The first division is used to divide the target power data into a plurality of data blocks of fixed length; The first conversion converts the first division result into a grayscale matrix; A second preprocessing module, configured to perform a second preprocessing on the target power data; The second preprocessing includes calculating a grayscale difference factor and obtaining a target shared key through the grayscale difference factor; a structure acquisition module, configured to acquire target statistical features of the grayscale matrix according to the first preprocessing result, and generate a first permutation structure in combination with a target shared key obtained after the second preprocessing; An encryption module is configured to encrypt the target power data according to the first replacement structure.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the power data key negotiation and symmetric encryption method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a power data key negotiation and symmetric encryption method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Secure quantum encryption transmission method for power internet of things
CN121098581A
Power grid network data security management system
CN121261918A
A power grid network data security management system
CN121261918B