High-concurrency transparent encryption and decryption method and system for power dispatching operation data
By introducing pipeline concurrency and dynamic thread pool technology in the transparent encryption and decryption process of power scheduling operation data, the problem of insufficient data processing capabilities in the middle and high concurrency environments of the existing technology is solved, and more efficient encryption and decryption performance and data security are achieved.
Patent Information
- Application Number
- CN202411626701.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-04-04
AI Technical Summary
The transparent encryption and decryption method for power scheduling operation data in the prior art does not consider performance optimization in a high concurrency environment, resulting in weak data processing capabilities in high concurrency situations, reducing data security.
The pipeline concurrency mechanism is used to decompose tasks to encrypt or decrypt request tasks, and thread allocation is performed through dynamic thread pool processing method, and finally transparent encryption and decryption is performed through the preset master key.
It improves the encryption performance and security of power scheduling operation data in high concurrency, and optimizes system performance, avoiding the problems of wasted resources and excessive system load.
Smart Images

Figure CN119760735A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data security technology, and in particular to a method and system for high-concurrency transparent encryption and decryption of power dispatching operation data. Background Art
[0002] At present, as the core data of infrastructure operation, power dispatching operation data has a high degree of confidentiality requirements. In order to ensure data security, the power industry has adopted a variety of data protection methods, mainly including access control, data desensitization, and data transparent encryption and decryption. Taking the access control method involved in the invention with patent number CN115587113A and the name "A method for managing access rights to transparent encrypted data in MySQL databases" as an example, the invention implements unified permission management for users to access transparent encrypted data based on database IP, database service port, database name, user name and user IP information for multiple MySQL databases that provide transparent data encryption functions; user access rights information is stored in a domestic encryption machine, which ensures that MySQL database data is stored safely on the physical disk while distinguishing the user's access rights to transparent encrypted data, solving the security problem of unauthorized users being able to access transparent encrypted data in MySQL 5.7.33 version and not affecting the original normal functions of the MySQL database, being transparent to the upper-layer business software of the MySQL database, and having little impact on database performance. However, the method of the invention only improves access rights and improves security, but does not optimize encryption and decryption performance for high-concurrency environments, and therefore cannot meet the requirements for power operation data encryption.
[0003] Transparent Data Encryption (TDE) technology has been widely used because it is transparent to users and applications and does not require modification of existing application logic. Taking the data processing technology field involved in the invention with patent number CN118643517A and titled "An Adaptive Hardware Encryption Method, Device, Computer Equipment and Medium" as an example, the applied data transparent encryption and decryption technology specifically includes the following steps: obtaining the data to be encrypted and the data characteristics of the data to be encrypted through a data transmission channel, and selecting a corresponding data encryption method according to the data characteristics; preprocessing the encrypted data according to the data type and data volume of the data to be encrypted, and dividing and filling the encrypted data according to the selected data encryption method to generate preprocessed encrypted data; checking the correctness of the metadata, optimizing the encryption process of the selected data encryption method according to the hardware configuration of the microcontroller, and executing the optimized encryption process of the selected data encryption method on the microcontroller according to the metadata to encrypt and / or decrypt the preprocessed encrypted data. The method in the invention improves the efficiency and security of hardware data encryption by adaptively selecting an encryption algorithm. However, the invention uses hardware acceleration to improve the efficiency of transparent encryption and decryption, but hardware acceleration requires special hardware, which will increase the cost of system maintenance. The use of hardware acceleration can only accelerate specific algorithms and cannot be applied to all encryption algorithms. In the invention with patent number CN118036026A and name "Transparent Data Encryption Method and Encryption System Based on MongoDB", the transparent data encryption method is applied to the transparent data encryption system; the transparent data encryption system includes: a transparent encryption management platform, an application system, and a Mongo database; the transparent encryption management platform is provided with a key management module and a policy database; the transparent data encryption method includes: the transparent encryption management platform adds the Mongo database and generates an authentication identifier bound to the Mongo database; obtains the configuration file of the Mongo database; adds the database address and authentication identifier of the preset read storage strategy to the configuration file to generate a modified configuration file; obtains the Jar package dependency of the Mongo database; adds the read storage strategy operation and the encryption and decryption operation to the add, delete, modify and query operations recorded in the Jar package dependency to generate the modified Jar package dependency; in this way, transparent encryption can be realized conveniently and efficiently; however, the invention designs a transparent encryption system for the Mongo database, only for low load, and does not consider the performance optimization of high concurrency.
[0004] In summary, the encryption and decryption methods used in the prior art for power dispatching operation data do not take into account performance optimization in a high-concurrency environment, resulting in weak data processing capabilities in high-concurrency situations, leading to reduced data security. Summary of the invention
[0005] In order to solve the problem that the existing transparent encryption method for power dispatching operation data does not take into account the performance optimization in a high concurrency environment, resulting in weak data processing capability under high concurrency conditions, resulting in reduced data security, the present invention proposes a high-concurrency transparent encryption method for power dispatching operation data, comprising:
[0006] Obtain the encryption request task corresponding to the power dispatching operation data;
[0007] Decomposing the request task to be encrypted by using a pipeline concurrency mechanism to obtain a task execution queue;
[0008] Utilizing a dynamic thread pool processing method to allocate threads to the task execution queue;
[0009] The task execution queue allocated by the thread is transparently encrypted by a preset master key.
[0010] Optionally, the pipeline concurrency mechanism is used to decompose the request task to be encrypted to obtain a task execution queue, including:
[0011] Decomposing the request task to be encrypted by using a pipeline concurrency mechanism to obtain encryption tasks at different stages corresponding to the request task to be encrypted;
[0012] The input-output multiplexing method is adopted to queue the encryption tasks in the different stages according to a preset execution order to obtain a task execution queue.
[0013] Optionally, the utilizing a dynamic thread pool processing method to allocate threads to the task execution queue includes:
[0014] Obtaining a preset number of encryption tasks from the task execution queue according to the execution order;
[0015] The dynamic thread pool processing method is used to allocate threads to a preset number of encryption tasks in the task execution queue.
[0016] Optionally, the use of a dynamic thread pool processing method to perform thread allocation on a preset number of encryption tasks in the task execution queue includes:
[0017] Initialize the number of core thread pools, the maximum number of thread pools, and the blocking queue;
[0018] If the current number of working threads is less than the number of the core thread pool, threads are allocated for the preset number of encryption tasks;
[0019] If the number of working threads is not less than the number of core thread pools, check whether the blocking queue is full. If not, add the encryption task to the blocking queue. If full, compare the number of working threads with the maximum number of threads, and allocate threads to the encryption task based on the comparison result.
[0020] Optionally, performing thread allocation for the encryption task according to the comparison result includes:
[0021] If the number of working threads is equal to or greater than the maximum number of thread pools, the encryption task is discarded and an exception is thrown;
[0022] If the number of working threads is less than the maximum number of thread pools, threads are allocated for the encryption task.
[0023] Optionally, transparently encrypting the task execution queue assigned by the thread by using a preset master key includes:
[0024] Get the data key;
[0025] Encrypting the data key using a preset master key to obtain an encrypted data key;
[0026] The task execution queue distributed by the thread is transparently encrypted using the encrypted data key.
[0027] Based on the same inventive concept, the present invention also provides a high-concurrency transparent encryption system for power dispatching operation data, comprising:
[0028] An encryption task acquisition module is used to obtain the encryption request tasks corresponding to the power dispatching operation data;
[0029] An encryption task decomposition module is used to decompose the encryption request task by using a pipeline concurrency mechanism to obtain a task execution queue;
[0030] An encryption thread allocation module, used for allocating threads to the task execution queue using a dynamic thread pool processing method;
[0031] The transparent encryption module is used to transparently encrypt the task execution queue allocated by the thread through a preset master key.
[0032] Optionally, the encryption task decomposition module includes:
[0033] The encryption task parallel decomposition submodule is used to decompose the encryption request task by using the pipeline concurrency mechanism to obtain encryption tasks at different stages corresponding to the encryption request task;
[0034] The encryption task execution submodule is used to queue the encryption tasks in different stages according to a preset execution order by using an input-output multiplexing method to obtain a task execution queue.
[0035] Optionally, the encryption thread allocation module includes:
[0036] An encryption task selection submodule, used to obtain a preset number of encryption tasks from the task execution queue according to the execution order;
[0037] The encryption dynamic thread allocation submodule is used to use a dynamic thread pool processing method to perform thread allocation on a preset number of encryption tasks in the task execution queue.
[0038] Optionally, the encrypted dynamic thread allocation submodule includes:
[0039] Encrypted data initialization unit, used to initialize the number of core thread pools, the maximum number of thread pools, and the blocking queue;
[0040] An encryption thread work unit, used for performing thread allocation for the preset number of encryption tasks when the number of the work threads is less than the number of the core thread pool;
[0041] The encryption thread quantity comparison unit is used to check whether the blocking queue is full when the number of working threads is not less than the number of core thread pools. If not, the encryption task is added to the blocking queue; if full, the number of working threads is compared with the maximum number of threads, and threads are allocated to the encryption task based on the comparison result.
[0042] Optionally, the encryption thread quantity comparison unit includes:
[0043] An encryption task exception execution subunit, used for discarding the encryption task and throwing an exception when the number of working threads is equal to or greater than the maximum number of thread pools;
[0044] The encryption thread allocation execution subunit is used to allocate threads to the encryption task when the number of working threads is less than the maximum number of thread pools.
[0045] Optionally, the transparent encryption module includes:
[0046] The encryption key acquisition submodule is used to obtain the data key;
[0047] The key encryption submodule is used to encrypt the data key using a preset master key to obtain an encrypted data key;
[0048] The encrypted task execution submodule is used to transparently encrypt the task execution queue allocated by the thread using the encrypted data key.
[0049] Based on the same inventive concept, the present invention also provides a high-concurrency transparent decryption method for power dispatching operation data, comprising:
[0050] Obtain the decryption request task corresponding to the power dispatching operation data;
[0051] Decomposing the request tasks to be decrypted by using a pipeline concurrency mechanism to obtain a decryption execution queue;
[0052] Utilizing a dynamic thread pool processing method to allocate threads to the decryption execution queue;
[0053] The decryption execution queue allocated by the thread is transparently decrypted by using a preset master key.
[0054] Optionally, the step of decomposing the to-be-decrypted request task by using a pipeline concurrency mechanism to obtain a decryption execution queue includes:
[0055] Decomposing the request task to be decrypted by using a pipeline concurrency mechanism to obtain decryption tasks at different stages corresponding to the request task to be decrypted;
[0056] The input-output multiplexing method is adopted to queue the decryption tasks in the different stages according to a preset execution order to obtain a decryption execution queue.
[0057] Optionally, the utilizing a dynamic thread pool processing method to allocate threads to the decryption execution queue includes:
[0058] Obtaining a preset number of decryption tasks from the decryption execution queue according to the execution order;
[0059] The dynamic thread pool processing method is used to allocate threads to a preset number of decryption tasks in the decryption execution queue.
[0060] Optionally, the use of a dynamic thread pool processing method to perform thread allocation on a preset number of decryption tasks in the decryption execution queue includes:
[0061] Initialize the number of core thread pools, the maximum number of thread pools, and the blocking queue;
[0062] If the number of the working threads is less than the number of the core thread pool, performing thread allocation for the preset number of decryption tasks;
[0063] If the number of working threads is not less than the number of core thread pools, check whether the blocking queue is full. If not, add the decryption task to the blocking queue. If full, compare the number of working threads with the maximum number of threads, and allocate threads to the decryption task based on the comparison result.
[0064] Optionally, performing thread allocation for the decryption task according to the comparison result includes:
[0065] If the number of working threads is equal to or greater than the maximum number of thread pools, the decryption task is discarded and an exception is thrown;
[0066] If the number of working threads is less than the maximum number of thread pools, threads are allocated for the decryption task.
[0067] Optionally, the transparently decrypting the decryption execution queue assigned by the thread by using a preset master key includes:
[0068] Get the data key;
[0069] Decrypting the data key using a preset master key to obtain a decrypted data key;
[0070] The decrypted data key is used to transparently decrypt the decryption execution queue assigned by the thread.
[0071] Based on the same inventive concept, the present invention also provides a high-concurrency transparent decryption system for power dispatching operation data, comprising:
[0072] A decryption task acquisition module is used to obtain the decryption request tasks corresponding to the power dispatching operation data;
[0073] A decryption task decomposition module, used to decompose the request task to be decrypted by using a pipeline concurrency mechanism to obtain a decryption execution queue;
[0074] A decryption thread allocation module, used to allocate threads to the decryption execution queue using a dynamic thread pool processing method;
[0075] The transparent decryption module is used to transparently decrypt the decryption execution queue allocated by the thread by using a preset master key.
[0076] Optionally, the decryption task decomposition module includes:
[0077] The decryption task parallel decomposition submodule is used to decompose the request task to be decrypted by using the pipeline concurrency mechanism to obtain the decryption tasks at different stages corresponding to the request task to be decrypted;
[0078] The decryption task execution submodule is used to queue the decryption tasks in the different stages according to a preset execution order by using an input-output multiplexing method to obtain a decryption execution queue.
[0079] Optionally, the decryption thread allocation module includes:
[0080] A decryption task selection submodule, used to obtain a preset number of decryption tasks from the decryption execution queue according to the execution order;
[0081] The decryption dynamic thread allocation submodule is used to allocate threads to a preset number of decryption tasks in the decryption execution queue using a dynamic thread pool processing method.
[0082] Optionally, the decryption dynamic thread allocation submodule includes:
[0083] Decryption data initialization unit, used to initialize the number of core thread pools, the maximum number of thread pools and the blocking queue;
[0084] A decryption thread working unit, used for performing thread allocation for the preset number of decryption tasks when the number of working threads is less than the number of the core thread pool;
[0085] The decryption thread quantity comparison unit is used to check whether the blocking queue is full when the number of working threads is not less than the number of core thread pools. If not, the decryption task is added to the blocking queue; if full, the number of working threads is compared with the maximum number of threads, and threads are allocated to the decryption task according to the comparison result.
[0086] Optionally, the decryption thread quantity comparison unit includes:
[0087] A decryption task exception execution subunit, used for discarding the decryption task and throwing an exception when the number of working threads is equal to or greater than the maximum number of thread pools;
[0088] The decryption thread allocation execution subunit is used to allocate threads to the decryption task when the number of working threads is less than the maximum number of thread pools.
[0089] Optionally, the transparent decryption module includes:
[0090] A decryption key acquisition submodule is used to obtain a data key;
[0091] The key decryption submodule is used to decrypt the data key using a preset master key to obtain a decrypted data key;
[0092] The decryption task execution submodule is used to use the decrypted data key to transparently decrypt the decryption execution queue allocated by the thread.
[0093] In another aspect, the present invention further provides an electronic device, comprising: at least one processor and a memory; the memory and the processor are connected via a bus;
[0094] The memory is used to store one or more programs;
[0095] When the one or more programs are executed by the at least one processor, a high-concurrency transparent encryption method for electric power dispatching operation data or a high-concurrency transparent decryption method for electric power dispatching operation data as described above is implemented.
[0096] On the other hand, the present invention also provides a computer-readable storage medium having an execution program stored thereon, which, when executed, implements a high-concurrency transparent encryption method for electric power dispatching operation data or a high-concurrency transparent decryption method for electric power dispatching operation data as described above.
[0097] Compared with the prior art, the present invention has the following beneficial effects:
[0098] The present invention provides a method and system for transparent encryption and decryption of electric power dispatching operation data with high concurrency, including: obtaining a request task to be encrypted corresponding to the electric power dispatching operation data; decomposing the request task to be encrypted by using a pipeline concurrency mechanism to obtain a task execution queue; allocating threads to the task execution queue by using a dynamic thread pool processing method; transparently encrypting the task execution queue that has been thread-allocated by using a pre-set master key; the present application decomposes tasks by using a pipeline concurrency mechanism, which is beneficial to improving the processing speed and efficiency of electric power dispatching operation data; dynamically adjusting the number of working threads by using a dynamic thread pool processing method is beneficial to improving the concurrent processing capability of tasks, ensuring the security of electric power dispatching operation data while improving system performance; therefore, the present invention introduces pipeline concurrency and dynamic thread pool technology in the transparent encryption process of electric power dispatching operation data, which is beneficial to improving the encryption performance of electric power dispatching operation data under high concurrency conditions, thereby improving the security of electric power dispatching operation data. BRIEF DESCRIPTION OF THE DRAWINGS
[0099] Figure 1 A schematic diagram of a flow chart of a high-concurrency transparent encryption method for power dispatching operation data provided by the present invention;
[0100] Figure 2 A schematic diagram of the overall architecture design of a high-concurrency transparent encryption method for power dispatching operation data provided by the present invention;
[0101] Figure 3A schematic diagram of another architecture design of a high-concurrency transparent encryption method for power dispatching operation data provided by the present invention;
[0102] Figure 4 A schematic diagram of the structure of a high-concurrency transparent encryption system for power dispatching operation data provided by the present invention;
[0103] Figure 5 A flow chart of a method for high-concurrency transparent decryption of power dispatching operation data provided by the present invention;
[0104] Figure 6 A schematic diagram of the structure of a high-concurrency transparent decryption system for power dispatching operation data provided by the present invention;
[0105] Figure 7 The present invention provides a schematic structural diagram of an electronic device. DETAILED DESCRIPTION
[0106] The present invention proposes a method, system, device and medium for high-concurrency transparent encryption and decryption of power dispatching operation data. The specific implementation methods of the present invention are further described in detail below in conjunction with the accompanying drawings.
[0107] Embodiment 1:
[0108] The present invention provides a method for high-concurrency transparent encryption of power dispatching operation data, the flow chart is as follows: Figure 1 As shown, including:
[0109] Step 1: Obtain the encryption request task corresponding to the power dispatching operation data;
[0110] Step 2: Use the pipeline concurrency mechanism to decompose the encryption request task and obtain the task execution queue;
[0111] Step 3: Use the dynamic thread pool processing method to allocate threads to the task execution queue;
[0112] Step 4: The task execution queue assigned by the thread is transparently encrypted using a pre-set master key.
[0113] Generally, the pipeline concurrency mechanism is a technology widely used in computer systems and software engineering to improve processing efficiency and resource utilization. It achieves higher throughput and response speed by breaking down complex processing processes into multiple independent stages and allowing these stages to proceed in parallel; in the pipeline concurrency working mechanism, each stage can process different data blocks at the same time, which is similar to the assembly line operation on the production line, where each worker is responsible for a specific task; for example, in the data processing pipeline, the input data first passes through the parsing stage, then enters the processing stage, and finally reaches the output stage. Since different data blocks can be processed simultaneously at different stages, the overall processing speed is significantly improved. The dynamic thread pool processing method is a commonly used concurrent processing mechanism that aims to dynamically adjust the number of working threads according to the number of tasks and the load of the system, so as to effectively utilize system resources and maximize processing power. Compared with the fixed thread pool, the dynamic thread pool can automatically expand or reduce the number of working threads according to the needs of the system, avoiding waste or shortage of resources. Therefore, in order to improve the encryption performance of power dispatching operation data, the present invention introduces a pipeline concurrency mechanism and a dynamic thread pool processing method. Compared with the limited concurrent processing capability of traditional data transparent encryption, the method of the present invention can improve the concurrent processing capability, ensure the security of power dispatching operation data and improve system performance. Specifically:
[0114] In one implementation, the above-mentioned process of using the pipeline concurrency mechanism to decompose the encryption request task to obtain the task execution queue may include:
[0115] The pipeline concurrency mechanism is used to decompose the encryption request task to obtain the encryption tasks at different stages corresponding to the encryption request task;
[0116] The input / output multiplexing method (epoll) is adopted to queue the encryption tasks at different stages according to the preset execution order to obtain the task execution queue; in this implementation, by decomposing the encryption request task into encryption tasks at different stages and processing them by using the pipeline concurrency mechanism, the parallelism and execution efficiency of the encryption processing of the task in a high concurrency scenario can be significantly improved, and the encryption tasks of each stage can be executed in parallel on different hardware units or processing units, thereby reducing the overall encryption processing time; and by queuing the encryption tasks by using the input / output multiplexing method, it can be ensured that the tasks are executed efficiently and orderly according to the preset execution order. This method avoids waiting and conflicts between tasks and further improves the efficiency of encryption processing. In addition, the pipeline concurrency mechanism can dynamically allocate hardware resources (such as registers, adders, etc.) according to the needs of each encryption task, and flexibly adjust the number and complexity of encryption tasks at each stage according to actual needs. This flexibility enables the system to adapt to different encryption needs, which is conducive to improving the applicability of the system and ensuring the efficient use of resources; through reasonable resource allocation, it can avoid waste and conflict of resources and improve the overall performance of the system. In this implementation, by combining the pipeline concurrency mechanism and input-output multiplexing technology, the CPU can continuously process encryption tasks and reduce idle time. This not only improves CPU utilization and shortens the overall encryption processing time, but also helps to reduce conflicts and waiting time between tasks, and reduce system performance degradation and error rate caused by task conflicts.
[0117] After decomposing the encryption tasks through the pipeline concurrency mechanism, if a fixed number of thread pools are used, it may lead to too many or too few threads in some cases. When there are fewer tasks, a large number of idle threads will occupy system resources, increase memory consumption and scheduling overhead; when there are more tasks, insufficient number of threads will lead to task accumulation, increase task processing delay, and reduce system throughput; and the fixed thread pool cannot dynamically adjust the number of threads according to the task volume. When the task volume suddenly increases, the tasks may accumulate in the queue, resulting in increased response time. New tasks need to wait longer to start processing, which increases the overall delay of the system. In order to solve the above problems, the present invention introduces a dynamic thread pool processing method to dynamically adjust the number of threads according to the change of task volume. Specifically:
[0118] In one implementation, the process of allocating threads to the task execution queue using the dynamic thread pool processing method may include:
[0119] Obtain a preset number of encryption tasks from the task execution queue in the order of execution;
[0120] Using the dynamic thread pool processing method, threads are allocated to a preset number of encryption tasks in the task execution queue;
[0121] In this implementation, the dynamic thread pool can instantly adjust the number and allocation of threads according to the current system load and the status of the task queue. This means that when there are a large number of encryption tasks to be processed in the task queue, the thread pool can quickly increase the number of threads to speed up the processing; and when the amount of tasks decreases, the thread pool can reduce the number of threads accordingly to avoid resource waste. Since the thread pool can flexibly adjust the number of threads, it can ensure that each encryption task can obtain the required computing resources as soon as possible, which significantly reduces the waiting time of the task and improves the overall processing efficiency; and the dynamic thread pool can ensure that CPU resources are fully utilized to avoid CPU idleness during task processing. By reasonably allocating the number of threads, the thread pool can ensure that the CPU always remains in an efficient working state. Compared with the static thread pool or single-threaded processing mode, the dynamic thread pool can manage memory resources more effectively. It can dynamically adjust the number of threads according to task requirements, thereby avoiding the problem of memory waste caused by too many threads.
[0122] In this implementation, the process of allocating threads to a preset number of encryption tasks in the task execution queue using the dynamic thread pool processing method may include:
[0123] Initialize the number of core thread pools, the maximum number of thread pools, and the blocking queue;
[0124] If the current number of working threads is less than the number of core thread pools, threads are allocated for the preset number of encryption tasks;
[0125] If the current number of working threads is not less than the number of core thread pools, check whether the blocking queue is full. If not, add the encryption task to the blocking queue; if full, compare the number of working threads with the maximum number of threads, and allocate threads to the encryption task based on the comparison result; in this implementation, after the number of working threads reaches the number of core thread pools, the task is added to the blocking queue and waits for idle threads to process it, which avoids resource competition and context switching overhead caused by too many threads and improves the utilization efficiency of thread resources; when the blocking queue is full and the number of working threads has not reached the maximum number of threads, continue to add threads to process tasks, which ensures that the system can maintain high performance during task peaks, respond to and process a large number of tasks in a timely manner, and in this implementation, by limiting the maximum number of threads, the system resource exhaustion and crash problems caused by too many threads are avoided, which ensures that the system can maintain stable operation when processing a large number of tasks;
[0126] In this implementation, the process of allocating threads to encryption tasks according to the comparison result may include:
[0127] If the number of worker threads is equal to or greater than the maximum number of thread pools, the encryption task is discarded and an exception is thrown;
[0128] If the number of working threads is less than the maximum number of thread pools, threads are allocated for the encryption task; in this implementation, when the number of working threads is equal to or greater than the maximum number of thread pools, the system chooses to discard the encryption task and throws an exception, which helps to avoid system performance degradation or crash due to resource overload (such as CPU, memory, etc.), avoid the occupation of invalid resources, and the system can also more effectively utilize limited resources to handle other important tasks.
[0129] After assigning a work thread to the encryption task, the encryption task can be executed. The present invention transparently encrypts the data by introducing a pre-set master key to ensure the security of the data during storage and transmission. Specifically:
[0130] In one implementation, the process of transparently encrypting the task execution queue assigned by the thread by using the preset master key may include:
[0131] Get the data key;
[0132] The data key is encrypted by using a preset master key to obtain an encrypted data key;
[0133] The encrypted data key is used to transparently encrypt the task execution queue assigned by the thread;
[0134] In this implementation, the data key is encrypted by a preset master key to obtain an encrypted data key. Subsequently, the encrypted data key is used to transparently encrypt the plaintext data in the task execution queue to generate ciphertext. This double encryption method greatly enhances data security and simplifies the complexity of key management. For example, the AES-256 encryption algorithm can be selected to encrypt the power dispatching operation data in the task execution queue. The specific execution process is shown in Algorithm 1:
[0135]
[0136]
[0137] The execution process of the above-mentioned AES-256 encryption algorithm may specifically include: first, padding the key and plaintext to ensure that their lengths meet the requirements of AES-256. Next, the padded plaintext is converted into a state matrix (plaintext matrix). Then, the round key addition operation is performed on this plaintext matrix using the initial key. Next, the algorithm enters a loop, which will be executed multiple times (the specific number of times is specified by the AES standard). In each loop, a byte replacement operation is first performed to replace each byte in the plaintext matrix with the corresponding ciphertext byte. Then, a row shift operation is performed on the plaintext matrix to further scramble the data. If the current loop is not the last loop, a column obfuscation operation will be performed on the plaintext matrix to increase the complexity of the data through linear transformation. After that, the round key addition operation is performed again on the plaintext matrix using the corresponding key in the round key table. When the loop ends, the plaintext matrix becomes the final ciphertext. Finally, this ciphertext matrix is used as the output to complete the AES-256 encryption process. After that, the master key is generated by encrypting the data key. The master key is used to encrypt the data key, and the data key is used to encrypt the actual data content. This hierarchical management method makes the key management clearer and more orderly. Even if the data key is leaked in some cases, the attacker cannot directly decrypt the data because they still need to obtain the master key; and when transparently encrypting the power dispatching operation data, the user is allowed to automatically encrypt and decrypt the data without affecting the normal use of the file. This means that the user does not need to perceive the encryption and decryption process. When the key needs to be updated, only one of the master key or the data key needs to be updated, which avoids the tedious process of updating all keys at the same time in traditional key management. At the same time, since the master key and the data key are managed in a hierarchical manner, updating one key will not affect the use of another key, and the encrypted file can be used seamlessly, thereby reducing the operational complexity caused by encryption, avoiding the tedious process of manual encryption and decryption by users, and improving the efficiency of encryption operations; at the same time, this concealment also increases the security of the data because it is difficult for attackers to detect the encryption status of the data.
[0138] In summary, the present invention aims at the existing transparent encryption method for power dispatching operation data, and the problem of weak processing capability in high concurrency situations. In order to meet the high concurrency requirements of power dispatching operation data, a high concurrency transparent encryption method for power dispatching operation data is proposed. By introducing pipeline concurrency technology and dynamic thread pool technology in the process of transparent encryption of power dispatching operation data, the overall architecture design diagram is shown as follows: Figure 2As shown, first, the encryption request (for example, the encryption request can be an encryption request initiated by an application or user to a database) is decomposed into encryption tasks at different stages through the pipeline concurrent decomposition mechanism. The tasks at each stage enter the waiting queue and wait for scheduling, and then are scheduled by the task scheduler according to the waiting queue situation. During this process, the thread scheduler monitors the operation of the dynamic thread pool all the time, dynamically adjusts the dynamic thread pool parameters according to the current dynamic thread pool operation status, and finds the most suitable parameters for the current system operation status, so as to better adapt to high concurrency scenarios. If there are too many threads in the dynamic thread pool, the redundant threads are recycled; after the above encryption process, it is beneficial to improve the high concurrency capability of data transparent encryption and decryption, and it is beneficial to avoid the system from repeatedly generating and destroying threads, so as to better utilize system resources and ensure data security and system efficiency.
[0139] Embodiment 2:
[0140] In addition to Figure 2 In addition to the design architecture shown in FIG. 1 , the execution architecture diagram of the transparent encryption method for power dispatching operation data of the present invention can also be as follows: Figure 3 As shown, firstly, an encryption request is obtained, and an encryption task is obtained from a request queue through a task scheduler. When there is an idle thread, the thread is awakened to assign the task. When there is no idle thread, the encryption task is inserted into the request queue. Then, the encryption task is decomposed into multiple stages through a pipeline concurrency mechanism. The decomposed tasks of multiple stages (also called input / output threads) are queued to generate a waiting queue through input / output multiplexing technology, waiting for the scheduling of the thread scheduler. The thread scheduler is responsible for dynamically adjusting the number of threads according to the request load of the encryption task to ensure that the encryption task can obtain sufficient resources under high concurrency. When there is an idle thread in the thread pool (used to provide the thread scheduler with a working thread to complete the encryption task), the idle thread is directly used to execute the encryption task. If there is no idle thread in the thread pool, the thread scheduler is called to adjust the number of threads and execute the encryption task. When executing the encryption task, the data is encrypted by managing the key. Specifically, the process of managing the key may include: master key (Master Key, MK), data key (Data Encryption Key, DEK) and automatic key rotation, wherein the master key is used to encrypt the data key, and the data key is usually stored in a secure hardware module or a key management system (Key Management System). System, KMS); data keys are used to encrypt and decrypt actual data, and are usually stored encrypted with master keys; automatic key rotation is used to improve security, so data keys are supported to be rotated regularly during data transparent encryption, which ensures data security while being transparent to users and applications; therefore, if you use Figure 3The architecture transparently encrypts the power dispatching operation data, and through efficient task scheduling, optimized pipeline concurrency mechanism, secure key management, and flexible resource allocation and adjustment and other technical means, it is also conducive to improving the execution efficiency of encryption tasks, the concurrent performance and security of the system. In addition, the transparent encryption method involved in this embodiment is also applicable to the transparent decryption process of power dispatching operation data.
[0141] Embodiment 3:
[0142] The present invention based on the same inventive concept also provides a high-concurrency transparent encryption system for power dispatching operation data, the structural composition diagram is as follows: Figure 4 As shown, including:
[0143] An encryption task acquisition module is used to obtain the encryption request tasks corresponding to the power dispatching operation data;
[0144] The encryption task decomposition module is used to decompose the encryption request task by using the pipeline concurrency mechanism to obtain the task execution queue;
[0145] The encrypted thread allocation module is used to allocate threads to the task execution queue using a dynamic thread pool processing method;
[0146] The transparent encryption module is used to transparently encrypt the task execution queue assigned by the thread through a pre-set master key.
[0147] In one implementation, the encryption task decomposition module may include:
[0148] The encryption task parallel decomposition submodule is used to decompose the encryption request task by using the pipeline concurrency mechanism to obtain the encryption tasks at different stages corresponding to the encryption request task;
[0149] The encryption task execution submodule is used to queue the encryption tasks at different stages according to a preset execution order by using an input-output multiplexing method to obtain a task execution queue.
[0150] In one implementation, the encryption thread allocation module may include:
[0151] The encryption task selection submodule is used to obtain a preset number of encryption tasks from the task execution queue according to the execution order;
[0152] The encryption dynamic thread allocation submodule is used to use the dynamic thread pool processing method to allocate threads to a preset number of encryption tasks in the task execution queue.
[0153] In this implementation, the above-mentioned encrypted dynamic thread allocation submodule may include:
[0154] Encrypted data initialization unit, used to initialize the number of core thread pools, the maximum number of thread pools, and the blocking queue;
[0155] The encryption thread work unit is used to allocate threads to a preset number of encryption tasks when the number of worker threads is less than the number of core thread pools;
[0156] The encryption thread quantity comparison unit is used to check whether the blocking queue is full when the number of working threads is not less than the number of core thread pools. If not, the encryption task is added to the blocking queue; if full, the number of working threads is compared with the maximum number of threads, and threads are allocated to the encryption task based on the comparison result.
[0157] In this implementation, the encryption thread quantity comparison unit may include:
[0158] The encryption task exception execution subunit is used to discard the encryption task and throw an exception when the number of working threads is equal to or greater than the maximum number of thread pools;
[0159] The encryption thread allocation execution subunit is used to allocate threads for encryption tasks when the number of working threads is less than the maximum number of thread pools.
[0160] In one implementation, the transparent encryption module may include:
[0161] The encryption key acquisition submodule is used to obtain the data key;
[0162] The key encryption submodule is used to encrypt the data key using a preset master key to obtain the encrypted data key;
[0163] The encrypted task execution submodule is used to transparently encrypt the task execution queue assigned by the thread using the encrypted data key.
[0164] Embodiment 4:
[0165] The present invention based on the same inventive concept also provides a method for high-concurrency transparent decryption of power dispatching operation data, the flow chart is as follows: Figure 5 As shown, including:
[0166] Step S1: Obtain the request task to be decrypted corresponding to the power dispatching operation data;
[0167] Step S2: Decompose the decryption request task by using the pipeline concurrency mechanism to obtain a decryption execution queue;
[0168] Step S3: using a dynamic thread pool processing method to allocate threads to the decryption execution queue;
[0169] Step S4: transparently decrypt the decryption execution queue assigned by the thread using a preset master key.
[0170] The execution process of transparently decrypting the power dispatching operation data of the present invention is similar to the encryption process, specifically:
[0171] In one implementation, the above-mentioned process of decomposing the decryption request task by using the pipeline concurrency mechanism to obtain the decryption execution queue may include:
[0172] The pipeline concurrency mechanism is used to decompose the decryption request task to obtain the decryption tasks at different stages corresponding to the decryption request task;
[0173] The input-output multiplexing method is adopted to queue the decryption tasks in different stages according to the preset execution order to obtain a decryption execution queue; in this implementation method, the request task to be decrypted can be an encryption request initiated by an application or a user to the database; the pipeline concurrency mechanism decomposes the request task to be decrypted into multiple stages, and the decomposed tasks of each stage enter the decryption execution queue, and then the task scheduler is used to schedule according to the situation of the decryption execution queue.
[0174] In one implementation, the process of allocating threads to the decryption execution queue using the dynamic thread pool processing method may include:
[0175] Obtain a preset number of decryption tasks from the decryption execution queue in the execution order;
[0176] The dynamic thread pool processing method is used to allocate threads to a preset number of decryption tasks in the decryption execution queue.
[0177] In this implementation, the process of allocating threads to a preset number of decryption tasks in the decryption execution queue using the dynamic thread pool processing method may include:
[0178] Initialize the number of core thread pools, the maximum number of thread pools, and the blocking queue;
[0179] If the number of working threads is less than the number of core thread pools, threads are allocated for the preset number of decryption tasks;
[0180] If the number of working threads is not less than the number of core thread pools, check whether the blocking queue is full. If not, add the decryption task to the blocking queue. If full, compare the number of working threads with the maximum number of threads, and allocate threads to the decryption task based on the comparison result.
[0181] In this implementation, the process of allocating threads to decryption tasks according to the comparison result may include:
[0182] If the number of worker threads is equal to or greater than the maximum number of thread pools, the decryption task is discarded and an exception is thrown;
[0183] If the number of working threads is less than the maximum number of thread pools, threads are allocated for the decryption task.
[0184] In one implementation, the process of transparently decrypting the thread-allocated decryption execution queue using a preset master key may include:
[0185] Get the data key;
[0186] Decrypt the data key using the pre-set master key to obtain the decrypted data key;
[0187] The decrypted data key is used to transparently decrypt the decryption execution queue assigned by the thread.
[0188] In this implementation, the stored ciphertext data is decrypted using the acquired data key and restored to plaintext. The specific decryption algorithm (taking the AES-256 decryption algorithm as an example) is shown in the execution process of Algorithm 2:
[0189]
[0190] The execution process of the above-mentioned AES-256 decryption algorithm may specifically include: first, padding the key and ciphertext to ensure that their lengths meet the requirements of AES-256. Next, the padded ciphertext is converted into a state matrix (ciphertext matrix). Then, the last key in the round key table is used to perform a round key addition operation on the ciphertext matrix, which is the first step of the decryption process and corresponds to the last step of the encryption process. Next, the algorithm enters a loop that decreases from the maximum round number minus one. In each loop, a reverse row shift operation is first performed, which is the inverse process of the row shift operation and is used to restore the order of the data that was disrupted during the encryption process. Then, an inverse byte replacement operation is performed on the ciphertext matrix to replace the ciphertext bytes with the corresponding plaintext bytes. After that, the round key addition operation is performed again on the ciphertext matrix using the corresponding key in the round key table. If the current loop is not the first loop (that is, the number of rounds is greater than 0), an inverse column confusion operation will be performed on the ciphertext matrix to restore the state of the data being confused during the encryption process through an inverse linear transformation. When the loop ends, the ciphertext matrix becomes the final plaintext. Finally, this plaintext matrix is used as output to complete the AES-256 decryption process. In this implementation, the ciphertext is restored to the original plaintext by reversing the steps of the AES-256 encryption algorithm (reverse shift, reverse byte replacement, reverse column confusion, and round key addition). This helps to ensure that the data can be correctly decrypted and restored even if it is encrypted during transmission or storage, thereby maintaining the integrity of the data. In addition, the AES-256 decryption algorithm is fully compatible with the AES-256 encryption algorithm, which means that data encrypted using AES-256 can be correctly decrypted by any decryption algorithm that complies with the AES standard, which helps to ensure data interoperability between different systems, platforms, or devices. After the decryption is completed, the thread controller adjusts the dynamic thread pool parameters according to the current dynamic thread pool operation status. If there are too many threads in the dynamic thread pool, the redundant threads are recycled.
[0191] Embodiment 5:
[0192] The present invention based on the same inventive concept also provides a high-concurrency transparent decryption system for power dispatching operation data, the structural composition diagram is as follows: Figure 6 As shown, including:
[0193] A decryption task acquisition module is used to obtain the decryption request tasks corresponding to the power dispatching operation data;
[0194] The decryption task decomposition module is used to decompose the decryption request task by using the pipeline concurrency mechanism to obtain the decryption execution queue;
[0195] A decryption thread allocation module is used to allocate threads to the decryption execution queue using a dynamic thread pool processing method;
[0196] The transparent decryption module is used to transparently decrypt the decryption execution queue allocated by the thread through a preset master key.
[0197] In one implementation, the decryption task decomposition module may include:
[0198] The decryption task parallel decomposition submodule is used to decompose the decryption request task by using the pipeline concurrency mechanism to obtain the decryption tasks at different stages corresponding to the decryption request task;
[0199] The decryption task execution submodule is used to queue the decryption tasks at different stages according to a preset execution order by using an input-output multiplexing method to obtain a decryption execution queue.
[0200] In one implementation, the above-mentioned decryption thread allocation module may include:
[0201] The decryption task selection submodule is used to obtain a preset number of decryption tasks from the decryption execution queue according to the execution order;
[0202] The decryption dynamic thread allocation submodule is used to allocate threads to a preset number of decryption tasks in the decryption execution queue using a dynamic thread pool processing method.
[0203] In this implementation, the above-mentioned decryption dynamic thread allocation submodule may include:
[0204] Decryption data initialization unit, used to initialize the number of core thread pools, the maximum number of thread pools and the blocking queue;
[0205] The decryption thread work unit is used to allocate threads to a preset number of decryption tasks when the number of work threads is less than the number of core thread pools;
[0206] The decryption thread quantity comparison unit is used to check whether the blocking queue is full when the number of working threads is not less than the number of core thread pools. If not, the decryption task is added to the blocking queue; if full, the number of working threads is compared with the maximum number of threads, and threads are allocated to the decryption task based on the comparison result.
[0207] In this implementation, the decryption thread quantity comparison unit may include:
[0208] The decryption task exception execution subunit is used to discard the decryption task and throw an exception when the number of working threads is equal to or greater than the maximum number of thread pools;
[0209] The decryption thread allocation execution subunit is used to allocate threads for decryption tasks when the number of working threads is less than the maximum number of thread pools.
[0210] In one implementation, the transparent decryption module may include:
[0211] A decryption key acquisition submodule is used to obtain a data key;
[0212] The key decryption submodule is used to decrypt the data key using the preset master key to obtain the decrypted data key;
[0213] The decryption task execution submodule is used to transparently decrypt the decryption execution queue assigned by the thread using the decrypted data key.
[0214] Embodiment 6:
[0215] like Figure 7 As shown, the present invention also provides an electronic device, which may be a computer device, a single-chip device, an intelligent mobile device, etc. The electronic device in this embodiment may include a processor, a memory, a transceiver component, etc. The memory, the processor, and the transceiver component are connected via a bus; the memory may be used to store an execution program, and an exemplary execution program may include instructions; the processor is used to execute the instructions stored in the memory. The memory may also be used to store data, which may be called and / or modified when the instructions are executed.
[0216] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions in a storage medium to implement the corresponding method flow or corresponding function, so as to implement the steps of a high-concurrency transparent encryption method for power dispatching operation data or a high-concurrency transparent decryption method for power dispatching operation data in the above-mentioned embodiment.
[0217] Embodiment 7:
[0218] Based on the same inventive concept, the present invention also provides a readable storage medium, specifically an electronic device readable storage medium (Memory), which is a memory device in an electronic device for storing programs and data. It can be understood that the storage medium here can include both built-in storage media in electronic devices and, of course, extended storage media supported by electronic devices. The storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by a processor are also stored in the storage space, and these instructions can be one or more execution programs (including program codes). It should be noted that the storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor loads and executes one or more instructions stored in the storage medium, which can implement the steps of a high-concurrency transparent encryption method for power dispatching operation data or a high-concurrency transparent decryption method for power dispatching operation data in the above-mentioned embodiment.
[0219] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0220] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0221] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0222] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0223] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit its protection scope. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that after reading the present invention, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the application, but these changes, modifications or equivalent substitutions are all within the protection scope of the claims to be approved.
Claims
1. A high-concurrency transparent encryption method for power dispatching operation data, characterized in that: include: Obtain the encryption request task corresponding to the power dispatching operation data; Decomposing the request task to be encrypted by using a pipeline concurrency mechanism to obtain a task execution queue; Utilizing a dynamic thread pool processing method to allocate threads to the task execution queue; The task execution queue allocated by the thread is transparently encrypted by a preset master key.
2. The method according to claim 1, characterized in that The pipeline concurrency mechanism is used to decompose the request task to be encrypted to obtain a task execution queue, including: Decomposing the request task to be encrypted by using a pipeline concurrency mechanism to obtain encryption tasks at different stages corresponding to the request task to be encrypted; The input-output multiplexing method is adopted to queue the encryption tasks in the different stages according to a preset execution order to obtain a task execution queue.
3. The method according to claim 2, characterized in that The method of using a dynamic thread pool to allocate threads to the task execution queue includes: Obtaining a preset number of encryption tasks from the task execution queue according to the execution order; The dynamic thread pool processing method is used to allocate threads to a preset number of encryption tasks in the task execution queue.
4. The method according to claim 3, characterized in that The method of using a dynamic thread pool to allocate threads to a preset number of encryption tasks in the task execution queue includes: Initialize the number of core thread pools, the maximum number of thread pools, and the blocking queue; If the current number of working threads is less than the number of the core thread pool, threads are allocated for the preset number of encryption tasks; If the number of working threads is not less than the number of core thread pools, check whether the blocking queue is full. If not, add the encryption task to the blocking queue. If full, compare the number of working threads with the maximum number of threads, and allocate threads to the encryption task based on the comparison result.
5. The method according to claim 4, characterized in that The thread allocation for the encryption task according to the comparison result includes: If the number of working threads is equal to or greater than the maximum number of thread pools, the encryption task is discarded and an exception is thrown; If the number of working threads is less than the maximum number of thread pools, threads are allocated for the encryption task.
6. The method according to claim 1, characterized in that The transparent encryption of the task execution queue assigned by the thread by using a preset master key includes: Get the data key; Encrypting the data key using a preset master key to obtain an encrypted data key; The task execution queue distributed by the thread is transparently encrypted using the encrypted data key.
7. A high-concurrency transparent encryption system for power dispatching operation data, characterized in that: include: An encryption task acquisition module is used to obtain the encryption request tasks corresponding to the power dispatching operation data; An encryption task decomposition module is used to decompose the encryption request task by using a pipeline concurrency mechanism to obtain a task execution queue; An encryption thread allocation module, used for allocating threads to the task execution queue using a dynamic thread pool processing method; The transparent encryption module is used to transparently encrypt the task execution queue allocated by the thread through a preset master key.
8. A high-concurrency transparent decryption method for power dispatching operation data, characterized in that: include: Obtain the decryption request task corresponding to the power dispatching operation data; Decomposing the request tasks to be decrypted by using a pipeline concurrency mechanism to obtain a decryption execution queue; Utilizing a dynamic thread pool processing method to allocate threads to the decryption execution queue; The decryption execution queue allocated by the thread is transparently decrypted by using a preset master key.
9. The method according to claim 8, characterized in that The pipeline concurrency mechanism is used to decompose the request task to be decrypted to obtain a decryption execution queue, including: Decomposing the request task to be decrypted by using a pipeline concurrent mechanism to obtain decryption tasks at different stages corresponding to the request task to be decrypted; The input-output multiplexing method is adopted to queue the decryption tasks in the different stages according to a preset execution order to obtain a decryption execution queue.
10. A high-concurrency transparent decryption system for power dispatching operation data, characterized in that: include: A decryption task acquisition module is used to obtain the decryption request tasks corresponding to the power dispatching operation data; A decryption task decomposition module, used to decompose the request task to be decrypted by using a pipeline concurrency mechanism to obtain a decryption execution queue; A decryption thread allocation module, used to allocate threads to the decryption execution queue using a dynamic thread pool processing method; The transparent decryption module is used to transparently decrypt the decryption execution queue allocated by the thread by using a preset master key.
Citation Information
Patent Citations
MySQL database transparent encrypted data access authority management method
CN115587113A
Transparent data encryption method and encryption system based on MongoDB
CN118036026A
Self-adaptive hardware encryption method and device, computer equipment and medium
CN118643517A