Data processing method and device, computer equipment and storage medium
By utilizing data processing methods within the Django framework, and leveraging configuration files and AES encryption technology, we perform sensitivity checks and encryption on user-submitted business data. This solves the security issues associated with plaintext data transmission and storage, improves data security and processing efficiency, and reduces the risk of data leakage.
Patent Information
- Application Number
- CN202510877253.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-10-28
AI Technical Summary
In existing technologies, business data submitted by users is transmitted and stored in plain text, lacking effective security protection mechanisms. This results in the risk of data being eavesdropped, tampered with, or leaked during transmission and storage. Especially in the financial and medical fields, sensitive information is vulnerable to cyber attacks, leading to privacy leaks and property losses.
Through the data processing method based on the Django framework, configuration files, tool module files, business logic files and routing configuration files are used to extract business data and determine its sensitivity. The sensitive data is encrypted with AES using the preset target key, and the target ciphertext is generated and stored. The hash value is generated by combining HMAC to ensure data integrity.
It enables automatic and intelligent encryption and storage of user-submitted business data, improving data encryption efficiency and security, reducing the risk of data leakage, and protecting user privacy and business security.
Smart Images

Figure CN120850334A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology and can be applied to fields such as fintech and digital healthcare, particularly to data processing methods, devices, computer equipment, and storage media. Background Technology
[0002] In traditional internet business data processing models, user-submitted business data is typically transmitted and stored directly in plaintext, lacking effective security mechanisms. This leaves the data vulnerable to eavesdropping, tampering, or leakage during transmission and storage. Specifically, existing technologies largely rely on basic communication protocols (such as HTTP) or simple encryption methods. This crude data processing approach is ill-equipped to withstand increasingly sophisticated cyberattacks (such as man-in-the-middle attacks and packet sniffing), exposing sensitive information (such as user identity, financial data, and health records) to potential threats, leading to privacy breaches, financial losses, or legal compliance risks.
[0003] For example, in online payment scenarios in the financial sector, user-submitted bank card numbers, passwords, and transaction amounts may be transmitted to the payment system in plaintext. Attackers can steal funds or forge transactions by tampering with data packets. If a user initiates a cross-border remittance request, and the traditional system does not perform end-to-end encryption on the transaction data, attackers may tamper with the recipient account information, causing funds to flow to malicious accounts and resulting in financial losses for the user. Furthermore, in telemedicine consultation scenarios in the medical field, sensitive information such as patient-submitted medical records, diagnostic reports, and genetic data may be stored in plaintext in the cloud. If the database is illegally accessed, patient privacy will be seriously threatened. For example, if a patient's cancer diagnosis record is leaked, it may lead to employment discrimination or insurance refusal, harming their legitimate rights and interests.
[0004] Therefore, there is an urgent need to provide a business data processing method that can effectively reduce the risk of data leakage in order to protect user privacy and business security. Summary of the Invention
[0005] The purpose of this application is to provide a data processing method, apparatus, computer equipment, and storage medium to solve the technical problem that existing business data processing methods lack effective security protection mechanisms, leading to the risk of data being eavesdropped, tampered with, or leaked during transmission and storage.
[0006] Firstly, a data processing method is provided, including:
[0007] The system receives data processing requests submitted by users based on a preset target interface; wherein the data processing requests carry business data submitted by the users.
[0008] Invoke the target project corresponding to the target interface; wherein, the target project includes at least a configuration file, a tool module file, a business logic file, and a routing configuration file;
[0009] The business data is extracted from the data processing request based on the routing configuration file and the business logic file.
[0010] Determine whether the business data is sensitive information;
[0011] If so, load the preset target key from the configuration file;
[0012] Based on the tool module file, the business data is encrypted using the target key to obtain the corresponding target ciphertext;
[0013] The target ciphertext is stored.
[0014] Secondly, a data processing apparatus is provided, comprising:
[0015] The receiving module is used to receive data processing requests submitted by users based on a preset target interface; wherein the data processing request carries business data submitted by the user;
[0016] The calling module is used to call the target project corresponding to the target interface; wherein, the target project includes at least a configuration file, a tool module file, a business logic file, and a routing configuration file;
[0017] The extraction module is used to extract the business data from the data processing request based on the routing configuration file and the business logic file;
[0018] The judgment module is used to determine whether the business data is sensitive information;
[0019] A loading module, used to load a preset target key from the configuration file if the condition is met;
[0020] An encryption module is used to encrypt the business data using the target key based on the tool module file to obtain the corresponding target ciphertext;
[0021] The storage module is used to store the target ciphertext.
[0022] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described data processing method.
[0023] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the above-described data processing method.
[0024] In the above-described data processing method, apparatus, computer equipment, and storage medium, the following steps are taken: First, a data processing request submitted by a user is received based on a preset target interface; wherein the data processing request carries business data submitted by the user; then, a target project corresponding to the target interface is invoked; wherein the target project includes at least a configuration file, a tool module file, a business logic file, and a routing configuration file; then, the business data is extracted from the data processing request based on the routing configuration file and the business logic file; and it is determined whether the business data is sensitive information; if so, a preset target key is loaded from the configuration file; subsequently, based on the tool module file, the business data is encrypted using the target key to obtain the corresponding target ciphertext; finally, the target ciphertext is stored. Based on the above processing flow, after receiving a user-submitted data processing request based on the target interface, this application calls the target project corresponding to the target interface, which includes configuration files, tool module files, business logic files, and routing configuration files. Then, based on the combined use of the routing configuration file and business logic file, it extracts business data from the data processing request. When the business data is detected as sensitive information, a preset target key is loaded based on the configuration file. Then, based on the tool module file, the target key is used to encrypt the business data to obtain target ciphertext. Finally, the target ciphertext is stored. Thus, by combining the configuration files, tool module files, business logic files, and routing configuration files included in the target project, this application can automatically, intelligently, and accurately complete the encryption and storage processing of user-submitted business data, effectively improving the data encryption efficiency and data security of business data. This effectively reduces the risk of business data leakage and helps protect user privacy and business security. Attached Figure Description
[0025] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0027] Figure 2 This is a flowchart of an embodiment of the data processing method according to this application;
[0028] Figure 3 This is a schematic diagram of the structure of an embodiment of the data processing apparatus according to this application;
[0029] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0031] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0032] 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.
[0033] like Figure 1 As shown, system architecture 100 may include terminal device 101, network 102, and server 103. Terminal device 101 may be a laptop 1011, tablet 1012, or mobile phone 1013. Network 102 is used as a medium to provide a communication link between terminal device 101 and server 103. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0034] Users can use terminal device 101 to interact with server 103 via network 102 to receive or send messages, etc. Various communication client applications can be installed on terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0035] Terminal device 101 can be various electronic devices with a display screen and support web browsing. In addition to laptops 1011, tablets 1012, or mobile phones 1013, terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer, and a desktop computer, etc.
[0036] Server 103 can be a server that provides various services, such as a backend server that provides support for the pages displayed on terminal device 101.
[0037] It should be noted that the data processing method provided in the embodiments of this application is generally executed by a server / terminal device, and correspondingly, the data processing device is generally located in the server / terminal device.
[0038] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0039] Continue to refer to Figure 2 A flowchart illustrating an embodiment of the data processing method according to this application is shown. The order of steps in the flowchart can be changed, and some steps can be omitted, depending on different needs. The data processing method provided in this application embodiment can be applied to any scenario requiring data security processing, and thus can be applied to products in these scenarios, such as data security processing scenarios in the financial insurance and medical fields. The data processing method includes the following steps:
[0040] Step S201: Receive a data processing request submitted by the user based on a preset target interface; wherein the data processing request carries business data submitted by the user.
[0041] In this embodiment, the data processing method runs on an electronic device (e.g., Figure 1The server / terminal device shown can obtain user-submitted business data via wired or wireless connection. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, Wi-Fi connections, Bluetooth connections, Wi-Fi connections, Zigbee connections, UWB (ultra-wideband) connections, and other currently known or future wireless connection methods. The executing entity of this application is specifically a data processing system, which can be simply referred to as the system. The aforementioned target interface is specifically the Django interface. Django is a high-level Python web framework that follows the MVT (Model-View-Template) design pattern. It provides a complete toolset and conventions to help developers quickly build secure and maintainable web applications. Django's core features include: Full-stack framework: built-in ORM (Object-Relational Mapping), template engine, form processing, authentication system, middleware, etc., covering the entire web development process. Battery-Included: provides out-of-the-box solutions (such as user authentication, Admin backend, static file processing, etc.), reducing the need to reinvent the wheel. Security: Built-in protection mechanisms (such as CSRF protection, XSS protection, and SQL injection protection) eliminate the need for developers to manually implement common security measures. Scalability: Supports extending functionality through third-party libraries or custom code. A DJ Ango project is a container for complete web applications built using the DJ Ango framework. A project typically contains multiple applications (Apps), each focusing on a specific functional module.
[0042] The aforementioned data processing request can be a data processing request submitted by the user through the system's front-end interface based on actual business needs, containing data related to business data. For example, the aforementioned data processing request could be a payment information protection request, and the corresponding business data includes data such as the user-submitted card number and expiration date.
[0043] Furthermore, this application can be applied to data security processing scenarios in the financial insurance and medical fields. In the scenario of applying for auto insurance claims in the financial insurance field, the user requirement corresponding to the above data processing request is: a user needs to apply for compensation due to a vehicle accident and submits relevant data for the insurance company to review. The data processing request may include: Request type: Auto insurance claim application. Request purpose: Submit accident information and supporting documents, requesting the insurance company to review and pay compensation. The business data submitted by the user may include: Basic information: Name, ID number, contact information (for identity verification). Policy number (linked to the insurance contract). Accident information: Accident time, location, cause (e.g., "rear-end collision"). Accident photos or videos (to prove the authenticity of the accident). Vehicle information: License plate number, vehicle model, VIN (for vehicle identification). Repair quotation (estimated repair costs). Other materials: Traffic police accident report (third-party proof). Bank account information (for compensation transfer).
[0044] In the online appointment booking scenario within the medical field, the user need corresponding to the above data processing request is as follows: a user needs to book an appointment due to physical discomfort and submits past medical records for the doctor's reference. The data processing request may include: Request type: Online appointment booking and medical record submission. Request purpose: To book an appointment with a doctor in a specific department and upload medical records to assist in diagnosis. The business data submitted by the user may include: Basic information: Name, gender, age, contact information (for identity verification and notification). ID card number or medical insurance card number (linked to medical records). Appointment information: Department, doctor, appointment time (selection of medical resources). Medical record information: Past medical history (e.g., "hypertension, diabetes"). Current symptom description (e.g., "headache, fever"). Recent examination reports (e.g., blood routine, CT images). Medication records (e.g., "taking aspirin"). Other materials: Allergy history (e.g., "penicillin allergy"). Emergency contact information (for emergencies).
[0045] Step S202: Invoke the target project corresponding to the target interface; wherein the target project includes at least a configuration file, a tool module file, a business logic file, and a routing configuration file.
[0046] In this embodiment, the target project is specifically the Django project, which includes configuration files (.env files), a core configuration file (or global configuration file, i.e., settings.py file), utility module files (utils / crypto.py file), business logic files (views.py file), and routing configuration files (urls.py file). The .env file stores environment variables (such as encryption keys) to avoid hardcoding sensitive information in the code. The settings.py file is the global configuration file for the Django project, used to load environment variables (such as keys) and configure encryption parameters. The utils / crypto.py file encapsulates AES encryption and decryption utility classes, providing a unified encryption interface. The views.py file handles the logic of Django views, integrating encryption tools to protect interface data. The urls.py file configures the routing rules for the Django project and exposes encryption / decryption interfaces (optional).
[0047] Specifically, the process of implementing data protection based on the DJ Ango project includes:
[0048] Step 1: Environment Preparation and Dependency Installation. This step provides foundational toolkit support for subsequent encryption operations. The cryptography library provides an implementation of the AES encryption algorithm, while python-dotenv is used to securely manage sensitive information such as keys, avoiding direct hardcoding in the code. The specific implementation process includes: 1) Installing the encryption library: Install the cryptography library using the command `pip install cryptography aphy`. This library is a widely used encryption toolkit in Python, supporting multiple encryption algorithms such as AES, ensuring reliable data encryption and decryption. 2) Installing the environment variable management library: Install the python-dotenv library using the command `pip install python-dotenv`. This library allows loading environment variables from .env files, enabling sensitive information such as keys to be stored independently of the code, improving security.
[0049] Step 2: Key Security Management. The key is the core of AES encryption and must be stored independently and not leaked. AES symmetric encryption requires the same key to be used for encryption and decryption, so the security of the key directly determines the security of the entire encryption scheme. The specific implementation process includes: 1) Creating a .env file: Create a text file named .env in the root directory of the Dj ango project. Write the key in this file, in the format: AES_KEY=your-secure-256-bit-key-here. Note: The key should be a 256-bit (32-byte) random string, for example, generated by os.urandom(32). 2) Loading environment variables: In the settings.py file, load the environment variables in the .env file using python-dotenv. Use os.getenv('AES_KEY') to read the key and convert it to byte format using .encode('utf-8') (the AES algorithm requires the key to be of byte type).
[0050] Step 3: Encapsulate the encryption utility class. Centralized management of encryption / decryption logic facilitates reuse. Encapsulating independent utility classes avoids redundant implementation of encryption logic in business code and improves code maintainability. The specific implementation process includes: 1) Creating the encryption utility file: Create a file named `utils / crypto.py` in the DJ Ango project to encapsulate the core functions of AES encryption and decryption. 2) Implementing the encryption function: Write a method (e.g., `encrypt_data`) that receives plaintext data as input. Encrypt the plaintext using AES_KEY to generate ciphertext. Convert the ciphertext to Base64 encoding format (for easy transmission or storage). 3) Implementing the decryption function: Write a method (e.g., `decrypt_data`) that receives Base64 encoded ciphertext as input. Verify the validity of the ciphertext format (e.g., length, character set). Decrypt the ciphertext using AES_KEY to restore the original plaintext data. 4) Integrity verification: Generate a hash value using HMAC (Hash-based Message Authentication Code) and append it to the ciphertext. Verify the hash value during decryption to ensure that the data has not been tampered with during transmission.
[0051] Step 4: Integrate Encryption Logic into Interfaces. By applying encryption tools to actual business interfaces, ensure the security of sensitive data during transmission and storage. The specific implementation process includes: 1) Importing Encryption Tools: Import the AESEncryptor utility class into the view file requiring encryption (e.g., views.py). 2) Request Processing: In interfaces that receive user-submitted data (e.g., user registration or payment interfaces), call the encrypt_data method to encrypt sensitive fields (e.g., password, phone number, bank card number). Store the encrypted data in the database, not the original plaintext. 3) Response Processing: In interfaces that query data from the database and return it to the front end, call the decrypt_data method to decrypt the encrypted fields. Return the decrypted data (or only return non-sensitive fields, depending on business requirements).
[0052] Step 5: Route Configuration. This exposes the encryption / decryption interface (optional, for testing or specific scenarios). Route configuration allows you to provide independent interfaces for testing encryption functionality or supporting specific business needs. The specific implementation process includes: 1) Adding test routes: In the urls.py file, add two routes: / encrypt / : Receives plaintext data submitted by the frontend and calls an encryption tool to return ciphertext. / decrypt / : Receives ciphertext data submitted by the frontend and calls a decryption tool to return plaintext. 2) Use cases: Testing purposes: Verifying whether the encryption / decryption function works correctly during the development phase. Specific business needs: For example, scenarios where the frontend needs to encrypt data before submission, and the backend provides a decryption interface.
[0053] Step S203: Extract the business data from the data processing request based on the routing configuration file and the business logic file.
[0054] In this embodiment, the specific implementation process of extracting the business data from the data processing request based on the routing configuration file and the business logic file will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0055] Step S204: Determine whether the business data is sensitive information.
[0056] In this embodiment, the specific implementation process of determining whether the business data belongs to sensitive information will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0057] Step S205: If yes, load the preset target key from the configuration file.
[0058] In this embodiment, the specific implementation process of loading the preset target key from the configuration file will be described in more detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0059] Step S206: Based on the tool module file, encrypt the business data using the target key to obtain the corresponding target ciphertext.
[0060] In this embodiment, the specific implementation process of encrypting the business data using the target key based on the tool module file to obtain the corresponding target ciphertext will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0061] Step S207: Store the target ciphertext.
[0062] In this embodiment, the specific implementation process of storing the target ciphertext described above will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0063] This application first receives a user-submitted data processing request based on a preset target interface; wherein the data processing request carries user-submitted business data; then it calls the target project corresponding to the target interface; wherein the target project includes at least a configuration file, a tool module file, a business logic file, and a routing configuration file; then it extracts the business data from the data processing request based on the routing configuration file and the business logic file; and determines whether the business data is sensitive information; if so, it loads a preset target key from the configuration file; subsequently, based on the tool module file, it uses the target key to encrypt the business data to obtain the corresponding target ciphertext; finally, it stores the target ciphertext. Based on the above processing flow, after receiving a user-submitted data processing request based on the target interface, this application calls the target project corresponding to the target interface, which includes a configuration file, a tool module file, a business logic file, and a routing configuration file; then, it extracts business data from the data processing request based on the combined use of the routing configuration file and the business logic file; and when it detects that the business data is sensitive information, it loads a preset target key based on the configuration file; then, based on the tool module file, it uses the target key to encrypt the business data to obtain the target ciphertext; finally, it stores the target ciphertext. Thus, by combining the configuration files, tool module files, business logic files, and routing configuration files contained in the target project, this application can automatically, intelligently, and accurately complete the data encryption and data storage processing of user-submitted business data, effectively improving the data encryption efficiency and data security of business data, thereby effectively reducing the risk of business data leakage and helping to protect user privacy and business security.
[0064] In some alternative implementations, step S203 includes the following steps:
[0065] Obtain the request path of the data processing request.
[0066] In this embodiment, the aforementioned request path specifically refers to the URL path of the aforementioned data processing request.
[0067] Based on the request path, the request is routed to the view function in the business logic file via the routing configuration file.
[0068] In this embodiment, by utilizing the aforementioned routing configuration file (urls.py), the data processing request is routed to the register view function in the business logic file (views.py) based on the obtained request path (URL path).
[0069] Specifically, the target framework (Dj Ango framework) searches for matching routing rules in the `urls.py` file based on the requested URL path (e.g., ` / api / register / `). The `urls.py` file then binds the URL path to the `register` view function in the routing configuration file (`views.py`), ensuring the request is correctly routed. Route matching is the "entry point" for request processing, ensuring that the user's request is handled correctly by the backend logic. The routing configuration file (`urls.py`) has navigation functionality, allowing it to find the corresponding processing function (e.g., `register`) in the business logic file (`views.py`) based on the user's requested address (e.g., ` / api / register / `).
[0070] Based on the view function, the business data is extracted from the data processing request.
[0071] In this embodiment, the user-submitted business data can be extracted from the data processing request using the aforementioned view function, specifically the `register` view function. Specifically, if it's a form submission, data is obtained via `request.POST`. If it's JSON data, it's obtained through `request.body` parsing. Furthermore, the request data can be further converted into key-value pairs (e.g., `{"use r name":"user 1","password":"123456"}`). The username and password are then temporarily stored in plaintext in memory for later processing. The view function acts like a "mail clerk," receiving the "letters" (request data) sent by the user through the front end and opening them to read their contents.
[0072] This application obtains the request path of the data processing request; then, based on the request path, routes it to a view function in the business logic file through the routing configuration file; subsequently, based on the view function, it extracts the business data from the data processing request. Based on this processing flow, this application, by combining the routing configuration file, business logic file, and view function, can quickly and accurately extract user-submitted business data from data processing requests, effectively improving the efficiency and intelligence of request data extraction. Furthermore, the use of the retrieved business data helps ensure that user-submitted data processing requests are correctly processed by the backend logic, thereby improving the standardization and intelligence of data processing request processing.
[0073] In some optional implementations of this embodiment, step S204 includes the following steps:
[0074] Extract the field names of the business data.
[0075] In this embodiment, the business data submitted by the user can be parsed to extract all field names and values submitted by the user (such as {"user name":"use r 1","password":"123456"}).
[0076] Calls the preset list of sensitive fields.
[0077] In this embodiment, a list of sensitive fields is maintained in the system according to actual business needs (e.g., SENSITIVE_FIELDS = ["password", "phone", "email", "id_card"]).
[0078] The field name is matched against the list of sensitive fields to determine whether the field name exists in the list of sensitive fields.
[0079] In this embodiment, a list matching method can be used to match the field name with the list of sensitive fields in order to detect whether the field name exists in the list of sensitive fields.
[0080] If so, the business data is determined to be sensitive information; otherwise, the business data is determined not to be sensitive information.
[0081] In this embodiment, if the aforementioned field name is detected to exist in the aforementioned sensitive field list, the aforementioned business data is determined to be sensitive information; conversely, if the aforementioned field name is detected not to exist in the aforementioned sensitive field list, the aforementioned business data is determined not to be sensitive information. Furthermore, if the business data is detected to be non-sensitive information, subsequent encryption processing cannot be performed on the business data, and the business data can be directly stored and processed. This reduces the workload of data encryption processing, thereby improving the efficiency and intelligence of business data processing.
[0082] This application extracts the field names from the business data; then calls a preset sensitive field list; subsequently, it matches the field names with the sensitive field list to determine if the field name exists in the sensitive field list; if so, the business data is determined to be sensitive information; otherwise, the business data is determined not to be sensitive information. Based on the above processing flow, this application extracts the field names from the business data, then matches the field names with the sensitive field list, and based on the matching results, can efficiently and accurately identify whether the business data is sensitive information, ensuring the accuracy of sensitive identification of business data.
[0083] In some optional implementations, the target project also includes a core configuration file; step S205 includes the following steps:
[0084] Call the default processing library.
[0085] In this embodiment, the aforementioned processing library is specifically the python-dotenv library.
[0086] Based on the core configuration file, the pre-stored key data is loaded from the configuration file through the processing library.
[0087] In this embodiment, a pre-stored key (such as AES_KEY = your-secure-256-bit-key-here) can be loaded from the configuration file (.env file) stored in the root directory of the target project (i.e., the Dj ango project) according to the core configuration file (or global configuration file, i.e., the settings.py file) through the above processing library.
[0088] The key data is used as the target key.
[0089] This application calls a preset processing library; then, based on the core configuration file, it loads pre-stored key data from the configuration file using the processing library; subsequently, this key data is used as the target key. Based on the above processing flow, this application, by combining the core configuration file and the processing library, can quickly and intelligently load the required target key from the configuration file, improving the loading efficiency of the target key. Furthermore, the subsequent use of the target key can efficiently and accurately complete the encryption processing of business data, thereby improving the encryption efficiency of business data and ensuring the security of business data.
[0090] In some alternative implementations, step S206 includes the following steps:
[0091] Invoke the target encryption algorithm encapsulated in the tool module file.
[0092] In this embodiment, the target encryption algorithm specifically refers to the encryption algorithm encapsulated in the tool module file (utils / crypto.py), such as the AESEncryptor.encrypt() method.
[0093] Invoke the default encryption tool.
[0094] In this embodiment, the encryption tool is a pre-built processing tool with encryption functionality.
[0095] The business data and the target key are transmitted to the encryption tool.
[0096] In this embodiment, the aforementioned business data and target key can be passed into the aforementioned encryption tool as parameters.
[0097] Based on the encryption tool, the business data is encrypted using the target encryption algorithm to obtain the corresponding encrypted data.
[0098] In this embodiment, the encryption tool will encrypt the incoming business data based on the target encryption algorithm and the target key, thereby generating unreadable ciphertext, i.e., the encrypted data (such as "U2FsdGVkX1+...").
[0099] The encrypted data is used as the target ciphertext.
[0100] This application calls the target encryption algorithm encapsulated in the tool module file; then calls a preset encryption tool; and passes the business data and the target key to the encryption tool; subsequently, based on the encryption tool, the business data is encrypted using the target encryption algorithm to obtain the corresponding encrypted data; this encrypted data is then used as the target ciphertext. Based on the above processing flow, this application, by combining the target encryption algorithm encapsulated in the tool module file with the encryption tool, can efficiently and accurately complete the encryption processing of business data, improving the efficiency of data encryption. Furthermore, by encrypting the business data, data protection for sensitive information can be effectively achieved, ensuring that even if the database is leaked, attackers cannot directly read the original data, which helps to guarantee the security of the generated target ciphertext.
[0101] In some optional implementations of this embodiment, step S207 includes the following steps:
[0102] Call the target view function corresponding to the business logic file.
[0103] In this embodiment, the target view function refers to the regular view function in the business logic file (views.py).
[0104] Calls the preset specified storage medium.
[0105] In this embodiment, the selection of the specified storage medium is not specifically limited and can be determined according to the actual business storage needs. For example, any one of the media such as local database, local disk, cloud server, and blockchain can be used.
[0106] Get the preset storage policy.
[0107] In this embodiment, the above storage strategy can be set according to actual data storage needs. For example, a field storage method can be adopted, using the user name field to store the plaintext username (such as "user 1") and the password field to store the encrypted password (such as "U2FsdGVkX1+...").
[0108] Based on the storage strategy, the target ciphertext is stored in the specified storage medium using the target view function.
[0109] In this embodiment, the generated target ciphertext can be stored in the selected specified storage medium using the target view function according to the selected storage strategy, thereby completing the storage processing of the target ciphertext.
[0110] This application calls the target view function corresponding to the business logic file; then calls a preset specified storage medium; subsequently obtains a preset storage strategy; and then, based on the storage strategy, uses the target view function to store the target ciphertext into the specified storage medium. Based on the above processing flow, this application, through the combined use of the target view function, specified storage medium, and storage strategy based on the business logic file, can automatically and intelligently complete the storage processing of target ciphertext, improving the data storage efficiency and intelligence of target ciphertext. Furthermore, it can ensure the persistent storage of target ciphertext, improving the data security of target ciphertext.
[0111] In some optional implementations of this embodiment, after the step of storing the target ciphertext into the specified storage medium using the target view function based on the storage strategy, the following step is further included:
[0112] Determine whether a data query request corresponding to the business data triggered by a specified user has been received.
[0113] In this embodiment, the aforementioned data query request may be a plaintext data query request related to the aforementioned business data triggered by a specified user through the system.
[0114] If so, retrieve the target ciphertext from the specified storage medium.
[0115] In this embodiment, upon receiving a plaintext data query request related to the aforementioned business data, the system will automatically access the specified storage medium to retrieve the target ciphertext related to the aforementioned business data.
[0116] The target ciphertext is decrypted based on the tool module file to obtain the corresponding plaintext data.
[0117] In this embodiment, the target ciphertext can be decrypted by using the target decryption algorithm (such as the AESEncryptor.decrypt() method) corresponding to the target encryption algorithm in the tool module file (utils / crypto.py), and the processed data can be used as the plaintext data of the target ciphertext.
[0118] The plaintext data is returned to the designated user.
[0119] In this embodiment, the method of returning the plaintext data is not specifically limited and can be determined according to actual business needs. For example, it can be any one of the following methods: UI display, email, or SMS. Furthermore, plaintext data can be generated and sent to the designated user according to the selected return method, thereby completing the response processing for the data query request corresponding to the business data triggered by the designated user.
[0120] This application determines whether a data query request corresponding to the business data triggered by a specified user has been received. If so, it retrieves the target ciphertext from the specified storage medium; then, it decrypts the target ciphertext using the tool module file to obtain the corresponding plaintext data; subsequently, it returns the plaintext data to the specified user. Based on the above processing flow, after receiving a data query request corresponding to business data triggered by a specified user, this application automatically and intelligently retrieves the target ciphertext from the specified storage medium, and then decrypts the target ciphertext using the tool module file to obtain plaintext data. This enables efficient and accurate generation of the required plaintext data, improving the generation efficiency and accuracy of plaintext data. Furthermore, by returning the plaintext data to the specified user to complete the response processing for the data query request corresponding to business data triggered by the specified user, it helps to improve the user experience.
[0121] In some alternative implementations, the user information obtained is subject to user consent and complies with relevant laws and policies.
[0122] Furthermore, any software tools or components not belonging to our company that appear in the embodiments of this application are merely illustrative examples and do not represent actual use.
[0123] Furthermore, the primary reason for using AES encryption in the Django-based data interface provided in this application is to protect data security. On the internet, data transmission may be subject to eavesdropping or tampering. AES encryption ensures that even if data is intercepted, it cannot be easily cracked. It uses the same key for both encryption and decryption, making it suitable for encrypting large amounts of data and offering relatively fast speed. The following improvements and innovations are implemented:
[0124] 1. By encrypting the data, even if the data is intercepted during transmission, attackers cannot directly read and understand the data content, thereby reducing the risk of data leakage.
[0125] 2. AES encryption not only protects data confidentiality but also ensures data integrity. By combining it with a hash algorithm (such as HMAC), a data integrity check value can be generated while encrypting the data. When the recipient decrypts the data, they can verify whether the data has been tampered with during transmission, thus ensuring the integrity and authenticity of the data.
[0126] 3. In DJ Ango projects, especially in scenarios that require frequent data encryption and decryption (such as real-time data transmission and high-concurrency request processing), AES can provide better performance, reduce server load, and improve user experience.
[0127] 4. The Django ecosystem offers a wealth of libraries and tools, such as the cryptography library, making it relatively easy to implement AES encryption in Django projects. Developers can write encryption and decryption functions and integrate them into Django views, middleware, or signal processing to achieve seamless encryption and decryption of sensitive data.
[0128] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0129] It should be emphasized that, to further ensure the privacy and security of the aforementioned target ciphertext, the target ciphertext can also be stored in a node of a blockchain.
[0130] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0131] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0132] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0133] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0134] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0135] Further reference Figure 3 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a data processing apparatus, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0136] like Figure 3 As shown, the data processing device 300 described in this embodiment includes: a receiving module 301, a calling module 302, an extraction module 303, a judging module 304, a loading module 305, an encryption module 306, and a storage module 307. Wherein:
[0137] The receiving module 301 is used to receive a data processing request submitted by a user based on a preset target interface; wherein the data processing request carries business data submitted by the user.
[0138] The calling module 302 is used to call the target project corresponding to the target interface; wherein, the target project includes at least a configuration file, a tool module file, a business logic file, and a routing configuration file;
[0139] Extraction module 303 is used to extract the business data from the data processing request based on the routing configuration file and the business logic file;
[0140] The judgment module 304 is used to determine whether the business data belongs to sensitive information;
[0141] Loading module 305 is used to load a preset target key from the configuration file if the condition is met.
[0142] Encryption module 306 is used to encrypt the business data using the target key based on the tool module file to obtain the corresponding target ciphertext;
[0143] Storage module 307 is used for storing the target ciphertext.
[0144] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data processing method in the aforementioned embodiments, and will not be repeated here.
[0145] In some optional implementations of this embodiment, the extraction module 303 includes:
[0146] The first acquisition submodule is used to acquire the request path of the data processing request;
[0147] The processing submodule is used to route to the view function in the business logic file based on the request path and through the routing configuration file;
[0148] The first extraction submodule is used to extract the business data from the data processing request based on the view function.
[0149] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data processing method in the aforementioned embodiments, and will not be repeated here.
[0150] In some optional implementations of this embodiment, the determination module 304 includes:
[0151] The second extraction submodule is used to extract the field names of the business data;
[0152] The first submodule is used to invoke the preset list of sensitive fields;
[0153] The matching submodule is used to match the field name with the sensitive field list to determine whether the field name exists in the sensitive field list;
[0154] The determination submodule is used to determine if the business data is sensitive information, and otherwise determine if the business data is not sensitive information.
[0155] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data processing method in the aforementioned embodiments, and will not be repeated here.
[0156] In some optional implementations of this embodiment, the target project further includes a core configuration file; the loading module 305 includes:
[0157] The second submodule is used to call the preset processing library;
[0158] A loading submodule is used to load pre-stored key data from the configuration file through the processing library based on the core configuration file.
[0159] The first determining submodule is used to use the key data as the target key.
[0160] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data processing method in the aforementioned embodiments, and will not be repeated here.
[0161] In some optional implementations of this embodiment, the encryption module 306 includes:
[0162] The third calling submodule is used to call the target encryption algorithm encapsulated in the tool module file;
[0163] The fourth submodule is used to invoke the preset encryption tools;
[0164] The input submodule is used to input the business data and the target key into the encryption tool;
[0165] The encryption submodule is used to encrypt the business data using the target encryption algorithm based on the encryption tool, so as to obtain the corresponding encrypted data;
[0166] The second determining submodule is used to use the encrypted data as the target ciphertext.
[0167] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data processing method in the aforementioned embodiments, and will not be repeated here.
[0168] In some optional implementations of this embodiment, the storage module 307 includes:
[0169] The fifth calling submodule is used to call the target view function corresponding to the business logic file;
[0170] The sixth submodule is used to invoke a preset specified storage medium;
[0171] The second acquisition submodule is used to acquire the preset storage strategy;
[0172] The storage submodule is used to store the target ciphertext into the specified storage medium using the target view function based on the storage strategy.
[0173] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data processing method in the aforementioned embodiments, and will not be repeated here.
[0174] In some optional implementations of this embodiment, the storage module 307 further includes:
[0175] The judgment submodule is used to determine whether a data query request corresponding to the business data triggered by a specified user has been received;
[0176] The query submodule is used to retrieve the target ciphertext from the specified storage medium if the condition is met.
[0177] The decryption submodule is used to decrypt the target ciphertext based on the tool module file to obtain the corresponding plaintext data;
[0178] The return submodule is used to return the plaintext data to the specified user.
[0179] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data processing method in the aforementioned embodiments, and will not be repeated here.
[0180] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0181] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0182] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0183] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for data processing methods. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.
[0184] In some embodiments, the processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute computer-readable instructions for the data processing method.
[0185] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.
[0186] Compared with the prior art, the embodiments of this application have the following beneficial effects:
[0187] In this embodiment, after receiving a user-submitted data processing request based on a target interface, the application calls the target project corresponding to the target interface, which includes a configuration file, tool module file, business logic file, and routing configuration file. Then, based on the combined use of the routing configuration file and business logic file, business data is extracted from the data processing request. When sensitive information is detected in the business data, a preset target key is loaded based on the configuration file. Then, based on the tool module file, the target key is used to encrypt the business data to obtain target ciphertext. Finally, the target ciphertext is stored. Thus, by combining the configuration file, tool module file, business logic file, and routing configuration file included in the target project, this application can automatically, intelligently, and accurately complete the encryption and storage processing of user-submitted business data, effectively improving the data encryption efficiency and data security of business data. This effectively reduces the risk of business data leakage and helps protect user privacy and business security.
[0188] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the data processing method described above.
[0189] Compared with the prior art, the embodiments of this application have the following main advantages:
[0190] In this embodiment, after receiving a user-submitted data processing request based on a target interface, the application calls the target project corresponding to the target interface, which includes a configuration file, tool module file, business logic file, and routing configuration file. Then, based on the combined use of the routing configuration file and business logic file, business data is extracted from the data processing request. When sensitive information is detected in the business data, a preset target key is loaded based on the configuration file. Then, based on the tool module file, the target key is used to encrypt the business data to obtain target ciphertext. Finally, the target ciphertext is stored. Thus, by combining the configuration file, tool module file, business logic file, and routing configuration file included in the target project, this application can automatically, intelligently, and accurately complete the encryption and storage processing of user-submitted business data, effectively improving the data encryption efficiency and data security of business data. This effectively reduces the risk of business data leakage and helps protect user privacy and business security.
[0191] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0192] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A data processing method, characterized in that, Includes the following steps: The system receives data processing requests submitted by users based on a preset target interface; wherein the data processing requests carry business data submitted by the users. Invoke the target project corresponding to the target interface; wherein, the target project includes at least a configuration file, a tool module file, a business logic file, and a routing configuration file; The business data is extracted from the data processing request based on the routing configuration file and the business logic file. Determine whether the business data is sensitive information; If so, load the preset target key from the configuration file; Based on the tool module file, the business data is encrypted using the target key to obtain the corresponding target ciphertext; The target ciphertext is stored.
2. The data processing method according to claim 1, characterized in that, The step of extracting the business data from the data processing request based on the routing configuration file and the business logic file specifically includes: Obtain the request path of the data processing request; Based on the request path, the request is routed to the view function in the business logic file through the routing configuration file; Based on the view function, the business data is extracted from the data processing request.
3. The data processing method according to claim 1, characterized in that, The step of determining whether the business data is sensitive information specifically includes: Extract the field names from the business data; Call the preset list of sensitive fields; Match the field name with the list of sensitive fields to determine whether the field name exists in the list of sensitive fields; If so, the business data is determined to be sensitive information; otherwise, the business data is determined not to be sensitive information.
4. The data processing method according to claim 1, characterized in that, The target project also includes a core configuration file; the step of loading a preset target key from the configuration file specifically includes: Call the default processing library; Based on the core configuration file, the pre-stored key data is loaded from the configuration file through the processing library; The key data is used as the target key.
5. The data processing method according to claim 1, characterized in that, The step of encrypting the business data using the target key based on the tool module file to obtain the corresponding target ciphertext specifically includes: Invoke the target encryption algorithm encapsulated in the tool module file; Invoke the preset encryption tool; The business data and the target key are transmitted to the encryption tool; Based on the encryption tool, the business data is encrypted using the target encryption algorithm to obtain the corresponding encrypted data; The encrypted data is used as the target ciphertext.
6. The data processing method according to claim 1, characterized in that, The step of storing the target ciphertext specifically includes: Call the target view function corresponding to the business logic file; Call the specified preset storage medium; Get the preset storage policy; Based on the storage strategy, the target ciphertext is stored in the specified storage medium using the target view function.
7. The data processing method according to claim 6, characterized in that, After the step of storing the target ciphertext into the specified storage medium using the target view function based on the storage strategy, the method further includes: Determine whether a data query request corresponding to the business data, triggered by a specified user, has been received; If so, retrieve the target ciphertext from the specified storage medium; The target ciphertext is decrypted based on the tool module file to obtain the corresponding plaintext data. The plaintext data is returned to the designated user.
8. A data processing apparatus, characterized in that, include: The receiving module is used to receive data processing requests submitted by users based on a preset target interface; wherein the data processing request carries business data submitted by the user; The calling module is used to call the target project corresponding to the target interface; wherein, the target project includes at least a configuration file, a tool module file, a business logic file, and a routing configuration file; The extraction module is used to extract the business data from the data processing request based on the routing configuration file and the business logic file; The judgment module is used to determine whether the business data is sensitive information; A loading module, used to load a preset target key from the configuration file if the condition is met; An encryption module is used to encrypt the business data using the target key based on the tool module file to obtain the corresponding target ciphertext; The storage module is used to store the target ciphertext.
9. A computer device, characterized in that, The method includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the data processing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the data processing method as described in any one of claims 1 to 7.