File storage method, device, equipment and medium
By generating encryption keys through hash coding and preset keys, government data files are encrypted, and file storage is managed using target identifiers, which solves the versatility and security issues of government data file storage systems and achieves seamless docking and data sharing.
Patent Information
- Application Number
- CN202411239499.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-09-05
AI Technical Summary
The existing government data file storage system lacks universality, making it difficult to achieve seamless integration between different systems. It also lacks personalized encryption storage mechanisms, making files easy to crack, resulting in data loss and privacy infringement.
The encryption key is generated through hash coding and preset keys to encrypt the file, and the target identifier is used to manage file storage. Combined with the file storage middleware, seamless docking and data sharing between different systems can be achieved.
It achieves seamless connection between different systems, improves data sharing and business collaboration efficiency, and ensures the security of file data.
Smart Images

Figure CN119128978B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a file storage method, device, equipment and medium. Background Art
[0002] Current government data file storage systems face numerous challenges and shortcomings. First, most government resource systems rely on specific middleware for data storage. These middleware often lack versatility, making it difficult to achieve seamless integration between different systems, severely restricting the efficiency of data sharing and business collaboration. Second, existing middleware has limitations in performance and functionality, making it difficult to meet the diverse business needs and cost considerations of different applications. Crucially, most existing file storage middleware lacks personalized encryption storage mechanisms, making it extremely easy for files to be cracked once leaked, resulting in immeasurable data loss and privacy violations.
[0003] As can be seen from the above, how to adapt to the business needs of different applications during the file storage process and ensure the security of file data is an urgent problem to be solved. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a file storage method, apparatus, device, and medium that can adapt to the business needs of different applications during the file storage process and ensure the security of file data. The specific solution is as follows:
[0005] In a first aspect, the present application provides a file storage method, comprising:
[0006] Obtaining a current storage request initiated by a user and a corresponding original file, and saving a hash code of the original file to a local database so as to generate an encryption key for the original file based on the hash code and a preset key;
[0007] Encrypting the original file using the encryption key to obtain a corresponding encrypted file, and forwarding the encrypted file to a preset file storage middleware so that the preset file storage middleware returns parameter information indicating that the encrypted file has been successfully stored;
[0008] A target identifier for the original file is generated based on the parameter information, the parameter information and the target identifier are saved in the local database, and then the target identifier is sent to the user terminal.
[0009] Optionally, before forwarding the encrypted file to the preset file storage middleware, the method further includes:
[0010] A configuration file for setting a file storage middleware is obtained, and a target file storage middleware matching the configuration file is determined from a plurality of pre-set file storage middlewares, and the target file storage middleware is used as the preset file storage middleware so as to forward the encrypted file to the preset file storage middleware.
[0011] Optionally, after generating a target identifier for the original file based on the parameter information, saving the parameter information and the target identifier to the local database, and then sending the target identifier to the user terminal, the method further includes:
[0012] Obtaining a current deletion request initiated by the user and a corresponding target identifier for the original file;
[0013] Determining parameter information of an encrypted file corresponding to the original file from a local database using the target identifier, performing a deletion operation on the encrypted file corresponding to the parameter information in the preset file storage middleware, and then receiving status information of the encrypted file returned by the preset file storage middleware after the deletion operation is completed;
[0014] The parameter information in the local database is updated based on the status information, and response information indicating successful deletion for the current deletion request is generated based on the corresponding updated information, and then the response information is sent to the user terminal.
[0015] In a second aspect, the present application provides a file downloading method, comprising:
[0016] Obtaining a current download request initiated by a user terminal and a corresponding target identifier for the original file; wherein the target identifier is an identifier generated based on parameter information returned by a preset file storage middleware indicating successful storage of the encrypted file; the encrypted file is a text obtained by encrypting the original file based on an encryption key; the encryption key is a key for the original file generated based on a hash code of the original file and a preset key;
[0017] Determining, from a local database, a hash code corresponding to the original file and parameter information of an encrypted file corresponding to the original file using the target identifier, and generating a decryption key for the encrypted file based on the hash code and the parameter information; the decryption key corresponds to the encryption key and is used to decrypt the file encrypted using the encryption key;
[0018] The corresponding encrypted file is downloaded from the preset file storage middleware according to the parameter information, and the encrypted file is decrypted using the decryption key to obtain the original file, and then the original file is sent to the user terminal.
[0019] Optionally, sending the original file to the user terminal may include:
[0020] Determine the target file type of the original file, and determine a target desensitization model that matches the target file type from a preset file desensitization model;
[0021] The target desensitization model is used to perform a desensitization operation on the original file, and the corresponding desensitized file is sent to the user end.
[0022] Optionally, determining the target file type of the original file and determining a target desensitization model that matches the target file type from a preset file desensitization model includes:
[0023] If the target file type of the original file is a text type, the model constructed based on the attention mechanism in the preset file desensitization model is determined as the target desensitization model corresponding to the original file;
[0024] If the target file type of the original file is a picture type, the model constructed based on optical characters in the preset file desensitization model is determined as the target desensitization model corresponding to the original file.
[0025] In a third aspect, the present application provides a file storage device, comprising:
[0026] A file acquisition module is configured to acquire the current storage request initiated by the user terminal and the corresponding original file, and save the hash code of the original file to a local database so as to generate an encryption key for the original file based on the hash code and a preset key;
[0027] a file encryption module configured to encrypt the original file using the encryption key to obtain a corresponding encrypted file, and forward the encrypted file to a preset file storage middleware so that the preset file storage middleware returns parameter information indicating that the encrypted file has been successfully stored;
[0028] The target identifier generating module is used to generate a target identifier for the original file based on the parameter information, save the parameter information and the target identifier to the local database, and then send the target identifier to the user terminal.
[0029] In a fourth aspect, the present application provides a file downloading device, comprising:
[0030] A download request acquisition module is configured to acquire the current download request initiated by the user terminal and the corresponding target identifier for the original file; wherein the target identifier is an identifier generated based on parameter information returned by the preset file storage middleware indicating successful storage of the encrypted file; the encrypted file is a text obtained by encrypting the original file based on an encryption key; the encryption key is a key for the original file generated based on a hash code of the original file and a preset key;
[0031] a decryption key generation module, configured to use the target identifier to determine from a local database a hash code corresponding to the original file and parameter information of an encrypted file corresponding to the original file, and to generate a decryption key for the encrypted file based on the hash code and the parameter information; the decryption key corresponds to the encryption key and is used to decrypt a file encrypted using the encryption key;
[0032] The file decryption module is used to download the corresponding encrypted file from the preset file storage middleware according to the parameter information, decrypt the encrypted file using the decryption key to obtain the original file, and then send the original file to the user terminal.
[0033] In a fifth aspect, the present application provides an electronic device, comprising:
[0034] Memory, used to store computer programs;
[0035] The processor is configured to execute the computer program to implement the aforementioned method.
[0036] In a sixth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned method when executed by a processor.
[0037] This application obtains the current storage request initiated by the user terminal and the corresponding original file, and saves the hash code of the original file to the local database, so as to generate an encryption key for the original file based on the hash code and the preset key; uses the encryption key to encrypt the original file to obtain the corresponding encrypted file, and forwards the encrypted file to the preset file storage middleware, so that the preset file storage middleware returns parameter information indicating that the encrypted file is successfully stored; generates a target identifier for the original file based on the parameter information, saves the parameter information and the target identifier to the local database, and then sends the target identifier to the user terminal.
[0038] As can be seen from the above, this application connects the user end and the middleware, and can encrypt the file in combination with the hash code of the original file and save it to the middleware. At the same time, the target identifier for the original file is generated through the parameter information returned by the middleware, allowing the user end to use the target identifier of the original file to manage the file data in the file storage middleware, thus achieving seamless connection between different systems and improving the efficiency of data sharing and business collaboration. In addition, encrypting the original file in combination with the hash code can ensure the security of the original file data. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0040] Figure 1 A flow chart of a file storage method disclosed in this application;
[0041] Figure 2 A schematic diagram of a file encryption and decryption process disclosed in this application;
[0042] Figure 3 A schematic diagram of a process for determining a file storage middleware disclosed in this application;
[0043] Figure 4 A schematic diagram of a file deletion process disclosed in this application;
[0044] Figure 5 A flowchart of a specific file storage method disclosed in this application;
[0045] Figure 6 A flowchart of a file downloading method disclosed in this application;
[0046] Figure 7 A schematic diagram of a document desensitization process disclosed in this application;
[0047] Figure 8 A flowchart of a specific file downloading method disclosed in this application;
[0048] Figure 9 This is a schematic diagram of a file storage device disclosed in this application;
[0049] Figure 10 This is a schematic diagram of a file downloading device disclosed in this application;
[0050] Figure 11 This is a structural diagram of an electronic device disclosed in this application. Implementation Method
[0051] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0052] At present, most government resource systems rely on specific middleware for data storage. These middlewares often lack versatility and are difficult to achieve seamless integration between different systems, which seriously restricts the efficiency of data sharing and business collaboration. In addition, existing middleware has limitations in performance and functionality, making it difficult to meet the diverse business needs and cost considerations under different applications. What is particularly critical is that most existing file storage middleware lacks a personalized encryption storage mechanism, which means that once a file is leaked, it is extremely easy to be cracked, causing immeasurable data loss and privacy infringement. To this end, the present application provides a file storage solution that can adapt to the business needs of different applications during the file storage process and ensure the security of file data.
[0053] See also Figure 1 As shown, the embodiment of the present application discloses a file storage method, including:
[0054] Step S11: Obtain the current storage request initiated by the user terminal and the corresponding original file, and save the hash code of the original file to a local database, so as to generate an encryption key for the original file based on the hash code and a preset key.
[0055] In this embodiment, it is necessary to obtain the current storage request and the corresponding original file from the user terminal, and save the hash code of the original file to the local database, so as to generate an encryption key for the original file based on the hash code and a preset key. The preset key is a key that is pre-set and pre-stored in the local database. This key can be used in conjunction with the hash code to encrypt the file. The specific key type can be determined based on actual application conditions and is not specifically limited here.
[0056] See also Figure 2As shown, in a specific embodiment, after receiving the current storage request and the corresponding original file sent by the user terminal, the hash code corresponding to the original file is obtained, and the hash code is saved to local data, so that the original file can be encrypted or the encrypted original file can be decrypted by the hash code. The configuration file key pre-stored in the local database and the hash code are combined to generate a file encryption key corresponding to the original file, and the original file is encrypted by the file encryption key to obtain an encrypted file corresponding to the original file. Accordingly, in the process of decrypting the encrypted file, the corresponding file decryption key is generated by the file hash code pre-stored in the local database and the basic information of the encrypted file, and the encrypted file is decrypted by the file decryption key to obtain the original file corresponding to the encrypted file.
[0057] Step S12: Encrypt the original file using the encryption key to obtain a corresponding encrypted file, and forward the encrypted file to the preset file storage middleware so that the preset file storage middleware returns parameter information indicating that the encrypted file has been successfully stored.
[0058] In this embodiment, after the original file is encrypted using the encryption key, the encrypted file is forwarded to the preset file storage middleware, and parameter information representing the successful storage of the encrypted file generated by the preset storage middleware based on the encrypted file is received. Among them, the file storage middleware acts as a bridge between the file management system and the storage system, and is responsible for the requests and responses for the actual storage, reading, deletion and other operations of the file; the file storage system middleware integration application can first establish a communication connection with several file storage middlewares, and the preset file storage middleware is any one of the several file storage middlewares that establish a communication connection, which can be determined according to the actual application situation. For example, in a specific embodiment, by obtaining a configuration file for setting the file storage middleware, the configuration item information about the preset file storage middleware in the configuration file is determined, and according to the configuration item information, the target file storage middleware that matches the configuration file is determined from the pre-set several file storage middlewares, and the target file storage middleware is used as the preset file storage middleware, so that the encrypted file can be forwarded to the preset file storage middleware for storage. For details, see Figure 3As shown, the integrated file storage system middleware application obtains the configuration item information in the configuration file. If the configuration item information is file.store.media.file = local, the encrypted file is stored in the local storage space; if the configuration item is file.store.media.file = fdfs, the encrypted file is stored through the FDFS (Fast Distributed File System, a distributed file system) storage middleware; if the configuration item is file.store.media.file = hdfs, the encrypted file is stored through the HDFS (Hadoop Distributed File System, a distributed file system) storage middleware. In another specific embodiment, the configuration item information for the original file in the current storage request initiated by the user end is obtained, and based on the configuration item information, a target file storage middleware that matches the original file is determined from a plurality of pre-set file storage middlewares, and the target file storage middleware is used as the preset file storage middleware, so that the encrypted file is forwarded to the preset file storage middleware.
[0059] It is understandable that the parameter information includes but is not limited to the storage result information of the encrypted file, the storage address information of the encrypted file, the corresponding original file basic information and the file basic information of the encrypted file. The specific information can be determined according to the actual application situation and is not specifically limited here.
[0060] Step S13: Generate a target identifier for the original file based on the parameter information, save the parameter information and the target identifier to the local database, and then send the target identifier to the user terminal.
[0061] In this embodiment, a target identifier for the original file is generated using the parameter information, and the parameter information and the target identifier are bound and saved to the local database so that the parameter information can be obtained through the target identifier. The target identifier is then sent to the user terminal, and the storage status of the original file is fed back to the user terminal. The target identifier is a unique target identifier for the original file. The specific identifier type of the target identifier can be determined based on the actual application scenario. For example, a unique file code for the original file can be generated as the target identifier corresponding to the original file. This is not specifically limited here.
[0062] Furthermore, if the user terminal wishes to delete the encrypted file stored in the preset file storage middleware, the deletion operation of the encrypted file can be completed through a preset deletion instruction. In a specific embodiment, the target identifier for the original file is generated based on the parameter information, and the parameter information and the target identifier are saved to the local database, and then the target identifier is sent to the user terminal. It can also include: obtaining the preset deletion instruction initiated by the user terminal and the corresponding target identifier for the original file; using the target identifier to determine the parameter information of the encrypted file corresponding to the original file from the local database, and performing a deletion operation on the encrypted file corresponding to the parameter information in the preset file storage middleware, and then receiving the status information of the encrypted file returned by the preset file storage middleware after the deletion operation is completed; updating the parameter information in the local database based on the status information, and generating a response information indicating the successful deletion of the current deletion request based on the corresponding updated information, and then sending the response information to the user terminal to complete the preset deletion instruction.
[0063] See also Figure 4 As shown, in a specific embodiment, the integrated file storage system middleware application obtains the file unique ID (Identity) as the target identifier and the preset deletion instruction for the encrypted file sent by a third-party Spring Boot (a development framework) application (user end), and uses the file unique ID through the integrated file storage system middleware application to obtain the parameter information of the encrypted file from the database, and then deletes the encrypted file from the file storage middleware using the parameter information of the encrypted file. The application receives the deletion return status information returned from the file storage middleware, so as to update the data in the database through the deletion return status information, and returns the deletion success status to the third-party Spring Boot application to complete the entire encrypted file deletion operation.
[0064] As can be seen from the above, the embodiment of the present application generates a target identifier for the original file through the parameter information, allowing the user end to use the target identifier of the original file to manage the file data in the file storage middleware. In addition, the present application can select the file storage middleware used to store the file through the configuration file, achieving universality between different file storage middleware. By connecting the user end and the middleware, seamless docking between different systems can be achieved, improving the efficiency of data sharing and business collaboration. In addition, the original file can be encrypted through the hash code and the preset key, which can ensure the security of the original file data.
[0065] See also Figure 5As shown, the embodiment of the present application provides a specific file storage method, including:
[0066] In an embodiment of the present application, the integrated file storage system middleware application can obtain the basic file information corresponding to the original file sent by the third-party Spring Boot application. The basic file information includes but is not limited to the data information, file attribute information and file encryption information of the original file. The original file is forwarded to the corresponding file storage middleware through the integrated file storage system middleware application, and the parameter information returned after the storage system is successfully saved is obtained. The parameter information and the file unique ID generated based on the parameter information are saved in the database through the integrated file storage system middleware application, and the file unique ID is returned to the third-party Spring Boot application to complete the storage process for the original file.
[0067] It should be noted that the integrated file storage system middleware application is developed based on the Spring Boot framework, and the storage operation of the original file is completed according to the current storage request through the integrated file storage system middleware application and the file storage middleware.
[0068] As can be seen from the above, the embodiment of the present application performs storage operations on the original file through an integrated file storage system middleware application developed and designed based on the Spring Boot framework, so that a third-party Spring Boot application can manage the file data in the file storage middleware through the integrated file storage system middleware application and the file unique ID, thereby achieving universality between different file storage middleware, realizing seamless docking between different systems, and improving the efficiency of data sharing and business collaboration.
[0069] See also Figure 6 As shown, the embodiment of the present application discloses a file downloading method, including:
[0070] Step S21: Obtain the current download request initiated by the user terminal and the corresponding target identifier for the original file.
[0071] In this embodiment, the current download request initiated by the user and the corresponding target identifier for the original file are first obtained. The target identifier is generated based on parameter information returned by the preset file storage middleware indicating successful storage of the encrypted file; the encrypted file is the text obtained by encrypting the original file using an encryption key; and the encryption key is a key for the original file generated based on a hash code of the original file and a preset key. The specific implementation process for generating the target identifier, the encrypted file, and the encryption key can be referenced in the corresponding content of the aforementioned embodiments and will not be repeated here.
[0072] Step S22: Determine the hash code corresponding to the original file and parameter information of the encrypted file corresponding to the original file from a local database using the target identifier, and generate a decryption key for the encrypted file based on the hash code and the parameter information.
[0073] In this embodiment, a decryption key for the encrypted file is generated using the hash code corresponding to the original file and the parameter information of the encrypted file corresponding to the original file, which is pre-stored in the local database. The parameter information of the encrypted file corresponding to the original file is parameter information generated by the preset storage middleware based on the encrypted file, indicating that the encrypted file has been successfully stored.
[0074] Specifically, after receiving the current download request and the corresponding target identifier of the original file sent by the user terminal, the hash code corresponding to the original file and the parameter information of the encrypted file corresponding to the original file are obtained from the local database through the target identifier, the parameter information of the encrypted file corresponding to the original file and the hash code are combined to generate a file decryption key corresponding to the original file, and the encrypted file is decrypted using the file decryption key to obtain the original file corresponding to the encrypted file.
[0075] Step S23: download the corresponding encrypted file from the preset file storage middleware according to the parameter information, decrypt the encrypted file using the decryption key to obtain the original file, and then send the original file to the user terminal.
[0076] In this embodiment, the corresponding encrypted file is downloaded from the preset file storage middleware through the parameter information. The decryption key obtained in the above steps is used to decrypt the encrypted file to obtain the original file. It should be noted that if there is sensitive information in the original file, the original file needs to be desensitized, and the desensitized file obtained is sent to the user terminal. Specifically, the sending of the original file to the user terminal may include: determining the target file type of the original file, and determining a target desensitization model that matches the target file type from the preset file desensitization model; if the target file type of the original file is a text type such as txt, doc, excel, etc., then the model constructed based on the attention mechanism in the preset file desensitization model is determined as the target desensitization model corresponding to the original file; if the target file type of the original file is a picture type, then the model constructed based on optical characters in the preset file desensitization model is determined as the target desensitization model corresponding to the original file; using the target desensitization model to desensitize the original file, and sending the corresponding desensitized file to the user terminal. That is, for different file types of the original files, the corresponding desensitization model is selected to desensitize the original files, and the desensitized files are sent to the user end to hide the sensitive information in the original files and ensure the privacy of file data during file transmission.
[0077] See also Figure 7 As shown, in a specific embodiment, after obtaining the original file, the file type of the original file is obtained. If the original file type is a text type, a sensitive information detection model based on Transformer (a deep learning model structure) is called for identification, and the identified sensitive information is replaced with asterisks or other mask characters of a fixed length. The specific form of the mask characters can be determined according to the actual application situation. If the original file type is a picture type, an optical character recognition model is called to realize sensitive information identification, and the picture area corresponding to the identified sensitive information is masked. Among them, the optical character recognition (OCR) model can be specifically determined according to the actual application situation. For example, models such as the PaddleOCR model, the CnOCR model, and the chinese_lite OCR model are selected as the optical character recognition model.
[0078] As can be seen from the above, the embodiment of the present application generates a target identifier for the original file through the parameter information, allowing the user end to use the target identifier of the original file to download the file data in the file storage middleware, thereby improving the efficiency of data sharing and business collaboration. In addition, the original file is encrypted through the hash code and the preset key, which can ensure the security of the original file data. By desensitizing key information during the file download process, the security of the file data of the original file can be guaranteed when it circulates between different user ends.
[0079] See also Figure 8 As shown, in an embodiment of the present application, a file unique ID corresponding to the original file sent by a third-party Spring Boot application is obtained through an integrated file storage system middleware application. The integrated file storage system middleware application uses the file unique ID to obtain parameter information returned by the storage system after successfully saving the original file from a database, and forwards the parameter information to the file storage middleware so that the original file can be downloaded through the file storage middleware. Finally, the original file is forwarded to the third-party Spring Boot application to complete the download process for the original file.
[0080] It should be noted that the integrated file storage system middleware application is developed based on the Spring Boot framework, and the download operation of the original file is completed according to the current storage request through the integrated file storage system middleware application and the file storage middleware.
[0081] As can be seen from the above, the embodiment of the present application downloads the original file through the integrated file storage system middleware application developed and designed based on the Spring Boot framework, so that the third-party Spring Boot application can download the file data in the file storage middleware through the integrated file storage system middleware application and the file unique ID, thereby achieving universality between different file storage middleware, realizing seamless docking between different systems, and improving the efficiency of data sharing and business collaboration.
[0082] See also Figure 9 As shown, the present application provides a file storage device, comprising:
[0083] The file acquisition module 11 is used to obtain the current storage request initiated by the user terminal and the corresponding original file, and save the hash code of the original file to the local database so as to generate an encryption key for the original file based on the hash code and a preset key;
[0084] A file encryption module 12 is configured to encrypt the original file using the encryption key to obtain a corresponding encrypted file, and forward the encrypted file to a preset file storage middleware so that the preset file storage middleware returns parameter information indicating that the encrypted file has been successfully stored;
[0085] The target identifier generating module 13 is configured to generate a target identifier for the original file based on the parameter information, save the parameter information and the target identifier to the local database, and then send the target identifier to the user terminal.
[0086] As can be seen from the above, this application connects the user end and the middleware, and can encrypt the file in combination with the hash code of the original file and save it to the middleware. At the same time, the target identifier for the original file is generated through the parameter information returned by the middleware, allowing the user end to use the target identifier of the original file to manage the file data in the file storage middleware. This achieves universality between different file storage middleware, realizes seamless connection between different systems, and improves the efficiency of data sharing and business collaboration. In addition, the original file is encrypted using the hash code and the preset key, which can ensure the security of the original file data.
[0087] In some specific implementations, the file storage device may further include:
[0088] a file storage middleware determination module, configured to obtain a configuration file for setting a file storage middleware, determine a target file storage middleware that matches the configuration file from among a plurality of pre-set file storage middlewares, and use the target file storage middleware as a preset file storage middleware, so as to forward the encrypted file to the preset file storage middleware;
[0089] The file deletion module is used to delete the encrypted file corresponding to the original file according to the current deletion request.
[0090] In some specific implementations, the file deletion module may specifically include:
[0091] A request obtaining unit, configured to obtain a current deletion request initiated by a user terminal and a corresponding target identifier for the original file;
[0092] a file deleting unit, configured to determine, from a local database, parameter information of an encrypted file corresponding to the original file using the target identifier, and perform a deletion operation on the encrypted file corresponding to the parameter information in the preset file storage middleware, and then receive status information of the encrypted file returned by the preset file storage middleware after the deletion operation is completed;
[0093] The information returning unit is configured to update the parameter information in the local database based on the status information, generate response information indicating successful deletion for the current deletion request based on the corresponding updated information, and then send the response information to the user terminal.
[0094] See also Figure 10 As shown, the present application provides a file downloading device, comprising:
[0095] The download request acquisition module 21 is configured to acquire the current download request initiated by the user terminal and the corresponding target identifier for the original file; wherein the target identifier is an identifier generated based on parameter information returned by the preset file storage middleware indicating successful storage of the encrypted file; the encrypted file is a text obtained by encrypting the original file based on an encryption key; the encryption key is a key for the original file generated based on a hash code of the original file and a preset key;
[0096] a decryption key generation module 22 configured to determine, from a local database, a hash code corresponding to the original file and parameter information of an encrypted file corresponding to the original file using the target identifier, and to generate a decryption key for the encrypted file based on the hash code and the parameter information; the decryption key corresponding to the encryption key being used to decrypt a file encrypted using the encryption key;
[0097] The file decryption module 23 is used to download the corresponding encrypted file from the preset file storage middleware according to the parameter information, decrypt the encrypted file using the decryption key to obtain the original file, and then send the original file to the user terminal.
[0098] As can be seen from the above, in this application, the user terminal can use the target identifier of the original file to download the file data in the file storage middleware. Combined with the hash code of the original file stored in the database, the encrypted file can be decrypted and the corresponding original file can be obtained safely. This application can improve the efficiency of data sharing and business collaboration as well as the security of data.
[0099] In some specific implementations, the file decryption module 23 may specifically include:
[0100] A file desensitization submodule is used to determine the target file type of the original file and determine a target desensitization model that matches the target file type from a preset file desensitization model;
[0101] The file sending submodule is used to perform a desensitization operation on the original file using the target desensitization model, and send the corresponding desensitized file to the user end.
[0102] In some specific implementations, the file desensitization submodule may specifically include:
[0103] A text file desensitization unit, configured to, if the target file type of the original file is a text type, determine the model constructed based on the attention mechanism in the preset file desensitization model as the target desensitization model corresponding to the original file;
[0104] The picture file desensitization unit is used to determine the model constructed based on optical characters in the preset file desensitization model as the target desensitization model corresponding to the original file if the target file type of the original file is a picture type.
[0105] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 11 This is a structural diagram of an electronic device 30 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of use of this application. The electronic device 30 may specifically include: at least one processor 31, at least one memory 32, a power supply 33, a communication interface 34, an input / output interface 35, and a communication bus 36. The memory 32 is used to store a computer program, which is loaded and executed by the processor 31 to implement the relevant steps of the file storage method disclosed in any of the aforementioned embodiments. In addition, the electronic device 30 in this embodiment may specifically be an electronic computer.
[0106] In this embodiment, the power supply 33 is used to provide operating voltage for each hardware device on the electronic device 30; the communication interface 34 can create a data transmission channel between the electronic device 30 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 35 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0107] In addition, the memory 32, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 321, a computer program 322, etc., and the storage method can be temporary storage or permanent storage.
[0108] The operating system 321 is used to manage and control the hardware devices on the electronic device 30 and the computer program 322, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to implement the file storage method performed by the electronic device 30 disclosed in any of the aforementioned embodiments, the computer program 322 can further include a computer program that can be used to perform other specific tasks.
[0109] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the file storage method disclosed above is implemented. For the specific steps of this method, reference can be made to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0110] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0111] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0112] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0113] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0114] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A file storage method, characterized in that: include: Obtaining a current storage request initiated by a user and a corresponding original file, and saving a hash code of the original file to a local database so as to generate an encryption key for the original file based on the hash code and a preset key; Encrypting the original file using the encryption key to obtain a corresponding encrypted file, and forwarding the encrypted file to a preset file storage middleware so that the preset file storage middleware returns parameter information indicating that the encrypted file has been successfully stored; A target identifier for the original file is generated based on the parameter information, the parameter information and the target identifier are saved in the local database, and then the target identifier is sent to the user terminal.
2. The file storage method according to claim 1, wherein: Before forwarding the encrypted file to the preset file storage middleware, the method further includes: A configuration file for setting a file storage middleware is obtained, and a target file storage middleware matching the configuration file is determined from a plurality of pre-set file storage middlewares, and the target file storage middleware is used as the preset file storage middleware so as to forward the encrypted file to the preset file storage middleware.
3. The file storage method according to claim 1 or 2, characterized in that: After generating a target identifier for the original file based on the parameter information, saving the parameter information and the target identifier to the local database, and then sending the target identifier to the user terminal, the method further includes: Obtaining a current deletion request initiated by the user and a corresponding target identifier for the original file; Determining parameter information of an encrypted file corresponding to the original file from a local database using the target identifier, performing a deletion operation on the encrypted file corresponding to the parameter information in the preset file storage middleware, and then receiving status information of the encrypted file returned by the preset file storage middleware after the deletion operation is completed; The parameter information in the local database is updated based on the status information, and response information indicating successful deletion for the current deletion request is generated based on the corresponding updated information, and then the response information is sent to the user terminal.
4. A file downloading method, characterized in that: include: Obtaining a current download request initiated by a user terminal and a corresponding target identifier for the original file; wherein the target identifier is an identifier generated based on parameter information returned by a preset file storage middleware indicating successful storage of the encrypted file; the encrypted file is a text obtained by encrypting the original file based on an encryption key; the encryption key is a key for the original file generated based on a hash code of the original file and a preset key; Determining, from a local database, a hash code corresponding to the original file and parameter information of an encrypted file corresponding to the original file using the target identifier, and generating a decryption key for the encrypted file based on the hash code and the parameter information; the decryption key corresponds to the encryption key and is used to decrypt the file encrypted using the encryption key; The corresponding encrypted file is downloaded from the preset file storage middleware according to the parameter information, and the encrypted file is decrypted using the decryption key to obtain the original file, and then the original file is sent to the user terminal.
5. The file downloading method according to claim 4, characterized in that: The sending of the original file to the user terminal may include: Determine the target file type of the original file, and determine a target desensitization model that matches the target file type from a preset file desensitization model; The target desensitization model is used to perform a desensitization operation on the original file, and the corresponding desensitized file is sent to the user end.
6. The file downloading method according to claim 5, characterized in that: The determining the target file type of the original file and determining a target desensitization model that matches the target file type from a preset file desensitization model includes: If the target file type of the original file is a text type, the model constructed based on the attention mechanism in the preset file desensitization model is determined as the target desensitization model corresponding to the original file; If the target file type of the original file is a picture type, the model constructed based on optical characters in the preset file desensitization model is determined as the target desensitization model corresponding to the original file.
7. A file storage device, characterized in that: include: A file acquisition module is configured to acquire the current storage request initiated by the user terminal and the corresponding original file, and save the hash code of the original file to a local database so as to generate an encryption key for the original file based on the hash code and a preset key; a file encryption module configured to encrypt the original file using the encryption key to obtain a corresponding encrypted file, and forward the encrypted file to a preset file storage middleware so that the preset file storage middleware returns parameter information indicating that the encrypted file has been successfully stored; The target identifier generating module is used to generate a target identifier for the original file based on the parameter information, save the parameter information and the target identifier to the local database, and then send the target identifier to the user terminal.
8. A file downloading device, characterized in that: include: A download request acquisition module is configured to acquire the current download request initiated by the user terminal and the corresponding target identifier for the original file; wherein the target identifier is an identifier generated based on parameter information returned by the preset file storage middleware indicating successful storage of the encrypted file; the encrypted file is a text obtained by encrypting the original file based on an encryption key; the encryption key is a key for the original file generated based on a hash code of the original file and a preset key; a decryption key generation module, configured to use the target identifier to determine from a local database a hash code corresponding to the original file and parameter information of an encrypted file corresponding to the original file, and to generate a decryption key for the encrypted file based on the hash code and the parameter information; the decryption key corresponds to the encryption key and is used to decrypt a file encrypted using the encryption key; The file decryption module is used to download the corresponding encrypted file from the preset file storage middleware according to the parameter information, decrypt the encrypted file using the decryption key to obtain the original file, and then send the original file to the user terminal.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that Used to store a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Request processing method and device, computer equipment and storage medium
CN114547028A
Encryption communication system and method, storage medium and electronic equipment
CN118233157A