CN114938358B - 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
CN114938358B
CN114938358B CN202210392102.7A CN202210392102A CN114938358B CN 114938358 B CN114938358 B CN 114938358B CN 202210392102 A CN202210392102 A CN 202210392102A CN 114938358 B CN114938358 B CN 114938358B
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.)
Active
Application number
CN202210392102.7A
Other languages
Chinese (zh)
Other versions
CN114938358A (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

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 according to a received backup request of an application data file to be backed up, if not, a unique identity mark of a user and a backup key are generated; 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; 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 furthest reducing the risk of revealing the private data of the user.

Description

Backup method and terminal for instant messaging application data
Technical Field
The present invention relates to the field of data security technologies, and in particular, to a method and a terminal for backing up instant messaging application data.
Background
Since the advent of the Android operating system in 2008, the Android system has become the largest mobile internet operating system in the market through rapid development for many years, the market share is first, and the popularity of the Android system is mainly that the wide application of the Android mobile terminal covers the aspects of daily life and work of people, and the clothing and eating activities of people are affected at any time. The use proportion of the social application exceeds 60 percent and is more than the total use amount of other applications. Social applications are almost kept away every day, foreign Telegram, whatsapp, line, twitter and domestic WeChat, QQ and nails are always around people's lives, and a large number of social applications are put on Google Play Store every day.
Such a huge application social network is necessarily accompanied by a large amount of interaction and storage of personal application data, while the problem of social data security of mobile phones is always the most concerned by users, and application data security relates to personal privacy, so that privacy security has become a non-negligible problem. Especially, in recent years, cases and social events caused by exposure of personal chat data are layered endlessly, and even privacy event exposure of some stars effects has extremely bad social influence. The safe storage and protection of the data have various modes, and the storage position can be local or cloud, but absolute safety cannot be achieved. If the security of the data is guaranteed to be high, the security and privacy problems can be avoided to a certain extent by timely clearing the application data on the platform, but the security and privacy problems are also meant to be permanent loss of the personal data.
How to safely backup application data to personal space, especially the most concerned instant messaging application data of users, and how to safely restore personal privacy data without being acquired by careless people when in use becomes the content which needs to be discussed with great importance.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the backup method and the terminal for the instant messaging application data can realize the 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 messaging application data comprises the following steps:
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 an 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 problems, the invention adopts another technical scheme that:
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, the processor implementing 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 an 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 the key file does not exist locally, the backup is the first backup, the unique user identity and the backup key are generated, the application data file to be backed up is encrypted based on the backup key, the backup file is generated based on the unique user identity 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, 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, the data cannot be opened and restored, and 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, thereby realizing the safe backup of the instant messaging application data, further enhancing the safety of the application data, and furthest reducing the risk of user privacy data leakage.
Drawings
FIG. 1 is a flowchart illustrating 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 of a flow chart of generating 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 a portion of codes generated by a backup key in the backup method of instant messaging application data according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a portion of codes generated by a unique user identifier in a backup method of instant messaging application data according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a portion of codes of encryption of an application data file to be backed up in the backup method of instant messaging application data according to an embodiment of the present invention;
fig. 7 is a schematic flow chart of compressing an encrypted application data file to be backed up in the backup method of instant messaging application data according to the embodiment of the invention;
fig. 8 is a schematic structural diagram of a backup file in the backup method of instant messaging application data according to an embodiment of the present invention;
fig. 9 is a schematic diagram of a data restoration flow in the backup method of instant messaging application data according to an embodiment of the present invention.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
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 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 an 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 invention are as follows: if the key file does not exist locally, the backup is the first backup, the unique user identity and the backup key are generated, the application data file to be backed up is encrypted based on the backup key, the backup file is generated based on the unique user identity 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, 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, the data cannot be opened and restored, and 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, thereby realizing the safe backup of the instant messaging application data, further enhancing the safety of the application data, and furthest reducing the risk of user privacy data leakage.
Further, the generating the user unique identity and the backup key includes:
acquiring a user ID corresponding to the application data file to be backed up and a time corresponding to the backup request;
performing abstract calculation on the user ID by using a first hash algorithm 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 parameters, and intercepting preset bits 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.
As can be seen from the above description, the user ID is subjected to summary calculation by using the first hash algorithm to obtain a unique user identity, so as to ensure the uniqueness of the unique user identity, intercept the preset bits of the random parameters, and calculate the intercepted data stream by using the second hash algorithm to obtain the backup key, so that the backup key has higher randomness and cannot be predicted, and further the security of application data backup is improved.
Further, encrypting the application data file to be backed up based on the backup key, and obtaining 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 based on the backup key, the byte stream and the initialization vector to obtain the encrypted application data file to be backed up, the randomly generated initialization vector is introduced to encrypt, so that the encryption randomness is ensured, the encryption security is improved, and the application data backup security is further improved.
Further, the 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 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 includes:
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 unique user identity, the initialization vector, the compressed application data file to be backed up, the first calculated value and the preset file ending mark.
As can be seen from the above description, the compressed application data file to be backed up is calculated by using the third hash algorithm to obtain the first calculated value, the backup file corresponding to the application data file to be backed up is generated 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 calculated value and the preset file end mark, the backed up data has no plaintext data, the encrypted data cannot be decrypted according to the backed up data, the safe backup of the application data is realized, the unique user identity and the first calculated value can be used for verifying the authenticity of the backup file, and the initialization vector is convenient for the subsequent restoration of the backup file, thereby realizing the safe restoration of the application data.
Further, encrypting the backup key to obtain an 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 an 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, when the subsequent file data is restored, the user is required to request the server for successful authentication, and then the user password is used to obtain the backup key, so that the security of the backup key can be ensured to a great extent, the backup data is related to the user account, and each user can only unlock the application data of the user, thereby protecting the personal privacy of the user.
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 capable of running 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 an 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 invention are as follows: if the key file does not exist locally, the backup is the first backup, the unique user identity and the backup key are generated, the application data file to be backed up is encrypted based on the backup key, the backup file is generated based on the unique user identity 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, 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, the data cannot be opened and restored, and 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, thereby realizing the safe backup of the instant messaging application data, further enhancing the safety of the application data, and furthest reducing the risk of user privacy data leakage.
Further, the generating the user unique identity and the backup key includes:
acquiring a user ID corresponding to the application data file to be backed up and a time corresponding to the backup request;
performing abstract calculation on the user ID by using a first hash algorithm 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 parameters, and intercepting preset bits 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.
As can be seen from the above description, the user ID is subjected to summary calculation by using the first hash algorithm to obtain a unique user identity, so as to ensure the uniqueness of the unique user identity, intercept the preset bits of the random parameters, and calculate the intercepted data stream by using the second hash algorithm to obtain the backup key, so that the backup key has higher randomness and cannot be predicted, and further the security of application data backup is improved.
Further, encrypting the application data file to be backed up based on the backup key, and obtaining 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 based on the backup key, the byte stream and the initialization vector to obtain the encrypted application data file to be backed up, the randomly generated initialization vector is introduced to encrypt, so that the encryption randomness is ensured, the encryption security is improved, and the application data backup security is further improved.
Further, the 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 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 includes:
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 unique user identity, the initialization vector, the compressed application data file to be backed up, the first calculated value and the preset file ending mark.
As can be seen from the above description, the compressed application data file to be backed up is calculated by using the third hash algorithm to obtain the first calculated value, the backup file corresponding to the application data file to be backed up is generated 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 calculated value and the preset file end mark, the backed up data has no plaintext data, the encrypted data cannot be decrypted according to the backed up data, the safe backup of the application data is realized, the unique user identity and the first calculated value can be used for verifying the authenticity of the backup file, and the initialization vector is convenient for the subsequent restoration of the backup file, thereby realizing the safe restoration of the application data.
Further, encrypting the backup key to obtain an 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 an 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, when the subsequent file data is restored, the user is required to request the server for successful authentication, and then the user password is used to obtain the backup key, so that the security of the backup key can be ensured to a great extent, the backup data is related to the user account, and each user can only unlock the application data of the user, thereby protecting the personal privacy of the user.
The backup method and the terminal of the instant messaging application data can be applied to all instant messaging applications on Android (Android), and the following description is made by a specific implementation mode:
example 1
Referring to fig. 1 and fig. 3-9, a backup method for instant messaging application data in the present embodiment includes the steps of:
s1, 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, executing S11;
the application data file to be backed up is a data file locally cached by the instant messaging application and comprises personal information, friends, group chat and other important data;
specifically, whether a key FILE backup exists locally or not is judged according to the received backup request of the application DATA FILE to be backed up, and if not, S11 is executed; if yes, decrypting the key file by using a user password to obtain a backup key, and executing S2;
s11, generating a unique identity mark and a backup key of a user, which specifically comprises the following steps:
s111, acquiring a user ID corresponding to the application data file to be backed up and a time corresponding to the backup request;
wherein, 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, the first hash algorithm is used to perform digest calculation on the user ID to obtain a unique IDENTITY identifier identity_key, where the unique IDENTITY identifier_key is written in a fixed flag bit of the backup file to verify the user IDENTITY of the backup file during data restoration, and not just one backup KEY is used to restore the backup data;
s113, generating random parameters by using a random number generation algorithm based on the time;
the random number generation algorithm can be selected according to actual conditions, and the generated random parameters can be guaranteed to be not predicted sufficiently, and in the embodiment, the random number generation algorithm generates a secure random for the secure random number provided in Android;
specifically, the time is used as a random seed to call a safe random number generation class SecureRandom of java to generate a random parameter which cannot be predicted by other programs;
s114, determining the data stream of the random parameters, and intercepting preset bits of the data stream to obtain an intercepted data stream;
wherein the preset bit is the first 32 bits;
specifically, determining the data stream of the random parameters, 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 the 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, reading the application DATA FILE SOURCE_FILE_DATA to be backed up into a byte buffer area ByteBuffer through codes to obtain a byte stream;
s22, generating an initialization vector by using a random number interface;
specifically, an initialization vector NONCE_IV is generated by using a random number interface of the system, the NONCE_IV is also random, the randomness of the encryption byte stream is ensured, and the value is written into a file to be used as a necessary parameter for restoring a 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;
the first symmetric encryption algorithm may select an "encryption+message authentication" symmetric encryption algorithm according to actual situations, in this embodiment, the first symmetric encryption algorithm is a ChaCha20-Poly1305 algorithm, where the ChaCha20-Poly1305 algorithm is an authentication encryption algorithm that is applied to an internet security protocol by combining a ChaCha20 stream cipher with a Poly1305 Message Authentication Code (MAC), and is also a stream cipher symmetric encryption algorithm that is widely used in Android mobile terminal applications;
specifically, as shown in fig. 6, the BACKUP KEY backup_key is used as an encryption KEY, and the BACKUP KEY backup_key, the byte stream and the initialization vector nonce_iv are used as inputs to call a ChaCha20-Poly1305 algorithm for encryption, so as to obtain an encrypted application DATA FILE to be backed up SECRET_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 (comp) by using a compression algorithm, so as to obtain a compressed application DATA FILE to be backed up SECRET_FILE_DATA_comp;
the compression algorithm is GZIP, bzip 2, zip or a combination of multiple compression algorithms, which 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, wherein the method specifically comprises the following steps:
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, namely an MD5 value;
s42, determining preset file header information and a preset file end mark;
specifically, the preset FILE header information backup_file_head and the preset FILE end mark 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 mark 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 user unique identity, the initialization vector, the compressed application data file to be backed up, the first calculated value and the preset file ending mark;
specifically, writing the preset FILE header information backup_file_head, the user unique identity_key, the initialization vector nonce_iv, the compressed application DATA FILE to be backed up SECRET_FILE_DATA_COMPRESS, the MD5 value and the preset FILE ending mark 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_key of the user 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, obtaining a user password corresponding to the application data file to be backed up;
the user password is the user password after the current login account passes the authentication;
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, writing the coded value of the encrypted BACKUP KEY SECRET_BACKUP_KEY into the KEY file BACKUP so as to realize the generation of the KEY file;
the key file and the backup file are both stored under a data directory of the instant communication application;
when the login account needs to backup new application data, the data is backed up by using the backup key generated for the first time, and if the backup key generated for the first time is lost, the backup key is regenerated according to S1;
as shown in fig. 9, during data restoration, user login authentication is completed on an instant messaging application, after the login authentication is passed, the whole data restoration process is to obtain a secret_backup_key from a local BACKUP, decrypt the secret_backup_key through a user password after the login authentication to obtain a BACKUP KEY backup_key, analyze the BACKUP file, verify whether a user unique identity of the file is consistent with a user unique identity of a current login user, obtain an initialization vector and a compressed application data file from the BACKUP file, decompress the compressed application data file, decrypt the decompressed application data file through the obtained BACKUP KEY and the initialization vector to obtain a final plaintext file data stream, write the final plaintext file into the plaintext BACKUP file, and read and restore through an application program, namely, perform data restoration according to the reverse order of S5-S1.
Example two
Referring to fig. 2, a backup terminal for instant messaging application data in this embodiment includes a memory, a processor and a computer program stored in the memory and capable of running on the processor, where the processor implements each step in the backup method for instant messaging application data in the first embodiment when executing the computer program.
In summary, according to the backup method and terminal for instant messaging application data provided by the invention, when a key file does not exist 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 an 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 can not be opened and restored, the backup key for encrypting the data is also stored by encrypting, even if the android device is lost, the backup file and the key file in the device can not be obtained by others, and the backup key of the backup file can be obtained by decrypting the key file only after the user login authentication is passed in the data restoring process, thereby realizing the safe backup of the instant messaging application data, further enhancing the safety of the application data and furthest reducing the risk of user privacy data leakage.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.

Claims (6)

1. The backup method of the instant messaging application data is characterized by comprising the following steps:
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 an 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;
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, wherein the step of obtaining the encrypted application data file to be backed up comprises the following steps:
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;
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;
the step of encrypting the backup key to obtain the encrypted backup key comprises the following steps:
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 an encrypted backup key.
2. The method of claim 1, wherein generating the user unique identification and the backup key comprises:
acquiring a user ID corresponding to the application data file to be backed up and a time corresponding to the backup request;
performing abstract calculation on the user ID by using a first hash algorithm 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 parameters, and intercepting preset bits 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 for backing up instant messaging application data according to claim 1, wherein the 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 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 includes:
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 unique user identity, the initialization vector, the compressed application data file to be backed up, the first calculated value and the preset file ending mark.
4. 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 when executing the computer program performs the steps of:
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 an 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;
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, wherein the step of obtaining the encrypted application data file to be backed up comprises the following steps:
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;
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;
the step of encrypting the backup key to obtain the encrypted backup key comprises the following steps:
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 an encrypted backup key.
5. The backup terminal for instant messaging application data of claim 4, wherein the generating the user unique identification and backup key comprises:
acquiring a user ID corresponding to the application data file to be backed up and a time corresponding to the backup request;
performing abstract calculation on the user ID by using a first hash algorithm 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 parameters, and intercepting preset bits 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.
6. The backup terminal for instant messaging application data according to claim 4, wherein the 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 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 includes:
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 unique user identity, the initialization vector, the compressed application data file to be backed up, the first calculated value and the preset file ending mark.
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 CN114938358A (en) 2022-08-23
CN114938358B true 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 (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103546281A (en) * 2013-10-31 2014-01-29 厦门市美亚柏科信息股份有限公司 Dynamic secret key generating method and device
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

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8510552B2 (en) * 2010-04-07 2013-08-13 Apple Inc. System and method for file-level data protection
GB2532039B (en) * 2014-11-06 2016-09-21 Ibm Secure database backup and recovery

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103546281A (en) * 2013-10-31 2014-01-29 厦门市美亚柏科信息股份有限公司 Dynamic secret key generating method and device
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
CN114938358A (en) 2022-08-23

Similar Documents

Publication Publication Date Title
CN104852925B (en) Mobile intelligent terminal anti-data-leakage secure storage, backup method
CN111245802B (en) Data transmission security control method, server and terminal
US8621189B2 (en) System and method for hardware strengthened passwords
CN112311865B (en) File encryption transmission method and device
CN102567688B (en) File confidentiality keeping system and file confidentiality keeping method on Android operating system
CN113067699B (en) Data sharing method and device based on quantum key and computer equipment
CN104834868A (en) Electronic data protection method, device and terminal equipment
CN108632021A (en) A kind of key encryption method, device and system
CN109684129B (en) Data backup recovery method, storage medium, encryption machine, client and server
CN113190584B (en) Concealed trace query method based on oblivious transmission protocol
CN109510702A (en) A method of it key storage based on computer characteristic code and uses
CN111884814A (en) Method and system for preventing counterfeiting of intelligent terminal
CN109934013A (en) A kind of data guard method and device
CN113722741A (en) Data encryption method and device and data decryption method and device
CN109118187A (en) Restoration methods, device and the computer readable storage medium of block chain wallet
CN112199730A (en) Method and device for processing application data on terminal and electronic equipment
CN114938358B (en) Backup method and terminal for instant messaging application data
KR102216869B1 (en) Apparatus and method for decrypting end-to-end encrypted files
EP2469441A1 (en) System and method for hardware strenghtened passwords
CN112651038B (en) VR resource safety protection method and terminal capable of reducing space and time
CN115766244A (en) Internet of vehicles information encryption method and device, computer equipment and storage medium
CN115603907A (en) Method, device, equipment and storage medium for encrypting storage data
CN103838986A (en) Multimedia file encryption method and device
CN115022042A (en) Compliance code verification method for protecting data privacy and computer readable medium
CN108184230B (en) System and method for realizing encryption of soft SIM

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