CN114938358A - Backup method and terminal for instant messaging application data - Google Patents

Backup method and terminal for instant messaging application data Download PDF

Info

Publication number
CN114938358A
CN114938358A CN202210392102.7A CN202210392102A CN114938358A CN 114938358 A CN114938358 A CN 114938358A CN 202210392102 A CN202210392102 A CN 202210392102A CN 114938358 A CN114938358 A CN 114938358A
Authority
CN
China
Prior art keywords
application data
backed
backup
file
data file
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
CN202210392102.7A
Other languages
Chinese (zh)
Other versions
CN114938358B (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.)
Xiamen Meiya Pico Information Co Ltd
Original Assignee
Xiamen Meiya Pico Information 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 Xiamen Meiya Pico Information Co Ltd filed Critical Xiamen Meiya Pico Information Co Ltd
Priority to CN202210392102.7A priority Critical patent/CN114938358B/en
Publication of CN114938358A publication Critical patent/CN114938358A/en
Application granted granted Critical
Publication of CN114938358B publication Critical patent/CN114938358B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/06Message adaptation to terminal or network requirements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/06Message adaptation to terminal or network requirements
    • H04L51/063Content adaptation, e.g. replacement of unsuitable content
    • 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
    • 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

Abstract

The invention discloses a backup method and a terminal of instant messaging application data, which judge whether a key file exists locally or not according to a received backup request of an application data file to be backed up, and if not, generate a unique identity identifier and a backup key of a user; encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up; generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key; and generating the key file according to the encrypted backup key, thereby realizing the safe backup of the instant messaging application data, further enhancing the safety of the application data and reducing the risk of the leakage of the private data of the user to the maximum extent.

Description

Backup method and terminal for instant messaging application data
Technical Field
The invention relates to the technical field of data security, in particular to a backup method and a terminal for instant messaging application data.
Background
Since the appearance of the Android operating system in 2008, the Android system has become the largest mobile internet operating system in the market after years of rapid development, the market share is the first place, and the popularity of the Android system mainly lies in that the wide application of the Android mobile terminal covers the aspects of daily life and work of people, and the clothes and residence of people are influenced at all times. The usage proportion of the social application exceeds more than 60%, and is more than the total usage amount of other applications. Nowadays, social applications are almost impossible every day, foreign telegrams, Whatsapp, Line and Twitter and domestic WeChat, QQ and nailing are all around people's life, and a great deal of social applications are put on the shelf in Google Play Store every day.
Such a huge application social network is bound to accompany interaction and storage of a large amount of personal application data, while the social data security problem of the mobile phone is always the most concerned by users, the application data security relates to the personal privacy problem, and the privacy security has become a considerable problem. Particularly, cases and social events caused by exposure of personal chatting data are endless in recent years, and even privacy event exposure of a star effect has extremely bad social influence. There are many ways for the secure storage and protection of data, and the storage location may be local or cloud, but absolute security is impossible. If the high security of the data is just ensured, even the application data on the platform can be cleared in time, so that the security privacy problem can be avoided to a certain extent, but the permanent loss of the personal data is also implied.
How to safely backup application data to a personal space, especially instant messaging application data which is most concerned by a user, and how to safely restore the application data when in use without being cared by careless people to acquire personal private data becomes a matter of key discussion.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the method and the terminal for backing up the instant messaging application data can realize safe backup of the instant messaging application data.
In order to solve the technical problems, the invention adopts a technical scheme that:
a backup method of instant communication application data comprises the following steps:
judging whether a key file exists locally according to a received backup request of the application data file to be backed up, and if not, generating a unique user identity and a backup key;
encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up;
generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key;
and generating the key file according to the encrypted backup key.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a backup terminal for instant messaging application data, comprising a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the processor implements the following steps when executing the computer program:
judging whether a key file exists locally according to a received backup request of an application data file to be backed up, and if not, generating a unique user identity and a backup key;
encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up;
generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key;
and generating the key file according to the encrypted backup key.
The invention has the beneficial effects that: if no key file exists locally, the backup is a first backup, a user unique identity identifier and a backup key are generated, the application data file to be backed up is encrypted based on the backup key, a backup file is generated based on the user unique identity identifier and the encrypted application data file to be backed up, the backup key is encrypted, the key file is generated according to the encrypted backup key, the backup key in the key file can be used for carrying out multiple safe backups subsequently, the backup file is generated by encrypting the application data file to be backed up, the data cannot be opened and restored even if a non-user obtains the backup file by himself, the backup key for encrypting the data is also stored in an encrypted manner, and the backup file and the key file in the exported device cannot obtain the application data even if the android device is lost, therefore, the safe backup of the instant messaging application data is realized, the safety of the application data is further enhanced, and the risk of the leakage of the user privacy data is reduced to the maximum extent.
Drawings
Fig. 1 is a flowchart illustrating steps of a method for backing up instant messaging application data according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a backup terminal for instant messaging application data according to an embodiment of the present invention;
fig. 3 is a schematic diagram illustrating a generation flow of a backup file in the backup method of instant messaging application data according to an embodiment of the present invention;
fig. 4 is a schematic diagram of partial codes for generating a backup key in a backup method of instant messaging application data according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a part of codes generated by a unique user id in a backup method of instant messaging application data according to an embodiment of the present invention;
fig. 6 is a schematic diagram of partial codes for encrypting an application data file to be backed up in a backup method of instant messaging application data according to an embodiment of the present invention;
fig. 7 is a schematic flowchart of compressing an encrypted application data file to be backed up in a backup method of instant messaging application data according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a backup file in the backup method of instant messaging application data according to the embodiment of the present invention;
fig. 9 is a schematic diagram illustrating a data restoring flow in a backup method of instant messaging application data according to an embodiment of the present invention.
Detailed Description
In order to explain the technical contents, the objects and the effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 1, an embodiment of the present invention provides a method for backing up instant messaging application data, including the steps of:
judging whether a key file exists locally according to a received backup request of the application data file to be backed up, and if not, generating a unique user identity and a backup key;
encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up;
generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key;
and generating the key file according to the encrypted backup key.
From the above description, the beneficial effects of the present invention are: if no key file exists locally, the backup is a first backup, a user unique identity identifier and a backup key are generated, the application data file to be backed up is encrypted based on the backup key, a backup file is generated based on the user unique identity identifier and the encrypted application data file to be backed up, the backup key is encrypted, the key file is generated according to the encrypted backup key, the backup key in the key file can be used for carrying out multiple safe backups subsequently, the backup file is generated by encrypting the application data file to be backed up, the data cannot be opened and restored even if a non-user obtains the backup file by himself, the backup key for encrypting the data is also stored in an encrypted manner, and the backup file and the key file in the exported device cannot obtain the application data even if the android device is lost, therefore, the safe backup of the instant messaging application data is realized, the safety of the application data is further enhanced, and the risk of the leakage of the user privacy data is reduced to the maximum extent.
Further, the generating the user unique identity and the backup key comprises:
acquiring a user ID corresponding to the application data file to be backed up and time corresponding to the backup request;
using a first hash algorithm to perform abstract calculation on the user ID to obtain a unique user identity;
generating a random parameter using a random number generation algorithm based on the time;
determining a data stream of the random parameter, and intercepting a preset bit of the data stream to obtain an intercepted data stream;
and calculating the intercepted data stream by using a second hash algorithm to obtain a backup key.
According to the description, the unique user identity is obtained by performing abstract calculation on the user ID through the first hash algorithm, the uniqueness of the unique user identity is ensured, the preset bit of the random parameter is intercepted, the intercepted data stream is calculated through the second hash algorithm, and the backup key is obtained, so that the backup key has high randomness and cannot be predicted, and the safety of application data backup is improved.
Further, the encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up includes:
reading the application data file to be backed up into a byte buffer area to obtain a byte stream;
generating an initialization vector using a random number interface;
and encrypting by using a first symmetric encryption algorithm based on the backup key, the byte stream and the initialization vector to obtain an encrypted application data file to be backed up.
As can be seen from the above description, the application data file to be backed up is read into the byte buffer to obtain the byte stream, the random number interface is used to generate the initialization vector, the symmetric encryption algorithm is used to encrypt the byte stream, the initialization vector and the backup key to obtain the encrypted application data file to be backed up, and the randomly generated initialization vector is introduced to encrypt the encrypted application data file to ensure the randomness of the encryption, thereby improving the security of the encryption and further improving the security of the application data backup.
Further, obtaining the encrypted application data file to be backed up includes:
compressing the encrypted application data file to be backed up to obtain a compressed application data file to be backed up;
the generating of the backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up comprises:
calculating the compressed application data file to be backed up by using a third hash algorithm to obtain a first calculated value;
determining preset file header information and a preset file end mark;
and generating a backup file corresponding to the application data file to be backed up according to the preset file header information, the user unique identity, the initialization vector, the compressed application data file to be backed up, the first calculation value and the preset file end mark.
According to the description, the compressed application data file to be backed up is calculated by using a third hash algorithm to obtain a first calculated value, a backup file corresponding to the application data file to be backed up is generated according to the preset file head information, the user unique identity, the initialization vector, the compressed application data file to be backed up, the first calculated value and the preset file end mark, the backed up data does not have plaintext data, the encrypted data cannot be decrypted according to the backed up data, the safe backup of the application data is realized, the user unique identity and the first calculated value can be used for verifying the authenticity of the backup file, the initialization vector is convenient for the subsequent restoration of the backup file, and the safe restoration of the application data is realized.
Further, the encrypting the backup key to obtain the encrypted backup key includes:
acquiring a user password corresponding to the application data file to be backed up;
calculating the user password by using a fourth hash algorithm to obtain a second calculated value;
and encrypting the backup key by using a second symmetric encryption algorithm based on the second calculated value to obtain the encrypted backup key.
As can be seen from the above description, the fourth hash algorithm is used to calculate the user password to obtain the second calculated value, the symmetric encryption algorithm is used to encrypt the backup key based on the second calculated value to obtain the encrypted backup key, and when subsequent file data is restored, the user password is used to obtain the backup key after the user requests the server for successful authentication, so that the security of the backup key can be greatly ensured, the backup data is related to the user account, each user can only unlock own application data, and the personal privacy of the user is protected.
Referring to fig. 2, a backup terminal for instant messaging application data includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the following steps when executing the computer program:
judging whether a key file exists locally according to a received backup request of the application data file to be backed up, and if not, generating a unique user identity and a backup key;
encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up;
generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key;
and generating the key file according to the encrypted backup key.
As can be seen from the above description, the beneficial effects of the present invention are: if no key file exists locally, the backup is a first backup, a user unique identity mark and a backup key are generated, the application data file to be backed up is encrypted based on the backup key, a backup file is generated based on the user unique identity mark and the encrypted application data file to be backed up, the backup key is encrypted, the key file is generated according to the encrypted backup key, and the backup key in the key file can be used for carrying out multiple safe backups subsequently, because the backup file is generated by encrypting the application data file to be backed up, the backup file cannot be opened and data can not be restored even if a non-user acquires the backup file himself, the backup key for encrypting the data is also stored by encryption, and even if the android device is lost, the backup file and the key file in the exported device cannot acquire application data, therefore, the safe backup of the instant messaging application data is realized, the safety of the application data is further enhanced, and the risk of leakage of the private data of the user is reduced to the maximum extent.
Further, the generating the user unique identity and the backup key comprises:
acquiring a user ID corresponding to the application data file to be backed up and time corresponding to the backup request;
using a first hash algorithm to perform abstract calculation on the user ID to obtain a unique user identity;
generating a random parameter using a random number generation algorithm based on the time;
determining a data stream of the random parameter, and intercepting a preset bit of the data stream to obtain an intercepted data stream;
and calculating the intercepted data stream by using a second hash algorithm to obtain a backup key.
According to the description, the unique user identity is obtained by performing abstract calculation on the user ID through the first hash algorithm, the uniqueness of the unique user identity is ensured, the preset bit of the random parameter is intercepted, the intercepted data stream is calculated through the second hash algorithm, and the backup key is obtained, so that the backup key has high randomness and cannot be predicted, and the safety of application data backup is improved.
Further, the encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up includes:
reading the application data file to be backed up into a byte buffer area to obtain a byte stream;
generating an initialization vector using a random number interface;
and encrypting by using a first symmetric encryption algorithm based on the backup key, the byte stream and the initialization vector to obtain an encrypted application data file to be backed up.
As can be seen from the above description, the application data file to be backed up is read into the byte buffer to obtain the byte stream, the random number interface is used to generate the initialization vector, the symmetric encryption algorithm is used to encrypt the byte stream, the initialization vector and the backup key to obtain the encrypted application data file to be backed up, and the randomly generated initialization vector is introduced to encrypt the encrypted application data file to ensure the randomness of the encryption, thereby improving the security of the encryption and further improving the security of the application data backup.
Further, obtaining the encrypted application data file to be backed up includes:
compressing the encrypted application data file to be backed up to obtain a compressed application data file to be backed up;
the generating of the backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up comprises:
calculating the compressed application data file to be backed up by using a third hash algorithm to obtain a first calculated value;
determining preset file header information and a preset file end mark;
and generating a backup file corresponding to the application data file to be backed up according to the preset file header information, the user unique identity, the initialization vector, the compressed application data file to be backed up, the first calculation value and the preset file end mark.
According to the description, the compressed application data file to be backed up is calculated by using a third hash algorithm to obtain a first calculated value, a backup file corresponding to the application data file to be backed up is generated according to the preset file head information, the user unique identity, the initialization vector, the compressed application data file to be backed up, the first calculated value and the preset file end mark, the backed up data does not have plaintext data, the encrypted data cannot be decrypted according to the backed up data, the safe backup of the application data is realized, the user unique identity and the first calculated value can be used for verifying the authenticity of the backup file, the initialization vector is convenient for the subsequent restoration of the backup file, and the safe restoration of the application data is realized.
Further, the encrypting the backup key to obtain the encrypted backup key includes:
acquiring a user password corresponding to the application data file to be backed up;
calculating the user password by using a fourth hash algorithm to obtain a second calculated value;
and encrypting the backup key by using a second symmetric encryption algorithm based on the second calculated value to obtain the encrypted backup key.
As can be seen from the above description, the fourth hash algorithm is used to calculate the user password to obtain the second calculated value, the symmetric encryption algorithm is used to encrypt the backup key based on the second calculated value to obtain the encrypted backup key, and when subsequent file data is restored, the user password is used to obtain the backup key after the user requests the server for successful authentication, so that the security of the backup key can be greatly ensured, the backup data is related to the user account, each user can only unlock own application data, and the personal privacy of the user is protected.
The backup method and the terminal for the instant messaging application data can be applied to all instant messaging applications on Android (Android), and are explained by specific implementation modes as follows:
example one
Referring to fig. 1, fig. 3 to fig. 9, a method for backing up instant messaging application data according to the present embodiment includes the steps of:
s1, judging whether a key file exists locally according to the received backup request of the application data file to be backed up, if not, executing S11;
the application data file to be backed up is a data file locally cached by the instant messaging application and comprises important data such as personal information, friends and group chatting;
specifically, whether a key FILE backup exists locally is judged according to the received backup request of the SOURCE _ FILE _ DATA of the application DATA FILE to be backed up, and if not, S11 is executed; if so, decrypting the key file by using the user password to obtain a backup key, and executing S2;
s11, generating a unique user identity and a backup key, including:
s111, acquiring a user ID corresponding to the application data file to be backed up and time corresponding to the backup request;
the user ID is the user ID of the current login account;
s112, performing abstract calculation on the user ID by using a first hash algorithm to obtain a unique user identity;
specifically, as shown in fig. 5, a first hash algorithm is used to perform digest calculation on the user ID to obtain a unique user IDENTITY identifier IDENTITY _ KEY, where the IDENTITY _ KEY is written in a fixed flag bit of the backup file to verify the user IDENTITY of the backup file when data is restored, and the backup data is not restored only by using a backup KEY;
s113, generating random parameters by using a random number generation algorithm based on the time;
the random number generation algorithm may be selected according to actual conditions, as long as it is sufficiently ensured that generated random parameters cannot be predicted, and in this embodiment, the random number generation algorithm generates secure random for a secure random provided in Android;
specifically, the time is used as a random seed to call a secure random number generation class SecureRandom of java to generate a random parameter, and the random parameter cannot be predicted by other programs;
s114, determining a data stream of the random parameter, and intercepting a preset bit of the data stream to obtain an intercepted data stream;
wherein the preset bits are the first 32 bits;
specifically, determining a data stream of the random parameter, and intercepting the first 32 bits of the data stream to obtain an intercepted data stream;
s115, calculating the intercepted data stream by using a second hash algorithm to obtain a backup key;
wherein the second hash algorithm is an MD5 algorithm;
specifically, as shown in fig. 4, an MD5 algorithm is used to calculate the intercepted data stream, so as to obtain a BACKUP KEY BACKUP _ KEY;
s2, encrypting the application data file to be backed up based on the backup key to obtain an encrypted application data file to be backed up, as shown in fig. 3, specifically including:
s21, reading the application data file to be backed up into a byte buffer area to obtain a byte stream;
specifically, the SOURCE _ FILE _ DATA of the application DATA FILE to be backed up is read into a byte buffer by a code to obtain a byte stream;
s22, generating an initialization vector by using a random number interface;
specifically, a random number interface of the system is used for generating an initialization vector NONCE _ IV, the NONCE _ IV is also random, the randomness of the encrypted byte stream is ensured, and the value is written into a file to serve as a necessary parameter for restoring the backup file;
s23, encrypting by using a first symmetric encryption algorithm based on the backup key, the byte stream and the initialization vector to obtain an encrypted application data file to be backed up;
in this embodiment, the first symmetric encryption algorithm is a ChaCha20-Poly1305 algorithm, the ChaCha20-Poly1305 algorithm is an authentication encryption algorithm which is applied to an internet security protocol and is formed by combining a ChaCha20 stream cipher and a Poly1305 Message Authentication Code (MAC), and a relatively wide stream cipher symmetric encryption algorithm is also used in Android mobile terminal application;
specifically, as shown in fig. 6, the BACKUP KEY BACKUP _ KEY is used as an encryption KEY, and the ChaCha20-Poly1305 algorithm is called to encrypt the BACKUP KEY BACKUP _ KEY, the byte stream and the initialization vector NONCE _ IV as inputs to obtain an encrypted application DATA FILE to be backed up, search _ FILE _ DATA;
s3, compressing the encrypted application data file to be backed up to obtain a compressed application data file to be backed up;
specifically, as shown in fig. 7, the encrypted application DATA FILE to be backed up is Compressed (COMPRESS) by using a compression algorithm, so as to obtain a compressed application DATA FILE to be backed up, search _ FILE _ DATA _ COMPRESS;
the compression algorithm is GZIP, Bzib2, Zip or a combination of multiple compression algorithms, and the compression algorithm is not limited;
s4, generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key, which specifically includes:
s41, calculating the compressed application data file to be backed up by using a third hash algorithm to obtain a first calculated value;
wherein the third hash algorithm is an MD5 algorithm;
specifically, the compressed application data file to be backed up is calculated by using an MD5 algorithm to obtain a first calculated value, that is, an MD5 value;
s42, determining the header information of the preset file and the end mark of the preset file;
specifically, the preset FILE header information BACKUP _ FILE _ HEAD and the preset FILE end flag are determined, in this embodiment, the data length of the preset FILE header information BACKUP _ FILE _ HEAD is 50 bits, and the data length of the preset FILE end flag is 4 bits;
s43, generating a backup file corresponding to the application data file to be backed up according to the preset file header information, the unique user identity, the initialization vector, the compressed application data file to be backed up, the first calculation value and the preset file end mark;
specifically, the preset FILE header information BACKUP _ FILE _ HEAD, the user unique IDENTITY identifier _ KEY, the initialization vector no _ IV, the compressed application DATA FILE to be backed up search _ FILE _ DATA _ complete, the MD5 value, and the preset FILE end flag are written into to generate a BACKUP FILE BACKUP _ FILE corresponding to the application DATA FILE to be backed up, as shown in fig. 8;
in this embodiment, the data length of the unique IDENTITY identifier IDENTITY _ KEY is 32 bits, the data length of the initialization vector NONCE _ IV is 16 bits, and the data length of the MD5 value is 16 bits;
s44, acquiring a user password corresponding to the application data file to be backed up;
the user password is the user password after the authentication of the current login account is passed;
s45, calculating the user password by using a fourth hash algorithm to obtain a second calculated value;
s46, encrypting the backup key by using a second symmetric encryption algorithm based on the second calculated value to obtain an encrypted backup key;
wherein the second symmetric encryption algorithm is an AES _ GCM _256 algorithm;
specifically, the second calculated value is used as a symmetric encryption KEY to encrypt the BACKUP KEY BACKUP _ KEY by using an AES _ GCM _256 algorithm, so as to obtain an encrypted BACKUP KEY SECRET _ BACKUP _ KEY;
s5, generating the key file according to the encrypted backup key;
specifically, the encoded value of the encrypted BACKUP KEY SECRET _ BACKUP _ KEY is written into the KEY file BACKUP.
The key file and the backup file are both stored in a data directory of the instant messaging application;
if the backup key generated for the first time is lost, the backup key is regenerated according to S1;
as shown in fig. 9, when the data is restored, the user login authentication is first completed on the instant messaging application, and after the login authentication is passed, the whole data recovery process is to obtain the search _ BACKUP _ KEY from the local BACKUP. And decrypts SECRET _ BACKUP _ KEY through the user password after login authentication to obtain a BACKUP KEY BACKUP _ KEY, analyzing the backup file, verifying whether the user unique identity of the file is consistent with the user unique identity of the current login user, acquiring an initialization vector and a compressed application data file from the backup file, decompressing the compressed application data file, decrypting the decompressed application data file through the acquired backup key and the initialization vector to acquire a final plaintext file data stream, and writing the data into a plaintext backup file, and reading and restoring the data through an application program, namely, restoring the data according to the reverse order of S5-S1.
Example two
Referring to fig. 2, a backup terminal for instant messaging application data of the present embodiment includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor executes the computer program to implement each step of the backup method for instant messaging application data in the first embodiment.
In summary, according to the backup method and the terminal for the instant messaging application data provided by the present invention, when no key file exists locally, a unique user identity and a backup key are generated; encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up; generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key; generating the key file according to the encrypted backup key; because the backup file is generated by encrypting the application data file to be backed up, even if a non-user obtains the backup file without a key, the data cannot be opened and restored, the backup key for encrypting the data is also stored by encryption, even if the android device is lost, the backup file and the key file in the device exported by other people cannot obtain the application data, and the key file can be decrypted to obtain the backup key of the backup file only after the user passes login authentication in the data restoration process, so that the safe backup of the instant messaging application data is realized, the safety of the application data is further enhanced, and the risk of leakage of user privacy data is reduced to the maximum extent.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (10)

1. A backup method for instant communication application data is characterized by comprising the following steps:
judging whether a key file exists locally according to a received backup request of the application data file to be backed up, and if not, generating a unique user identity and a backup key;
encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up;
generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key;
and generating the key file according to the encrypted backup key.
2. The method for backing up instant messaging application data according to claim 1, wherein the generating a user unique id and a backup key comprises:
acquiring a user ID corresponding to the application data file to be backed up and time corresponding to the backup request;
using a first hash algorithm to perform abstract calculation on the user ID to obtain a unique user identity;
generating a random parameter using a random number generation algorithm based on the time;
determining a data stream of the random parameter, and intercepting a preset bit of the data stream to obtain an intercepted data stream;
and calculating the intercepted data stream by using a second hash algorithm to obtain a backup key.
3. The method of claim 1, wherein the encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up comprises:
reading the application data file to be backed up into a byte buffer area to obtain a byte stream;
generating an initialization vector using a random number interface;
and encrypting by using a first symmetric encryption algorithm based on the backup key, the byte stream and the initialization vector to obtain an encrypted application data file to be backed up.
4. The method for backing up instant messaging application data according to claim 3, wherein the obtaining of the encrypted application data file to be backed up comprises:
compressing the encrypted application data file to be backed up to obtain a compressed application data file to be backed up;
the generating of the backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up comprises:
calculating the compressed application data file to be backed up by using a third hash algorithm to obtain a first calculated value;
determining preset file header information and a preset file end mark;
and generating a backup file corresponding to the application data file to be backed up according to the preset file header information, the user unique identity, the initialization vector, the compressed application data file to be backed up, the first calculation value and the preset file end mark.
5. The method as claimed in claim 1, wherein the encrypting the backup key to obtain the encrypted backup key comprises:
acquiring a user password corresponding to the application data file to be backed up;
calculating the user password by using a fourth hash algorithm to obtain a second calculated value;
and encrypting the backup key by using a second symmetric encryption algorithm based on the second calculated value to obtain the encrypted backup key.
6. A backup terminal for instant messaging application data, comprising a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the processor implements the following steps when executing the computer program:
judging whether a key file exists locally according to a received backup request of an application data file to be backed up, and if not, generating a unique user identity and a backup key;
encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up;
generating a backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up, and encrypting the backup key to obtain an encrypted backup key;
and generating the key file according to the encrypted backup key.
7. The backup terminal of instant messaging application data of claim 6, wherein the generating the user unique id and the backup key comprises:
acquiring a user ID corresponding to the application data file to be backed up and time corresponding to the backup request;
using a first hash algorithm to perform abstract calculation on the user ID to obtain a unique user identity;
generating a random parameter using a random number generation algorithm based on the time;
determining the data stream of the random parameter, and intercepting a preset bit of the data stream to obtain an intercepted data stream;
and calculating the intercepted data stream by using a second hash algorithm to obtain a backup key.
8. The backup terminal of instant messaging application data according to claim 6, wherein the encrypting the application data file to be backed up based on the backup key to obtain the encrypted application data file to be backed up comprises:
reading the application data file to be backed up into a byte buffer area to obtain a byte stream;
generating an initialization vector using a random number interface;
and encrypting by using a first symmetric encryption algorithm based on the backup key, the byte stream and the initialization vector to obtain an encrypted application data file to be backed up.
9. The terminal of claim 8, wherein obtaining the encrypted application data file to be backed up comprises:
compressing the encrypted application data file to be backed up to obtain a compressed application data file to be backed up;
the generating of the backup file corresponding to the application data file to be backed up based on the unique user identity and the encrypted application data file to be backed up comprises:
calculating the compressed application data file to be backed up by using a third hash algorithm to obtain a first calculated value;
determining preset file head information and a preset file end mark;
and generating a backup file corresponding to the application data file to be backed up according to the preset file header information, the user unique identity, the initialization vector, the compressed application data file to be backed up, the first calculation value and the preset file end mark.
10. The backup terminal of instant messaging application data according to claim 6, wherein the encrypting the backup key to obtain the encrypted backup key comprises:
acquiring a user password corresponding to the application data file to be backed up;
calculating the user password by using a fourth hash algorithm to obtain a second calculated value;
and encrypting the backup key by using a second symmetric encryption algorithm based on the second calculated value to obtain the encrypted backup key.
CN202210392102.7A 2022-04-14 2022-04-14 Backup method and terminal for instant messaging application data Active CN114938358B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210392102.7A CN114938358B (en) 2022-04-14 2022-04-14 Backup method and terminal for instant messaging application data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210392102.7A CN114938358B (en) 2022-04-14 2022-04-14 Backup method and terminal for instant messaging application data

Publications (2)

Publication Number Publication Date
CN114938358A true CN114938358A (en) 2022-08-23
CN114938358B CN114938358B (en) 2024-02-23

Family

ID=82862317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210392102.7A Active CN114938358B (en) 2022-04-14 2022-04-14 Backup method and terminal for instant messaging application data

Country Status (1)

Country Link
CN (1) CN114938358B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110252234A1 (en) * 2010-04-07 2011-10-13 Apple Inc. System and method for file-level data protection
CN103546281A (en) * 2013-10-31 2014-01-29 厦门市美亚柏科信息股份有限公司 Dynamic secret key generating method and device
US20160132684A1 (en) * 2014-11-06 2016-05-12 International Business Machines Corporation Secure database backup and recovery
CN106126373A (en) * 2016-06-21 2016-11-16 青岛海信传媒网络技术有限公司 Data back up method and device, data reconstruction method and device
CN106549858A (en) * 2016-12-08 2017-03-29 深圳奥联信息安全技术有限公司 A kind of instant messaging encryption method based on id password
CN112235289A (en) * 2020-10-13 2021-01-15 桂林微网互联信息技术有限公司 Data encryption and decryption method and device, computing equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110252234A1 (en) * 2010-04-07 2011-10-13 Apple Inc. System and method for file-level data protection
CN103546281A (en) * 2013-10-31 2014-01-29 厦门市美亚柏科信息股份有限公司 Dynamic secret key generating method and device
US20160132684A1 (en) * 2014-11-06 2016-05-12 International Business Machines Corporation Secure database backup and recovery
CN106126373A (en) * 2016-06-21 2016-11-16 青岛海信传媒网络技术有限公司 Data back up method and device, data reconstruction method and device
CN106549858A (en) * 2016-12-08 2017-03-29 深圳奥联信息安全技术有限公司 A kind of instant messaging encryption method based on id password
CN112235289A (en) * 2020-10-13 2021-01-15 桂林微网互联信息技术有限公司 Data encryption and decryption method and device, computing equipment and storage medium

Also Published As

Publication number Publication date
CN114938358B (en) 2024-02-23

Similar Documents

Publication Publication Date Title
US7899184B2 (en) Ends-messaging protocol that recovers and has backward security
CN111464301B (en) Key management method and system
CN111245802B (en) Data transmission security control method, server and terminal
CN109547198B (en) System for network transmission video file
CN113067699B (en) Data sharing method and device based on quantum key and computer equipment
CN107920052B (en) Encryption method and intelligent device
CN109684129B (en) Data backup recovery method, storage medium, encryption machine, client and server
CN111526007B (en) Random number generation method and system
CN109067517B (en) Encryption and decryption device, encryption and decryption method and communication method of hidden key
CN108809936B (en) Intelligent mobile terminal identity verification method based on hybrid encryption algorithm and implementation system thereof
CN103701596A (en) Document access method, system and equipment and document access request response method, system and equipment
CN111639357A (en) Encryption network disk system and authentication method and device thereof
JP2022117456A (en) Message transmission system with hardware security module
CN113722741A (en) Data encryption method and device and data decryption method and device
CN109934013A (en) A kind of data guard method and device
CN109118187A (en) Restoration methods, device and the computer readable storage medium of block chain wallet
CN112804058A (en) Conference data encryption and decryption method and device, storage medium and electronic equipment
KR102216869B1 (en) Apparatus and method for decrypting end-to-end encrypted files
CN112199730A (en) Method and device for processing application data on terminal and electronic equipment
CN109784072B (en) Security file management method and system
CN114938358B (en) Backup method and terminal for instant messaging application data
CN114866317B (en) Multi-party data security calculation method and device, electronic equipment and storage medium
CN116248316A (en) File encryption method, file decryption method, device and storage medium
CN115603907A (en) Method, device, equipment and storage medium for encrypting storage data
CN115022042A (en) Compliance code verification method for protecting data privacy and computer readable 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