File transmission method and device and electronic equipment
By using the asymmetric key encryption symmetrical key in the file transmission, and transmitting it with the encrypted target file, it solves the problem of insufficient security in the file encryption transmission in the file encryption. File encrypted transmission.
Patent Information
- Application Number
- CN202411478888.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the security of file encryption transmission using symmetric encryption is low, and the problem of file transmission security cannot be effectively solved.
Through the request of the file of the target user, determine the asymmetric key in the target client, generate a symmetrical key, and transfer it to the target client with the encrypted target file to ensure the security of the key transmission Essence
It is realized that while ensuring the security of file transmission, it improves the efficiency of files and decryption, and solves the problem of lack of security in file encryption transmission in file encryption.
Smart Images

Figure CN119382957A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security, and in particular to a file transmission method, device and electronic device. Background Art
[0002] With the continuous development of Internet financial products, the scenarios and frequency of users using Internet financial products are gradually increasing. However, in the process of using Internet financial products, network attacks and data leaks frequently occur, which in turn leads to information leakage and even property loss of users. Therefore, the security of file transmission is particularly important.
[0003] In order to ensure the security of file transmission, files are usually encrypted to ensure that even if the files are intercepted during transmission, attackers cannot decrypt the file contents, thereby reducing the risk of data leakage.
[0004] In the related technology, asymmetric encryption is usually used to encrypt and transmit files to ensure the security of file transmission. However, although asymmetric encryption is more secure in key management, its computational complexity is high and the encryption efficiency is low when processing large files.
[0005] Therefore, in order to improve the efficiency of file processing, symmetric encryption can be used to process files. However, the security of using symmetric encryption to process files is low, which in turn affects the security of file transmission.
[0006] With regard to the technical problem of low security in file encryption and transmission using symmetric encryption in related technologies, no effective solution has been proposed so far. Summary of the invention
[0007] The present application provides a file transmission method, device and electronic device to solve the technical problem of low security in file encryption transmission using symmetric encryption in the related art.
[0008] According to one aspect of the present application, a file transfer method is provided. The method includes: receiving a file acquisition request sent by a target user through a target client, and determining a first key in the target client, wherein the first key is an asymmetric key, the file acquisition request is used to request to acquire the target file, and the file acquisition request carries user information of the target user; generating a second key according to the user information, wherein the second key is a symmetric key; encrypting the second key according to the first key to obtain the encrypted second key, and encrypting the target file according to the second key to obtain the encrypted target file; determining a transmission file according to the encrypted second key and the encrypted target file, and sending the transmission file to the target client, wherein the target client decrypts the encrypted second key in the transmission file according to the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by the second key to obtain the target file.
[0009] Optionally, determining the first key in the target client includes: sending a public key acquisition request to the target client and receiving the first public key sent by the target client; obtaining a client identifier of the target client from the file acquisition request, and combining the client identifier and the first public key into the first key.
[0010] Optionally, encrypting the second key according to the first key to obtain the encrypted second key includes: encrypting the second key using the first public key in the first key to obtain an initial key; determining an encryption strategy for encrypting the second key according to the client identifier in the first key, and using the client identifier to encrypt the initial key according to the encryption strategy to obtain an encrypted second key.
[0011] Optionally, generating a second key based on user information includes: determining an encryption algorithm for encrypting a target file based on the user information, and generating an initial symmetric key corresponding to the encryption algorithm; determining an encryption policy corresponding to the target user based on the user information, and using the user information to perform an encryption operation on the initial symmetric key according to the encryption policy to obtain a second key; encrypting the target file indicated by the file retrieval request according to the second key, and obtaining the encrypted target file includes: encrypting the target file according to the encryption algorithm using the initial symmetric key to obtain the encrypted target file.
[0012] Optionally, the first key includes the first public key of the target client. Before determining the transmission file based on the encrypted second key and the encrypted target file, the method also includes: using a preset hash algorithm to generate a target hash value based on the target file; using the second private key to encrypt the target hash value to obtain a digital signature; using the first public key to encrypt the second public key to obtain an encryption key, wherein the second public key corresponds to the second private key; combining the encryption key, the preset hash algorithm and the digital signature with the encrypted target file to obtain an updated target file, and combining the encrypted second key with the encrypted target file to obtain a transmission file.
[0013] Optionally, using a preset hash algorithm to generate a target hash value based on the target file includes: selecting a preset hash algorithm from multiple initial hash algorithms based on the file level of the target file; determining whether the target file meets the calculation requirements of the preset hash algorithm; if the target file does not meet the calculation requirements, filling the target file according to the calculation requirements to obtain an updated target file; using the preset hash algorithm to perform hash calculation on the updated target file to obtain the target hash value.
[0014] Optionally, after receiving a file acquisition request sent by a target user through a target client, the method further includes: acquiring client information of the target client and user information of the target user from the file acquisition request; acquiring transmission conditions of the target file, and judging whether there are abnormalities in the client information and the user information based on the transmission conditions; in the case where there are abnormalities in the client information or the user information, sending a prompt message to the target client, wherein the prompt message indicates that transmission of the target file is prohibited; and in the case where both the client information and the user information are normal, executing the step of determining the first key in the target client.
[0015] According to another aspect of the present application, a file transmission device is provided. The device includes: a first determination unit, which is used to receive a file acquisition request sent by a target user through a target client, and determine a first key in the target client, wherein the first key is an asymmetric key, the file acquisition request is used to request to obtain the target file, and the file acquisition request carries user information of the target user; a first generation unit, which is used to generate a second key according to the user information, wherein the second key is a symmetric key; a first encryption unit, which is used to encrypt the second key according to the first key to obtain the encrypted second key, and encrypt the target file according to the second key to obtain the encrypted target file; a second determination unit, which is used to determine a transmission file according to the encrypted second key and the encrypted target file, and send the transmission file to the target client, wherein the target client decrypts the encrypted second key in the transmission file according to the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by the second key to obtain the target file.
[0016] According to another aspect of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, a file transmission method provided in the aforementioned embodiment of the present application is implemented.
[0017] According to another aspect of the present invention, an electronic device is provided, comprising one or more processors and a memory; the memory stores computer-readable instructions, and the processor is used to execute the computer-readable instructions, wherein when the computer-readable instructions are executed, a file transfer method provided in the aforementioned embodiment is executed.
[0018] In an embodiment of the present application, a file acquisition request sent by a target user through a target client is received, and a first key in the target client is determined, wherein the first key is an asymmetric key, and the file acquisition request is used to request to obtain the target file, and the file acquisition request carries user information of the target user; a second key is generated according to the user information, wherein the second key is a symmetric key; the second key is encrypted according to the first key to obtain an encrypted second key, and the target file is encrypted according to the second key to obtain an encrypted target file; a transmission file is determined based on the encrypted second key and the encrypted target file, and the transmission file is sent to the target client, wherein the target client decrypts the file according to the decryption key corresponding to the first key The encrypted second key in the transmission file is decrypted to obtain the second key, and the target file in the transmission file is decrypted by the second key to obtain the target file. The second key is encrypted by using the first key to ensure the transmission security of the second key. At the same time, the target file is encrypted by using the second key to ensure the encryption efficiency of the file. The encrypted second key and the encrypted target file are transmitted to the target client, thereby ensuring the security of file transmission while ensuring the efficiency of file encryption and decryption, thereby achieving the technical effect of efficient and secure file encryption transmission, and solving the technical problem of low security of file encryption transmission using symmetric encryption in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0020] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a file transmission method is shown;
[0021] Figure 2 is a flowchart of a file transmission method provided according to an embodiment of the present application;
[0022] Figure 3 is a flowchart of an optional file transmission method provided according to an embodiment of the present application;
[0023] Figure 4 is a schematic diagram of a file transmission device provided according to an embodiment of the present application;
[0024] Figure 5 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] It should be noted that the file transfer method, device and electronic device determined in the present disclosure can be used in the field of information security, and can also be used in any field other than the field of information security. The application field of the file transfer method, device and electronic device determined in the present disclosure is not limited.
[0029] It should be noted that the collected information, user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) used in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated. Corresponding operation portals are provided for users to choose to authorize or refuse to use. For example, an interface is set up between this system and relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0030] The embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.
[0031] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0032] Symmetric Algorithm: It is an encryption algorithm, also known as a private key encryption algorithm. In a symmetric encryption algorithm, the same key is used for encryption and decryption. This means that the sender and the receiver must share the same key in order to perform encryption and decryption operations. Symmetric algorithms are usually faster than asymmetric algorithms because they use shorter keys, but they are also more vulnerable to cracking and eavesdropping.
[0033] Asymmetric algorithm: It is a cryptographic algorithm, also known as a public-private key algorithm. In an asymmetric encryption algorithm, different keys are used for encryption and decryption, where the public key is used to encrypt information and the private key is used to decrypt information. The advantage of this algorithm is that it has high security, but the encryption and decryption speed is slow.
[0034] AES algorithm: AES (Advanced Encryption Standard) is a symmetric encryption algorithm used to protect the confidentiality of data. It is a fast, efficient and secure encryption algorithm that is widely used in information security fields, such as network communications, data storage and transmission, etc.
[0035] Example 1
[0036] According to an embodiment of the present application, a method embodiment of file transfer is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0037] The method embodiment provided in Embodiment 1 of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a file transmission method. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0038] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0039] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the file transmission method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned file transmission method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0040] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0041] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0042] Under the above operating environment, this application provides Figure 2 The file transfer method shown. Figure 2 It is a flowchart of a file transmission method provided according to an embodiment of the present application.
[0043] Step S201, receiving a file acquisition request sent by a target user through a target client, and determining a first key in the target client, wherein the first key is an asymmetric key, and the file acquisition request is used to request acquisition of a target file, and the file acquisition request carries user information of the target user.
[0044] It should be noted that the executor of this embodiment can be a server. When a user obtains a file from the server, it is necessary to send a file acquisition request to the server. After parsing the file acquisition request, the server can determine the file that the target user needs to obtain based on the request content carried in the file acquisition request, and then feedback the target file to the target user based on the request content.
[0045] It should be noted that when the target user sends a file acquisition request, the first public key of the target client will be sent to the server, so that the first public key can be used to encrypt the file content or other content, thereby ensuring the security of file transmission. Among them, the key pair consisting of the first public key and the first private key can be generated in the target client through a preset algorithm.
[0046] Specifically, in order to ensure the security of target file transmission, a file acquisition request sent by the target user can be received and parsed to obtain user information of the target user carried in the file acquisition request, and determine a first key, wherein the first key is an asymmetric key, such as the first public key of the target user, and the user information can be used to identify the user's identity information and generate the first key together with the first public key.
[0047] Furthermore, after obtaining the first key, the second key generated in the subsequent process can be encrypted according to the first key, thereby ensuring that during the file transmission process, the attacker cannot obtain the content of the second key, thereby ensuring the security of the transmitted target file.
[0048] Step S202: Generate a second key according to the user information, wherein the second key is a symmetric key.
[0049] It should be noted that the user information of the target user obtained from the file acquisition request can be the target user's identity authentication information such as user name, password, etc., or the target user's device information such as device ID, IP address, etc. There is no limit to the method of generating the second key based on the user information. Different users can generate different second keys, thereby improving the personalization and security of file transfer.
[0050] For example, the user's username can be obtained and used as input to generate a fixed-length hash value or hash value through a hash function or a hash function, and the value is determined as the user's symmetric key, and the encryption algorithm used by the user is determined, and then the symmetric key can be used to perform symmetric encryption operations on the file, for example, using the above key to symmetrically encrypt the target file according to the AES algorithm.
[0051] Step S203, encrypting the second key according to the first key to obtain the encrypted second key, and encrypting the target file according to the second key to obtain the encrypted target file;
[0052] Specifically, after generating the second key, the second key can be used to encrypt the target file indicated by the file acquisition request according to a preset symmetric encryption algorithm to obtain the encrypted target file, thereby ensuring the execution efficiency of the file encryption operation, and further using the first key to encrypt the second key to obtain the encrypted second key, thereby ensuring the transmission security of the second key when the file and the key are subsequently transmitted.
[0053] Step S204, determine the transmission file based on the encrypted second key and the encrypted target file, and send the transmission file to the target client, wherein the target client decrypts the encrypted second key in the transmission file according to the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by the second key to obtain the target file.
[0054] Specifically, after obtaining the encrypted second key and the encrypted target file, further encryption operations can be performed on the encrypted second key and the encrypted target file to obtain a transmission file for transmission, wherein the further encryption operation can be encrypted using the first public key sent by the target client.
[0055] Furthermore, after obtaining the transmission file, the transmission file can be sent to the target client. Since the first key comes from the first public key in the first key pair generated by the target client, the target client will decrypt the transmission file according to the first private key stored in the client to obtain the encrypted second key and the encrypted target file. The target client can decrypt the encrypted second key by the corresponding first private key to obtain the second key, and then decrypt the target file in the transmission file by the second key to obtain the target file, thereby completing the transmission operation of the target file.
[0056] The file transmission method provided by the embodiment of the present application receives a file acquisition request sent by a target user through a target client, and determines a first key in the target client, wherein the first key is an asymmetric key, and the file acquisition request is used to request to obtain the target file, and the file acquisition request carries the user information of the target user; generates a second key according to the user information, wherein the second key is a symmetric key; encrypts the second key according to the first key to obtain the encrypted second key, and encrypts the target file according to the second key to obtain the encrypted target file; determines a transmission file according to the encrypted second key and the encrypted target file, and sends the transmission file to the target client, wherein the target client determines the transmission file according to the encrypted second key corresponding to the first key The decryption key decrypts the encrypted second key in the transmission file to obtain the second key, and decrypts the target file in the transmission file by the second key to obtain the target file. By using the first key to encrypt the second key, the transmission security of the second key is guaranteed. At the same time, the second key is used to encrypt the target file to ensure the encryption efficiency of the file, and the encrypted second key and the encrypted target file are transmitted to the target client, thereby ensuring the security of file transmission while ensuring the efficiency of file encryption and decryption, thereby achieving the technical effect of efficient and secure file encryption transmission, and solving the technical problem of low security of file encryption transmission using symmetric encryption in related technologies.
[0057] Optionally, in the file transfer method provided in an embodiment of the present application, determining the first key in the target client includes: sending a public key acquisition request to the target client, and receiving the first public key sent by the target client; obtaining a client identifier of the target client from the file acquisition request, and combining the client identifier and the first public key into a first key.
[0058] Specifically, since the transmission risk of the symmetric key used to encrypt the target file is relatively high, in order to ensure the security of the key transmission process, a public key acquisition request can be sent to the target client to obtain the first public key of the target client. Since the first public key is generated on the target client, only the target client has the corresponding first private key. After the data is encrypted using the first public key, only the target client can decrypt the encrypted data using the first private key it holds, thereby ensuring the secure transmission of data.
[0059] Furthermore, after obtaining the first public key sent by the target client, the client identifier of the target client can be obtained, and the client identifier and the first public key can be combined into a first key. Then, when the first key is subsequently used to encrypt the second key, the first public key can be used for the first encryption, and further encrypted twice according to the target client, thereby ensuring the secure transmission of the second key.
[0060] It should be noted that, since the target client includes the first private key corresponding to the first public key and the client identifier, after receiving the encrypted second key, the encrypted second key can be decrypted according to the first private key and the client identifier to obtain the second key.
[0061] This embodiment obtains the first public key and the client identifier by sending a public key acquisition request, thereby obtaining the first key that can be used to encrypt the second key, thereby ensuring the security of the second key transmission.
[0062] Optionally, in the file transfer method provided in the embodiment of the present application, the second key is encrypted according to the first key to obtain the encrypted second key, which includes: encrypting the second key using the first public key in the first key to obtain an initial key; determining an encryption strategy for encrypting the second key according to the client identifier in the first key, and using the client identifier to encrypt the initial key according to the encryption strategy to obtain an encrypted second key.
[0063] Specifically, in order to ensure the secure transmission of the second key, the second key can first be asymmetrically encrypted using the first public key in the first key to obtain an initial key. It should be noted that since the first public key is an asymmetrically encrypted key, it has stronger encryption security. Compared with the content of the target file, the content of the second key is much smaller than the content of the target file, the use of the first public key to encrypt the second key is more efficient, and the encryption time will not be longer due to too much content to be encrypted, thereby reducing the encryption efficiency.
[0064] Furthermore, in order to improve the security of the second key, the encryption strategy for the second key can also be determined based on the client identifier, wherein the encryption strategy can be a preset encryption strategy corresponding to the target client, and the initial key is encrypted using the client identifier and the preset encryption strategy, thereby ensuring the security of the second key by performing secondary encryption on the second key.
[0065] It should be noted that when transmitting a file to a target client, a preset encryption strategy can be added to the transmission file. For example, the preset encryption strategy can be: use the client identifier to perform A encryption operation, so that the target client can decrypt the encrypted second key according to the decryption operation corresponding to the preset encryption operation and the specific identification content of the client identifier, thereby obtaining the initial key, and further decrypt the initial key according to the first private key corresponding to the first public key, thereby obtaining the second key.
[0066] This embodiment encrypts the second key by using the first public key and the client identifier, thereby improving the security of the second key during transmission.
[0067] Optionally, in the file transfer method provided in the embodiment of the present application, generating a second key based on user information includes: determining an encryption algorithm for encrypting a target file based on the user information, and generating an initial symmetric key corresponding to the encryption algorithm; determining an encryption policy corresponding to the target user based on the user information, and using the user information to perform an encryption operation on the initial symmetric key according to the encryption policy to obtain a second key; encrypting the target file indicated by the file acquisition request according to the second key, and obtaining the encrypted target file includes: encrypting the target file according to the encryption algorithm using the initial symmetric key to obtain the encrypted target file.
[0068] Specifically, the encryption algorithm can be a symmetric encryption algorithm. When the encryption algorithm for encrypting the target file is determined based on the user information, different user information corresponds to different encryption algorithms. For example, when user A wants to transfer a file to user B, the AES (Advanced Encryption Standard) encryption algorithm can be determined based on user B's information, and then a random symmetric encryption key, that is, the initial symmetric key, is generated using the user information.
[0069] Furthermore, after obtaining the initial symmetric key, the target file can be encrypted using the initial symmetric key according to the encryption algorithm to obtain the encrypted target file. Since the initial symmetric key is a symmetric key and the encryption algorithm is a symmetric encryption algorithm, when the target file is encrypted, the encryption speed is relatively fast and the encryption efficiency is high, thereby ensuring the efficient execution of the encryption process.
[0070] It should be noted that in order to ensure the security of the initial symmetric key during transmission, the initial symmetric key can be encrypted again using user information according to the encryption policy to obtain a second key, thereby improving the security of the initial symmetric key.
[0071] It should be noted that since the target client can obtain the user information of the target user when the target user sends a file acquisition request to the target client, when sending an encrypted file to the target client, the encryption policy can be sent to the target client at the same time, so that the target client can decrypt the second key according to the encryption policy and the user information of the target user, thereby obtaining the initial symmetric key.
[0072] This embodiment generates an initial symmetric key and encrypts the initial symmetric key according to user information, thereby ensuring the secure transmission of the initial symmetric key.
[0073] Optionally, in the file transfer method provided in the embodiment of the present application, the first key includes the first public key of the target client. Before determining the transmission file based on the encrypted second key and the encrypted target file, the method also includes: using a preset hash algorithm to generate a target hash value based on the target file; using the second private key to encrypt the target hash value to obtain a digital signature; using the first public key to encrypt the second public key to obtain an encryption key, wherein the second public key corresponds to the second private key; combining the encryption key, the preset hash algorithm and the digital signature with the encrypted target file to obtain an updated target file, and combining the encrypted second key and the encrypted target file to obtain the transmission file.
[0074] Specifically, in order to ensure that the file has not been tampered with during the transmission process, the digital signature technology generates a hash value for the target file by using a hash algorithm, that is, the target hash value, and encrypts the target hash value using a second private key to obtain a digital signature. As a result, when the target client receives the second public key corresponding to the digital signature and the second private key, it can decrypt the digital signature according to the second public key to obtain the target hash value, and perform the same operation on the target file according to the same preset hash algorithm to obtain the hash value. Then, by comparing whether the hash value obtained by the target client is consistent with the target hash value, it is determined whether the target file has been tampered with, thereby ensuring the security of the target file.
[0075] For example, user A and user B are the server and target user of the file respectively. Before encrypting the file, user A will use a preset hash algorithm to generate a hash value for the target file. The hash value can be a data summary of a fixed length calculated based on the file content, which is used to verify the consistency of the file content. After generating the hash value, user A uses his second private key to encrypt the hash value to form a digital signature. Since the private key can only be held by user A himself, this digital signature is unique and can ensure that the file comes from user A.
[0076] Furthermore, when the server transmits the encrypted file, it also needs to transmit a preset hash algorithm and a second public key, so that after receiving the digital signature, the target client can decrypt the digital signature according to the second public key and use the preset hash algorithm to process the target file, thereby ensuring that the target file has not been tampered with.
[0077] It should be noted that, in order to ensure the security of the second public key, the first public key may be used to encrypt and transmit the second public key, thereby ensuring that the second public key will not be modified.
[0078] This embodiment obtains a digital signature by encrypting a hash value, and determines whether the target file has been tampered with based on the digital signature, thereby ensuring accurate transmission of the target file.
[0079] Optionally, in the file transfer method provided in the embodiment of the present application, using a preset hash algorithm to generate a target hash value based on the target file includes: selecting a preset hash algorithm from multiple initial hash algorithms based on the file level of the target file; determining whether the target file meets the calculation requirements of the preset hash algorithm; if the target file does not meet the calculation requirements, filling the target file according to the calculation requirements to obtain an updated target file; and using the preset hash algorithm to perform hash calculation on the updated target file to obtain the target hash value.
[0080] Specifically, when using a preset hash algorithm to generate a target hash value according to a target file, a preset hash algorithm can be selected from multiple initial hash algorithms according to the level or importance of the target file, so as to generate a hash value of the target file according to the preset hash algorithm.
[0081] Furthermore, before performing hash calculation on the target file through the preset hash algorithm, it is necessary to check whether the target file meets the calculation requirements of the preset hash algorithm, such as whether the format, size or content of the target file meets the preset conditions. If the target file does not meet the calculation requirements, such as the file content size is incorrect or the format is incorrect, it is necessary to fill or modify the target according to the algorithm requirements of the preset hash algorithm, such as adding data, adjusting the file format or modifying erroneous content, etc., to obtain the updated target file, and then perform hash operation on it to obtain the target hash value.
[0082] This embodiment ensures the accuracy of calculating the target hash value by determining a preset hash algorithm and processing the target file according to the calculation requirements of the preset hash algorithm.
[0083] Optionally, in the file transfer method provided in the embodiment of the present application, after receiving a file acquisition request sent by the target user through the target client, the method further includes: obtaining client information of the target client and user information of the target user from the file acquisition request; obtaining the transmission conditions of the target file, and judging whether there are any abnormalities in the client information and the user information based on the transmission conditions; in the case where there are any abnormalities in the client information or the user information, sending a prompt message to the target client, wherein the prompt message indicates that the transmission of the target file is prohibited; and in the case where the client information and the user information are both normal, executing the step of determining the first key in the target client.
[0084] Specifically, the client information in the file acquisition request may be a client identifier, version number, system type, IP address, etc., and the user information of the target user may be the user's username or authentication information, etc. Furthermore, after obtaining the client information and user information, it is necessary to determine whether there are any abnormalities in the client information and user information based on the transmission conditions, that is, to determine whether the client information and user information meet the transmission conditions, wherein the transmission conditions may be a user list, where the users on the list meet the transmission conditions, and a client list, where the clients on the list meet the transmission conditions, etc., thereby determining whether the request can be responded to and the corresponding target file can be fed back based on the judgment result.
[0085] Furthermore, when it is determined that there is an abnormality in the client information or user information, it is necessary to send a message to the target client to prohibit file transmission, thereby informing the target user that he does not have the authority to obtain the target file. Only when the client information and user information are normal will the step of determining the first key in the target client be executed to complete the transmission operation of the target file, thereby ensuring the security of the target file.
[0086] This embodiment improves the security of file transmission by determining abnormal conditions of client information or user information.
[0087] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0088] Example 2
[0089] Figure 3 is a flowchart of an optional file transmission method provided according to an embodiment of the present application, such as Figure 3 As shown, the process includes the following steps:
[0090] Before a file transfer requirement arises, the server sends a public key acquisition request to the client. The client generates a first key pair and sends the first public key in the first key pair to the server. The server stores the first public key of the client.
[0091] When there is a need for file transfer, the client can send a file acquisition request to the server, which includes a client identifier and user information. After receiving the request, the server determines the target file to be acquired based on the file acquisition request, and determines whether there is an abnormality in the client information or user information based on the transmission conditions of the target file. If there is an abnormality, the server will send a message to the client prompting that the file transmission is prohibited; if there is no abnormality, the representation can feedback the file acquisition request. At this time, the server will obtain the client identifier and the first public key of the target client from the file acquisition request as a first key, generate a second key based on the user information, and then use a preset hash algorithm to generate a target hash value based on the target file, and then provide encryption operations in the transmission process based on the first key, the second key and the target hash value.
[0092] Furthermore, when encrypting the target file, the server first encrypts the target file by using the second key to obtain the encrypted target file; then encrypts the second key by using the first key to obtain the encrypted second key; the server generates a second key pair, and encrypts the target hash value by using the second private key therein to obtain a digital signature, and then encrypts the second public key by using the first public key to obtain an encryption key; the encryption key, the preset hash algorithm, the digital signature and the encrypted target file are combined to obtain an updated target file, and then the encrypted second key and the updated target file are combined to obtain a transmission file, and finally the server needs to encrypt the transmission file again in a random manner and send it to the client.
[0093] When the client decrypts a file, it first decrypts the encrypted transmission file using the corresponding decryption method; then the encrypted second key and the encryption key are decrypted using the generated first private key to obtain the second key and the second public key; the second key is used to decrypt the target file, and the hash value of the target file is calculated using the preset hash algorithm obtained by decryption; the second public key is used to decrypt the digital signature to obtain the target hash value, and finally, by comparing the hash value generated by the client with the target hash value sent by the server, it is determined whether the file has been tampered with, thereby ensuring the accuracy of the target file while ensuring the secure transmission of the target file.
[0094] Example 3
[0095] The present application also provides a file transmission device. It should be noted that the file transmission device of the present application can be used to execute the file transmission method provided in the present application. The file transmission device provided in the present application is introduced below.
[0096] According to an embodiment of the present application, a device for implementing the above-mentioned file transmission method is also provided. Figure 4 is a schematic diagram of a file transmission device provided according to an embodiment of the present application, such as Figure 4As shown, the device comprises:
[0097] The first determination unit 41 is used to receive a file acquisition request sent by a target user through a target client, and determine a first key in the target client, wherein the first key is an asymmetric key, and the file acquisition request is used to request to acquire a target file, and the file acquisition request carries user information of the target user.
[0098] The first generating unit 42 is configured to generate a second key according to the user information, wherein the second key is a symmetric key.
[0099] The first encryption unit 43 is used to encrypt the second key according to the first key to obtain the encrypted second key, and to encrypt the target file according to the second key to obtain the encrypted target file.
[0100] The second determination unit 44 is used to determine the transmission file based on the encrypted second key and the encrypted target file, and send the transmission file to the target client, wherein the target client decrypts the encrypted second key in the transmission file according to the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by the second key to obtain the target file.
[0101] The file transmission device provided by the embodiment of the present application receives a file acquisition request sent by a target user through a target client through a first determination unit 41, and determines a first key in the target client, wherein the first key is an asymmetric key, and the file acquisition request is used to request to obtain a target file, and the file acquisition request carries user information of the target user; a first generation unit 42 generates a second key according to the user information, wherein the second key is a symmetric key; a first encryption unit 43 encrypts the second key according to the first key to obtain an encrypted second key, and encrypts the target file according to the second key to obtain an encrypted target file; a second determination unit 44 determines a transmission file according to the encrypted second key and the encrypted target file, and sends the transmission file to the target client, Among them, the target client decrypts the encrypted second key in the transmission file according to the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by the second key to obtain the target file. By encrypting the second key with the first key, the transmission security of the second key is guaranteed. At the same time, the target file is encrypted with the second key to ensure the encryption efficiency of the file, and the encrypted second key and the encrypted target file are transmitted to the target client, thereby ensuring the security of file transmission while ensuring the efficiency of file encryption and decryption, thereby achieving the technical effect of efficient and secure file encryption transmission, and solving the technical problem of low security of file encryption transmission using symmetric encryption in related technologies.
[0102] Optionally, in the file transfer device provided in an embodiment of the present application, the first determination unit 41 includes: a receiving module, used to send a public key acquisition request to the target client, and receive a first public key sent by the target client; a combining module, used to obtain a client identifier of the target client from the file acquisition request, and combine the client identifier and the first public key into a first secret key.
[0103] Optionally, in the file transfer device provided in the embodiment of the present application, the first encryption unit 43 includes: a first encryption module, used to encrypt the second key using the first public key in the first key to obtain an initial key; a second encryption module, used to determine an encryption strategy for encrypting the second key based on the client identifier in the first key, and use the client identifier to encrypt the initial key according to the encryption strategy to obtain an encrypted second key.
[0104] Optionally, in the file transfer device provided in the embodiment of the present application, the first generation unit 42 includes: a generation module, used to determine the encryption algorithm for encrypting the target file according to the user information, and generate an initial symmetric key corresponding to the encryption algorithm; a third encryption module, used to determine the encryption policy corresponding to the target user according to the user information, and use the user information to perform an encryption operation on the initial symmetric key according to the encryption policy to obtain a second key; the first encryption unit 43 includes: a fourth encryption module, used to use the initial symmetric key to encrypt the target file according to the encryption algorithm to obtain an encrypted target file.
[0105] Optionally, in the file transfer device provided in the embodiment of the present application, the first key includes the first public key of the target client. Before determining the transfer file based on the encrypted second key and the encrypted target file, the device also includes: a second generation unit, used to generate a target hash value according to the target file using a preset hash algorithm; a second encryption unit, used to encrypt the target hash value using a second private key to obtain a digital signature; a third encryption unit, used to encrypt the second public key using the first public key to obtain an encryption key, wherein the second public key corresponds to the second private key; a combination unit, used to combine the encryption key, the preset hash algorithm and the digital signature with the encrypted target file to obtain an updated target file, and combine the encrypted second key with the encrypted target file to obtain the transfer file.
[0106] Optionally, in the file transfer device provided in the embodiment of the present application, the second generation unit includes: a selection module, used to select a preset hash algorithm from multiple initial hash algorithms according to the file level of the target file; a judgment module, used to judge whether the target file meets the calculation requirements of the preset hash algorithm; a filling module, used to fill the target file according to the calculation requirements when the target file does not meet the calculation requirements to obtain an updated target file; a calculation module, used to use the preset hash algorithm to perform hash calculation on the updated target file to obtain a target hash value.
[0107] Optionally, in the file transfer device provided in the embodiment of the present application, after receiving a file acquisition request sent by the target user through the target client, the device also includes: an acquisition unit, used to acquire client information of the target client and user information of the target user from the file acquisition request; a judgment unit, used to acquire the transmission condition of the target file, and judge whether there is an abnormality in the client information and the user information based on the transmission condition; a prompt unit, used to send a prompt message to the target client when there is an abnormality in the client information or the user information, wherein the prompt message indicates that the transmission of the target file is prohibited; and an execution unit, used to execute the step of determining the first key in the target client when the client information and the user information are normal.
[0108] It should be noted that the first determination unit 41, the first generation unit 42, the first encryption unit 43, and the second determination unit 44 correspond to steps S201 to S204 in Example 1, and the first determination unit 41, the first generation unit 42, the first encryption unit 43, and the second determination unit 44 are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above-mentioned modules can also be part of the device and can be run in the computer terminal 10 provided in Example 1.
[0109] Example 4
[0110] The embodiment of the present application may provide a computer terminal, which may be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced by a terminal device such as a mobile terminal or an electronic device.
[0111] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of the computer network.
[0112] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the file transfer method: receiving a file acquisition request sent by a target user through a target client, and determining a first key in the target client, wherein the first key is an asymmetric key, and the file acquisition request is used to request to obtain the target file, and the file acquisition request carries user information of the target user; generating a second key according to the user information, wherein the second key is a symmetric key; encrypting the second key according to the first key to obtain an encrypted second key, and encrypting the target file according to the second key to obtain an encrypted target file; determining a transmission file based on the encrypted second key and the encrypted target file, and sending the transmission file to the target client, wherein the target client decrypts the encrypted second key in the transmission file according to the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by the second key to obtain the target file.
[0113] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the file transfer method: sending a public key acquisition request to the target client and receiving a first public key sent by the target client; obtaining the client identifier of the target client from the file acquisition request, and combining the client identifier and the first public key into a first key.
[0114] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the file transfer method: use the first public key in the first key to encrypt the second key to obtain an initial key; determine the encryption strategy for encrypting the second key based on the client identifier in the first key, and use the client identifier to encrypt the initial key according to the encryption strategy to obtain an encrypted second key.
[0115] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the file transfer method: determine the encryption algorithm for encrypting the target file according to the user information, and generate an initial symmetric key corresponding to the encryption algorithm; determine the encryption policy corresponding to the target user according to the user information, and use the user information to perform an encryption operation on the initial symmetric key according to the encryption policy to obtain a second key; encrypt the target file according to the second key to obtain the encrypted target file, including: encrypting the target file according to the encryption algorithm using the initial symmetric key to obtain the encrypted target file.
[0116] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the file transfer method: use a preset hash algorithm to generate a target hash value according to the target file; use a second private key to encrypt the target hash value to obtain a digital signature; use the first public key to encrypt the second public key to obtain an encryption key, wherein the second public key corresponds to the second private key; combine the encryption key, the preset hash algorithm and the digital signature with the encrypted target file to obtain an updated target file, and combine the encrypted second key and the encrypted target file to obtain a transmission file.
[0117] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the file transfer method: select a preset hash algorithm from multiple initial hash algorithms according to the file level of the target file; determine whether the target file meets the calculation requirements of the preset hash algorithm; if the target file does not meet the calculation requirements, fill the target file according to the calculation requirements to obtain an updated target file; use the preset hash algorithm to perform hash calculation on the updated target file to obtain a target hash value.
[0118] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the file transfer method: obtaining the client information of the target client and the user information of the target user from the file acquisition request; obtaining the transmission conditions of the target file, and judging whether there are abnormalities in the client information and the user information according to the transmission conditions; when there are abnormalities in the client information or the user information, sending a prompt message to the target client, wherein the prompt message indicates that the transmission of the target file is prohibited; when the client information and the user information are normal, executing the step of determining the first key in the target client.
[0119] Optionally, Figure 5 is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 5 As shown, the electronic device may include: one or more ( Figure 5 (only one is shown) processor 1002, memory 1004, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0120] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the file transfer method and device in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned file transfer method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0121] The processor can call the information and application programs stored in the memory through the transmission device to execute the above steps in the above file transmission method.
[0122] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 5 The structure of the electronic device is not limited. Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations are shown.
[0123] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0124] Example 5
[0125] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the file transmission method provided in the first embodiment.
[0126] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0127] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: receiving a file acquisition request sent by a target user through a target client, and determining a first key in the target client, wherein the first key is an asymmetric key, and the file acquisition request is used to request acquisition of the target file, and the file acquisition request carries user information of the target user; generating a second key based on the user information, wherein the second key is a symmetric key; encrypting the second key based on the first key to obtain an encrypted second key, and encrypting the target file based on the second key to obtain an encrypted target file; determining a transmission file based on the encrypted second key and the encrypted target file, and sending the transmission file to the target client, wherein the target client decrypts the encrypted second key in the transmission file based on the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by the second key to obtain the target file.
[0128] Optionally, the storage medium is also configured to store program code for executing the following steps: sending a public key acquisition request to the target client and receiving a first public key sent by the target client; obtaining a client identifier of the target client from the file acquisition request, and combining the client identifier and the first public key into a first key.
[0129] Optionally, the storage medium is also configured to store program code for performing the following steps: encrypting the second key using the first public key in the first key to obtain an initial key; determining an encryption strategy for encrypting the second key based on a client identifier in the first key, and encrypting the initial key based on the encryption strategy using the client identifier to obtain an encrypted second key.
[0130] Optionally, the storage medium is also configured to store program code for executing the following steps: determining an encryption algorithm for encrypting a target file based on user information, and generating an initial symmetric key corresponding to the encryption algorithm; determining an encryption policy corresponding to a target user based on user information, and using the user information to perform an encryption operation on the initial symmetric key according to the encryption policy to obtain a second key; encrypting the target file according to the second key to obtain the encrypted target file includes: encrypting the target file according to the encryption algorithm using the initial symmetric key to obtain the encrypted target file.
[0131] Optionally, the storage medium is also configured to store program code for performing the following steps: generating a target hash value based on the target file using a preset hash algorithm; encrypting the target hash value using a second private key to obtain a digital signature; encrypting the second public key using the first public key to obtain an encryption key, wherein the second public key corresponds to the second private key; combining the encryption key, the preset hash algorithm and the digital signature with the encrypted target file to obtain an updated target file, and combining the encrypted second key and the encrypted target file to obtain a transmission file.
[0132] Optionally, the storage medium is also configured to store program code for executing the following steps: selecting a preset hash algorithm from multiple initial hash algorithms based on the file level of the target file; determining whether the target file meets the calculation requirements of the preset hash algorithm; if the target file does not meet the calculation requirements, filling the target file according to the calculation requirements to obtain an updated target file; using the preset hash algorithm to perform hash calculation on the updated target file to obtain a target hash value.
[0133] Optionally, the storage medium is also configured to store program codes for executing the following steps: obtaining the client information of the target client and the user information of the target user from a file acquisition request; obtaining the transmission conditions of the target file, and determining whether there are any abnormalities in the client information and the user information based on the transmission conditions; in the case where there are any abnormalities in the client information or the user information, sending a prompt message to the target client, wherein the prompt message indicates that the transmission of the target file is prohibited; and in the case where the client information and the user information are both normal, executing the step of determining the first key in the target client.
[0134] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program steps of the file transfer method.
[0135] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0136] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0137] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0138] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0139] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0140] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0141] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A file transmission method, characterized in that: include: Receive a file acquisition request sent by a target user through a target client, and determine a first key in the target client, wherein the first key is an asymmetric key, the file acquisition request is used to request to acquire a target file, and the file acquisition request carries user information of the target user; Generate a second key according to the user information, wherein the second key is a symmetric key; Encrypting the second key according to the first key to obtain an encrypted second key, and encrypting the target file according to the second key to obtain an encrypted target file; A transmission file is determined based on the encrypted second key and the encrypted target file, and the transmission file is sent to the target client, wherein the target client decrypts the encrypted second key in the transmission file according to the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by using the second key to obtain the target file.
2. The method according to claim 1, characterized in that Determining the first key in the target client includes: Sending a public key acquisition request to the target client, and receiving a first public key sent by the target client; The client identifier of the target client is obtained from the file acquisition request, and the client identifier and the first public key are combined into the first secret key.
3. The method according to claim 2, characterized in that The second key is encrypted according to the first key to obtain the encrypted second key, comprising: Encrypt the second key using the first public key in the first key to obtain an initial key; An encryption strategy for encrypting the second key is determined according to the client identifier in the first key, and the initial key is encrypted according to the encryption strategy using the client identifier to obtain the encrypted second key.
4. The method according to claim 1, characterized in that: Generating the second key according to the user information includes: determining an encryption algorithm for encrypting the target file according to the user information, and generating an initial symmetric key corresponding to the encryption algorithm; determining an encryption policy corresponding to the target user according to the user information, and performing an encryption operation on the initial symmetric key according to the encryption policy using the user information to obtain the second key; Encrypting the target file according to the second key to obtain the encrypted target file includes: using the initial symmetric key to encrypt the target file according to the encryption algorithm to obtain the encrypted target file.
5. The method according to claim 1, characterized in that The first key includes a first public key of the target client. Before determining the transmission file according to the encrypted second key and the encrypted target file, the method further includes: Generate a target hash value based on the target file using a preset hash algorithm; Encrypt the target hash value using a second private key to obtain a digital signature; Encrypting the second public key using the first public key to obtain an encryption key, wherein the second public key corresponds to the second private key; The encryption key, the preset hash algorithm and the digital signature are combined with the encrypted target file to obtain an updated target file, and the encrypted second key and the encrypted target file are combined to obtain the transmission file.
6. The method according to claim 5, characterized in that Generating a target hash value according to the target file using a preset hash algorithm includes: Selecting the preset hash algorithm from a plurality of initial hash algorithms according to the file level of the target file; Determine whether the target file meets the calculation requirements of the preset hash algorithm; In the case where the target file does not meet the calculation requirement, filling the target file according to the calculation requirement to obtain an updated target file; The preset hash algorithm is used to perform a hash calculation on the updated target file to obtain the target hash value.
7. The method according to claim 1, characterized in that After receiving the file acquisition request sent by the target user through the target client, the method further includes: Acquire the client information of the target client and the user information of the target user from the file acquisition request; Acquire the transmission condition of the target file, and determine whether there is any abnormality in the client information and the user information according to the transmission condition; When there is an abnormality in the client information or the user information, sending a prompt message to the target client, wherein the prompt message indicates that the transmission of the target file is prohibited; When the client information and the user information are both normal, a step of determining a first key in the target client is performed.
8. A file transmission device, characterized in that: include: A first determining unit is used to receive a file acquisition request sent by a target user through a target client, and determine a first key in the target client, wherein the first key is an asymmetric key, the file acquisition request is used to request to acquire a target file, and the file acquisition request carries user information of the target user; A first generating unit, configured to generate a second key according to the user information, wherein the second key is a symmetric key; a first encryption unit, configured to encrypt the second key according to the first key to obtain an encrypted second key, and to encrypt the target file according to the second key to obtain an encrypted target file; A second determination unit is used to determine a transmission file based on the encrypted second key and the encrypted target file, and send the transmission file to the target client, wherein the target client decrypts the encrypted second key in the transmission file according to the decryption key corresponding to the first key to obtain the second key, and decrypts the target file in the transmission file by using the second key to obtain the target file.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is executed, the device where the computer-readable storage medium is located is controlled to execute the file transmission method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A memory storing an executable program; A processor, configured to run the program, wherein the program, when running, executes the file transfer method described in any one of claims 1 to 7.