File storage method and device, equipment and medium
By using hash encoding and preset keys to encrypt files in the government data file storage system and generating target identifiers for management, the problems of middleware universality and insufficient encryption storage are solved, and data sharing efficiency and security are improved.
Patent Information
- Application Number
- CN202411239499.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-05
AI Technical Summary
The existing government data file storage system middleware lacks universality and encrypted storage mechanism, resulting in low data sharing efficiency and insufficient security, making it difficult to meet the business needs of different applications.
By obtaining the storage request from the user, using hash encoding and preset keys to generate encryption keys to encrypt the file, and store the encrypted file in the preset file storage middleware to generate target identifiers for management, so as to realize the Seamless docking and data security.
It improves the efficiency of data sharing and business collaboration, ensures the security of file data, and adapts to the business needs of different applications.
Smart Images

Figure CN119128978A_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] The current government data file storage system faces many challenges and shortcomings. First, most government resource systems rely on specific middleware for data storage. These middleware often lack versatility and are difficult to achieve seamless connection between different systems, which seriously restricts the efficiency of data sharing and business collaboration. Secondly, the 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 of the existing file storage middleware lacks a personalized encryption storage mechanism, which means that once the files are leaked, they are easily cracked, causing immeasurable data loss and privacy infringement.
[0003] As can be seen from the above, how to adapt to the business needs of different applications during file storage 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, device, equipment and medium, which can adapt to the business needs of different applications in the file storage process and ensure the security of file data. The specific scheme 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 is successfully stored;
[0008] A target identifier for the original file is generated based on the parameter information, and 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 a 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] Determine parameter information of the encrypted file corresponding to the original file from a local database using the target identifier, 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;
[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] Obtain the current download request initiated by the user end 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 the hash code of the original file and a preset key;
[0017] 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 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 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 end.
[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 matching 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, used to acquire the current storage request initiated by the user end 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, used 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 is successfully stored;
[0028] The target identifier generation 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, used to acquire the current download request initiated by the user end 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 the hash code of the original file and a preset key;
[0031] a decryption key generation module, 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 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 end.
[0033] In a fifth aspect, the present application provides an electronic device, including:
[0034] Memory, used to store computer programs;
[0035] The processor is used 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] The present application obtains the current storage request initiated by the user end 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 representing the successful storage of the encrypted file; 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 end.
[0038] As can be seen from the above, the present 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, so that the user end can use the target identifier of the original file to manage the file data in the file storage middleware, realizing 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 drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying 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 flow chart of a file downloading method disclosed in this application;
[0046] Figure 7 A schematic diagram of a file desensitization process disclosed in this application;
[0047] Figure 8 A flowchart of a specific file downloading method disclosed in this application;
[0048] Fig. 9 A schematic diagram of a file storage device disclosed in this application;
[0049] Fig.10 A schematic diagram of a file downloading device disclosed in this application;
[0050] Fig.11 This is a structural diagram of an electronic device disclosed in this application. Implementation
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 creative work are within the scope of protection of the present invention.
[0053] At present, 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, 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.
[0054] See also Figure 1 As shown, the embodiment of the present application discloses a file storage method, including:
[0055] Step S11: obtaining the current storage request initiated by the user terminal and the corresponding original file, and saving 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.
[0056] 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 the preset key. The preset key is a key that is set in advance and saved in advance to the local database. The key can be combined with the hash code to encrypt the file. The specific key type can be determined according to the actual application situation and is not specifically limited here.
[0057] See also Figure 2As shown, in a specific implementation, 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 hash code can be used to encrypt the original file or decrypt the encrypted original file. 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. Correspondingly, 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.
[0058] Step S12: 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.
[0059] 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 serves as a bridge between the file management system and the storage system, and is responsible for the actual storage, reading, deletion and other operations of the file. The file storage system middleware integrated 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 implementation, 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 preset 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 implementation, by obtaining the configuration item information for the original file in the current storage request initiated by the user end, and determining the target file storage middleware that matches the original file from a plurality of pre-set file storage middlewares according to the configuration item information, and using the target file storage middleware as the preset file storage middleware, the encrypted file is forwarded to the preset file storage middleware.
[0060] It can be understood 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 basic file information of the encrypted file, which can be determined according to the actual application situation and is not specifically limited here.
[0061] 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.
[0062] In this embodiment, the target identifier for the original file is generated by the parameter information, and the parameter information and the target identifier are bound and saved in the local database so that the parameter information can be obtained through the target identifier. Then the target identifier is sent to the user terminal, and the storage status of the original file is fed back to the user terminal. Among them, the target identifier is a unique target identifier for the original file. The specific identifier type of the target identifier can be determined according to 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, which is not specifically limited here.
[0063] 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 the 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 perform a deletion operation on the encrypted file corresponding to the parameter information in the preset file storage middleware, and then receive the status information of the encrypted file returned by the preset file storage middleware after the deletion operation is completed; based on the status information, the parameter information in the local database is updated, and based on the corresponding updated information, a response information representing the successful deletion of the current deletion request is generated, and then the response information is sent to the user terminal to complete the preset deletion instruction.
[0064] 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 the third-party Spring Boot (a development framework) application (user end), and obtains the parameter information of the encrypted file from the database through the integrated file storage system middleware application using the file unique ID, and then deletes the encrypted file from the file storage middleware through the parameter information of the encrypted file. Receive 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 return the deletion success status to the third-party Spring Boot application to complete the entire encrypted file deletion operation.
[0065] 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, so that the user end can use the target identifier of the original file to manage the file data in the file storage middleware; and the present application can select the file storage middleware used to store the file through the configuration file, thereby achieving the commonality between different file storage middlewares, and connecting the user end and the middleware, so as to achieve seamless connection between different systems and improve the efficiency of data sharing and business collaboration. And the original file can be encrypted through the hash code and the preset key, so as to ensure the security of the original file data.
[0066] See also Figure 5As shown, the embodiment of the present application provides a specific file storage method, including:
[0067] 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.
[0068] 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.
[0069] 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 commonality between different file storage middleware, realizing seamless docking between different systems, and improving the efficiency of data sharing and business collaboration.
[0070] See also Figure 6 As shown, the embodiment of the present application discloses a file downloading method, including:
[0071] Step S21: Obtain the current download request initiated by the user terminal and the corresponding target identifier for the original file.
[0072] In this embodiment, the current download request initiated by the user end and the corresponding target identifier for the original file are first obtained. The target identifier is an identifier generated based on the parameter information returned by the preset file storage middleware indicating the successful storage of the encrypted file; the encrypted file is a text obtained by encrypting the original file based on the encryption key; the encryption key is a key for the original file generated based on the hash code of the original file and the preset key. The specific implementation process of generating the target identifier, the encrypted file and the encryption key can refer to the corresponding content in the aforementioned embodiment, and will not be repeated here.
[0073] 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.
[0074] In this embodiment, the 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 are pre-stored in the local database. The parameter information of the encrypted file corresponding to the original file is the parameter information generated by the preset storage middleware according to the encrypted file, which indicates that the encrypted file is successfully stored.
[0075] Specifically, after receiving the current download request sent by the user terminal and the target identifier of the corresponding original file, 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 by the file decryption key to obtain the original file corresponding to the encrypted file.
[0076] 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.
[0077] In this embodiment, the corresponding encrypted file is downloaded from the preset file storage middleware through the parameter information. And 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 end. Specifically, the sending of the original file to the user end 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., 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; the target desensitization model is used to desensitize the original file, and the corresponding desensitized file is sent to the user end. That is, for different file types of the original files, the corresponding desensitizing model is selected to perform desensitization operations on the original files, and the desensitized files are sent to the user end so as to hide the sensitive information in the original files and ensure the privacy of file data during file transmission.
[0078] See also Figure 7 As shown, in a specific implementation, 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 character can be determined according to the actual application situation. If the original file type is a picture type, the 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 (Optical Character Recognition, OCR) model can be specifically determined according to the actual application situation. For example, models such as PaddleOCR model, CnOCR model and chinese_lite OCR model are selected as the optical character recognition model.
[0079] 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, so that the user terminal can 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. And by encrypting the original file through the hash code and the preset key, the security of the original file data can be guaranteed. By desensitizing key information during the file download process, the security of the file data when the original file circulates between different user terminals can be guaranteed.
[0080] See also Figure 8 As shown, in an embodiment of the present application, the file unique ID corresponding to the original file sent by the third-party Spring Boot application is obtained through the integrated file storage system middleware application. The integrated file storage system middleware application uses the file unique ID to obtain the parameter information returned by the storage system after successfully saving the original file from the 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.
[0081] 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.
[0082] 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 the commonality between different file storage middleware, realizing seamless connection between different systems, and improving the efficiency of data sharing and business collaboration.
[0083] See also Fig. 9 As shown, the present application provides a file storage device, comprising:
[0084] The file acquisition module 11 is used to acquire the current storage request initiated by the user end 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;
[0085] The file encryption module 12 is used to 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 is successfully stored;
[0086] The target identifier generating module 13 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.
[0087] As can be seen from the above, the present 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, so that the user end can use the target identifier of the original file to manage the file data in the file storage middleware, thereby achieving the commonality between different file storage middlewares, achieving seamless connection between different systems, and improving the efficiency of data sharing and business collaboration. And by encrypting the original file through the hash code and the preset key, the security of the original file data can be guaranteed.
[0088] In some specific implementations, the file storage device may further include:
[0089] A file storage middleware determination module, used to obtain a configuration file for setting the file storage middleware, and determine a target file storage middleware that matches the configuration file from 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;
[0090] The file deletion module is used to delete the encrypted file corresponding to the original file according to the current deletion request.
[0091] In some specific implementations, the file deletion module may specifically include:
[0092] A request acquisition unit, used to acquire a current deletion request initiated by a user terminal and a corresponding target identifier for the original file;
[0093] A file deletion unit, configured to determine parameter information of an encrypted file corresponding to the original file from a local database by using the target identifier, and to 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;
[0094] The information returning unit is used to update the parameter information in the local database based on the state 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.
[0095] See also Fig.10 As shown, the present application provides a file downloading device, comprising:
[0096] The download request acquisition module 21 is used to acquire the current download request initiated by the user end and the corresponding target identifier for the original file; wherein the target identifier is an identifier generated based on the parameter information returned by the preset file storage middleware indicating the successful storage of the encrypted file; the encrypted file is a text obtained by encrypting the original file based on the encryption key; the encryption key is a key for the original file generated based on the hash code of the original file and the preset key;
[0097] 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 corresponds to the encryption key and is used to decrypt a file encrypted using the encryption key;
[0098] 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.
[0099] As can be seen from the above, in the present application, the user terminal can use the target identifier of the original file to download the file data in the file storage middleware, and the hash code of the original file stored in the database can be combined to realize the decryption of the encrypted file, and the corresponding original file can be obtained safely; the present application can improve the efficiency of data sharing and business collaboration as well as the security of data.
[0100] In some specific implementations, the file decryption module 23 may specifically include:
[0101] A file desensitization submodule, 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;
[0102] 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.
[0103] In some specific implementations, the file desensitization submodule may specifically include:
[0104] A text file desensitization unit, configured to determine, if the target file type of the original file is a text type, a model constructed based on an attention mechanism in the preset file desensitization model as a target desensitization model corresponding to the original file;
[0105] 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.
[0106] Furthermore, the present application also discloses an electronic device. Fig.11 : This is a structural diagram of an electronic device 30 according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on 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 and output interface 35, and a communication bus 36. Among them, the memory 32 is used to store a computer program, and the computer program is loaded and executed by the processor 31 to implement the relevant steps in the file storage method disclosed in any of the above embodiments. In addition, the electronic device 30 in this embodiment may specifically be an electronic computer.
[0107] In this embodiment, the power supply 33 is used to provide working 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, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present 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, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0108] In addition, the memory 32, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, 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.
[0109] The operating system 321 is used to manage and control the hardware devices and computer programs 322 on the electronic device 30, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete 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 complete other specific tasks.
[0110] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed file storage method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0111] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0112] 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 composition and steps of each example have been generally described in the above description according to function. 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 to be beyond the scope of this application.
[0113] The steps of the method or algorithm 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 a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0114] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0115] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article 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 general technicians in this field, according to the idea of the present application, there will 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 is successfully stored; A target identifier for the original file is generated based on the parameter information, and 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, characterized in that: 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 a 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; Determine parameter information of the encrypted file corresponding to the original file from a local database using the target identifier, 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; 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: Obtain the current download request initiated by the user end 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 the hash code of the original file and a preset key; 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 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 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 end.
5. The file downloading method according to claim 4, characterized in that: The sending 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 step of 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, used to acquire the current storage request initiated by the user end 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, used 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 is successfully stored; The target identifier generation 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, used to acquire the current download request initiated by the user end 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 the hash code of the original file and a preset key; a decryption key generation module, 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 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 end.
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
Middleware storage method and device, electronic equipment and readable storage medium
CN116185291A
Encryption communication system and method, storage medium and electronic equipment
CN118233157A
Enhanced data security through combination of encryption and vertical fragmentation of tabular data
EP4137978A1
System and method for identity management
WO2023144687A1
