Mobile terminal file transmission method based on commercial encryption algorithm

By using commercial cryptographic algorithms (SM2, SM3, SM4) for encryption and decryption during mobile file transfer, and combining it with the integrity check of the HMAC-SM3 algorithm, the problem that mobile communication tools are not protected by commercial cryptographic algorithms is solved and achieved. The security and integrity of file transmission avoids risks in public network transmission.

CN114945170BActive Publication Date: 2024-10-22FUJIAN JINMI NETWORK SECURITY EVALUATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210570719.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-24
Publication Date
2024-10-22
Estimated Expiration
2042-05-24

AI Technical Summary

Technical Problem

Existing mobile communication tools do not use commercial cryptographic algorithms to protect communication content, and the security of third-party transfer servers is uncontrollable. There is a risk of file retention, leakage, and tampering in public network transmission.

Method used

Commercial cryptographic algorithms (SM2, SM3, SM4) are used for file encryption and decryption, and the encrypted transmission of files is realized through server-side transfer. The digital envelope method of public key online distribution and symmetric encryption keys is used, combined with the HMAC-SM3 algorithm for complete Confidentiality check to ensure the confidentiality and integrity of the file transfer process.

Benefits of technology

It realizes confidential communication during the file transmission process to prevent eavesdropping, tampering and forgery. It realizes one-to-many file encrypted transmission through server decryption and re-encryption, and uses the sandbox protection mechanism of the mobile terminal to ensure the security of the private key and avoid Problems with document interception, leakage or illegal tampering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114945170B_ABST
    Figure CN114945170B_ABST
Patent Text Reader

Abstract

The present invention provides a mobile terminal file transmission method based on a commercial cryptographic algorithm, and the method comprises the following steps: step S1, including a mobile terminal A, a mobile terminal B and a server; step S2, based on encryption and decryption by the commercial cryptographic algorithm, calling the common file module of the mobile terminal A and the mobile terminal B to realize real-time parsing and viewing; step S3, using the SM2, SM3, and SM4 algorithms of the commercial cryptographic algorithm to realize online distribution of public keys and distribution of symmetric encryption keys using digital envelopes; step S4, the mobile terminal A and the mobile terminal B register with the server; step S5, the mobile terminal A and the mobile terminal B both generate the SM2 public-private key pair of the commercial cryptographic algorithm by themselves; step S6, the server generates the SM2 public-private key pair of the commercial cryptographic algorithm and stores it in the server; step S7, the mobile terminal A and the mobile terminal B access the user list of existing users on the server; the present invention can realize that the commercial cryptographic algorithm is used to protect the communication and storage processes of the file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a mobile terminal file transmission method based on a commercial cryptographic algorithm. Background Art

[0002] Currently commonly used mobile communication tools, such as WeChat and QQ, do not use commercial cryptographic algorithms to protect communication content. In addition, the security of third-party transit servers is uncontrollable, and the public network transmission environment is complex and changeable, and there is a risk of transmitted files being retained, leaked, and tampered with. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide a mobile file transmission method based on commercial cryptographic algorithms that can be protected during both file communication and storage, and is independently deployed in an autonomous server and a private network.

[0004] The present invention is implemented by the following method: a mobile terminal file transmission method based on a commercial cryptographic algorithm, the method comprising the following steps:

[0005] Step S1, including mobile terminal A, mobile terminal B and server, wherein mobile terminal A and mobile terminal B send and receive files after being transferred by the server;

[0006] Step S2: Based on the encryption and decryption of the commercial cryptographic algorithm, the common file modules of the mobile terminals A and B are called to realize real-time parsing and viewing;

[0007] Step S3: Use the SM2, SM3, and SM4 algorithms of the commercial cryptographic algorithm to implement online distribution of the public key and distribution of the symmetric encryption key using a digital envelope;

[0008] Step S4: Mobile terminal A and mobile terminal B register with the server, fill in and record account information, and identify mobile terminal A and mobile terminal B;

[0009] Step S5: Mobile terminal A and mobile terminal B both generate SM2 public and private key pairs of commercial cryptographic algorithm and save them locally. When the mobile terminal registers an account with the server, the local public key is uploaded to the server and saved corresponding to the account information.

[0010] Step S6: The server generates a SM2 public-private key pair of a commercial cryptographic algorithm and stores it inside the server. The server public key is distributed to mobile terminals A and B after mobile terminals A and B successfully log in.

[0011] Step S7, mobile terminal A and mobile terminal B access the user list of existing users on the server to select the recipient when sending the file, thereby achieving the use of commercial encryption algorithms for protection in the communication and storage processes of the file.

[0012] Furthermore, the upload operation process of the commercial encryption algorithm for encrypting files includes the following steps:

[0013] Step S10: Mobile terminal A and mobile terminal B generate an SM2 key pair of a commercial cryptographic algorithm, and mobile terminal A and mobile terminal B save the SM2 key pair of the commercial cryptographic algorithm to the server, and obtain the SM2 key of the commercial cryptographic algorithm of the server;

[0014] Step S11: Mobile terminal A and mobile terminal B generate an SM4 key of a commercial cryptographic algorithm, and mobile terminal A and mobile terminal B select a file to be encrypted, and encrypt the file to be encrypted using the SM4 key of the commercial cryptographic algorithm;

[0015] Step S12: Use the commercial encryption algorithm SM2 public key of the server to encrypt the SM4 key of the commercial encryption algorithm to form SM4 ciphertext, use the HMAC-SM3 algorithm to perform digest calculation on the file ciphertext, and upload the encryption result to the server;

[0016] Step S13, the server receives the encryption result, decrypts the SM4 key with the SM2 private key of the server, and performs HMAC-SM3 algorithm digest calculation on the file ciphertext;

[0017] Step S14: determine whether the ciphertext digest generated in step S13 is the same as the ciphertext digest in step S12. If yes, the data is valid and saved to the database; if not, the data is invalid and discarded.

[0018] Furthermore, the commercial encryption algorithm for file decryption process includes the following steps:

[0019] Step S20, extracting the SM4 ciphertext and SM4 random offset data corresponding to the ciphertext of the file that the receiver needs to download from the data volume, and decrypting the ciphertext of the SM4 key using the SM2 private key of the server to obtain the SM4 key;

[0020] Step S21, decrypt the file ciphertext using the SM4 key and the SM4 random offset to obtain the file plaintext;

[0021] Step S22: Generate a new SM4 key, use the new SM4 key to encrypt the file to obtain a new file ciphertext, use the recipient's SM2 public key to encrypt the new SM4 key to obtain a new SM4 key ciphertext, use the HMAC-SM3 algorithm to calculate the digest of the new file ciphertext to obtain the new file ciphertext digest, and return the calculation result to mobile terminal A and mobile terminal B;

[0022] Step S23, mobile terminal A and mobile terminal B receive the calculation result, use the mobile terminal SM2 key to decrypt the new SM4 key ciphertext, obtain the new SM4 key, and perform HMAC-SM3 algorithm digest calculation on the new file ciphertext;

[0023] Step S24, determine whether the ciphertext summary generated in step S23 is equal to the ciphertext summary generated in step S22. If yes, the data is valid, and decryption continues. The new SM4 key and the new SM4 random offset are used to decrypt the new file ciphertext to obtain the file plaintext. According to different file types, the corresponding components are used to display the file; otherwise, the data is invalid and the user is prompted.

[0024] The beneficial effects of the present invention are as follows: the present invention uses a commercial cryptographic algorithm to achieve confidential communication; a comprehensive use of encryption and decryption and a method with a key summary is used to achieve anti-eavesdropping, anti-tampering and anti-forgery of the entire process of file transmission in a public network environment; one-to-many file encryption transmission can be achieved through a transit method of server decryption and re-encryption; the sandbox protection mechanism provided by the mobile terminal is used to ensure the security of private key storage; currently commonly used mobile devices all use sandbox technology to isolate resources between APPs, and cooperate with the strict access control strategy of the operating system to protect files and data in the sandbox to prevent malicious APPs from illegally accessing and modifying other normal APPs. Based on this principle, the mobile terminal SM2 private key we generated can be protected by a certain program; it runs on the mobile terminal, is easy to operate, has rich usage scenarios, and can send and receive files confidentially anytime and anywhere; it can be independently deployed on an autonomous server and a dedicated network, avoiding the use of conventional communication software for file transfer, and the problems of file interception, leakage or illegal tampering. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It is a schematic diagram of the method flow of the present invention.

[0026] Figure 2 Flowchart of the upload operation for file encryption using commercial cryptographic algorithms.

[0027] Figure 3 Flowchart for file decryption using commercial encryption algorithms. DETAILED DESCRIPTION

[0028] The present invention will be further described below in conjunction with the accompanying drawings.

[0029] See also Figure 1 As shown, the mobile terminal file transmission method based on the commercial encryption algorithm of the present invention comprises the following steps:

[0030] Step S1, including mobile terminal A, mobile terminal B and server, wherein mobile terminal A and mobile terminal B send and receive files after being transferred by the server;

[0031] Step S2: Based on the encryption and decryption of the commercial cryptographic algorithm, the common file modules of the mobile terminals A and B are called to realize real-time parsing and viewing;

[0032] Step S3: Use the SM2, SM3, and SM4 algorithms of the commercial cryptographic algorithm to implement online distribution of the public key and distribution of the symmetric encryption key using a digital envelope;

[0033] Step S4: Mobile terminal A and mobile terminal B register with the server, fill in and record account information, and identify mobile terminal A and mobile terminal B;

[0034] Step S5: Mobile terminal A and mobile terminal B both generate SM2 public and private key pairs of commercial cryptographic algorithm and save them locally. When the mobile terminal registers an account with the server, the local public key is uploaded to the server and saved corresponding to the account information.

[0035] Step S6: The server generates a SM2 public-private key pair of a commercial cryptographic algorithm and stores it inside the server. The server public key is distributed to mobile terminals A and B after mobile terminals A and B successfully log in.

[0036] Step S7, mobile terminal A and mobile terminal B access the user list of existing users on the server to select the recipient when sending the file, thereby achieving the use of commercial encryption algorithms for protection in the communication and storage processes of the file.

[0037] The present invention will be further described below by a specific embodiment:

[0038] Use commercial encryption algorithms to encrypt and transmit files on mobile devices;

[0039] It consists of mobile terminal A, mobile terminal B, and server. A and B can send and receive files after being transferred through the server.

[0040] All types of files can be transferred, and for the following file types, based on commercial password encryption and decryption, the mobile terminal general file module is called to realize real-time parsing and viewing: at least DOC / DOCX / XLSX / XLSX / PDF / TXT / JPG / JPEG / GIF / PNG / BMP, etc.

[0041] The SM2, SM3, and SM4 algorithms are used in combination, and the public key is distributed online, the symmetric encryption key is distributed using a digital envelope, and HMAC-SM3 is used for integrity verification to ensure the confidentiality and integrity of the file transfer process;

[0042] Specifically, the public-private key mechanism of the SM2 algorithm is used to protect the session key; the symmetric encryption mechanism of the SM4 algorithm is used to encrypt and protect the file content in the session; the HMAC-SM3 algorithm is used to encrypt the key information summary of the file content of the session to protect the integrity of the data.

[0043] The mobile terminal registers with the server, fills in basic information, account number, and password, and the server uses the recorded account information to identify the mobile terminal;

[0044] Mobile terminal A and mobile terminal B both generate SM2 public and private key pairs by themselves and save them locally. When the mobile terminal registers an account with the server, the local public key is uploaded to the server and saved corresponding to the account information;

[0045] The server generates an SM2 public-private key pair and stores it inside the server. Its server public key is distributed to the mobile terminal after the mobile terminal successfully logs in.

[0046] The mobile terminal can access the user list of existing users on the server to select the recipient when sending files;

[0047] See also Figure 2 As shown, the file encryption upload operation process:

[0048] The mobile terminal selects a file and a file recipient -> The mobile terminal generates an SM4 encryption key Key-sm4 and an SM4 random offset Offset -> The file binary stream is encrypted to form a ciphertext M(File) -> The SM4 encryption key M(Key-sm4) is encrypted using the server public key -> The file ciphertext is encrypted using the HMAC-SM3 algorithm to generate an HMAC(M(File)) and the file ciphertext M(File), SM4 random offset Offset, the encrypted key M(Key-sm4), the file ciphertext summary HMAC(M(File)) and the file recipient user name are uploaded to the server -> The server decrypts the SM4 key M(Key-sm4) using the server SM2 private key to obtain Key-sm4 and uses it to participate in the HMAC-SM3 algorithm to summarize the file ciphertext and compare it with the HMAC(M(File)) uploaded by the mobile terminal. If the values ​​are equal, they are saved; otherwise, an error is returned.

[0049] The HMAC algorithm is a general algorithm. HMAC-SM3 indicates the HMAC algorithm that uses the SM3 algorithm for digest.

[0050] HMAC algorithm: The HMAC algorithm is first based on the information digest algorithm, which currently mainly combines the two major message digest algorithms of MD and SHA. In addition to the information digest algorithm, a key is also required to participate in the digest calculation. The calculation process is actually a hash process similar to salting the original text twice.

[0051] See also Figure 3 As shown in the figure, the file download and decryption process: After logging in on the mobile terminal, you can query the list of file names sent to this account. Click an entry in the list to initiate a download request to the server. The download and parsing process is divided into two steps:

[0052] 1) Server-side file preparation: query the file entry to be downloaded, obtain the file ciphertext M(File), SM4 random offset Offset, encrypted key M(Key-sm4), file ciphertext summary HMAC(M(File)), file recipient username -> The server decrypts the existing key M(Key-sm4) with the server Sm2 private key to obtain Key-sm4 -> Then use Key-sm4 and SM4 random offset Offset to decrypt M(File) and obtain the original File -> Query the recipient Sm2 public key by the recipient username -> The server generates SM4 encryption key S-Key-sm4 and SM4 random offset S-Offset -> Encrypt the file file plaintext to form ciphertext SM(File) -> Use the server public key to encrypt the SM4 encryption key SM(S-Key-sm4) -> Use the HMAC-SM3 algorithm to encrypt the file ciphertext and generate S-HMAC(M(File)), and provide the file ciphertext SM(File), SM4 random offset S-Offset, encrypted key SM(S-Key-sm4), and file ciphertext summary S-HMAC(M(File)) for the receiving end to download;

[0053] 2) Mobile terminal file download and decryption: After the mobile terminal obtains the file ciphertext SM(File), SM4 random offset S-Offset, encrypted key SM(S-Key-sm4), and file ciphertext summary S-HMAC(M(File)), -> use the mobile terminal Sm2 private key to decrypt SM(S-Key-sm4) and obtain S-Key-sm4 -> use S-Key-sm4 to participate in HMAC-SM3 to calculate the summary value of SM(File), and compare it with S-HMAC(M(File)). If the values ​​are equal, continue to decrypt, and if the values ​​are not equal, report an integrity violation error -> S-Key-sm4 and SM4 random offset S-Offset decrypt the ciphertext SM(File) to obtain the original file -> determine the original file type -> display the files according to different types.

[0054] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.

Claims

1. A mobile terminal file transmission method based on a commercial cryptographic algorithm, characterized in that: The method comprises the following steps: Step S1, including mobile terminal A, mobile terminal B and server, wherein mobile terminal A and mobile terminal B send and receive files after being transferred by the server; Step S2: Based on the encryption and decryption of the commercial cryptographic algorithm, the common file modules of the mobile terminals A and B are called to realize real-time parsing and viewing; Step S3: Use the SM2, SM3, and SM4 algorithms of the commercial cryptographic algorithm to implement online distribution of the public key and distribution of the symmetric encryption key using a digital envelope; Step S4: Mobile terminal A and mobile terminal B register with the server, fill in and record account information, and identify mobile terminal A and mobile terminal B; Step S5: Mobile terminal A and mobile terminal B both generate SM2 public and private key pairs of commercial cryptographic algorithm and save them locally. When the mobile terminal registers an account with the server, the local public key is uploaded to the server and saved corresponding to the account information. Step S6: The server generates a SM2 public-private key pair of a commercial cryptographic algorithm and stores it inside the server. The server public key is distributed to mobile terminals A and B after mobile terminals A and B successfully log in. Step S7: Mobile terminal A and mobile terminal B access a user list of existing users on the server to select a recipient when sending a file, thereby achieving protection using a commercial cryptographic algorithm in both the communication and storage processes of the file; The upload operation process of the commercial cryptographic algorithm for file encryption includes the following steps: Step S10: Mobile terminal A and mobile terminal B generate an SM2 key pair of a commercial cryptographic algorithm, and mobile terminal A and mobile terminal B save the SM2 key pair of the commercial cryptographic algorithm to the server, and obtain the SM2 key of the commercial cryptographic algorithm of the server; Step S11: Mobile terminal A and mobile terminal B generate an SM4 key of a commercial cryptographic algorithm, and mobile terminal A and mobile terminal B select a file to be encrypted, and encrypt the file to be encrypted using the SM4 key of the commercial cryptographic algorithm; Step S12: Use the commercial encryption algorithm SM2 public key of the server to encrypt the SM4 key of the commercial encryption algorithm to form SM4 ciphertext, use the HMAC-SM3 algorithm to perform digest calculation on the file ciphertext, and upload the encryption result to the server; Step S13, the server receives the encryption result, decrypts the SM4 key with the SM2 private key of the server, and performs HMAC-SM3 algorithm digest calculation on the file ciphertext; Step S14: determine whether the ciphertext digest generated in step S13 is the same as the ciphertext digest in step S12. If yes, the data is valid and saved to the database. If not, the data is invalid and discarded. The commercial encryption algorithm file decryption process includes the following steps: Step S20, extracting the SM4 ciphertext and SM4 random offset data corresponding to the ciphertext of the file that the receiver needs to download from the data volume, and decrypting the ciphertext of the SM4 key using the SM2 private key of the server to obtain the SM4 key; Step S21, decrypt the file ciphertext using the SM4 key and the SM4 random offset to obtain the file plaintext; Step S22: Generate a new SM4 key, use the new SM4 key to encrypt the file to obtain a new file ciphertext, use the recipient's SM2 public key to encrypt the new SM4 key to obtain a new SM4 key ciphertext, use the HMAC-SM3 algorithm to calculate the digest of the new file ciphertext to obtain the new file ciphertext digest, and return the calculation result to mobile terminal A and mobile terminal B; Step S23, mobile terminal A and mobile terminal B receive the calculation result, use the mobile terminal SM2 key to decrypt the new SM4 key ciphertext, obtain the new SM4 key, and perform HMAC-SM3 algorithm digest calculation on the new file ciphertext; Step S24, determine whether the ciphertext summary generated in step S23 is equal to the ciphertext summary generated in step S22. If yes, the data is valid, and decryption continues. The new SM4 key and the new SM4 random offset are used to decrypt the new file ciphertext to obtain the file plaintext. According to different file types, the corresponding components are used to display the file; otherwise, the data is invalid and the user is prompted.

Citation Information

Patent Citations

  • Method for realizing secure transmission of data based on SM2-SM3-SM4 cryptographic algorithm

    CN113572741A

  • Data processing method and device for block chain BAAS service based on encryption algorithm

    CN113722749A

  • Data processing method, system and equipment based on national cryptographic algorithm and medium

    CN114257398A

  • SFTP multi-terminal file secure transmission method and system based on national cryptographic algorithm

    CN114338648A