Data encryption and decryption methods

By acquiring network performance metrics data of communication links, using machine learning models to determine risk levels, and dynamically adjusting the complexity and type of encryption credentials, the problem that encryption strategies in existing technologies cannot adapt to changes in network conditions is solved, achieving efficient encryption and decryption in different scenarios.

CN123122997APending Publication Date: 2026-11-17AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611528102.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing communication encryption methods cannot dynamically adjust encryption strategies based on real-time network security status and data volume changes, resulting in high encryption/decryption overhead or insufficient protection.

Method used

By acquiring network performance metrics data of the communication link, a machine learning model is used to determine the risk level. Based on the risk level and data volume, the complexity and type of the encryption credential are dynamically adjusted to generate an encryption credential to encrypt the communication data.

Benefits of technology

It enables dynamic adjustment of encryption strength of encryption credentials according to risk level, taking into account both transmission efficiency and security in different scenarios, and solves the problem of low transmission efficiency or insufficient protection caused by improper encryption strength configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123122997A_ABST
    Figure CN123122997A_ABST
Patent Text Reader

Abstract

This application relates to a data encryption and decryption method. The data encryption method includes: acquiring network performance index data of a communication link and determining the risk level of the communication link based on the network performance index data; determining a complexity coefficient positively correlated with the risk level; if the amount of communication data in the communication link within a preset period is less than a preset threshold, determining the encryption credential type as a single encryption credential; if it is not less than the preset threshold, determining the encryption credential type as a combined encryption credential; generating an encryption credential based on the complexity coefficient and the encryption credential type, and using the encryption credential to encrypt the communication data of the communication link to obtain ciphertext communication data. This application solves the technical problem that the encryption credential strength cannot be adjusted according to changes in the real-time security status of the network and the amount of data to be transmitted, resulting in high encryption and decryption overhead and low transmission efficiency when the strength configuration is too high, and insufficient protection when the configuration is too low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network security technology, and more specifically, to a data encryption and decryption method. Background Technology

[0002] With the rapid development of the digital economy, the Internet has been deeply integrated into all aspects of social production and life. The scale of network communication data transmission continues to expand and application scenarios are becoming increasingly rich. However, at the same time, the diversification and complexity of network attack methods have also posed a severe challenge to communication security. Strengthening network communication security protection has become a core requirement for ensuring the stable operation of digital infrastructure.

[0003] The relevant communication encryption methods generally suffer from performance bottlenecks: some methods lack sufficient encryption strength, making them vulnerable to new types of network attacks and failing to guarantee the confidentiality and integrity of core data transmission; others, while improving security levels, focus solely on increasing encryption strength, employing overly complex encryption credential systems indiscriminately. This leads to increased encryption computation time, decreased data transmission throughput, and an inability to meet the demands of high-concurrency, high-volume business scenarios, severely hindering efficient business operations. More critically, these methods lack dynamic awareness and adaptation mechanisms, failing to flexibly adjust encryption strategies based on real-time network communication conditions and the scale of communication data, resulting in a severe disconnect between security protection and actual business needs.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This application provides a data encryption and decryption method to at least solve the technical problem that the strength of the encryption credential cannot be adjusted according to the real-time security status of the network and the amount of data to be transmitted, resulting in high encryption and decryption overhead and low transmission efficiency when the strength configuration is too high, and insufficient protection when the configuration is too low.

[0006] According to one aspect of this application, a data encryption method is provided, comprising: acquiring network performance index data of a communication link, and determining the risk level of the communication link based on the network performance index data; determining a complexity coefficient positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated; if the amount of communication data of the communication link within a preset period is less than a preset threshold, determining the encryption credential type as a single encryption credential corresponding to an encryption algorithm; if the amount of communication data of the communication link within a preset period is not less than the preset threshold, determining the encryption credential type as a combined encryption credential corresponding to at least two encryption algorithms; generating an encryption credential based on the complexity coefficient and the encryption credential type, and using the encryption credential to encrypt the communication data of the communication link to obtain ciphertext communication data.

[0007] Optionally, determining the risk level of a communication link based on network performance index data includes: inputting the network performance index data into a machine learning model to obtain baseline data output by the machine learning model, wherein the baseline data is used to characterize the network performance index data under normal network operating conditions; calculating the deviation value between the network performance index data and the baseline data; and determining the risk level of the communication link based on the deviation value.

[0008] Optionally, network performance index data is input into a machine learning model to obtain baseline data output by the machine learning model, including: determining at least two network performance indices collected within a preset time window as time-series data according to the chronological order of collection time, and inputting the time-series data into the machine learning model; determining the correlation weights between each collection time in the time-series data through the machine learning model, and weighting the time-series data according to the correlation weights to obtain fused features; and analyzing the fused features through the machine learning model to obtain baseline data.

[0009] Optionally, after encrypting the communication data of the communication link using encryption credentials to obtain ciphertext communication data, the method further includes: re-collecting network performance index data of the communication link to obtain updated network performance index data; determining a performance compensation amount based on a complexity coefficient, wherein the performance compensation amount is positively correlated with the complexity coefficient, and the performance compensation amount is used to characterize the change in network performance index data caused by generating and using encryption credentials to encrypt the communication data; correcting the updated network performance index data using the performance compensation amount to obtain corrected network performance index data; inputting the corrected network performance index data into a machine learning model to obtain updated baseline data output by the machine learning model; calculating the deviation value between the corrected network performance index data and the updated baseline data, and determining the update risk level of the communication link based on the deviation value; and updating the complexity coefficient based on the update risk level.

[0010] Optionally, the risk level includes a first risk level, a second risk level, and a third risk level, where the first risk level is higher than the second risk level, and the second risk level is higher than the third risk level. The method further includes: blocking communication of the communication link when the risk level of the communication link is the first risk level; allowing communication of the communication link when the risk level of the communication link is the second or third risk level, and determining a complexity coefficient that is positively correlated with the risk level.

[0011] Optionally, the encryption strength is positively correlated with the bit length of the encryption credential; based on the complexity coefficient and the encryption credential type, an encryption credential is generated, including: determining the target bit length corresponding to the complexity coefficient; generating the encryption credential, wherein the bit length of the encryption credential is the target bit length, and the encryption credential belongs to the encryption credential type.

[0012] Optionally, when the encryption credential type is a combined encryption credential, the encryption credential includes a symmetric encryption credential and an asymmetric encryption credential; the method further includes: encrypting the communication data using the symmetric encryption credential to obtain ciphertext communication data; encrypting the symmetric encryption credential using the public key of the asymmetric encryption credential to obtain a ciphertext encryption credential; and sending the ciphertext communication data and the ciphertext encryption credential to the receiving end of the communication link, wherein the receiving end is used to decrypt the ciphertext encryption credential using the private key of the asymmetric encryption credential to obtain a symmetric encryption credential, and to decrypt the ciphertext communication data using the symmetric encryption credential to obtain the communication data.

[0013] Optionally, generating an encrypted credential based on a complexity coefficient and an encrypted credential type includes: determining a base bit length based on the complexity coefficient, wherein the base bit length is positively correlated with the complexity coefficient; generating a single encrypted credential when the encrypted credential type is a single encrypted credential, wherein the bit length of the single encrypted credential is the base bit length; and performing the following steps when the encrypted credential type is a combined encrypted credential: determining a first encrypted credential and a second encrypted credential included in the combined encrypted credential, wherein the first encrypted credential is used to encrypt communication data, and the second encrypted credential is used to encrypt the first encrypted credential; determining a bit length increment based on the amount of communication data, wherein the bit length increment is positively correlated with the amount of communication data; determining the sum of the base bit length and the bit length increment as the enhanced bit length, and generating a second encrypted credential, wherein the bit length of the second encrypted credential is the enhanced bit length; determining an equivalent bit length with equivalent security strength to the enhanced bit length, and generating a first encrypted credential, wherein the bit length of the first encrypted credential is the equivalent bit length.

[0014] According to another aspect of this application, a data decryption method is also provided, comprising: receiving data sent by a sender via a communication link; when the data includes encrypted communication data but does not include encrypted encryption credentials, determining the encryption credential type as a single encryption credential, and using a decryption credential corresponding to the single encryption credential to decrypt the encrypted communication data to obtain the communication data; when the data includes encrypted communication data and encrypted encryption credentials, determining the encryption credential type as a combined encryption credential, the combined encryption credential including a first encryption credential and a second encryption credential, using a decryption credential corresponding to the second encryption credential to decrypt the encrypted encryption credential to obtain a first encryption credential, and using the first encryption credential to decrypt the encrypted communication data to obtain the communication data; wherein, the encryption credential type is determined by the sender based on the comparison result of the communication data volume of the communication link within a preset period and a preset threshold, the bit lengths of the single encryption credential, the first encryption credential, and the second encryption credential are all positively correlated with the complexity coefficient, the complexity coefficient is positively correlated with the risk level of the communication link, and the risk level is determined based on the network performance index data of the communication link.

[0015] According to another aspect of this application, a data encryption device is also provided, comprising: an acquisition module, configured to acquire network performance index data of a communication link and determine the risk level of the communication link based on the network performance index data; a first determination module, configured to determine a complexity coefficient positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated; a second determination module, configured to perform the following steps: if the amount of communication data of the communication link within a preset period is less than a preset threshold, determine the encryption credential type as a single encryption credential corresponding to an encryption algorithm; if the amount of communication data of the communication link within a preset period is not less than the preset threshold, determine the encryption credential type as a combined encryption credential corresponding to at least two encryption algorithms; and an encryption module, configured to generate an encryption credential based on the complexity coefficient and the encryption credential type, and use the encryption credential to encrypt the communication data of the communication link to obtain ciphertext communication data.

[0016] In this application, the following methods are employed: acquiring network performance index data of the communication link and determining the risk level of the communication link based on the network performance index data; determining a complexity coefficient positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated; if the amount of communication data of the communication link within a preset period is less than a preset threshold, the encryption credential type is determined to be a single encryption credential corresponding to one encryption algorithm; if the amount of communication data of the communication link within a preset period is not less than the preset threshold, the encryption credential type is determined to be a combined encryption credential corresponding to at least two encryption algorithms; based on the complexity coefficient and the encryption credential type, an encryption credential is generated, and the encryption credential is used to encrypt the communication data of the communication link to obtain ciphertext communication data. This achieves the goal of dynamically adjusting the encryption strength of encryption credentials according to the risk level of the communication link and dynamically adapting the type of encryption credentials to the amount of communication data. This enables the encryption credentials to simultaneously improve their anti-cracking capability when network risks increase, reduce encryption and decryption overhead when network risks are stable, and ensure security with a single encryption credential in small data scenarios and balance encryption security and transmission efficiency with a combination of encryption credentials in large data scenarios. This ensures that encryption strength and transmission performance are matched in all scenarios. In turn, it solves the technical problem that the encryption strength cannot be adjusted according to the real-time security status of the network and the amount of data to be transmitted, resulting in high encryption and decryption overhead and low transmission efficiency when the strength configuration is too high, and insufficient protection when the configuration is too low. Attached Figure Description

[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0018] Figure 1This is a flowchart of a data encryption method according to an embodiment of this application;

[0019] Figure 2 This is a flowchart of a data decryption method according to an embodiment of this application;

[0020] Figure 3 This is a structural diagram of an intelligent communication device according to an embodiment of this application;

[0021] Figure 4 This is a flowchart of a data encryption and decryption method according to an embodiment of this application;

[0022] Figure 5 This is a structural diagram of a data encryption device according to an embodiment of this application;

[0023] Figure 6 This is a structural diagram of a data decryption device according to an embodiment of this application;

[0024] Figure 7 This is a hardware structure block diagram of a computer terminal according to an embodiment of the present application of a data encryption method. Detailed Implementation

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] According to an embodiment of this application, an embodiment of a data encryption method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0028] Figure 1 This is a flowchart of a data encryption method according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:

[0029] Step S102: Obtain network performance index data of the communication link, and determine the risk level of the communication link based on the network performance index data.

[0030] The network performance index data (also known as core network index data) in step S102 refers to a set of quantifiable parameters that reflect the current transmission status of the communication link. As an example, the network performance index data may include at least one of network bandwidth, throughput, packet loss rate, and network latency, and may further include parameters such as peak traffic. The risk level (also known as risk gradient or security stage) in step S102 refers to a quantitative classification result used to characterize the degree to which the communication link deviates from the normal network operating state. Its value can be divided into several levels. As an example, it can be divided into three levels: high risk, medium risk, and low risk. A high-risk level indicates that the communication link has a serious anomaly that may lead to service interruption; a medium-risk level indicates that the communication link has potential risks; and a low-risk level indicates that the communication link is operating normally.

[0031] In practice, network probes can be used to monitor communication links in real time and collect the aforementioned network performance metrics data according to a preset collection cycle. After obtaining the network performance metrics data, a pre-trained machine learning model can be used to determine the risk level. This process can include two stages: model training and real-time analysis.

[0032] During the model training phase, historical network performance metrics data under normal network operation conditions can be collected as training samples. These training samples can optionally cover operating scenarios under different time periods and load conditions to improve the comprehensiveness of the sample distribution. The historical network performance metrics data are first cleaned and normalized to eliminate dimensional differences between metrics. Then, the processed data is divided into training and validation sets according to a preset ratio (e.g., 8:2). The machine learning model used can be a deep neural network model. As an example, this model can include an input layer, several hidden layers (e.g., 3 layers), and an output layer. The hidden layers can include convolutional layers, recurrent layers, and a self-attention mechanism module. Features are transferred between layers through fully connected and residual connections. The self-attention mechanism module can be used to extract the temporal correlation features of various network performance metrics.

[0033] The training process can aim to minimize the deviation between the model's predicted values ​​and the actual sample values. The model parameters are iteratively updated using the backpropagation algorithm. Training hyperparameters can be set to an initial learning rate of 0.001, a batch size of 64, and 200 iterations. The fit is evaluated using a validation set. Training terminates when the model's accuracy in recognizing normal network operation reaches a preset accuracy threshold (e.g., 95%). The network structure, hyperparameter values, and accuracy thresholds described above are exemplary and can be adjusted based on sample size and computational resources. After training, the model can output the expected value and corresponding confidence interval of the input network performance metrics under normal network operation conditions. This expected value can serve as benchmark data for subsequent judgments.

[0034] In the real-time analysis phase, the collected network performance index data undergoes the same normalization process as in the training phase. The processed data is then input into the aforementioned machine learning model to obtain the baseline data output by the model. Next, the deviation between the network performance index data and the baseline data is calculated. This deviation can be calculated using methods such as Euclidean distance or cosine similarity. Alternatively, after calculating the difference, further adjustments can be made based on the confidence interval width. For example, the deviation can be positively correlated with the difference and negatively correlated with the interval width, thus appropriately relaxing the judgment scale during periods of significant network fluctuation. Finally, the deviation value is compared with a preset risk threshold rule, mapping the deviation value to a corresponding risk level. A larger deviation value corresponds to a higher risk level.

[0035] Step S104: Determine the complexity coefficient that is positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated;

[0036] The complexity coefficient (also known as the complexity factor or encryption credential complexity factor) in step S104 is a decision parameter used to indicate the level of protection that the encryption credential to be generated should achieve. The encryption strength in step S104 refers to the ability of the encryption credential to resist attacks such as brute-force cracking. In practice, this can be reflected by the bit length of the encryption credential; the longer the bit length, the higher the encryption strength.

[0037] In practice, a correspondence between risk levels and complexity coefficients can be established in advance. After determining the risk level, the complexity coefficient can be obtained by looking up the corresponding value in a table. This correspondence ensures that the complexity coefficient increases with the risk level. For example, when the risk level is low, the complexity coefficient can be configured to a low value, resulting in a stable communication link security situation. This satisfies basic protection requirements while also considering encryption efficiency. When the risk level is medium, the complexity coefficient can be configured to a higher value than the low-risk value to improve the encryption credential's resistance to cracking. The complexity coefficient can be a discrete level identifier or a continuous numerical value.

[0038] A pre-established correspondence can be established between the complexity coefficient and the bit length of the encryption credential. This correspondence can be set separately for each encryption algorithm, because different types of encryption algorithms require different bit lengths to achieve equivalent encryption strength. As an example, for asymmetric encryption algorithms, a low-level complexity coefficient can correspond to 1024 bits, and a high-level complexity coefficient can correspond to 2048 bits; for symmetric encryption algorithms, a low-level complexity coefficient can correspond to 128 bits, and a high-level complexity coefficient can correspond to 256 bits. These values ​​are exemplary and can be set differently depending on the selected encryption algorithm and security requirements during implementation.

[0039] The purpose of step S104 is to transform the security status of the communication link into the basis for configuring the strength of the encryption credential, so that the encryption protection level can be adjusted according to the real-time security status of the network.

[0040] Step S106: If the amount of communication data in the communication link within a preset period is less than a preset threshold, the encryption credential type is determined to be a single encryption credential corresponding to one encryption algorithm; if the amount of communication data in the communication link within a preset period is not less than a preset threshold, the encryption credential type is determined to be a combined encryption credential corresponding to at least two encryption algorithms.

[0041] The communication data volume in step S106 refers to the total amount of data transmitted or to be transmitted by the communication link within a preset period. The preset period can be a statistical window of fixed duration, such as a time period in seconds or minutes. The preset threshold in step S106 is a boundary used to distinguish between small data volume transmission scenarios and large data volume transmission scenarios. Its value can be preset according to the device's computing power, service type, and link bandwidth. A single encryption credential (also known as a single encryption credential) refers to an encryption credential that corresponds to only one encryption algorithm; a combined encryption credential refers to an encryption credential system consisting of multiple encryption credentials that correspond to at least two encryption algorithms.

[0042] In practice, the amount of communication data on the communication link within a preset period is first counted, and then compared with a preset threshold. When the amount of communication data is less than the preset threshold, it is determined to be a small data transmission scenario, and the encryption credential type is determined to be a single encryption credential. As an example, this single encryption credential can be an asymmetric encryption credential. Although the computation speed of asymmetric encryption algorithms is relatively low, the computational overhead is within an acceptable range due to the limited total amount of data to be encrypted. When the amount of communication data is not less than the preset threshold, it is determined to be a large data transmission scenario, and the encryption credential type is determined to be a combined encryption credential. As an example, this combined encryption credential can be composed of both symmetric and asymmetric encryption credentials.

[0043] The purpose of step S106 is to enable the type of encryption credential to adapt to changes in the volume of data to be transmitted, thereby balancing encryption security and transmission efficiency in different data volume scenarios.

[0044] Step S108: Based on the complexity coefficient and the encryption credential type, generate an encryption credential, and use the encryption credential to encrypt the communication data of the communication link to obtain ciphertext communication data.

[0045] It should be noted that when generating encrypted credentials, the corresponding encryption algorithm can be determined first based on the type of encrypted credential. Then, the target bit length corresponding to the encryption algorithm can be determined based on the correspondence between the complexity coefficient and the bit length. Finally, an encrypted credential with the target bit length can be generated according to the encryption algorithm. When the encrypted credential type is a combined encrypted credential, the target bit length can be determined separately for each of its corresponding encryption algorithms, and corresponding encrypted credentials can be generated separately for each algorithm.

[0046] When encrypting communication data using encryption credentials, there are two scenarios based on the type of encryption credential. When the encryption credential type is a single encryption credential and the single encryption credential is an asymmetric encryption credential, the sending end uses the public key of the asymmetric encryption credential to directly encrypt the communication data, obtaining ciphertext communication data, and sends the ciphertext communication data to the receiving end of the communication link; after receiving the ciphertext communication data, the receiving end uses the private key of the asymmetric encryption credential to decrypt the ciphertext communication data and restore the original communication data.

[0047] When the encryption credential type is a combined encryption credential, the combined encryption credential may include a first encryption credential and a second encryption credential. As an example, the first encryption credential may be a symmetric encryption credential, and the second encryption credential may be the public key of an asymmetric encryption credential.

[0048] The sending end uses the first encryption credential to encrypt the communication data to obtain ciphertext communication data; at the same time, it uses the second encryption credential to encrypt the first encryption credential to obtain ciphertext encryption credential; then it sends the ciphertext communication data and ciphertext encryption credential together to the receiving end of the communication link.

[0049] After receiving the above data, the receiving end first decrypts the ciphertext encryption certificate using the private key corresponding to the second encryption certificate to obtain the first encryption certificate, and then uses the first encryption certificate to decrypt the ciphertext communication data to restore the communication data.

[0050] Using the above method, the relatively fast symmetric encryption algorithm undertakes the encryption and decryption operations of large amounts of communication data, while the relatively slow asymmetric encryption algorithm is only used to protect the first encryption credential. This solves the security problem of transmitting symmetric encryption credentials while reducing the encryption and decryption overhead in large data scenarios.

[0051] Through the above steps S102 to S108, the encryption strength of the encryption credential is dynamically adjusted according to the risk level of the communication link, and the type of encryption credential is dynamically adapted according to the amount of communication data. This achieves the technical effect of simultaneously improving the anti-cracking capability of the encryption credential when the network risk increases, reducing the encryption and decryption operation overhead when the network risk is stable, ensuring security with a single encryption credential in small data scenarios, and balancing encryption security and transmission efficiency with a combination of encryption credentials in large data scenarios, so that the encryption strength and transmission performance are matched in all scenarios.

[0052] The following are Figure 1 The steps shown are illustrated and explained by way of example.

[0053] According to some optional embodiments of this application, the risk level of a communication link can be determined based on network performance index data in the following manner: inputting network performance index data into a machine learning model to obtain baseline data output by the machine learning model, wherein the baseline data is used to characterize the network performance index data under normal network operating conditions; calculating the deviation value between the network performance index data and the baseline data; and determining the risk level of the communication link based on the deviation value.

[0054] In this embodiment, the machine learning model refers to a model trained in a supervised manner using historical network performance index data under normal network operating conditions. The benchmark data (also known as benchmark features or benchmark reference system) refers to the expected values ​​that the model should present under normal network operating conditions for the currently input network performance index data. The deviation value is a quantitative result of the degree of difference between the network performance index data and the benchmark data.

[0055] This embodiment further addresses the problem of how to match the risk level determination criteria with the operating rules of the communication link itself.

[0056] In practical implementation, historical network performance index data can first be cleaned and normalized to eliminate dimensional differences. Then, it can be divided into training and validation sets according to a preset ratio (e.g., 8:2). The objective function is to minimize the deviation between the model's predicted values ​​and the actual sample values. The backpropagation algorithm is used to iteratively update the model parameters. Training hyperparameters can be set to an initial learning rate of 0.001, a batch size of 64, and 200 iterations. Training terminates when the model's accuracy in recognizing normal network operation reaches a preset accuracy threshold (e.g., 95%). Since the training samples are only taken from normal network operation, the model learns the distribution patterns of various indicators when the link is operating normally. Therefore, for any input, it will only output the expected values ​​that conform to normal operation. During real-time analysis, the collected network performance index data undergoes the same normalization process as in the training phase and is then input into the model to obtain baseline data. Subsequently, the deviation between the network performance index data and the baseline data is calculated. For example, Euclidean distance or cosine similarity can be used for calculation. Finally, the deviation value is compared with a preset risk threshold rule; the larger the deviation value, the higher the corresponding risk level.

[0057] In this embodiment, the risk level is determined by fitting the model from the historical operating data of the communication link itself, without relying on a fixed threshold set manually. This allows the deviation value to reflect the degree of deviation of the current network performance index data from the normal operating pattern of the link, thereby improving the adaptability of the risk level determination results to different time periods and different load scenarios.

[0058] According to some alternative embodiments of this application, inputting network performance index data into a machine learning model to obtain baseline data output by the machine learning model can be achieved in the following way: determining at least two network performance indicators collected within a preset time window as time series data according to the chronological order of collection time, and inputting the time series data into the machine learning model; determining the correlation weights between each collection time in the time series data through the machine learning model, and weighting the time series data according to the correlation weights to obtain fused features; and analyzing the fused features through the machine learning model to obtain baseline data.

[0059] In this embodiment, time-series data refers to a data sequence arranged chronologically according to the acquisition time, containing values ​​of at least two network performance indicators at multiple acquisition times. Association weight refers to the weight value used to characterize the degree of association between acquisition times in the time-series data. Fusion feature refers to the feature data obtained after weighting the time-series data according to the association weight, comprehensively reflecting the link operation status within the preset time window.

[0060] This embodiment further addresses the problem of how to enable the determination of benchmark data to utilize the correlation characteristics of network performance indicators in the time dimension.

[0061] In practical implementation, a preset time window length can be set first (as an example, it could be the duration corresponding to several collection periods). At least two network performance metrics collected within this window are arranged chronologically as time-series data and then input into a machine learning model. This model can include a self-attention mechanism module. As an example, this module calculates the correlation between each collection moment in the time-series data and the remaining collection moments within the window, and normalizes the calculation results as association weights. Then, the metric values ​​at each collection moment are weighted and summed according to the association weights to obtain the fused features. After the above processing, collection moments with a higher correlation to the current state have a larger proportion in the fused features, while collection moments with a lower correlation have a smaller proportion. Finally, the model analyzes the fused features and outputs baseline data. As an example, this model can also include convolutional layers and recurrent layers, with features passed between layers through fully connected and residual connections.

[0062] In this embodiment, the benchmark data is determined by weighted fusion of network performance indicators from multiple collection times within a preset time window. This allows the benchmark data to reflect the evolution of various network performance indicators over time, which is beneficial for identifying situations where the individual values ​​of each indicator are within the normal range, but their temporal trends have changed.

[0063] In some optional embodiments of this application, after encrypting the communication data of the communication link using encryption credentials to obtain ciphertext communication data, the following steps can be performed: re-collecting network performance index data of the communication link to obtain updated network performance index data; determining a performance compensation amount based on a complexity coefficient, wherein the performance compensation amount is positively correlated with the complexity coefficient, and the performance compensation amount is used to characterize the change in network performance index data caused by generating and using encryption credentials to encrypt the communication data; correcting the updated network performance index data using the performance compensation amount to obtain corrected network performance index data; inputting the corrected network performance index data into a machine learning model to obtain updated baseline data output by the machine learning model; calculating the deviation value between the corrected network performance index data and the updated baseline data, and determining the update risk level of the communication link based on the deviation value; and updating the complexity coefficient based on the update risk level.

[0064] In this embodiment, updated network performance index data refers to network performance index data re-collected after a round of encrypted transmission is completed. Performance compensation amount is a parameter used to characterize the change in network performance index data caused by the process of generating and encrypting communication data using encryption credentials. Corrected network performance index data refers to the data obtained after correcting the updated network performance index data using the performance compensation amount.

[0065] Increasing the encryption strength of encrypted credentials increases the computing power and time consumed in encryption and decryption operations, leading to increased network latency and decreased throughput. Since network latency and throughput are network performance metrics used to determine risk levels, a situation may arise where increasing encryption strength leads to metric degradation, which in turn is interpreted as an increase in risk level, further prompting an increase in encryption strength. This embodiment further addresses the problem of separating the metric changes caused by the encryption process itself from the criteria for risk level determination.

[0066] In practical implementation, a correspondence between complexity coefficients and performance compensation amounts can be pre-established. This correspondence can be obtained by measuring the increase in network latency and the decrease in throughput caused by encryption and decryption operations under different complexity coefficients. The larger the complexity coefficient, the larger the corresponding performance compensation amount. After completing one round of encrypted transmission, network performance index data of the communication link is re-collected to obtain updated network performance index data. Then, the performance compensation amount corresponding to the current complexity coefficient is found according to the above correspondence, and this performance compensation amount is used to correct the updated network performance index data. As an example, for indicators such as network latency, which increases with increasing encryption strength, the corresponding performance compensation amount can be subtracted from its value; for indicators such as throughput, which decreases with increasing encryption strength, the corresponding performance compensation amount can be added to its value. After correction, the corrected network performance index data is input into a machine learning model to obtain updated baseline data. The deviation between the two is calculated, and the update risk level is determined accordingly. Then, the complexity coefficient is updated according to the update risk level, and the next round of encryption configuration begins.

[0067] In this embodiment, the network performance index data after removing the impact of encryption processing is used to determine the risk level. This ensures that the updated risk level reflects the operating status of the communication link itself, thereby preventing the increase in network latency and decrease in throughput caused by the increase in encryption strength from being judged as link anomalies. It also prevents the complexity coefficient from being continuously pushed up in the above situation and failing to fall back as the link condition improves.

[0068] As some optional embodiments of this application, the risk levels include a first risk level, a second risk level, and a third risk level, wherein the first risk level is higher than the second risk level, and the second risk level is higher than the third risk level.

[0069] The data encryption method also includes the following steps: blocking communication on the communication link when the risk level of the communication link is the first risk level; allowing communication on the communication link when the risk level of the communication link is the second or third risk level, and determining a complexity coefficient that is positively correlated with the risk level.

[0070] In this embodiment, the first risk level, second risk level, and third risk level are further classifications of risk levels, with the levels decreasing sequentially. As an example, the first risk level may correspond to a high-risk stage, indicating a serious anomaly in the communication link that could lead to service interruption; the second risk level may correspond to a medium-risk stage, indicating a potential risk to the communication link; and the third risk level may correspond to a low-risk stage, indicating that the communication link is operating normally. Blocking communication through a communication link means prohibiting the transmission of communication data via that link; allowing communication through a communication link means permitting the transmission of communication data via that link.

[0071] This embodiment further addresses the problem of how to prevent the spread of risk through a link when the risk exceeds the scope of encryption methods.

[0072] In practical implementation, a judgment can be made after determining the risk level and before determining the complexity coefficient. If the risk level of the communication link is the first risk level, communication on the link is blocked. As an example, this can be achieved by disabling the communication service on that link through access control policy configuration. In this case, the subsequent encryption credential configuration process will not be executed. If the risk level of the communication link is the second or third risk level, communication on the link is allowed, and the complexity coefficient positively correlated with the risk level is determined, proceeding to the encryption credential generation process. The above three risk levels can be divided by setting two risk thresholds for the deviation value; the larger the deviation value, the higher the corresponding risk level.

[0073] In this embodiment, when the risk level is the first risk level, communication is blocked. When the risk level is the second or third risk level, communication is allowed and encryption credentials are configured according to the risk level. This ensures that the encryption credential configuration process is only executed when the link has the conditions to continue transmission, while avoiding the transmission of communication data through the link when the link is severely abnormal.

[0074] In some optional embodiments of this application, the encryption strength is positively correlated with the bit length of the encryption credential.

[0075] Based on the complexity coefficient and the encryption credential type, an encryption credential can be generated in the following way: determine the target bit length corresponding to the complexity coefficient; generate the encryption credential, where the bit length of the encryption credential is the target bit length, and the encryption credential belongs to the encryption credential type.

[0076] In this embodiment, encryption strength refers to the ability of an encrypted credential to resist attacks such as brute-force attacks. Bit length refers to the number of binary bits contained in the encrypted credential. Target bit length refers to the bit length that the encrypted credential to be generated should possess, determined based on the complexity coefficient.

[0077] The complexity coefficient is used to characterize the encryption strength of the encrypted credential to be generated, but the encryption strength itself is not a parameter that can be directly used to generate the encrypted credential. This embodiment further addresses the problem of how to translate the encryption strength characterized by the complexity coefficient into a specific parameter that can be directly used in the encrypted credential generation process.

[0078] In practical implementation, a correspondence between complexity coefficients and bit lengths can be pre-established, with larger complexity coefficients corresponding to longer bit lengths. When generating encrypted credentials, the target bit length corresponding to the current complexity coefficient is first determined according to this correspondence, and then an encrypted credential with the target bit length is generated according to the encryption algorithm corresponding to the encrypted credential type. Considering that different encryption algorithms require different bit lengths to achieve equivalent encryption strength, the above correspondence can be set separately for each encryption algorithm. As an example, for asymmetric encryption algorithms, a lower complexity coefficient can correspond to 1024 bits, and a higher complexity coefficient can correspond to 2048 bits; for symmetric encryption algorithms, a lower complexity coefficient can correspond to 128 bits, and a higher complexity coefficient can correspond to 256 bits. When the encrypted credential type is a combined encrypted credential, the target bit length can be determined separately for each corresponding encryption algorithm, and the corresponding encrypted credential can be generated separately.

[0079] In this embodiment, the encryption strength of the encryption certificate is reflected by its bit length. The complexity coefficient is converted into the target bit length through a pre-established correspondence and then directly used to generate the encryption certificate, so that the change in the value of the complexity coefficient can be reflected in the corresponding change in the bit length of the generated encryption certificate.

[0080] As some alternative embodiments of this application, when the encryption credential type is a combined encryption credential, the encryption credential includes symmetric encryption credentials and asymmetric encryption credentials.

[0081] The data encryption method further includes the following steps: encrypting the communication data using a symmetric encryption credential to obtain ciphertext communication data; encrypting the symmetric encryption credential using the public key of an asymmetric encryption credential to obtain a ciphertext encryption credential; and sending the ciphertext communication data and the ciphertext encryption credential to the receiving end of the communication link, wherein the receiving end is used to decrypt the ciphertext encryption credential using the private key of the asymmetric encryption credential to obtain a symmetric encryption credential, and then uses the symmetric encryption credential to decrypt the ciphertext communication data to obtain the communication data.

[0082] In this embodiment, a symmetric encryption credential refers to an encryption credential that uses the same encryption algorithm for both encryption and decryption; an asymmetric encryption credential refers to a key pair consisting of a public key and a private key, where the public key is used for encryption and the private key is used for decryption. A ciphertext encryption credential refers to the data obtained by encrypting a symmetric encryption credential using the public key of the asymmetric encryption credential.

[0083] The encryption credential type is a combined encryption credential, corresponding to scenarios where the communication data volume is not less than a preset threshold. In this scenario, if asymmetric encryption credentials are directly used to encrypt the communication data, the encryption and decryption of large amounts of data will consume significant computing power and time due to the relatively low computational speed of asymmetric encryption algorithms. If only symmetric encryption credentials are used, the credential needs to be transmitted between the sending and receiving ends, posing a risk of interception during transmission. This embodiment further addresses the issue of balancing encryption / decryption computational overhead with the security of symmetric encryption credential transmission in scenarios with large data volumes.

[0084] In practice, the sending end first encrypts the communication data using a symmetric encryption credential to obtain ciphertext communication data. Then, it encrypts the symmetric encryption credential itself using the public key of the asymmetric encryption credential to obtain a ciphertext encryption credential. The ciphertext communication data and the ciphertext encryption credential are then sent together to the receiving end of the communication link. Upon receiving the data, the receiving end first decrypts the ciphertext encryption credential using the private key of the asymmetric encryption credential to obtain a symmetric encryption credential. It then uses this symmetric encryption credential to decrypt the ciphertext communication data to obtain the communication data. Because the private key of the asymmetric encryption credential is kept by the receiving end and not transmitted over the communication link, even if the ciphertext encryption credential is obtained during transmission, it is difficult to reconstruct the symmetric encryption credential without the private key.

[0085] In this embodiment, communication data with a large amount of data is encrypted and decrypted by a symmetric encryption credential with a relatively high computing speed, while asymmetric encryption credential with a relatively low computing speed is only used to encrypt the symmetric encryption credential, which has a very small amount of data. This means that the symmetric encryption credential does not need to be transmitted in plaintext on the communication link. At the same time, the encryption and decryption overhead in the case of large amounts of data does not increase linearly with the computing speed of the asymmetric encryption algorithm as the amount of communication data increases.

[0086] In some optional embodiments, generating an encrypted credential based on a complexity coefficient and an encrypted credential type can be achieved as follows: A base bit length is determined based on the complexity coefficient, where the base bit length is positively correlated with the complexity coefficient; when the encrypted credential type is a single encrypted credential, a single encrypted credential is generated, with the bit length of the single encrypted credential being the base bit length; when the encrypted credential type is a combined encrypted credential, the following steps are performed: A first encrypted credential and a second encrypted credential are determined as included in the combined encrypted credential, where the first encrypted credential is used to encrypt communication data, and the second encrypted credential is used to encrypt the first encrypted credential; a bit length increment is determined based on the amount of communication data, where the bit length increment is positively correlated with the amount of communication data; the sum of the base bit length and the bit length increment is determined as the enhanced bit length, and a second encrypted credential is generated, where the bit length of the second encrypted credential is the enhanced bit length; an equivalent bit length with equivalent security strength to the enhanced bit length is determined, and a first encrypted credential is generated, where the bit length of the first encrypted credential is the equivalent bit length.

[0087] In this embodiment, the base bit length refers to the bit length determined solely based on the complexity coefficient. The bit length increment refers to the bit length added to the base bit length, determined based on the amount of communication data. The enhanced bit length is the sum of the base bit length and the bit length increment. The equivalent bit length refers to a bit length with comparable encryption strength to the enhanced bit length. Equivalent security strength refers to the comparable level of security achieved by encryption credentials from different encryption algorithms in resisting attacks such as brute-force attacks.

[0088] In scenarios where the encryption credential type is a combined encryption credential, the second encryption credential protects the first encryption credential. The first encryption credential protects communication data up to a preset threshold. Once the second encryption credential is cracked, the first encryption credential is exposed, and all the communication data it protected is no longer protected. Therefore, the protective responsibility of the second encryption credential in this scenario is different from that in a single encryption credential scenario. On the other hand, the overall encryption strength of a combined encryption credential depends on the one with the lower encryption strength. If the encryption strengths of the first and second encryption credentials are not comparable, the extra bits added by the one with higher encryption strength do not improve the overall encryption strength but instead increase the encryption and decryption overhead. This embodiment further addresses the problem of how to match the bit length of each encryption credential with the data volume of the object it protects and the encryption strength between them in a combined encryption credential scenario.

[0089] In the specific implementation, the base bit length is first determined according to the correspondence between complexity coefficients and bit lengths. If the encryption credential type is a single encryption credential, a single encryption credential with a bit length equal to the base bit length is generated. If the encryption credential type is a combined encryption credential, the first and second encryption credentials included are first determined, where the first encryption credential is used to encrypt communication data, and the second encryption credential is used to encrypt the first encryption credential. Then, the bit length increment is determined according to the pre-established correspondence between the amount of communication data and the bit length increment; the larger the amount of communication data, the larger the corresponding bit length increment. The base bit length and the bit length increment are added to obtain the enhanced bit length, and a second encryption credential with the enhanced bit length is generated. Finally, according to the pre-established bit length comparison relationship of different encryption algorithms under equivalent security strength, an equivalent bit length with equivalent security strength to the enhanced bit length is determined, and a first encryption credential with the equivalent bit length is generated. As an example, if the first encryption credential corresponds to a symmetric encryption algorithm and the second encryption credential corresponds to an asymmetric encryption algorithm, then the equivalent bit length corresponding to an enhanced bit length of 3072 bits can be 128 bits, and the equivalent bit length corresponding to an enhanced bit length of 7680 bits can be 192 bits.

[0090] In this embodiment, the bit length of the second encryption credential is increased by bit increments based on the base bit length as the amount of communication data increases. The bit length of the first encryption credential is aligned with the second encryption credential according to the equivalent security strength, so that the bit length of the second encryption credential is longer when the amount of communication data protected is larger. At the same time, the encryption strength of the first encryption credential and the second encryption credential is equivalent. There is no encryption credential in the combination that has a significantly lower encryption strength than the other, nor is there one whose bit length exceeds the equivalent security strength without bringing about an overall improvement in encryption strength.

[0091] This application also provides a data decryption method, which can be executed by the receiving end of a communication link. The receiving end can be a server, a gateway device, or a terminal device. This method corresponds to the aforementioned data encryption method, which is executed by the sending end, while this method is executed by the receiving end. Together, they constitute the complete process of communication data transmission via the communication link. Terms already described in the aforementioned data encryption method have the same meaning in this method.

[0092] Before describing each step, let's clarify some terms used in this method. A decryption credential is the data used to perform decryption operations on ciphertext, corresponding to the encryption credential used to perform the encryption operation: when the encryption credential is a symmetric encryption credential, the corresponding decryption credential is the symmetric encryption credential itself; when the encryption credential is the public key of an asymmetric encryption credential, the corresponding decryption credential is the private key of that asymmetric encryption credential. Ciphertext communication data refers to the data obtained after the sending end encrypts the communication data using an encryption credential. A ciphertext encryption credential refers to the data obtained after the sending end encrypts the first encryption credential using a second encryption credential.

[0093] Figure 2 This is a flowchart of a data decryption method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0094] Step S202: Receive data sent by the sending end via the communication link.

[0095] The data in step S202 refers to all the content sent by the sending end to the receiving end via the communication link after the encryption process is completed. The content of this data varies depending on the type of encryption credential used by the sending end: when the sending end uses a single encryption credential, the data includes ciphertext communication data; when the sending end uses a combination of encryption credentials, the data includes both ciphertext communication data and ciphertext encryption credentials.

[0096] In practice, the receiving end can continuously monitor the communication link, store the received data in a buffer, and then process it in subsequent steps. As an example, the sending end can write a flag bit in the header field of the sent data to indicate whether the data carries a ciphertext encryption credential; the receiving end can also determine whether there is a ciphertext encryption credential field that is independent of the ciphertext communication data by parsing the data structure.

[0097] Step S204: If the data includes encrypted communication data but does not include encrypted encryption credentials, determine that the encryption credentials type is a single encryption credentials, and use the decryption credentials corresponding to the single encryption credentials to decrypt the encrypted communication data to obtain the communication data.

[0098] The basis for this step is that when the sending end uses a single encryption credential, the credential is held separately by the sending and receiving ends, and does not need to be transmitted along with the communication data. Therefore, the encrypted encryption credential will not appear in the transmitted data. Accordingly, if the receiving end does not parse the encrypted encryption credential from the received data, it can be determined that the encryption credential type used by the sending end is a single encryption credential.

[0099] In practice, after making the above judgment, the receiving end obtains the decryption credential corresponding to the single encryption credential from its local storage, and uses the decryption credential to perform decryption operations on the encrypted communication data to restore the communication data. As an example, the single encryption credential can be the public key of an asymmetric encryption credential, and the corresponding decryption credential can be the private key of the asymmetric encryption credential. The private key is kept by the receiving end and is not transmitted over the communication link.

[0100] Step S206: When the data includes encrypted communication data and encrypted encryption certificate, determine that the encryption certificate type is a combined encryption certificate. The combined encryption certificate includes a first encryption certificate and a second encryption certificate. Use the decryption certificate corresponding to the second encryption certificate to decrypt the encrypted encryption certificate to obtain the first encryption certificate. Use the first encryption certificate to decrypt the encrypted communication data to obtain the communication data.

[0101] The encryption credential type is determined by the sender based on the comparison between the amount of communication data in the communication link within a preset period and a preset threshold. The bit lengths of the single encryption credential, the first encryption credential, and the second encryption credential are all positively correlated with the complexity coefficient. The complexity coefficient is positively correlated with the risk level of the communication link, and the risk level is determined based on the network performance index data of the communication link.

[0102] The basis for this step is that when the sending end uses a combined encryption credential, the first encryption credential needs to be transmitted to the receiving end for decryption. Since this credential is not transmitted in plaintext, the transmitted data will also carry the ciphertext encryption credential obtained by encrypting it. Therefore, when the receiving end simultaneously parses the ciphertext communication data and the ciphertext encryption credential from the received data, it can determine that the encryption credential type used by the sending end is a combined encryption credential.

[0103] In practice, the decryption process proceeds in the reverse order of the encryption process at the sending end, and is divided into two levels. The receiving end first obtains the decryption credential corresponding to the second encryption credential locally, uses this decryption credential to perform a decryption operation on the ciphertext encryption credential, and restores the first encryption credential; then, it uses the restored first encryption credential to perform a decryption operation on the ciphertext communication data, and restores the communication data. As an example, when the second encryption credential is the public key of an asymmetric encryption credential, the corresponding decryption credential is the private key of that asymmetric encryption credential. This private key is kept by the receiving end and is not transmitted over the communication link. Therefore, even if the ciphertext encryption credential is obtained during transmission, it is difficult to restore the first encryption credential without this private key.

[0104] The origins of the encryption credential types and their bit lengths are explained below. The encryption credential type is determined by the sending end based on a comparison between the amount of communication data within a preset period and a preset threshold. When the amount of communication data is less than the preset threshold, the sending end determines the encryption credential type to be a single encryption credential corresponding to one encryption algorithm; when the amount of communication data is not less than the preset threshold, the sending end determines the encryption credential type to be a combined encryption credential corresponding to at least two encryption algorithms. The bit lengths of the single encryption credential, the first encryption credential, and the second encryption credential are all positively correlated with the complexity coefficient, which is positively correlated with the risk level of the communication link. The risk level is determined by the sending end based on the network performance index data of the communication link. Therefore, the data received by the receiving end corresponds in form to the amount of communication data sent by the sending end, and the bit lengths of each encryption credential correspond to the risk level determined by the sending end.

[0105] It should be noted that when the receiving end executes steps S204 and S206, it does not need to know in advance the communication data volume, complexity coefficient, and risk level determined by the sending end, nor does it need the sending end to separately inform it of the encryption credential type used this time. The receiving end can direct the data to the corresponding decryption process simply based on whether the received data contains a ciphertext encryption credential, and perform a decryption operation of the corresponding bit length based on the actual bit length of the restored encryption credential. Therefore, the sending end can adjust the encryption credential type and bit length itself according to the link conditions and data volume in each round of transmission, and the receiving end does not need to update its configuration synchronously.

[0106] Through steps S202 to S206, the receiving end can restore the data sent by the sending end after dynamically adapting the encryption credential type according to the amount of communication data and dynamically adjusting the encryption credential bit length according to the risk level. Moreover, this restoration process does not depend on the pre-agreed agreement between the sending end and the receiving end on the encryption credential type and bit length, thereby maintaining the continuity of communication data transmission even when the encryption configuration of the sending end changes round by round.

[0107] Figure 3 This is a structural diagram of an intelligent communication device according to an embodiment of this application. Figure 4 This is a flowchart of a data encryption and decryption method according to an embodiment of this application. The following is in conjunction with... Figure 3 and Figure 4 It details the specific process of data encryption and decryption methods.

[0108] like Figure 3 As shown in the illustration, the intelligent communication device (also known as an AI-based intelligent communication encryption device) provided in this application includes a monitoring unit, an encryption credential generation unit, and an encryption / decryption unit. These three units are connected sequentially, with the output of the monitoring unit connected to the input of the encryption credential generation unit, and the output of the encryption credential generation unit connected to the input of the encryption / decryption unit. This device can be deployed at the transmitting end of the communication link, or it can be deployed at both the transmitting and receiving ends; this application does not limit this. The above unit division method is exemplary; each unit can be implemented by independent hardware modules or by different functional modules within the same electronic device.

[0109] The monitoring unit comprises a monitor, an intelligent analyzer, and a controller. The monitor listens to the communication link in real time, collecting network performance index data (also known as core network index data) according to a preset collection cycle, and transmits the collected data to the intelligent analyzer. The intelligent analyzer receives the network performance index data transmitted by the monitor, analyzes the data using a pre-trained machine learning model (also known as an AI intelligent engine or benchmark model), obtains benchmark data, calculates the deviation between the network performance index data and the benchmark data, and determines the risk level of the communication link based on the deviation value. This risk level is then transmitted to the controller. The controller performs control operations on the communication link based on the risk level output by the intelligent analyzer. Communication is blocked when the risk level is at the first risk level (also known as the high-risk stage), and communication is allowed when the risk level is at the second or third risk level (also known as the medium-risk stage or low-risk stage). Simultaneously, the controller also synchronizes the risk level to the encryption credential generation unit as a basis for subsequently determining the complexity coefficient.

[0110] The encrypted credential generation unit comprises an intelligent decision-maker and an encrypted credential generator. The intelligent decision-maker determines the complexity coefficient based on the risk level of the controller synchronization and determines the encrypted credential type based on a comparison of the communication data volume within a preset period with a preset threshold. It then transmits the complexity coefficient and encrypted credential type to the encrypted credential generator. The encrypted credential generator generates an encrypted credential (also known as a dynamic key) of the corresponding length based on the received complexity coefficient and encrypted credential type, and outputs the generated encrypted credential to the encryption / decryption unit.

[0111] The encryption / decryption unit includes an encryptor and a decryptor. The encryptor uses the encryption credential output by the encryption credential generator to encrypt the communication data, obtaining ciphertext communication data, which is then sent to the receiving end via the communication link. The decryptor decrypts the data received via the communication link, restoring the original communication data. Since the same electronic device can act as a sender in one communication and a receiver in another, both an encryptor and a decryptor can be configured in the encryption / decryption unit; in devices that only perform unidirectional transmission tasks, only one of them may be configured.

[0112] like Figure 4 As shown, the data encryption and decryption methods performed based on the above-mentioned device may include the following process.

[0113] After the process begins, data analysis and grading are performed first, corresponding to step S102 mentioned above, and are executed by the monitoring unit. Specifically, the monitor collects network performance indicator data of the communication link in real time. As an example, this data may include at least one of network bandwidth, throughput, packet loss rate, and network latency. The intelligent analyzer inputs the collected network performance indicator data into a machine learning model to obtain baseline data output by the model. This baseline data is used to characterize the network performance indicator data under normal network operating conditions. Subsequently, the deviation value between the network performance indicator data and the baseline data is calculated, and the deviation value is compared with a preset risk threshold rule to determine the risk level of the communication link. The larger the deviation value, the higher the corresponding risk level.

[0114] The logic for determining the risk status involves judging whether the risk level of the communication link is at the first risk level. This judgment is executed by the controller, and the result determines the subsequent process: if the judgment is yes, the process proceeds to the communication disabling branch; if the judgment is no, meaning the risk level is the second or third risk level, the process proceeds to the encrypted transmission branch.

[0115] If the determination result is yes, the controller performs a network communication disable operation, blocking communication on the communication link. As an example, communication services on this link can be disabled by configuring access control policies to prevent security risks from spreading through this link. After this operation is performed, the current process terminates, and subsequent encryption credential generation and encrypted transmission operations will not be executed.

[0116] If the determination result is negative, the controller allows communication through the communication link, and the process proceeds to the generation of the encryption credential, executed by the encryption credential generation unit. Specifically, the intelligent decision-maker first determines a complexity coefficient based on the risk level synchronized by the controller. The complexity coefficient is positively correlated with the risk level and is used to characterize the encryption strength of the encryption credential to be generated. Then, it counts the amount of communication data on the communication link within a preset period and compares this amount of communication data with a preset threshold. If the amount of communication data is less than the preset threshold, the encryption credential type is determined to be a single encryption credential corresponding to one encryption algorithm; if the amount of communication data is not less than the preset threshold, the encryption credential type is determined to be a combined encryption credential corresponding to at least two encryption algorithms. The intelligent decision-maker transmits the determined complexity coefficient and encryption credential type to the encryption credential generator, which determines the target bit length based on the complexity coefficient and generates an encryption credential with the target bit length according to the encryption algorithm corresponding to the encryption credential type. Because this generation process is re-executed in each round of transmission based on the risk level and communication data volume of that round, the bit length and type of the generated encryption credential change with the communication link status and the volume of data to be transmitted.

[0117] After generating the encryption credential, the process transitions to the encryption and decryption of communication data, which is performed by the encryption / decryption unit. When the encryption credential type is a single encryption credential, the sender's encryptor uses this single encryption credential to encrypt the communication data, obtaining ciphertext communication data, which is then sent to the receiver. The receiver's decryptor receives data that includes the ciphertext communication data but does not include the ciphertext encryption credential, thus determining the encryption credential type to be a single encryption credential. It then uses the decryption credential corresponding to this single encryption credential to decrypt the ciphertext communication data, obtaining the communication data.

[0118] When the encryption credential type is a combined encryption credential, the combined encryption credential includes a first encryption credential and a second encryption credential. The encryptor at the sending end first uses the first encryption credential to encrypt the communication data to obtain ciphertext communication data, and then uses the second encryption credential to encrypt the first encryption credential to obtain a ciphertext encryption credential. The ciphertext communication data and the ciphertext encryption credential are then sent to the receiving end. The decryptor at the receiving end receives data that includes both the ciphertext communication data and the ciphertext encryption credential, thus determining the encryption credential type to be a combined encryption credential. It first uses the decryption credential corresponding to the second encryption credential to decrypt the ciphertext encryption credential to obtain the first encryption credential, and then uses the first encryption credential to decrypt the ciphertext communication data to obtain the communication data. After completing the above operations, the process ends.

[0119] It should be noted that, Figure 4 The process shown can be executed cyclically according to a preset period. After completing one round of encrypted transmission, the monitor can re-collect network performance index data of the communication link. The intelligent analyzer determines the updated risk level based on this data, and the intelligent decision-maker then re-determines the complexity coefficient and encryption credential type based on the updated risk level and the current amount of communication data. This ensures that the bit length and type of the encryption credential continuously follow changes in the communication link status and the amount of data to be transmitted.

[0120] It should also be noted that when the receiving end performs the decryption operation, it does not need to know in advance the risk level, complexity coefficient and communication data volume determined by the sending end in the current round. It can be diverted to the corresponding decryption process only based on whether the received data contains the encrypted credential. Therefore, the sending end's adjustment of the encryption configuration round by round will not affect the receiving end's decryption process.

[0121] Figure 5 This is a structural diagram of a data encryption device according to an embodiment of this application, such as... Figure 5 As shown, the device includes:

[0122] The acquisition module 52 is used to acquire network performance index data of the communication link and determine the risk level of the communication link based on the network performance index data.

[0123] The first determining module 54 is used to determine a complexity coefficient that is positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated.

[0124] The second determining module 56 is used to perform the following steps: if the amount of communication data in the communication link within a preset period is less than a preset threshold, the encryption credential type is determined to be a single encryption credential corresponding to one encryption algorithm; if the amount of communication data in the communication link within a preset period is not less than a preset threshold, the encryption credential type is determined to be a combined encryption credential corresponding to at least two encryption algorithms.

[0125] The encryption module 58 is used to generate an encryption credential based on the complexity coefficient and the encryption credential type, and to use the encryption credential to encrypt the communication data of the communication link to obtain ciphertext communication data.

[0126] It should be noted that the above Figure 5 The modules in can be program modules (e.g., a set of program instructions that implements a specific function) or hardware modules. For the latter, they can be represented in the following forms, but are not limited to these: each of the above modules is represented by a processor, or the functions of each of the above modules are implemented by a processor.

[0127] It should be noted that, Figure 5 Preferred embodiments of the shown examples can be found in [reference needed]. Figure 1 The relevant descriptions of the embodiments shown will not be repeated here.

[0128] Figure 6 This is a structural diagram of a data decryption apparatus according to an embodiment of this application, such as... Figure 6 As shown, the device includes:

[0129] The receiving module 62 is used to receive data sent by the sending end via the communication link.

[0130] The determination module 64 is used to determine that the encryption credential type is a single encryption credential when the data includes encrypted communication data but does not include encrypted encryption credential, and to decrypt the encrypted communication data using the decryption credential corresponding to the single encryption credential to obtain the communication data.

[0131] The decryption module 66 is used to perform the following steps: when the data includes encrypted communication data and encrypted encryption credentials, the encryption credential type is determined to be a combined encryption credential, which includes a first encryption credential and a second encryption credential. The encrypted encryption credential is decrypted using the decryption credential corresponding to the second encryption credential to obtain the first encryption credential, and the encrypted communication data is decrypted using the first encryption credential to obtain the communication data. The encryption credential type is determined by the sending end based on the comparison between the amount of communication data in the communication link within a preset period and a preset threshold. The bit lengths of the single encryption credential, the first encryption credential, and the second encryption credential are all positively correlated with the complexity coefficient. The complexity coefficient is positively correlated with the risk level of the communication link, and the risk level is determined based on the network performance index data of the communication link.

[0132] It should be noted that the above Figure 5 The modules in can be program modules (e.g., a set of program instructions that implements a specific function) or hardware modules. For the latter, they can be represented in the following forms, but are not limited to these: each of the above modules is represented by a processor, or the functions of each of the above modules are implemented by a processor.

[0133] It should be noted that, Figure 6 Preferred embodiments of the shown examples can be found in [reference needed]. Figure 2 The relevant descriptions of the embodiments shown will not be repeated here.

[0134] Figure 7 A hardware block diagram of a computer terminal for implementing a data encryption method is shown. Figure 7 As shown, the computer terminal 70 may include a processor 702, a memory 704 for storing data, and a transmission module 706 for communication functions. The processor 702 may include one or more processors. For ease of explanation, Figure 7 The diagram illustrates multiple processors, including a first processor 702a, a second processor 702b, ..., an nth processor 702n. The processor 702 may be a processing device including, but not limited to, a microcontroller unit (MCU) or a field-programmable gate array (FPGA).

[0135] In addition, a computer terminal may also include: a display, an input / output interface (I / O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 7 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, the computer terminal 70 may also include... Figure 7 The more or fewer components shown, or having the same Figure 7 The different configurations shown.

[0136] It should be noted that the aforementioned one or more processors 702 and / or other data processing circuits may be referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 70. As involved in the embodiments of this application, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).

[0137] The memory 704 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the data encryption method in this embodiment. The processor 702 executes various functional applications and data processing by running the software programs and modules stored in the memory 704, thereby implementing the aforementioned data encryption method. The memory 704 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 704 may further include memory remotely located relative to the processor 702, and these remote memories can be connected to the computer terminal 70 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0138] The transmission module 706 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 70. In one example, the transmission module 706 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 706 may be a Radio Frequency (RF) module, used for data interaction with external networks or devices via wired and / or wireless network connections.

[0139] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the computer terminal 70. In addition, the computer terminal 70 can be connected to a cursor control device and a keyboard via an input / output interface. The cursor control device (e.g., a mouse, trackball, or touchpad) is mainly used to transmit directional information and command selection to the terminal and control the movement of the cursor on the display; the keyboard is mainly used to receive letters, numbers, and other control commands input by the user, thereby enabling interaction between the user and the computer terminal 70.

[0140] It should be noted here that, in some optional embodiments, the above... Figure 7 The computer terminal shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 7 This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computer terminal.

[0141] It should be noted that, Figure 7 The computer terminal shown is used to execute Figure 1The data encryption method shown above means that the relevant explanations in the execution method of the above command also apply to this electronic device, and will not be repeated here.

[0142] This application also provides a non-volatile storage medium, which includes a stored program, wherein the program, when running, controls the device where the storage medium is located to execute the above-mentioned data encryption method.

[0143] A non-volatile storage medium performs the following functions: acquires network performance index data of the communication link and determines the risk level of the communication link based on the network performance index data; determines a complexity coefficient positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated; if the amount of communication data of the communication link within a preset period is less than a preset threshold, determines the encryption credential type as a single encryption credential corresponding to one encryption algorithm; if the amount of communication data of the communication link within a preset period is not less than the preset threshold, determines the encryption credential type as a combined encryption credential corresponding to at least two encryption algorithms; generates an encryption credential based on the complexity coefficient and the encryption credential type, and uses the encryption credential to encrypt the communication data of the communication link to obtain ciphertext communication data.

[0144] This application also provides an electronic device, including a memory and a processor, wherein the processor is used to run a program stored in the memory, wherein the program executes the above-described data encryption method during runtime.

[0145] The processor is used to run a program that performs the following functions: acquires network performance index data of the communication link and determines the risk level of the communication link based on the network performance index data; determines a complexity coefficient positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated; if the amount of communication data of the communication link within a preset period is less than a preset threshold, determines the encryption credential type as a single encryption credential corresponding to one encryption algorithm; if the amount of communication data of the communication link within a preset period is not less than the preset threshold, determines the encryption credential type as a combined encryption credential corresponding to at least two encryption algorithms; generates an encryption credential based on the complexity coefficient and the encryption credential type, and uses the encryption credential to encrypt the communication data of the communication link to obtain ciphertext communication data.

[0146] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0147] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0148] In the above embodiments of this application, the information collected is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with relevant laws, regulations and standards, take necessary protective measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse.

[0149] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0150] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0151] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0152] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0153] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A data encryption method characterized by, include: Obtain network performance index data of the communication link, and determine the risk level of the communication link based on the network performance index data; Determine a complexity coefficient that is positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated; If the amount of communication data in the communication link within a preset period is less than a preset threshold, the encryption credential type is determined to be a single encryption credential corresponding to one encryption algorithm; if the amount of communication data in the communication link within the preset period is not less than the preset threshold, the encryption credential type is determined to be a combined encryption credential corresponding to at least two encryption algorithms. Based on the complexity coefficient and the encryption credential type, an encryption credential is generated, and the encryption credential is used to encrypt the communication data of the communication link to obtain ciphertext communication data.

2. The method of claim 1, wherein, Determining the risk level of the communication link based on the network performance index data includes: The network performance index data is input into a machine learning model to obtain the benchmark data output by the machine learning model, wherein the benchmark data is used to characterize the network performance index data under normal network operating conditions. Calculate the deviation between the network performance metric data and the benchmark data; The risk level of the communication link is determined based on the deviation value.

3. The method of claim 2, wherein, The network performance metric data is input into the machine learning model to obtain the baseline data output by the machine learning model, including: According to the order of collection time, at least two network performance indicators collected within a preset time window are determined as time series data, and the time series data is input into the machine learning model; The machine learning model is used to determine the correlation weights between each acquisition time in the time series data, and the time series data is weighted according to the correlation weights to obtain fused features. The benchmark data is obtained by analyzing the fused features using the machine learning model.

4. The method of claim 2, wherein, After encrypting the communication data of the communication link using the encryption credential to obtain ciphertext communication data, the method further includes: The network performance index data of the communication link is re-collected to obtain updated network performance index data; Based on the complexity coefficient, a performance compensation amount is determined, wherein the performance compensation amount is positively correlated with the complexity coefficient, and the performance compensation amount is used to characterize the change in the network performance index data caused by generating and using the encryption credential to encrypt the communication data; The updated network performance index data is corrected using the performance compensation amount to obtain corrected network performance index data; The corrected network performance index data is input into the machine learning model to obtain the updated baseline data output by the machine learning model; Calculate the deviation between the corrected network performance index data and the updated baseline data, and determine the update risk level of the communication link based on the deviation. The complexity coefficient is updated based on the updated risk level.

5. The method according to claim 1, characterized in that, The risk levels include a first risk level, a second risk level, and a third risk level, wherein the first risk level is higher than the second risk level, and the second risk level is higher than the third risk level; The method further includes: blocking communication of the communication link when the risk level of the communication link is the first risk level; If the risk level of the communication link is the second risk level or the third risk level, communication on the communication link is permitted, and a complexity coefficient positively correlated with the risk level is determined.

6. The method of claim 1, wherein, The encryption strength is positively correlated with the bit length of the encryption credential; generating the encryption credential based on the complexity coefficient and the encryption credential type includes: determining a target bit length corresponding to the complexity coefficient; generating the encryption credential, wherein the bit length of the encryption credential is the target bit length, and the encryption credential belongs to the encryption credential type.

7. The method according to claim 1, characterized in that, When the encryption credential type is the combined encryption credential, the encryption credential includes symmetric encryption credentials and asymmetric encryption credentials; The method further includes: encrypting the communication data using the symmetric encryption credential to obtain the ciphertext communication data; encrypting the symmetric encryption credential using the public key of the asymmetric encryption credential to obtain the ciphertext encryption credential; and sending the ciphertext communication data and the ciphertext encryption credential to the receiving end of the communication link, wherein the receiving end is used to decrypt the ciphertext encryption credential using the private key of the asymmetric encryption credential to obtain the symmetric encryption credential, and to decrypt the ciphertext communication data using the symmetric encryption credential to obtain the communication data.

8. The method of claim 1, wherein, Based on the complexity coefficient and the encryption credential type, an encryption credential is generated, including: The base bit length is determined based on the complexity coefficient, wherein the base bit length is positively correlated with the complexity coefficient; When the type of the encryption credential is the single encryption credential, the single encryption credential is generated, and the bit length of the single encryption credential is the base bit length; When the encryption credential type is the combined encryption credential, perform the following steps: The combined encryption credentials are determined to include a first encryption credential and a second encryption credential, wherein the first encryption credential is used to encrypt the communication data, and the second encryption credential is used to encrypt the first encryption credential; The bit length increment is determined based on the amount of communication data, wherein the bit length increment is positively correlated with the amount of communication data; The sum of the base bit length and the bit length increment is determined as the enhanced bit length, and the second encryption credential is generated, wherein the bit length of the second encryption credential is the enhanced bit length; An equivalent bit length with equivalent security strength to the enhanced bit length is determined, and the first encryption credential is generated, wherein the bit length of the first encryption credential is the equivalent bit length.

9. A data decryption method characterized by, include: Receive data sent by the sending end via the communication link; If the data includes encrypted communication data but does not include encrypted encryption credentials, the encryption credentials type is determined to be a single encryption credentials, and the encrypted communication data is decrypted using the decryption credentials corresponding to the single encryption credentials to obtain the communication data. When the data includes encrypted communication data and encrypted encryption credentials, the encryption credentials are determined to be a combined encryption credentials, which include a first encryption credentials and a second encryption credentials. The encrypted encryption credentials are decrypted using the decryption credentials corresponding to the second encryption credentials to obtain the first encryption credentials. The encrypted communication data is then decrypted using the first encryption credentials to obtain the communication data. The encryption credential type is determined by the sending end based on the comparison result of the communication data volume of the communication link within a preset period and a preset threshold. The bit length of the single encryption credential, the first encryption credential, and the second encryption credential are all positively correlated with the complexity coefficient. The complexity coefficient is positively correlated with the risk level of the communication link. The risk level is determined based on the network performance index data of the communication link.

10. A data encryption device, characterized by comprising: include: The acquisition module is used to acquire network performance index data of the communication link and determine the risk level of the communication link based on the network performance index data. The first determining module is used to determine a complexity coefficient that is positively correlated with the risk level, wherein the complexity coefficient is used to characterize the encryption strength of the encryption credential to be generated; The second determining module is used to perform the following steps: if the amount of communication data of the communication link within a preset period is less than a preset threshold, the encryption credential type is determined to be a single encryption credential corresponding to an encryption algorithm; if the amount of communication data of the communication link within the preset period is not less than the preset threshold, the encryption credential type is determined to be a combined encryption credential corresponding to at least two encryption algorithms. An encryption module is used to generate an encryption credential based on the complexity coefficient and the encryption credential type, and to use the encryption credential to encrypt the communication data of the communication link to obtain ciphertext communication data.