CN116455892A - File transmission method, file transmission device and terminal equipment - Google Patents

File transmission method, file transmission device and terminal equipment Download PDF

Info

Publication number
CN116455892A
CN116455892A CN202310426188.5A CN202310426188A CN116455892A CN 116455892 A CN116455892 A CN 116455892A CN 202310426188 A CN202310426188 A CN 202310426188A CN 116455892 A CN116455892 A CN 116455892A
Authority
CN
China
Prior art keywords
file
encrypted
key
target
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310426188.5A
Other languages
Chinese (zh)
Other versions
CN116455892B (en
Inventor
唐荻
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huizhou Leyitong Technology Co Ltd
Original Assignee
Huizhou Leyitong Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huizhou Leyitong Technology Co Ltd filed Critical Huizhou Leyitong Technology Co Ltd
Priority to CN202310426188.5A priority Critical patent/CN116455892B/en
Publication of CN116455892A publication Critical patent/CN116455892A/en
Application granted granted Critical
Publication of CN116455892B publication Critical patent/CN116455892B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0442Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply asymmetric encryption, i.e. different keys for encryption and decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3066Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving algebraic varieties, e.g. elliptic or hyper-elliptic curves

Abstract

The application is applicable to the technical field of data transmission, and provides a file transmission method, a file transmission device and terminal equipment, wherein the method comprises the following steps: encrypting the original file by using a symmetric encryption algorithm according to a first key and an offset to obtain an encrypted original file, wherein the first key and the offset consist of numbers and/or letters generated by a random function; cross-merging the first key and the offset to obtain a merged file; encrypting the combined file by using an elliptic curve encryption algorithm to obtain an encrypted combined file and a second secret key; inserting the encrypted combined file and the second key into the encrypted original file to obtain a target file; and transmitting the target file. According to the technical scheme, the original file is encrypted by using the symmetric encryption algorithm, then the key and the offset of the encrypted original file are encrypted by using the elliptic curve encryption algorithm, the target file is obtained for transmission in a double encryption mode, and the security of file transmission is improved.

Description

File transmission method, file transmission device and terminal equipment
Technical Field
The application belongs to the technical field of data transmission, and particularly relates to a file transmission method, a file transmission device and terminal equipment.
Background
At present, in the file transmission process, the file to be transmitted is not effectively encrypted, so that the file to be transmitted is easy to intercept, source code leakage is caused, and the security of file transmission is low.
Therefore, how to improve the security of file transfer is a urgent issue to be resolved.
Disclosure of Invention
The embodiment of the application provides a file transmission method, a file transmission device and terminal equipment, and the safety of file transmission is improved.
In a first aspect, an embodiment of the present application provides a file transmission method, where the method includes: encrypting an original file by using a symmetric encryption algorithm according to a first key and an offset to obtain an encrypted original file, wherein the first key and the offset consist of numbers and/or letters generated by a random function; cross-merging the first key and the offset to obtain a merged file; encrypting the combined file by using an elliptic curve encryption algorithm to obtain an encrypted combined file and a second secret key; inserting the encrypted combined file and the second key into the encrypted original file to obtain a target file; and transmitting the target file.
In one possible implementation, the method further includes: performing cyclic redundancy check on the original file to obtain a first check result; performing cyclic redundancy check on the target file to obtain a second check result; and transmitting the first check result and the second check result.
In one possible implementation, before the transmitting the target file, the method further includes: decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key to obtain a target combined file; processing the target merging file to obtain a target first key and a target offset; decrypting the encrypted original file by using a symmetric encryption algorithm according to the target first key and the target offset to obtain a target original file; performing cyclic redundancy check on the target original file to obtain a third check result; comparing the first verification result with the third verification result to obtain a first comparison result; accordingly, the transmitting the target file includes: and when the first comparison result is that the first check result is the same as the third check result, transmitting the target file.
In a second aspect, an embodiment of the present application provides a file transmission method, where the method includes: receiving a target file, wherein the target file comprises an encrypted original file, and an encrypted combined file and a second key which are inserted into the encrypted original file; decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key to obtain a combined file; processing the combined file to obtain a first key and an offset; and decrypting the encrypted original file by using a symmetric encryption algorithm according to the first key and the offset to obtain the original file.
In one possible implementation, the method further includes: and receiving a first check result and a second check result, wherein the first check result is obtained by performing cyclic redundancy check on the original file, and the second check result is obtained by performing cyclic redundancy check on the target file.
In one possible implementation, before the decrypting the encrypted combined file using elliptic curve cryptography according to the second key, the method further includes: performing cyclic redundancy check on the target file to obtain a fourth check result; comparing the fourth checking result with the second checking result to obtain a second comparison result; accordingly, the decrypting the encrypted file using elliptic curve cryptography according to the second key includes: and when the second comparison result is that the fourth check result is the same as the second check result, decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key.
In one possible implementation manner, after the decrypting the encrypted original file using a symmetric encryption algorithm according to the first key and the offset, the method further includes: performing cyclic redundancy check on the original file to obtain a fifth check result; and comparing the fifth checking result with the first checking result to obtain a third comparison result, and indicating that the original file is complete when the third comparison result is that the fifth checking result is identical to the first checking result.
In a third aspect, an embodiment of the present application provides a file transmission device, where the device includes: the encryption module is used for encrypting the original file by using a symmetric encryption algorithm according to a first secret key and an offset to obtain an encrypted original file, wherein the first secret key and the offset consist of numbers and/or letters generated by a random function; the processing module is used for carrying out cross combination on the first secret key and the offset to obtain a combined file; the encryption module is further used for encrypting the combined file by using an elliptic curve encryption algorithm to obtain an encrypted combined file and a second secret key; the processing module is further configured to insert the encrypted combined file and the second key into the encrypted original file to obtain a target file; and the transmission module is used for transmitting the target file.
In a fourth aspect, an embodiment of the present application provides a file transmission device, where the device includes: the receiving module is used for receiving a target file, wherein the target file comprises an encrypted original file, and an encrypted combined file and a second key which are inserted into the encrypted original file; the decryption module is used for decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key to obtain a combined file; the processing module is used for processing the combined file to obtain a first key and an offset; and the decryption module is further used for decrypting the encrypted original file by using a symmetric encryption algorithm according to the first key and the offset to obtain the original file.
In a fifth aspect, embodiments of the present application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the method according to the first aspect or the second aspect or any implementation manner of the first aspect or the second aspect when executing the computer program.
In a sixth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program which, when executed by a processor, implements a method according to the first aspect or the second aspect or any implementation manner of the first aspect or the second aspect.
In a seventh aspect, embodiments of the present application provide a computer program product, which when run on a terminal device, causes the terminal device to perform the method of the first aspect or the second aspect or any implementation manner of the first aspect or the second aspect.
Compared with the prior art, the embodiment of the application has the beneficial effects that:
1. according to the first secret key and the offset, the symmetric encryption algorithm is used for encrypting the original file, so that the leakage of the source code of the original file is effectively avoided; and the first secret key used for encrypting the original file and the offset are combined in a crossing way to obtain a combined file, the combined file is encrypted by using an elliptic curve encryption algorithm, and the target file is obtained by using a double encryption mode for transmission, so that the security of file transmission is improved.
2. The secret keys used for encrypting the original file and the combined file are directly inserted into the encrypted original file, so that the risk of file errors in the transmission process is reduced, the encrypted file is safer, and the safety of file transmission is further improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following description will briefly introduce the drawings that are needed in the embodiments or the description of the prior art, it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an application scenario provided in an embodiment of the present application;
FIG. 2 is a flowchart of a file transfer method according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating another method for file transfer according to an embodiment of the present disclosure;
FIG. 4 is a block diagram illustrating a file transfer device according to an embodiment of the present disclosure;
FIG. 5 is a block diagram illustrating another file transfer device according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
In addition, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
For easy understanding, the technical solutions of the present application will be described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of an application scenario provided in an embodiment of the present application. As shown in fig. 1, the file transfer system 100 includes a server 110 and an energy storage device 120, the server 110 being communicatively coupled to the energy storage device 120.
With the rapid development of the energy storage industry, the functional complexity of energy storage devices is increasing. In the development process, relevant settings need to be made on the software of the energy storage device according to market requirements and the like. After the energy storage device enters the market, the software of the energy storage device needs to be updated and upgraded according to changes of market requirements, problems found in use, customer feedback and the like. The scenario shown in fig. 1 is that the server 110 transmits an upgrade file required for the energy storage device 120 to perform software upgrade, where the energy storage device 120 performs software upgrade through the received upgrade file from the server 110, and the upgrade file is specifically a binary file required for the energy storage device 120 to perform software upgrade, for example, the upgrade file is a bin file.
In one possible implementation, the server 110 encrypts an original upgrade file required for performing a software upgrade on the energy storage device 120 using a symmetric encryption algorithm according to a first key and an offset, where the first key and the offset are composed of numbers and/or letters generated by a random function, to obtain an encrypted upgrade file; cross-merging the first key and the offset to obtain a merged file; encrypting the combined file by using an elliptic curve encryption algorithm to obtain an encrypted combined file and a second secret key; inserting the encrypted combined file and the second key into the encrypted upgrade file to obtain a target file; the target file is sent to the energy storage device 120.
In one possible implementation, the server 110 performs cyclic redundancy check on the original upgrade file to obtain a first check result; performing cyclic redundancy check on the encrypted target file to obtain a second check result; and transmits the first and second verification results to the energy storage device 120.
In one possible implementation, before sending the target file to the energy storage device 120, the server 110 decrypts the encrypted combined file using an elliptic curve cryptography algorithm according to the second key to obtain the target combined file; processing the target merging file to obtain a target first key and a target offset; decrypting the encrypted upgrade file by using a symmetric encryption algorithm according to the target first key and the target offset to obtain a target upgrade file; performing cyclic redundancy check on the target upgrade file to obtain a third check result; and comparing the first check result with the third check result to obtain a first comparison result, wherein the first comparison result is used for judging whether the encryption and decryption of the original upgrade file are correct or not.
As one example, the first comparison result includes the first check result being the same as the third check result, and the first check result being different from the third check result. When the first comparison result is that the first check result is the same as the third check result, the server 110 sends the encrypted target file to the energy storage device 120.
In one possible implementation, the energy storage device 120 receives a target file from the server 110, the target file including an encrypted upgrade file, and an encrypted combined file and a second key inserted into the encrypted upgrade file; decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key to obtain the combined file; processing the combined file to obtain a first key and an offset; and decrypting the encrypted upgrade file by using a symmetric encryption algorithm according to the first key and the offset to obtain an original upgrade file, and performing software upgrade according to the original upgrade file obtained by decryption.
In one possible implementation, the energy storage device 120 further receives a first check result and a second check result from the server 110, where the first check result is a result obtained by performing cyclic redundancy check on the original upgrade file by the server 110, and the second check result is a result obtained by performing cyclic redundancy check on the encrypted target file by the server 110.
As an example, before decrypting the encrypted combined file using the elliptic curve cryptography algorithm according to the second key, the energy storage device 120 performs a cyclic redundancy check on the received target file to obtain a fourth check result; and comparing the fourth checking result with the second checking result to obtain a second comparison result, wherein the second comparison result is used for judging the integrity of the received target file.
Illustratively, the second comparison result includes that the fourth check result is the same as the second check result, and the fourth check result is different from the second check result, and when the second comparison result is that the fourth check result is the same as the second check result, the energy storage device 120 decrypts the encrypted combined file using the elliptic curve cryptography algorithm according to the second key.
As another example, before performing a software upgrade according to the original upgrade file, the energy storage device 120 performs cyclic redundancy check on the decrypted original upgrade file to obtain a fifth check result; and comparing the fifth checking result with the first checking result to obtain a third comparison result, wherein the third comparison result is used for judging the integrity of the original upgrade file.
Illustratively, the third comparison result includes a fifth check result being the same as the first check result, and the fifth check result being different from the first check result; when the third comparison result is that the fifth verification result is the same as the first verification result, the energy storage device 120 performs software upgrade according to the original upgrade file.
It will be appreciated that the scenario shown in fig. 1 is only an example, and the technical solution of the present application may also be applied to other scenarios, as long as the scenario involves file transfer.
Fig. 2 is a flowchart of a file transmission method according to an embodiment of the present application. As shown in fig. 2, the method includes at least S201 to S205.
S201, encrypting an original file by using a symmetric encryption algorithm according to a first key and an offset to obtain an encrypted original file, wherein the first key and the offset consist of numbers and/or letters generated by a random function.
In one possible implementation, the first key and offset are first generated according to a random function, the first key and offset are composed of numbers and/or letters, and then the original file is encrypted using a symmetric encryption algorithm according to the randomly generated first key and offset.
As an example, the original file is encrypted using an advanced encryption standard (advanced encryption standard, AES) -cipher block chaining (cipher block chaining, CBC) mode in a symmetric encryption algorithm based on the first key and the offset.
Illustratively, the first key generated by the random function is "0123456789ABCDEF" and the offset is "abcdefghijknmlop".
For example, when encrypting an original file using AES-CBC, a first key is used to convert plaintext and ciphertext, and 128 bits (bits) are used as a group, and 128 bits= =16 bytes (bytes), that is, 16 bytes of plaintext are used as a group of ciphertext corresponding to 16 bytes after encryption. If the last remaining plaintext is less than 16 bytes, padding is required, for example, the padding may be performed using public key encryption standard 7 (public-key cryptography standards, PKCS 7). If the last 3 bytes are missing, 0x03 of the 3 bytes is filled; if the last 10 bytes are missing, 0x0a of the 10 bytes is filled; if the plaintext is exactly an integer multiple of 16 bytes, a 16 byte 0x10 group is added and then encrypted. And performing exclusive OR on the first group of data and the data block of the offset, encrypting the first group of data by using a first key, reassigning the ciphertext encrypted by the first group of data to the offset, performing second group encryption, and performing circulation until the end to obtain the encrypted original file.
S202, the first secret key and the offset are combined in a crossing mode, and a combined file is obtained.
In one possible implementation, the digits and/or letters in the first key are sequentially cross-combined with the digits and/or letters in the offset in order to obtain the combined file.
As an example, the first key is "0123456789ABCDEF", the offset is "abcdefghijknmlop", and the obtained combined file is "0a1b2c3d4e5f6g7h8i9jAkBnCmDlEoFp" after cross-combining the first key with the offset.
S203, encrypting the combined file by using an elliptic curve encryption algorithm to obtain an encrypted combined file and a second key.
In one possible implementation, after the first key and the offset are processed to obtain the combined file, the combined file is encrypted by adopting an existing method for encrypting the file by using an elliptic curve encryption algorithm, so as to obtain an encrypted combined file and a second key.
As an example, an elliptic curve Ep (a, b) is first selected, p is the number of elements in the elliptic curve, and a point on the elliptic curve is randomly selected as a base point G when encrypting a combined file. A K is randomly generated and k=kg is generated, k1=p-K is calculated. The combined file is encoded to a point M on Ep (a, b) and a random integer r is generated (r < n, n is the order of the base point G on the elliptic curve Ep (a, b)). Calculating a point c1=m+rk; c2 =rg, resulting in an encrypted combined file and a second key, wherein the second key is k1, C2.
S204, inserting the encrypted combined file and the second key into the encrypted original file to obtain the target file.
In one possible implementation, the encrypted combined file and the second key are inserted into the header of the encrypted original file to obtain the target file.
S205, transmitting the target file.
In one possible implementation manner, before transmitting the target file, performing cyclic redundancy check on the original file to obtain a first check result; performing cyclic redundancy check on the target file to obtain a second check result; and transmitting the first check result and the second check result together with the target file.
As an example, the first check result is a first cyclic redundancy check (cyclic redundancy check, CRC) code and the second check result is a second CRC code.
As an example, the first verification result is displayed with the file name of the encrypted original file.
As an example, the first and second check results are transmitted in the form of a response header.
In one possible implementation manner, after performing cyclic redundancy check on the original file to obtain a first check result and before transmitting the target file, a decryption operation is performed on the generated encrypted original file to determine whether encryption and decryption on the original file are correct.
As an example, according to the second key, decrypting the encrypted combined file using an elliptic curve cryptography algorithm to obtain a target combined file; processing the target merging file to obtain a target first key and a target offset; decrypting the encrypted original file according to the target first key and the target offset to obtain a target original file; performing cyclic redundancy check on the target original file to obtain a third check result; and comparing the first verification result with the third verification result to obtain a first comparison result, wherein the first comparison result is used for judging whether the encryption and decryption of the original file are correct or not.
Illustratively, the third check result is a third CRC code.
Illustratively, the first comparison result includes the first check result being the same as the third check result, and the first check result being different from the third check result; when the first comparison result is the first check result and the third check result are the same, the encryption and decryption operation of the original file is correct, and the target file, the first check result and the second check result are transmitted; when the first comparison result is that the first check result is different from the third check result, the encryption and decryption operation of the original file is wrong, and then the encryption operation is performed on the original file again.
In the technical scheme provided by the embodiment, the original file is encrypted by using a symmetric encryption algorithm according to the first key and the offset, so that the leakage of the source code of the original file is effectively avoided; the first secret key used for encrypting the original file and the offset are combined in a crossing way to obtain a combined file, the combined file is encrypted by using an elliptic curve encryption algorithm, and the target file is obtained by using a double encryption mode for transmission, so that the safety of file transmission is improved; in addition, the secret keys used for encrypting the original file and the combined file are directly inserted into the encrypted original file, so that the risk of file errors in the transmission process is reduced, the encrypted file is safer, and the safety of file transmission is further improved; and then, the original file is encrypted and then decrypted, and whether the encryption and decryption of the original file are correct or not is judged according to a verification result obtained by performing cyclic redundancy verification on the original file, so that the accuracy of file encryption and transmission is improved.
Fig. 3 is a flowchart of another file transfer method according to an embodiment of the present application. As shown in fig. 3, the method includes at least S301 to S304.
S301, receiving a target file, wherein the target file comprises an encrypted original file, and an encrypted combined file and a second key which are inserted into the encrypted original file.
S302, decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key to obtain the combined file.
In one possible implementation manner, the encrypted combined file and the second key are directly obtained from the received target file, an elliptic curve used when the combined file is encrypted is selected, and the encrypted combined file is decrypted by adopting the existing method for decrypting the file by using an elliptic curve encryption algorithm according to the second key to obtain the combined file.
As an example, an elliptic curve Ep (a, b) used in the encryption is selected, C1-kC2 is calculated from the second keys k1, C2, since k=p-k 1, c1=m+rk, c2=rg, and C1-kc2=m+rk-k (rG) =m+rk-r (kG) =m, and the combined file is obtained by decoding point M.
S303, processing the combined file to obtain a first key and an offset.
In one possible implementation, the combined file is split to obtain the first key and the offset.
As an example, the combined file is "0a1b2c3d4e5f6g7h8i9 jakbnncmdleofp", and the number and letter in the combined file are split to obtain a first key of "01234556789 ABCDEF", and the offset is "abcdefghijknmlop".
S304, decrypting the encrypted original file by using a symmetric encryption algorithm according to the first key and the offset to obtain the original file.
In one possible implementation, the encrypted original file is decrypted using the AES-CBC algorithm in the symmetric encryption algorithm based on the first key and the offset to obtain the original file.
It should be noted that, according to the first key and the offset, the specific implementation step of decrypting the encrypted original file by using the symmetric encryption algorithm may refer to the process of decrypting by using the symmetric encryption algorithm in the prior art, which is not described herein.
In one possible implementation manner, a first check result and a second check result are received, wherein the first check result is a result obtained by performing cyclic redundancy check on an original file, and the second check result is a result obtained by performing cyclic redundancy check on a target file.
As an example, a target file, a first check result and a second check result are received simultaneously, wherein the first check result and the second check result are transmitted in the form of a response header, the header is parsed, the first check result and the second check result are obtained, and the first check result and the second check result are saved.
Illustratively, the first verification result is displayed with the file name of the encrypted original file.
As an example, the first check result is a first CRC code and the second check result is a second CRC code.
In one possible implementation manner, after receiving the second verification result and before decrypting the encrypted combined file by using the elliptic curve cryptography algorithm according to the second key, performing cyclic redundancy verification on the received target file to obtain a fourth verification result; and comparing the fourth checking result with the second checking result to obtain a second comparison result, wherein the second comparison result is used for judging the integrity of the target file.
As an example, the fourth check result is a fourth CRC code.
As one example, the second comparison result includes a fourth check result that is the same as the second check result, and a fourth check result that is different from the second check result; when the second comparison result is that the fourth check result is the same as the second check result, indicating that the received target file is complete, decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key; and when the second comparison result is that the fourth check result is different from the second check result, indicating that the received target file is incomplete, sending a request message to request to send the target file again.
In one possible implementation manner, after receiving the first verification result and after decrypting the encrypted original file by using a symmetric encryption algorithm according to the first key and the offset, obtaining the original file, and then performing cyclic redundancy verification on the decrypted original file to obtain a fifth verification result; and comparing the fifth checking result with the first checking result to obtain a third comparison result, wherein the third comparison result is used for judging the integrity of the original file.
As an example, the fifth check result is a fifth CRC code.
As one example, the third comparison result includes a fifth check result that is the same as the first check result, and the fifth check result is different from the first check result; when the third comparison result is that the fifth check result is the same as the first check result, the original file obtained by decryption is complete; and when the third comparison result is that the fifth check result is different from the first check result, the original file obtained by decryption is incomplete, and then the received target file is decrypted again.
According to the technical scheme provided by the embodiment, after the target file is received, the target file is subjected to cyclic redundancy check, the check result is compared with the received result of the cyclic redundancy check on the target file, if the two check results are the same, decryption processing is carried out according to the target file, the integrity of the target file is ensured, data dislocation or tampering in the transmission process is prevented, and the safety and accuracy of file transmission are improved; and (3) performing cyclic redundancy check on the decrypted original file, comparing a check result with a received result of performing cyclic redundancy check on the original file, and if the two check results are the same, indicating that the decrypted original file is complete, thereby further improving the safety and accuracy of file transmission.
Fig. 4 is a block diagram of a file transfer device according to an embodiment of the present application, and for convenience of explanation, only a portion related to the embodiment of the present application is shown. Referring to fig. 4, the file transmission apparatus 400 may include an encryption module 401, a processing module 402, and a transmission module 403.
In one implementation, the apparatus 400 may be used to implement the method illustrated in fig. 2 described above. For example, the encryption module 401 is used to implement S201 and S203, the processing module 402 is used to implement S202 and S204, and the transmission module 403 is used to implement S205.
In another implementation manner, the apparatus 400 further includes a verification module, where the verification module is configured to perform cyclic redundancy verification on the original file to obtain a first verification result, and further configured to perform cyclic redundancy verification on the target file to obtain a second verification result; the transmission module 403 is configured to transmit the first check result and the second check result.
In yet another implementation manner, the apparatus 400 further includes a decryption module, a verification module, and a comparison module, where the decryption module is configured to decrypt the encrypted combined file using an elliptic curve encryption algorithm according to the second key to obtain a target combined file; the processing module 402 is configured to process the target merge file to obtain a target first key and a target offset; the decryption module is also used for decrypting the encrypted original file by using a symmetric encryption algorithm according to the target first key and the target offset to obtain a target original file; the verification module is used for performing cyclic redundancy verification on the target original file to obtain a third verification result; the comparison module is used for comparing the first check result with the third check result to obtain a first comparison result; the transmission module 403 is configured to transmit the target file when the first comparison result is that the first check result is the same as the third check result.
According to the embodiment, the original file and the key file are encrypted according to the symmetric encryption algorithm and the elliptic curve encryption algorithm, and the encrypted file is transmitted, so that the security of file transmission is improved. In addition, the original file is encrypted and then decrypted, and whether the encryption and decryption of the original file are correct or not is judged according to a verification result obtained by performing cyclic redundancy verification on the original file, so that the accuracy of file encryption and transmission is improved.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein again.
Fig. 5 is a block diagram of another file transfer device according to an embodiment of the present application, and for convenience of explanation, only a portion related to the embodiment of the present application is shown. Referring to fig. 5, the file transfer apparatus 500 may include a receiving module 501, a decrypting module 502, and a processing module 503.
In one implementation, the apparatus 500 may be used to implement the method illustrated in FIG. 3 described above. For example, the receiving module 501 is used to implement S301, the decrypting module 502 is used to implement S302 and S304, and the processing module 503 is used to implement S303.
In another implementation manner, the receiving module 501 is configured to receive a first check result and a second check result, where the first check result is a result obtained by performing cyclic redundancy check on an original file, and the second check result is a result obtained by performing cyclic redundancy check on a target file.
In yet another implementation manner, the apparatus 500 further includes a verification module and a comparison module, where the verification module is configured to perform cyclic redundancy verification on the target file to obtain a fourth verification result; the comparison module is used for comparing the fourth check result with the second check result to obtain a second comparison result; the decryption module 502 is configured to decrypt the encrypted combined file using an elliptic curve cryptography algorithm according to the second key when the second comparison result is that the fourth verification result is the same as the second verification result.
In yet another implementation manner, the apparatus 500 further includes a verification module and a comparison module, where the verification module is configured to perform cyclic redundancy verification on the original file to obtain a fifth verification result; the comparison module is used for comparing the fifth check result with the first check result to obtain a third comparison result, and when the third comparison result is that the fifth check result is identical to the first check result, the original file is complete.
According to the method and the device for verifying the original file, the received target file and the decrypted original file are verified through cyclic redundancy verification, the integrity of the received file and the decrypted file is guaranteed, and the safety and the accuracy of file transmission are improved.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein again.
Fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 6, the terminal device 6 of this embodiment includes: at least one processor 60 (only one shown in fig. 6), a memory 61 and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, the processor 60 implementing the steps in any of the embodiments of the file transfer method described above when executing the computer program 62.
The terminal device 6 may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, etc. The terminal device may include, but is not limited to, a processor 60, a memory 61. It will be appreciated by those skilled in the art that fig. 6 is merely an example of the terminal device 6 and is not meant to be limiting as to the terminal device 6, and may include more or fewer components than shown, or may combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The processor 60 may be a central processing unit (Central Processing Unit, CPU), the processor 60 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 61 may in some embodiments be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 61 may in other embodiments also be an external storage device of the terminal device 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal device 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the terminal device 6. The memory 61 is used for storing an operating system, application programs, boot loader (BootLoader), data, other programs, etc., such as program codes of the computer program. The memory 61 may also be used for temporarily storing data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
The embodiment of the application also provides a network device, which comprises: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, which when executed by the processor performs the steps of any of the various method embodiments described above.
Embodiments of the present application also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements steps that may implement the various method embodiments described above.
Embodiments of the present application provide a computer program product which, when run on a mobile terminal, causes the mobile terminal to perform steps that may be performed in the various method embodiments described above.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (RAM, random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other manners. For example, the apparatus/network device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of 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.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. A method of file transfer, the method comprising:
encrypting an original file by using a symmetric encryption algorithm according to a first key and an offset to obtain an encrypted original file, wherein the first key and the offset consist of numbers and/or letters generated by a random function;
Cross-merging the first key and the offset to obtain a merged file;
encrypting the combined file by using an elliptic curve encryption algorithm to obtain an encrypted combined file and a second secret key;
inserting the encrypted combined file and the second key into the encrypted original file to obtain a target file;
and transmitting the target file.
2. The method according to claim 1, wherein the method further comprises:
performing cyclic redundancy check on the original file to obtain a first check result;
performing cyclic redundancy check on the target file to obtain a second check result;
and transmitting the first check result and the second check result.
3. The method of claim 2, wherein prior to said transmitting said target file, said method further comprises:
decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key to obtain a target combined file;
processing the target merging file to obtain a target first key and a target offset;
decrypting the encrypted original file by using a symmetric encryption algorithm according to the target first key and the target offset to obtain a target original file;
Performing cyclic redundancy check on the target original file to obtain a third check result;
comparing the first verification result with the third verification result to obtain a first comparison result;
accordingly, the transmitting the target file includes:
and when the first comparison result is that the first check result is the same as the third check result, transmitting the target file.
4. A method of file transfer, the method comprising:
receiving a target file, wherein the target file comprises an encrypted original file, and an encrypted combined file and a second key which are inserted into the encrypted original file;
decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key to obtain a combined file;
processing the combined file to obtain a first key and an offset;
and decrypting the encrypted original file by using a symmetric encryption algorithm according to the first key and the offset to obtain the original file.
5. The method according to claim 4, wherein the method further comprises:
and receiving a first check result and a second check result, wherein the first check result is obtained by performing cyclic redundancy check on the original file, and the second check result is obtained by performing cyclic redundancy check on the target file.
6. The method of claim 5, wherein prior to said decrypting the encrypted combined file using elliptic curve cryptography algorithm in accordance with the second key, the method further comprises:
performing cyclic redundancy check on the target file to obtain a fourth check result;
comparing the fourth checking result with the second checking result to obtain a second comparison result;
correspondingly, the decrypting the encrypted combined file according to the second key using an elliptic curve cryptography algorithm includes:
and when the second comparison result is that the fourth check result is the same as the second check result, decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key.
7. The method of claim 5, wherein after decrypting the encrypted original file using a symmetric encryption algorithm based on the first key and the offset, the method further comprises:
performing cyclic redundancy check on the original file to obtain a fifth check result;
and comparing the fifth checking result with the first checking result to obtain a third comparison result, and indicating that the original file is complete when the third comparison result is that the fifth checking result is identical to the first checking result.
8. A document transfer apparatus, the apparatus comprising:
the encryption module is used for encrypting the original file by using a symmetric encryption algorithm according to a first secret key and an offset to obtain an encrypted original file, wherein the first secret key and the offset consist of numbers and/or letters generated by a random function;
the processing module is used for carrying out cross combination on the first secret key and the offset to obtain a combined file;
the encryption module is further used for encrypting the combined file by using an elliptic curve encryption algorithm to obtain an encrypted combined file and a second secret key;
the processing module is further configured to insert the encrypted combined file and the second key into the encrypted original file to obtain a target file;
and the transmission module is used for transmitting the target file.
9. A document transfer apparatus, the apparatus comprising:
the receiving module is used for receiving a target file, wherein the target file comprises an encrypted original file, and an encrypted combined file and a second key which are inserted into the encrypted original file;
the decryption module is used for decrypting the encrypted combined file by using an elliptic curve encryption algorithm according to the second secret key to obtain a combined file;
The processing module is used for processing the combined file to obtain a first key and an offset;
and the decryption module is further used for decrypting the encrypted original file by using a symmetric encryption algorithm according to the first key and the offset to obtain the original file.
10. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any one of claims 1 to 3 or the method according to any one of claims 4 to 7 when executing the computer program.
CN202310426188.5A 2023-04-19 2023-04-19 File transmission method, file transmission device and terminal equipment Active CN116455892B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310426188.5A CN116455892B (en) 2023-04-19 2023-04-19 File transmission method, file transmission device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310426188.5A CN116455892B (en) 2023-04-19 2023-04-19 File transmission method, file transmission device and terminal equipment

Publications (2)

Publication Number Publication Date
CN116455892A true CN116455892A (en) 2023-07-18
CN116455892B CN116455892B (en) 2023-10-27

Family

ID=87129963

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310426188.5A Active CN116455892B (en) 2023-04-19 2023-04-19 File transmission method, file transmission device and terminal equipment

Country Status (1)

Country Link
CN (1) CN116455892B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020124177A1 (en) * 2001-01-17 2002-09-05 Harper Travis Kelly Methods for encrypting and decrypting electronically stored medical records and other digital documents for secure storage, retrieval and sharing of such documents
CN102648471A (en) * 2008-11-24 2012-08-22 塞尔蒂卡姆公司 System and method for hardware based security
US8347398B1 (en) * 2009-09-23 2013-01-01 Savvystuff Property Trust Selected text obfuscation and encryption in a local, network and cloud computing environment
CN103198264A (en) * 2013-03-14 2013-07-10 厦门市美亚柏科信息股份有限公司 Method and device for recovering encrypted file system data
US20150310219A1 (en) * 2014-04-28 2015-10-29 Topia Technology, Inc. Systems and methods for security hardening of data in transit and at rest via segmentation, shuffling and multi-key encryption
CN106656475A (en) * 2017-01-09 2017-05-10 李朋林 Novel symmetric key algorithm for high speed encryption
CN107086915A (en) * 2017-05-25 2017-08-22 山东浪潮商用系统有限公司 A kind of data transmission method, data sending terminal and data receiver
CN110995685A (en) * 2019-11-26 2020-04-10 中国银联股份有限公司 Data encryption and decryption method, device, system and storage medium
CN114826733A (en) * 2022-04-19 2022-07-29 中国工商银行股份有限公司 File transfer method, device, system, apparatus, medium, and program product
CN115495757A (en) * 2022-08-25 2022-12-20 中国建设银行股份有限公司 File processing method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020124177A1 (en) * 2001-01-17 2002-09-05 Harper Travis Kelly Methods for encrypting and decrypting electronically stored medical records and other digital documents for secure storage, retrieval and sharing of such documents
CN102648471A (en) * 2008-11-24 2012-08-22 塞尔蒂卡姆公司 System and method for hardware based security
US8347398B1 (en) * 2009-09-23 2013-01-01 Savvystuff Property Trust Selected text obfuscation and encryption in a local, network and cloud computing environment
CN103198264A (en) * 2013-03-14 2013-07-10 厦门市美亚柏科信息股份有限公司 Method and device for recovering encrypted file system data
US20150310219A1 (en) * 2014-04-28 2015-10-29 Topia Technology, Inc. Systems and methods for security hardening of data in transit and at rest via segmentation, shuffling and multi-key encryption
CN106656475A (en) * 2017-01-09 2017-05-10 李朋林 Novel symmetric key algorithm for high speed encryption
CN107086915A (en) * 2017-05-25 2017-08-22 山东浪潮商用系统有限公司 A kind of data transmission method, data sending terminal and data receiver
CN110995685A (en) * 2019-11-26 2020-04-10 中国银联股份有限公司 Data encryption and decryption method, device, system and storage medium
CN114826733A (en) * 2022-04-19 2022-07-29 中国工商银行股份有限公司 File transfer method, device, system, apparatus, medium, and program product
CN115495757A (en) * 2022-08-25 2022-12-20 中国建设银行股份有限公司 File processing method and device

Also Published As

Publication number Publication date
CN116455892B (en) 2023-10-27

Similar Documents

Publication Publication Date Title
CN110493197B (en) Login processing method and related equipment
EP2852090B1 (en) Data authentication method and apparatus thereof
EP2290872A1 (en) Device for generating a message authentication code for authenticating a message
US20220360441A1 (en) Data encryption and decryption method, device, storage medium and encrypted file
US11914754B2 (en) Cryptographic method for verifying data
CN110598429B (en) Data encryption storage and reading method, terminal equipment and storage medium
CN112491549A (en) Data information encryption verification method, system and computer readable storage medium
CN113114654B (en) Terminal equipment access security authentication method, device and system
CN112346759A (en) Firmware upgrading method and device and computer readable storage medium
CN117640256B (en) Data encryption method, recommendation device and storage medium of wireless network card
CN101980471B (en) Digital signature method, and method, device and system for verifying digital signature
US10862675B2 (en) Method for exchanging messages between security-relevant devices
CN107294704B (en) Password generation method, password execution method and terminal
CN112261002A (en) Data interface docking method and device
CN116455892B (en) File transmission method, file transmission device and terminal equipment
CN107395350B (en) Method and system for generating key and key handle and intelligent key safety equipment
CN108242997B (en) Method and apparatus for secure communication
US10200348B2 (en) Method to detect an OTA (over the air) standard message affected by an error
CN113660725B (en) Positioning anti-cheating method, device and system, computer equipment and storage medium
CN107154920B (en) Encryption method and decryption method for security information and receiving device for receiving security information
CN115344848A (en) Identification obtaining method, device, equipment and computer readable storage medium
CN113158218A (en) Data encryption method and device and data decryption method and device
CN112929871A (en) OTA upgrade package acquisition method, electronic device and storage medium
CN117118586B (en) Block chain-based data transmission method, system, electronic equipment and medium
CN113553125B (en) Method, device and equipment for calling trusted application program and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Leyitong Industrial Park, No. 16 Dongsheng South Road, Chenjiang Street, Zhongkai High tech Zone, Huizhou City, Guangdong Province, 516000

Patentee after: Huizhou Leyitong Technology Co.,Ltd.

Address before: 516000 building a, industrial building, No.53, huitai Industrial Park, Zhongkai high tech Zone, Huizhou City, Guangdong Province

Patentee before: HUIZHOU LEYITONG TECHNOLOGY CO.,LTD.

CP03 Change of name, title or address