CN107992757B - File encryption and decryption method and device - Google Patents

File encryption and decryption method and device Download PDF

Info

Publication number
CN107992757B
CN107992757B CN201610975289.8A CN201610975289A CN107992757B CN 107992757 B CN107992757 B CN 107992757B CN 201610975289 A CN201610975289 A CN 201610975289A CN 107992757 B CN107992757 B CN 107992757B
Authority
CN
China
Prior art keywords
file
data
encryption
password
file data
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
CN201610975289.8A
Other languages
Chinese (zh)
Other versions
CN107992757A (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.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Kingsoft Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201610975289.8A priority Critical patent/CN107992757B/en
Publication of CN107992757A publication Critical patent/CN107992757A/en
Application granted granted Critical
Publication of CN107992757B publication Critical patent/CN107992757B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses a file encryption and decryption method and a device, wherein the method comprises the following steps: receiving a first trigger instruction, wherein the first trigger instruction is used for triggering the encryption operation of a file; acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file; selecting second file data from a pre-stored database, and encrypting the second file data by adopting a preset second encryption password; storing the encrypted first file data and the encrypted second file data in the same file.

Description

File encryption and decryption method and device
Technical Field
The present invention relates to file encryption technologies, and in particular, to a method and an apparatus for encrypting and decrypting a file.
Background
The security and confidentiality of documents has always been one of the most fundamental needs in the office field. At present, the most widely used encryption means is to set a corresponding password for a file, encrypt the content of the file in a symmetric encryption manner, and then store the encrypted content in a specific file stream format. When opening the file, firstly inputting the password, judging whether the password is correct, if so, displaying the content of the file, otherwise, prompting that the password is incorrect and requiring to input the password again. The scheme depends on the selection of the password strength and the encryption algorithm, the possibility that the password with weak safety and the encryption algorithm with weak safety are cracked violently is very high, and the safety of the file cannot be guaranteed.
Disclosure of Invention
In order to solve the technical problem, the invention provides a file encryption and decryption method and device, which can improve the security of a file.
In order to achieve the object of the present invention, the present invention provides a file encryption method, including:
receiving a first trigger instruction, wherein the first trigger instruction is used for triggering a first encryption operation of a file;
acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
selecting second file data from pre-stored data, and encrypting the second file data by adopting a preset second encryption password;
storing the encrypted first file data and the encrypted second file data in the same file.
Optionally, the selecting the second file data from the pre-stored data includes:
and randomly selecting second file data from the pre-stored data.
Optionally, the selecting the second file data from the pre-stored data includes:
and selecting second file data from prestored data according to the type information of the first file data.
Optionally, the method further includes:
and in the first encryption operation process, only displaying the content of the first file data in a display interface.
Optionally, the method further includes:
receiving a second trigger instruction, wherein the second trigger instruction is used for triggering second encryption operation of the file;
acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
storing the encrypted first file data in a file.
The invention also provides a file decryption method, which comprises the following steps:
receiving a third trigger instruction, wherein the third trigger instruction is used for triggering the operation of opening a file;
displaying a password input interface on a display interface;
acquiring and judging whether an externally input password is a first encrypted password, and if so, displaying the content of the first file data on a display interface; the first file data is original data of a file, and the first encryption password is an encryption password of the first file data;
if not, and the times of inputting the password from the outside exceed the preset value, displaying the content of the second file data on the display interface; the second file data is data stored in the same file as the first file data.
Optionally, the displaying the content of the second file data on the display interface includes:
decrypting the encrypted second file data in the file by using a second encryption password, and displaying the decrypted second file data on a display interface; the second encryption password is a preset password.
Optionally, the content of the second file data displayed on the display interface is in a read-only mode or an editable mode.
The invention also provides a file encryption device, which comprises:
the device comprises a first receiving module, a first encryption module and a second receiving module, wherein the first receiving module is used for receiving a first trigger instruction, and the first trigger instruction is used for triggering first encryption operation of a file;
the encryption processing module is used for acquiring a first encryption password and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file; selecting second file data from pre-stored data, and encrypting the second file data by adopting a preset second encryption password;
and the storage module is used for storing the encrypted first file data and the encrypted second file data in the same file.
Optionally, the encryption processing module includes:
the first encryption module is used for acquiring a first encryption password and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
the second encryption module is used for randomly selecting second file data from prestored data and encrypting the second file data by adopting a preset second encryption password; or selecting second file data from pre-stored data according to the type information of the first file data, and encrypting the second file data by adopting a preset second encryption password.
Optionally, the apparatus further comprises:
and the first display module is used for only displaying the content of the first file data in a display interface in the first encryption operation process.
Optionally, the first receiving module is further configured to receive a second trigger instruction, where the second trigger instruction is used to trigger a second encryption operation of the file;
the storage module is further configured to store the encrypted first file data in a file.
The invention also provides a file decryption device, which comprises:
the second receiving module is used for receiving a third trigger instruction, and the third trigger instruction is used for triggering the operation of opening the file;
the decryption processing module is used for acquiring and judging whether the password input from the outside is the first encrypted password, and if so, informing the second display module to display the content of the first file data on the display interface; if not, and the times of inputting the password from the outside exceed the preset value, informing a second display module to display the content of the second file data on a display interface;
the second display module is used for displaying a password input interface on the display interface; after receiving the notification of the decryption processing module, displaying the content of the first file data or the content of the second file data on a display interface;
the first file data is original data of a file, and the first encryption password is an encryption password of the first file data; the second file data is data stored in the same file as the first file data.
Optionally, the content of the second file data displayed on the display interface by the second display module is in a read-only mode or an editable mode.
Compared with the prior art, the invention comprises the following steps: receiving a first trigger instruction, wherein the first trigger instruction is used for triggering the encryption operation of a file; acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file; selecting second file data from a pre-stored database, and encrypting the second file data by adopting a preset second encryption password; storing the encrypted first file data and the encrypted second file data in the same file. According to the embodiment of the invention, the password input by the user is judged when the file is opened, if the user inputs the wrong password and the number of times of inputting the wrong password exceeds the preset number of times, the file is opened in the same way, and only the content displayed in the file is replaced by other data (second file data) instead of the original data (first file data) of the file, so that a malicious operator can mistakenly think that the password is successfully cracked, and the safety of the original file is ensured.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the example serve to explain the principles of the invention and not to limit the invention.
FIG. 1 is a first flowchart illustrating a file encryption method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a file encryption method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a file decryption method according to an embodiment of the present invention;
FIG. 4 is a first schematic diagram of a file encryption apparatus according to an embodiment of the present invention;
FIG. 5 is a second schematic diagram of a file encryption apparatus according to an embodiment of the present invention;
FIG. 6 is a third schematic view of a file encryption apparatus according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a file decryption apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
The steps illustrated in the flow charts of the figures may be performed in a computer system such as a set of computer-executable instructions. Also, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
Example one
An embodiment of the present invention provides a file encryption method, as shown in fig. 1, the method includes:
step 101: receiving a first trigger instruction, wherein the first trigger instruction is used for triggering a first encryption operation of a file;
step 102: acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
step 103: selecting second file data from pre-stored data, and encrypting the second file data by adopting a preset second encryption password;
step 104: storing the encrypted first file data and the encrypted second file data in the same file.
Here, it should be noted that the execution order of the steps 102 and 103 is not limited, and the precedence and the conversion can also be performed simultaneously. The first file data is original data of the file, namely data saved by a file user. The first triggering instruction may be a user triggering a corresponding button option in a menu, such as: the "masquerading encryption function (which may of course be another designation)" is selected (checked) in the menu "file" - > "file encryption" option.
According to the embodiment of the invention, the password input by the user is judged when the file is opened, if the user inputs the wrong password and the number of times of inputting the wrong password exceeds the preset number of times, the file is opened in the same way, and only the content displayed in the file is not the original data of the file but is replaced by other data (second file data), so that a malicious operator can mistakenly think that the password is successfully cracked, and the safety of the original file is ensured.
Optionally, the selecting the second file data from the pre-stored data includes: and randomly selecting second file data from the pre-stored data.
In practical applications, a database, such as a big data database, may be provided in the system, wherein a large amount of data of different types are pre-stored, and the data may be stored according to the type, for example: poetry, office documents, statistical tables and the like can be divided according to actual application; in the first encryption operation, a piece of data may be randomly extracted from the database as the second file data.
Optionally, the selecting the second file data from the pre-stored data includes: and selecting second file data from prestored data according to the type information of the first file data.
For example: the type of the first file data is poem, and then one piece of data can be selected from the stored poem data in the database according to the type to serve as the second file data.
Optionally, the method further includes: and in the first encryption operation process, only displaying the content of the first file data in a display interface.
When the first encryption operation is performed on the file, only the content of the first file data, namely the content edited by the user, is displayed in the display interface until the encryption operation is finished, and the file is closed and saved. That is, the content displayed in the display interface of the first encryption operation process is the same as the content displayed in the display interface of the existing file encryption process.
Example two
An embodiment of the present invention provides a file encryption method, as shown in fig. 1, the method includes:
step 101: receiving a first trigger instruction, wherein the first trigger instruction is used for triggering a first encryption operation of a file;
step 102: acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
step 103: selecting second file data from pre-stored data, and encrypting the second file data by adopting a preset second encryption password;
step 104: storing the encrypted first file data and the encrypted second file data in the same file.
Here, it should be noted that the execution order of the steps 102 and 103 is not limited, and the precedence and the conversion can also be performed simultaneously. The first file data is original data of the file, namely data saved by a file user. The first triggering instruction may be a user triggering a corresponding button option in a menu, such as: the "masquerading encryption function (which may of course be another designation)" is selected (checked) in the menu "file" - > "file encryption" option.
According to the embodiment of the invention, the password input by the user is judged when the file is opened, if the user inputs the wrong password and the number of times of inputting the wrong password exceeds the preset number of times, the file is opened in the same way, and only the content displayed in the file is not the original data of the file but is replaced by other data (second file data), so that a malicious operator can mistakenly think that the password is successfully cracked, and the safety of the original file is ensured.
Optionally, as shown in fig. 2, the method further includes:
step 201: receiving a second trigger instruction, wherein the second trigger instruction is used for triggering second encryption operation of the file;
step 202: acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
step 203: storing the encrypted first file data in a file.
Here, the second triggering instruction may be a user triggering a corresponding button option in a menu, for example: the "normal encryption function (i.e., the existing file encryption function)" is selected (checked) in the menu "file" - > "file encryption" option.
Step 202 is the same as step 102, namely, an encryption password input by a user (for example, input through a dialog box or the like) is obtained, and the encryption password is applied to encrypt the file data (first file data) edited by the user, and a corresponding encryption method may be a related encryption method, which is not described in detail here.
Therefore, the user can select to encrypt the file data by using a general encryption method or select an encryption method with higher security in the first embodiment.
Optionally, the selecting the second file data from the pre-stored data includes: and randomly selecting second file data from the pre-stored data.
In practical applications, a database, such as a big data database, may be provided in the system, wherein a large amount of data of different types are pre-stored, and the data may be stored according to the type, for example: poetry, office documents, statistical tables and the like can be divided according to actual application; in the first encryption operation, a piece of data may be randomly extracted from the database as the second file data.
Optionally, the selecting the second file data from the pre-stored data includes: and selecting second file data from prestored data according to the type information of the first file data.
For example: the type of the first file data is poem, and then one piece of data can be selected from the stored poem data in the database according to the type to serve as the second file data.
Optionally, the method further includes: and in the first encryption operation process, only displaying the content of the first file data in a display interface.
When the first encryption operation is performed on the file, only the content of the first file data, namely the content edited by the user, is displayed in the display interface until the encryption operation is finished, and the file is closed and saved. That is, the content displayed in the display interface of the first encryption operation process is the same as the content displayed in the display interface of the existing file encryption process.
EXAMPLE III
An embodiment of the present invention further provides a file decryption method, as shown in fig. 3, the method includes:
step 301: receiving a third trigger instruction, wherein the third trigger instruction is used for triggering the operation of opening a file;
step 302: displaying a password input interface on a display interface;
step 303: acquiring and judging whether an externally input password is a first encrypted password;
step 304: if yes, displaying the content of the first file data on a display interface; the first file data is original data of a file, and the first encryption password is an encryption password of the first file data;
step 305: if not, and the times of inputting the password from the outside exceed the preset value, displaying the content of the second file data on the display interface; the second file data is data stored in the same file as the first file data.
According to the embodiment of the invention, the password input by the user is judged when the file is opened, if the user inputs the wrong password and the number of times of inputting the wrong password exceeds the preset number of times, the file is opened in the same way, and only the content displayed in the file is not the original data of the file but is replaced by other data (second file data), so that a malicious operator can mistakenly think that the password is successfully cracked, and the safety of the original file is ensured.
Wherein, the displaying the content of the second file data on the display interface includes:
decrypting the encrypted second file data in the file by using a second encryption password, and displaying the decrypted second file data on a display interface; the second encryption password is a preset password.
In this embodiment, the third trigger instruction may be an operation of clicking a trigger file icon by a user, and after receiving the third trigger instruction, a password input interface may pop up on the display interface for the user to input a password. If the user is a legal user (file originator) of the file, the user can input a correct password (namely, a first encryption password), the file is opened, and the first file data stored before is displayed; if the user is an illegal user, the illegal user will try to input the password, if the input password is wrong and exceeds, such as: thirdly, the system decrypts the encrypted second file data in the file by using a preset second encryption password and displays the decrypted second file data on a display interface; the second encryption password is a preset password.
As in the first embodiment, a database, such as a big data database, may be provided in the system, wherein a large amount of data of different types are pre-stored, and the data may be stored according to the type, for example: poetry, office documents, statistical tables and the like can be divided according to actual application; the second file data is the data in the database.
Optionally, the content of the second file data displayed on the display interface is in a read-only mode or an editable mode.
Here, if a legitimate user (file originator) of the file forgets the first encryption password, the file may be opened even after inputting the error password three times, and the second file data may be displayed in a read-only mode in order to remind the user that the current file data is erroneous, so that the user cannot edit the file data and can recognize that there is a problem with the file. Therefore, the aim of reminding the user of file data errors can be achieved.
Similarly, if the opened file data is in the editable mode, the data in the file is regarded as the original data (first file data) for the illegal user, so that misleading is performed on the illegal user, and the security of the original file is guaranteed.
Example four
An embodiment of the present invention provides a file encryption apparatus, as shown in fig. 4, the apparatus includes:
a first receiving module 401, configured to receive a first trigger instruction, where the first trigger instruction is used to trigger a first encryption operation of a file;
an encryption processing module 402, configured to obtain a first encryption password, and encrypt first file data by using the first encryption password, where the first encryption password is a password input from the outside, and the first file data is original data of a file; selecting second file data from pre-stored data, and encrypting the second file data by adopting a preset second encryption password;
a storage module 403, configured to store the encrypted first file data and the encrypted second file data in the same file.
Here, the first file data is original data of a file, that is, data saved by a user editing the file. The first triggering instruction may be a user triggering a corresponding button option in a menu, such as: the "masquerading encryption function (which may of course be another designation)" is selected (checked) in the menu "file" - > "file encryption" option.
According to the embodiment of the invention, the password input by the user is judged when the file is opened, if the user inputs the wrong password and the number of times of inputting the wrong password exceeds the preset number of times, the file is opened in the same way, and only the content displayed in the file is not the original data of the file but is replaced by other data (second file data), so that a malicious operator can mistakenly think that the password is successfully cracked, and the safety of the original file is ensured.
Optionally, as shown in fig. 5, the encryption processing module 402 includes:
the first encryption module 4021 is configured to obtain a first encryption password, and encrypt first file data by using the first encryption password, where the first encryption password is an externally input password, and the first file data is original data of a file;
the second encryption module 4022 is configured to randomly select second file data from pre-stored data, and encrypt the second file data by using a preset second encryption password; or selecting second file data from pre-stored data according to the type information of the first file data, and encrypting the second file data by adopting a preset second encryption password.
In practical applications, a database, such as a big data database, may be provided in the system, wherein a large amount of data of different types are pre-stored, and the data may be stored according to the type, for example: poetry, office documents, statistical tables and the like can be divided according to actual application; in the first encryption operation, a piece of data may be randomly extracted from the database as the second file data.
For example: the type of the first file data is poem, and then one piece of data can be selected from the stored poem data in the database according to the type to serve as the second file data.
Optionally, as shown in fig. 6, the apparatus further includes:
a first display module 404, configured to display only the content of the first file data in a display interface in the first encryption operation process.
Here, when the first encryption operation is performed on the file, the first display module 404 displays only the content of the first file data, that is, the content edited by the user, in the display interface until the encryption operation is completed, and closes and saves the document. That is, the content displayed in the display interface of the first encryption operation process is the same as the content displayed in the display interface of the existing file encryption process.
Optionally, the first receiving module 401 is further configured to receive a second trigger instruction, where the second trigger instruction is used to trigger a second encryption operation of the file;
the storage module 403 is further configured to store the encrypted first file data in a file.
Here, the second triggering instruction may be a user triggering a corresponding button option in a menu, for example: the "normal encryption function (i.e., the existing file encryption function)" is selected (checked) in the menu "file" - > "file encryption" option.
Therefore, the user can select to encrypt the file data by using a general encryption method or select an encryption method with higher security in the first embodiment.
EXAMPLE five
An embodiment of the present invention further provides a file decryption apparatus, as shown in fig. 7, the apparatus includes:
a second receiving module 701, configured to receive a third trigger instruction, where the third trigger instruction is used to trigger an operation of opening a file;
the decryption processing module 702 is configured to obtain and determine whether an externally input password is a first encrypted password, and if so, notify the second display module to display the content of the first file data on the display interface; if not, and the times of inputting the password from the outside exceed the preset value, informing a second display module to display the content of the second file data on a display interface;
the second display module 703 is configured to display a password input interface on a display interface; after receiving the notification of the decryption processing module, displaying the content of the first file data or the content of the second file data on a display interface;
the first file data is original data of a file, and the first encryption password is an encryption password of the first file data; the second file data is data stored in the same file as the first file data.
In the embodiment of the present invention, the decryption processing module 702 determines the password input by the user when opening the file, and if the user inputs an incorrect password and the number of times of inputting the incorrect password exceeds the preset number of times, the file is opened in the same way, but the content displayed in the file by the second display module 703 is replaced by other data (second file data) instead of the original data of the file, so that a malicious operator may mistakenly think that the password is successfully cracked, thereby ensuring the security of the original file.
The second display module 703 displays the content of the second file data on a display interface, including:
the decryption processing module 702 decrypts the encrypted second file data in the file by using the second encryption password, and notifies the second display module 703 of displaying the decrypted second file data on a display interface; the second encryption password is a preset password.
In this embodiment, the third trigger instruction may be an operation of clicking a trigger file icon by a user, and after receiving the third trigger instruction, a password input interface may pop up on the display interface for the user to input a password. If the user is a legal user (file originator) of the file, the user can input a correct password (namely, a first encryption password), the file is opened, and the first file data stored before is displayed; if the user is an illegal user, the illegal user will try to input the password, if the input password is wrong and exceeds, such as: thirdly, the system decrypts the encrypted second file data in the file by using a preset second encryption password and displays the decrypted second file data on a display interface; the second encryption password is a preset password.
As in the first embodiment, a database, such as a big data database, may be provided in the system, wherein a large amount of data of different types are pre-stored, and the data may be stored according to the type, for example: poetry, office documents, statistical tables and the like can be divided according to actual application; the second file data is the data in the database.
Optionally, the content of the second file data displayed on the display interface by the second display module 703 is in a read-only mode or an editable mode.
Here, if a legitimate user (file originator) of the file forgets the first encryption password, the file may be opened even after inputting the error password three times, and the second file data may be displayed in a read-only mode in order to remind the user that the current file data is erroneous, so that the user cannot edit the file data and can recognize that there is a problem with the file. Therefore, the aim of reminding the user of file data errors can be achieved.
Similarly, if the opened file data is in the editable mode, the data in the file is regarded as the original data (first file data) for the illegal user, so that misleading is performed on the illegal user, and the security of the original file is guaranteed.
In practical applications, each module in the file encrypting and decrypting apparatus according to the embodiment of the present invention may be implemented by a processor in the file encrypting and decrypting apparatus, or may be implemented by a specific logic circuit; for example, in practical applications, the file encryption and decryption apparatus may be implemented by a Central Processing Unit (CPU), a microprocessor unit (MPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), or the like.
Here, it should be noted that: the descriptions of the embodiments of the apparatus are similar to the descriptions of the methods, and have the same advantages as the embodiments of the methods, and therefore are not repeated herein. For technical details that are not disclosed in the embodiments of the apparatus of the present invention, those skilled in the art should refer to the description of the embodiments of the method of the present invention to understand, and for brevity, will not be described again here.
Although the embodiments of the present invention have been described above, the above description is only for the convenience of understanding the present invention, and is not intended to limit the present invention. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (14)

1. A method for encrypting a file, the method comprising:
receiving a first trigger instruction, wherein the first trigger instruction is used for triggering a first encryption operation of a file;
acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
selecting second file data from pre-stored data, and encrypting the second file data by adopting a preset second encryption password;
storing the encrypted first file data and the encrypted second file data in the same file;
and the second file data is used for replacing the first file data to display when the file is cracked by the password.
2. The file encryption method according to claim 1, wherein said selecting the second file data from the pre-stored data comprises:
and randomly selecting second file data from the pre-stored data.
3. The file encryption method according to claim 1, wherein said selecting the second file data from the pre-stored data comprises:
and selecting second file data from prestored data according to the type information of the first file data.
4. The file encryption method according to claim 1, further comprising:
and in the first encryption operation process, only displaying the content of the first file data in a display interface.
5. The file encryption method according to any one of claims 1 to 4, characterized in that the method further comprises:
receiving a second trigger instruction, wherein the second trigger instruction is used for triggering second encryption operation of the file;
acquiring a first encryption password, and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
storing the encrypted first file data in a file.
6. A method for decrypting a file, the method comprising:
receiving a third trigger instruction, wherein the third trigger instruction is used for triggering the operation of opening a file;
displaying a password input interface on a display interface;
acquiring and judging whether an externally input password is a first encrypted password, and if so, displaying the content of the first file data on a display interface; the first file data is original data of a file, and the first encryption password is an encryption password of the first file data;
if not, and the times of inputting the password from the outside exceed the preset value, displaying the content of the second file data on the display interface; the encrypted second file data is data stored in the same file as the encrypted first file data; the encrypted second file data is obtained by encrypting the second file data according to a second encryption password.
7. The file decryption method according to claim 6, wherein the displaying the content of the second file data on the display interface comprises:
decrypting the encrypted second file data in the file by using a second encryption password, and displaying the decrypted second file data on a display interface; the second encryption password is a preset password.
8. The file decryption method of claim 6, wherein the content of the second file data displayed on the display interface is in a read-only mode or an editable mode.
9. A file encryption apparatus, comprising:
the device comprises a first receiving module, a first encryption module and a second receiving module, wherein the first receiving module is used for receiving a first trigger instruction, and the first trigger instruction is used for triggering first encryption operation of a file;
the encryption processing module is used for acquiring a first encryption password and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file; selecting second file data from pre-stored data, and encrypting the second file data by adopting a preset second encryption password;
the storage module is used for storing the encrypted first file data and the encrypted second file data in the same file;
and the second file data is used for replacing the first file data to display when the file is cracked by the password.
10. The file encryption apparatus according to claim 9, wherein the encryption processing module includes:
the first encryption module is used for acquiring a first encryption password and encrypting first file data by adopting the first encryption password, wherein the first encryption password is a password input from the outside, and the first file data is original data of a file;
the second encryption module is used for randomly selecting second file data from prestored data and encrypting the second file data by adopting a preset second encryption password; or selecting second file data from pre-stored data according to the type information of the first file data, and encrypting the second file data by adopting a preset second encryption password.
11. The file encryption apparatus according to claim 9, characterized in that the apparatus further comprises:
and the first display module is used for only displaying the content of the first file data in a display interface in the first encryption operation process.
12. The file encryption apparatus according to any one of claims 9 to 11,
the first receiving module is further configured to receive a second trigger instruction, where the second trigger instruction is used to trigger a second encryption operation of the file;
the storage module is further configured to store the encrypted first file data in a file.
13. A file decryption apparatus, characterized in that the apparatus comprises:
the second receiving module is used for receiving a third trigger instruction, and the third trigger instruction is used for triggering the operation of opening the file;
the decryption processing module is used for acquiring and judging whether the password input from the outside is the first encrypted password, and if so, informing the second display module to display the content of the first file data on the display interface; if not, and the times of inputting the password from the outside exceed the preset value, informing a second display module to display the content of the second file data on a display interface;
the second display module is used for displaying a password input interface on the display interface; after receiving the notification of the decryption processing module, displaying the content of the first file data or the content of the second file data on a display interface;
the first file data is original data of a file, and the first encryption password is an encryption password of the first file data; the encrypted second file data is data stored in the same file as the encrypted first file data; the encrypted second file data is obtained by encrypting the second file data according to a second encryption password.
14. The file decryption apparatus according to claim 13, wherein the content of the second file data displayed on the display interface by the second display module is in a read-only mode or an editable mode.
CN201610975289.8A 2016-10-27 2016-10-27 File encryption and decryption method and device Active CN107992757B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610975289.8A CN107992757B (en) 2016-10-27 2016-10-27 File encryption and decryption method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610975289.8A CN107992757B (en) 2016-10-27 2016-10-27 File encryption and decryption method and device

Publications (2)

Publication Number Publication Date
CN107992757A CN107992757A (en) 2018-05-04
CN107992757B true CN107992757B (en) 2021-11-16

Family

ID=62029566

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610975289.8A Active CN107992757B (en) 2016-10-27 2016-10-27 File encryption and decryption method and device

Country Status (1)

Country Link
CN (1) CN107992757B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113872970B (en) * 2021-09-28 2022-12-20 北京天融信网络安全技术有限公司 Data access method, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102750497A (en) * 2012-07-20 2012-10-24 腾讯科技(深圳)有限公司 Method and device for deciphering private information
CN103455761A (en) * 2012-05-28 2013-12-18 联想(北京)有限公司 File encryption and decryption method and device and electronic device
CN105260668A (en) * 2015-10-10 2016-01-20 北京搜狗科技发展有限公司 File encryption method and electronic device
CN105760765A (en) * 2016-02-04 2016-07-13 北京致远协创软件有限公司 Data encrypting method and device and data decrypting method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101026822A (en) * 2006-02-24 2007-08-29 江苏高通科技实业有限公司 Method for protecting mobile phone private data
CN103729583B (en) * 2012-10-16 2016-12-21 纬创资通股份有限公司 Data guard method and electronic installation
CN103559451A (en) * 2013-10-21 2014-02-05 宇龙计算机通信科技(深圳)有限公司 Method and device for protecting and displaying privacy information

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455761A (en) * 2012-05-28 2013-12-18 联想(北京)有限公司 File encryption and decryption method and device and electronic device
CN102750497A (en) * 2012-07-20 2012-10-24 腾讯科技(深圳)有限公司 Method and device for deciphering private information
CN105260668A (en) * 2015-10-10 2016-01-20 北京搜狗科技发展有限公司 File encryption method and electronic device
CN105760765A (en) * 2016-02-04 2016-07-13 北京致远协创软件有限公司 Data encrypting method and device and data decrypting method and device

Also Published As

Publication number Publication date
CN107992757A (en) 2018-05-04

Similar Documents

Publication Publication Date Title
US10972908B2 (en) Wireless network connection method, apparatus, and system
US9489518B2 (en) Method and device for unlocking screen
CN104660589B (en) Method, system and terminal for encrypting control and information analysis of information
US20170147802A1 (en) Message display method and apparatus
US10984114B2 (en) Document processing method and apparatus
CN106599723B (en) File encryption method and device and file decryption method and device
CN102750497B (en) Method and device for deciphering private information
CN106650355B (en) Method and device for protecting function call
AU2014202499B2 (en) Method for copy-protected storage of information on a data carrier
CN106685897B (en) Safe input method, device and system
CN105426721A (en) Picture encryption method and device
CN107992757B (en) File encryption and decryption method and device
CN105160261A (en) File encryption and decryption method and device
CN111079170B (en) Control method and control device of solid state disk
CN113127844A (en) Variable access method, device, system, equipment and medium
US8781128B2 (en) Method and device for automatically distributing updated key material
CN111259387B (en) Method and device for detecting tampered application
CN106022147A (en) Method and device for file encryption and decryption
US9633212B2 (en) Intelligent key selection and generation
CN116451257B (en) Encryption method and system for database data and electronic equipment
US20140115697A1 (en) Data Management Method and Apparatus
WO2019066668A1 (en) System, device and method for fingerprint authentication using a watermarked digital image
CN115270150A (en) Communication data encryption method, device, equipment and storage medium thereof
CN117527747A (en) Mail sending method and device and electronic equipment
EP2418800A1 (en) Method and device for automatically distributing updated key material

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