Method for processing privatized format files, electronic equipment and medium

By encrypting and signing the file using the cryptographic lock's license and device private key in the private format file, the problem of protection and management of the private format file is solved, and the security and legal access of the file content is achieved.

CN114329564BActive Publication Date: 2024-11-12SHANGHAI WEIBAI TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202111654641.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2024-11-12
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

The prior art is difficult to effectively protect and manage privatized format files, especially in the case where file content is maliciously cracked and illegally modified, and the keys of privatized format files are easily obtained by attackers.

Method used

Encrypt file data using permissions in the encryption lock, and use the device private key to persist the encrypted and signed data, ensuring that the file content is always encrypted outside the memory of the electronic device, and only legal software is allowed to decrypt and edit.

Benefits of technology

Effectively prevent the content of the privatized format file from being maliciously cracked and illegally modified, ensure the integrity and legality of the file, and only allow users who hold legal decryption keys to access and edit.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114329564B_ABST
    Figure CN114329564B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for processing a private format file. The method is applied to an electronic device, and includes: receiving a first operation for a first file, the first file is a private format file, the first file is located in the memory of the electronic device, and the first operation is used to instruct a specific software to store the first file; encrypting the first data by an encryption lock to obtain the second data, wherein the first file includes the first data; signing the first data based on the device private key in the encryption lock to obtain the fourth data; wherein the device private key corresponds to the developer of the specific software associated with the private format file; and persistently storing the second file including the second data, the fourth data, and the certificate chain. With the above implementation method, the user can open, edit, and store the private format file only if he can legally use the specific software and holds a specific encryption lock that can decrypt the private format file, which can prevent the file content from being maliciously acquired.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of file processing technology, and in particular to a method for processing files in a private format. In addition, the present application also relates to an electronic device and a computer-readable storage medium. Background Art

[0002] In some systems, such as Windows, files can be divided into many types according to different formats and purposes. For ease of management and identification, files can generally be distinguished by extension when naming. That is, the file name format can be "main file name. extension". In this way, the system can determine the type of file based on the extension in the file name, and then determine its format and purpose. The extension has almost become an indispensable part of every file name. For some operating systems, if a file name does not have an extension, then the operating system cannot process the file and cannot determine how to process the file.

[0003] For some files, their types are relatively common, and a variety of common software can open these files and perform operations such as editing and saving on them. For other files, they may be independently developed by a software developer and have a private extension. Such files can be called private format files. Generally, only one or several specific software developed by the software developer can open these files. This approach can maintain the autonomy and independence of the software developed by the software developer to a certain extent. This also protects the content of these private format files to a certain extent. Summary of the invention

[0004] One of the purposes of the present application is to provide a method for encrypting and decrypting private format files, so as to better protect these private format files.

[0005] The first aspect of the present application provides a method for processing a private format file, comprising:

[0006] The electronic device receives a first operation on a first file, the first file is a private format file, the first file is located in a memory of the electronic device, and the first operation is used to instruct specific software to store the first file;

[0007] The electronic device encrypts the first data through the encryption lock based on the license in the encryption lock to obtain the second data, wherein the first file includes the first data;

[0008] The electronic device signs the first data through the dongle based on the device private key in the dongle to obtain fourth data; wherein the device private key corresponds to the developer of the specific software associated with the privatization format file;

[0009] The electronic device persistently stores a second file, which is a private format file and includes: the second data, the fourth data and a certificate chain; wherein the certificate chain comes from the encryption lock and is used to verify the fourth data.

[0010] In combination with the first aspect, in a possible implementation manner, the encryption lock includes at least one preset file type;

[0011] The second data is: data obtained by encrypting the first data by the encryption lock when the type of the first file matches any one of the at least one preset file type; and / or,

[0012] The fourth data is data obtained by signing the first data with the encryption lock when the first file matches any one of the at least one preset file type.

[0013] In combination with the first aspect, in a possible implementation manner, the electronic device signs the first data based on a device private key in the dongle through the dongle to obtain fourth data, including:

[0014] The electronic device processes the first data to obtain third data;

[0015] The electronic device transmits the third data to the encryption lock;

[0016] The electronic device receives the fourth data from the dongle, where the fourth data is obtained by the dongle signing the third data based on the device private key.

[0017] In combination with the first aspect, in a possible implementation manner, the fourth data is obtained by the encryption lock signing the first data or the third data based on the device private key and based on the signature result and the unique identifier of the encryption lock.

[0018] In combination with the first aspect, in a possible implementation manner, the method further includes:

[0019] In the case where the second file is modified and the storage of the modified second file is indicated, the electronic device encrypts the second data, the fourth data, at least one of the certificate chain and the unique identifier of the encryption lock, and the eighth data through the encryption lock based on the permission in the encryption lock to obtain ninth data; wherein the eighth data is included in the modified second file;

[0020] The electronic device signs the eighth data through the encryption lock based on the device private key in the encryption lock to obtain tenth data;

[0021] The electronic device persistently stores a third file, the third file is a private format file, and the third file includes: the ninth data, the tenth data, and a certificate chain.

[0022] A second aspect of the present application provides a method for processing a private format file, comprising:

[0023] The electronic device receives a second operation on a second file; the second file is a private format file, and the second file includes: second data, fourth data, and a certificate chain; the second operation is used to instruct a specific software to open or edit the second file;

[0024] The electronic device decrypts the second data through the dongle based on the permission in the dongle to obtain fifth data;

[0025] The electronic device verifies the fourth data based on the certificate chain and the fifth data;

[0026] In a case where the fourth data passes the verification, the electronic device allows the second operation on the second file;

[0027] Wherein, when the fourth data passes the verification, the device public key indicated by the certificate chain corresponds to the device private key in the dongle, and the device private key is the developer of the specific software associated with the privatization format file.

[0028] In conjunction with the second aspect, in a possible implementation, the encryption lock includes at least one preset file type;

[0029] The fifth data is: data obtained by the encryption lock decrypting the second data when the type of the second file matches any one of the at least one preset file type; or

[0030] When the type of the second file matches any one of the at least one preset file type, the dongle returns the fifth data to the electronic device.

[0031] In combination with the second aspect, in a possible implementation manner, the step of, by the electronic device, verifying the fourth data based on the certificate chain and the fifth data, includes:

[0032] The electronic device determines sixth data, where the sixth data is data obtained by processing the fifth data;

[0033] The electronic device verifies the legitimacy of the device public key based on the certificate chain, and verifies the fourth data based on the device public key and the sixth data; wherein the certificate chain indicates that the device public key

[0034] A third aspect of the present application provides an electronic device, including:

[0035] a memory configured to store predetermined computer instructions;

[0036] The processor is configured to execute the predetermined computer instructions to implement all or part of the steps of any method of the first aspect or the second aspect.

[0037] A fourth aspect of the present application provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes any one of the methods of the first aspect or the second aspect.

[0038] Using the above-mentioned private format file processing method, when a user changes the content of a private format file and needs to persistently store the changed file, the persistent storage step is not directly performed, but on the one hand, the data in the file is encrypted using the license in the encryption lock to protect the content of the file; on the other hand, the data in the file is signed using the device key in the encryption lock and stored in the file, thereby ensuring the integrity and legitimacy of the encrypted data. In this way, the content of the private format file is always in an encrypted state outside the memory of the electronic device, which can effectively prevent the content of the private format file from being maliciously cracked and obtained, and can also effectively prevent the private format file from being illegally modified. The user can only open, edit, and store the private format file if he can legally use specific software and hold a specific encryption lock that can decrypt the private format file. In addition, this method also records the relevant information of the storer of the private format file (the holder of the encryption lock), which is convenient for tracing the editing history of the private format file. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of the system architecture of an exemplary application scenario of the method of an embodiment of the present application.

[0040] Figure 2The figure is a flowchart of an exemplary encryption method of a private format file of the present application.

[0041] Figure 3 The figure is a flowchart of another exemplary method for encrypting a private format file of the present application.

[0042] Figure 4 The figure is a flowchart of an exemplary method for decrypting a private format file of the present application.

[0043] Figure 5 The figure is a flowchart of an exemplary method for decrypting a private format file of the present application.

[0044] Figure 6 It is a schematic diagram of the structure of an exemplary electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0045] In order to clearly and completely describe the technical solution of the present application, further explanation will be given below in conjunction with embodiments and drawings.

[0046] For some specific software, users often need to purchase a license from the software developer before they can use these software legally and normally. The corresponding private format files can only be opened and edited by these specific software, which protects the contents of these private format files to a certain extent. Especially for ordinary software users, it is difficult to obtain some useful content from the private format files. However, for some attackers with technical capabilities, they may be able to crack the private format files and obtain valuable content from them. For this reason, the embodiment of the present application proposes a processing method for private format files, which can better protect private format files.

[0047] In addition, in some implementations, the private format file may be encrypted, but the encryption key is often stored in plain text in the specific software or in the memory during the operation of the specific software. This makes it relatively easy for an attacker with certain technical capabilities to obtain the key and thus obtain the content in the private format file.

[0048] To this end, the embodiment of the present application provides a new way to protect private format files. When a user changes the content of a private format file and needs to persistently store the changed file, the persistent storage step is not directly performed. Instead, the data in the file is encrypted using the license in the encryption lock to protect the content of the file; on the other hand, the data in the file is signed using the device key in the encryption lock and stored in the file, thereby ensuring the integrity and legitimacy of the encrypted data. In this way, the content of the private format file is always in an encrypted state outside the memory of the electronic device, which can effectively prevent the content of the private format file from being maliciously cracked and obtained, and can also effectively prevent the private format file from being illegally modified. The user can only open, edit, and store the private format file if he can legally use specific software and hold a specific encryption lock that can decrypt the private format file. In addition, in this way, the relevant information of the storer of the private format file (the holder of the encryption lock) is also recorded, which is convenient for tracing the editing history of the private format file.

[0049] For ease of understanding, an exemplary system architecture will be first introduced below, and then the processing method for private format files proposed in the embodiment of the present application, including the encryption process and the corresponding decryption process, will be explained respectively.

[0050] See also Figure 1 , Figure 1 The system architecture diagram of an exemplary application scenario of the method of the embodiment of the present application is as follows. The system includes an electronic device and a dongle.

[0051] The electronic devices in the embodiments of the present application may include, but are not limited to, mobile phones, tablet computers, personal computers (PCs), wearable devices, Internet of Things devices, Internet of Vehicles devices, augmented reality (AR) / virtual reality (VR) devices, personal digital assistants (PDAs), and the like. The present application does not limit the specific product form / type of the electronic devices.

[0052] Specific software can be installed on electronic devices, and these software can be configured to require the permission of the software developer to be used legally under certain conditions. For example, in the construction industry, there are engineering cost software, pricing software, quantity calculation software, construction software, and operation and maintenance software. Many of the files corresponding to these software, such as cost engineering files and pricing engineering files, are in private formats and have their own unique extensions.

[0053] The encryption lock in the embodiment of the present application is an information security device. In a broad sense, encryption locks can include hardware encryption locks, cloud locks, soft locks, etc. Hardware encryption locks can be physically connected to electronic devices through USB, parallel port, etc. to transmit data. For example, specific software installed on an electronic device can access the hardware encryption lock through the USB port, such as Figure 1 As shown. Soft lock mainly refers to an encrypted container stored on an electronic device such as a computer. Certain software on the electronic device can access the local encrypted container through a driver. Cloud lock mainly refers to an encryption lock cloud service running on a server, and can also be understood as an encryption lock entity running on the server. Certain software on an electronic device can access the cloud lock through a network such as the Internet or a local area network. The specific product form of the encryption lock is not limited in the embodiments of the present application.

[0054] It should be noted that in some application scenarios, different users may use the same electronic device or different electronic devices. For example, in the construction industry, a project file may need to be opened, edited, and saved by multiple different professionals to form a complete solution. These multiple professionals may use the same electronic device to edit, or they may use different electronic devices to edit, and this application does not limit this.

[0055] It should also be noted that in the solution of the embodiment of the present application, the user needs to use a dongle when saving a private format file, or when opening or editing a private format file. For a different user, the dongle used may be the same dongle, or it may not be the same dongle. Still taking the construction industry as an example, when editing a project file, multiple different professionals can pass the same dongle to each other, or they can each hold their own dongle. In some implementations, when different professionals each hold their own dongle, these dongles need to have some common features. For example, these different professionals all belong to the same construction company, and the device certificates in the dongles they use are the same or have a certain correlation, and are all issued by the manufacturer of the dongle for the construction company, and can be the only corresponding to the subject of the construction company.

[0056] The embodiment of the present application provides a method for encrypting a file in a private format, which can be performed by an electronic device, or an electronic device and a dongle. For ease of understanding, the following takes a certain file (a first file) as an example to describe the steps of the decryption method performed when the first file needs to be persistently stored.

[0057] See also Figure 2 , Figure 2This is a flowchart of an exemplary method for encrypting a private format file of the present application. The method may include steps S101 to S104.

[0058] S101: The electronic device receives a first operation on a first file.

[0059] The first file may be any private format file. For example, the first file may be a cost engineering file, a pricing engineering file, etc. The electronic device is installed with software corresponding to the first file, such as engineering cost software, engineering pricing software, etc. The first file may be opened, edited, saved, etc. by the corresponding software.

[0060] A private format file may be a file of a specific format developed by a certain developer. In general, a private format file may be set so that only the specific software (i.e., the corresponding software) developed by the software developer can open the private format file. That is, the private format file may be set so that only the software developed by the developer of the specific software associated with the private format file can open it. Of course, it should be understood that in some cases, other software developers may also develop other software that is compatible with opening these private format files. Such a situation is sometimes beyond the full control of the developer of the specific software.

[0061] In some implementations, these specific software can encapsulate the read-write interface at the application level, take over the reading and writing of the file, and ensure that the file does not temporarily appear in the hard disk of the electronic device. In other words, when a private format file is edited by the corresponding software, the file can be temporarily placed in the memory of the electronic device. After the user edits it, it is generally necessary to perform a storage operation to store the edited content persistently, such as storing it in the hard disk of the electronic device. At this time, the electronic device can be triggered to use the encryption lock to process the file in the memory. In some implementations, even if the electronic device cannot successfully use the encryption lock to process the file in the memory and successfully persist it, the file in the memory is not allowed to be stored in the hard disk.

[0062] The first operation can be used to instruct the storage of the first file by the specific software. For example, the user edits in the specific software on the electronic device, and then clicks a button such as "Save" in the specific software, thereby inputting the first operation to the electronic device to instruct the electronic device to store the first file formed after editing.

[0063] Optionally, in some implementations, the first operation can also be used to instruct the creation of a private format file. Exemplarily, when a user wants to create a new file in a specific software on an electronic device, he can click a button such as "New" in the specific software to input the first operation to the electronic device to instruct the electronic device to create a new file (for ease of distinction, referred to as an initial file in the embodiment of the present application). In this way, when a private format file is initially created, the electronic device can respond to the operation of instructing the creation and perform some or all of the subsequent steps such as encryption, signing, and persistent storage.

[0064] It should be understood that after the user creates the initial file, the user can continue to edit it in the software and then save the file formed after editing. When the user saves, the electronic device can respond to the operation indicating the save to perform subsequent encryption, signing, persistent storage and other steps. In this case, the file formed after the initial file created by the user is edited can be regarded as the first file in the aforementioned steps. Of course, any other user uses specific software to open a private format file, and the file formed after editing can also be used as the first file in the aforementioned steps. The following text will take the modified second file as the first file as an example to further illustrate this.

[0065] S102: The electronic device encrypts the first data through the encryption lock based on the permission in the encryption lock to obtain the second data; wherein the first file includes the first data.

[0066] The first data may be part or all of the content in the first file. In some implementations, the electronic device may extract some key data from the first file as the first data. Then, the electronic device uses an encryption lock to encrypt the first data to obtain the second data. In other implementations, the electronic device may regard the entire first file as the first data and encrypt it using an encryption lock. In some cases, the amount of data in the first file or the content to be encrypted therein may be large. Therefore, in some other implementations, the electronic device may regard the content to be encrypted as a data stream and encrypt it using an encryption lock in batches. Then, the data stream or the part of the data stream encrypted each time may be regarded as the first data.

[0067] There may also be a license in the dongle. The license may include contents such as a license ID and license terms. In some implementations, the license may be a license issued for a specific file or a specific type of file. Exemplarily, the license may be a license issued for a certain private format file (such as the aforementioned initial file) created by a user. Although the private format file may be edited multiple times later, the license may be used to encrypt the file after each edit. In other implementations, if a user wants to legally use specific software, he or she needs to purchase a license from the developer of the specific software. The license issued for the specific software may also be used to encrypt the private format file. That is, on the user side, the use of the specific software and the operation of the private format file may rely on the same license.

[0068] There are many possible implementations for encrypting the first data based on the license in the encryption lock. In some implementations of encryption, the electronic device can transmit the first data to the encryption lock, and the encryption lock encrypts the first data based on part of the information in the license (such as the license ID, etc.) to obtain the second data. In other implementations of encryption, the electronic device can do some processing on the first data, such as transformation operation, and then transmit the operation result to the encryption lock. The encryption lock then encrypts the operation result based on part of the information in the license (such as the license ID, etc.) to obtain the second data. In some implementations, the electronic device can transmit the first data to the encryption lock, and the encryption lock can do some processing on the first data, such as transformation operation, and then encrypt the operation result based on part of the information in the license (such as the license ID, etc.) to obtain the second data.

[0069] The encryption lock uses an algorithm for encrypting the first data based on the license, and an algorithm in the prior art may be used, such as an AES algorithm, an RSA algorithm, etc. For example, in some implementations, the encryption lock may use the CTR mode of the AES algorithm. Of course, the encryption lock may also use other possible algorithms, and this application does not limit the specific encryption algorithm used.

[0070] S103: The electronic device signs the first data based on the device key in the encryption lock through the encryption lock to obtain fourth data.

[0071] The device key corresponds to the developer of the specific software associated with the private format file.

[0072] Different software developers may have different keys / key pairs to indicate the identity of the software developer. These keys or the private keys in the key pairs may be stored in the encryption lock as device keys. It should be understood that a software developer may have one or more different keys / key pairs, or may have multiple encryption locks, and the device keys stored in different encryption locks may be the same or different. Exemplarily, the same device key may be stored for the encryption locks owned by the same project group, and different device keys may be stored for the encryption locks owned by different project groups.

[0073] The device keys stored in the dongle, especially the device private key, can be generated inside the dongle and can be set to not be exported outside the dongle, thus enhancing the security of the device keys. In other words, the keys stored in the dongle can only be used under the conditions that they meet, and cannot be exported or read.

[0074] In some implementations, the dongle can sign the first data based on the device key (e.g., device private key) in the dongle to obtain the fourth data. In other implementations, the dongle can first perform some processing (e.g., hash operation) on the first data to obtain the third data (e.g., hash operation result), and then use the device key to process the third data to obtain the signature result, and use the signature result as the fourth data. In still other implementations, see Figure 3 , the electronic device can first perform some processing on the first data to obtain the third data, and then use the device key to process the third data to obtain a signature result, and use the signature result as the fourth data. The above hash operation can be exemplarily calculated by sha256, and the generated third data is a 64-bit string. Compared with the method in which the encryption lock performs the processing, the method in which the electronic device performs the processing can reduce the requirements on the computing power of the encryption lock.

[0075] In some implementations, the dongle can generate fourth data based on the aforementioned signature result and the unique identifier of the dongle (eg, the serial number / SN number of the dongle), such as Figure 3 As shown. Exemplarily, the encryption lock can concatenate the signature result and the encryption lock identifier to obtain the fourth data. In this way, the second file that is finally persistently stored will contain the unique identifier information of the encryption lock. As a file is continuously edited and saved, the final file may record the information of the encryption lock used for each save, so as to facilitate tracing which encryption lock holders have edited and saved the file.

[0076] The encryption lock can return the fourth data and the aforementioned second data to the electronic device so that the electronic device can store them persistently.

[0077] S104: The electronic device persistently stores a second file, where the second file is a private format file and includes: second data, fourth data, and a certificate chain.

[0078] In some implementations, the encryption lock can also send a certificate chain used to verify the fourth data, that is, to verify the signature, to the electronic device so that the electronic device can store it persistently in the private format file and can be used to verify the signature stored therein when needed later (for example, when opening the private format file). In other words, the aforementioned certificate chain comes from the encryption lock and is mainly used to verify the fourth data. The use of the certificate chain will be further exemplified in the subsequent decryption process.

[0079] The certificate chain may include key information of a device key for verifying the fourth data. For ease of explanation, a pair of device keys (device private key and device public key) will be used as an example in the following description. In some implementations, the certificate chain includes at least information about a device public key corresponding to the device private key (also referred to as first public key information below for ease of distinction). The first public key information may be the device public key itself, or may be information indicating the device public key. This application does not limit its specific form, as long as the electronic device can obtain the corresponding device public key based on the first public key information when the device public key needs to be used.

[0080] In some implementations, the aforementioned device key may be issued by a CA, and the CA may issue a device public key certificate (hereinafter referred to as the first public key certificate for the sake of distinction) containing the device public key for a specific subject (such as the developer of the aforementioned specific software, etc.). The first public key certificate may be signed by the private key of the CA. Therefore, the certificate chain may also include the public key information of the CA (hereinafter referred to as the second public key information for the sake of distinction). That is to say, in this case, the certificate chain includes the first public key information and the corresponding second public key information.

[0081] In some implementations, when the above-mentioned CA also has an upper-level CA, the public key certificate containing the public key of the CA (hereinafter referred to as the second public key certificate for the sake of distinction) may be signed by the private key of the upper-level CA. Therefore, the certificate chain may also include the public key information of its upper-level CA (hereinafter referred to as the third public key information for the sake of distinction). By analogy, the certificate chain may also include the public key information of the upper-level CA (i.e., the fourth public key information), the public key information of the upper-level CA (i.e., the fifth public key information), and so on, until the public key information of the root CA. The public key indicated by the upper-level public key information can be used to verify the signature of the lower-level public key certificate. Through verification at each level, the legitimacy of the device public key can be guaranteed, thereby ensuring the reliability of the verification result of the fourth data.

[0082] The electronic device may generate a second file based on the fourth data, the second data, and the certificate chain, and store the second file persistently in the electronic device or other computer-readable storage medium. The second file is a private format file that is the same or similar to the first file. That is, the private formats of the files before and after processing may be the same or may not be exactly the same, but similarly, both can be opened or edited by the aforementioned specific software.

[0083] It should be understood that the second file may also include other possible data, which is not limited in the present application. Exemplarily, when the aforementioned first data is the key data of the first file, the second file may also include other data of the first file except the aforementioned key data.

[0084] As another example, the second file may also include a timestamp, which may be used to indicate the time when the second file is stored this time. It should be understood that the timestamp here may be generated by the encryption lock and transmitted to the electronic device, or may be generated by the electronic device itself, and this application does not limit this. In this way, for a file that has been edited and stored multiple times, the file may not only record the information of each storer (the user holding the encryption lock), such as the unique identifier of the encryption lock and the certificate chain, but also record the corresponding editing time, so as to facilitate tracing the editing history of the file. Such an implementation method is also very suitable for being applied to privatized format engineering files, such as bidding documents, etc., which can provide a basis for better identifying whether there are bidding violations.

[0085] The embodiment of the present application provides a method for decrypting a private format file, which can be performed by an electronic device, or an electronic device and a dongle. For ease of understanding, the following takes the aforementioned second file as an example to describe the steps of the decryption method performed when a specific software needs to open or edit the second file.

[0086] It should be understood that for other similar private format files, the same or similar steps can be adopted when they need to be opened or edited.

[0087] It should also be understood that the electronic device that executes the steps of the decryption method and the electronic device that executes the steps of the encryption method mentioned above can be the same electronic device or a different electronic device, and this application does not limit this.

[0088] See also Figure 4 , Figure 4 The flowchart of an exemplary method for decrypting a private format file of the present application is shown in FIG.

[0089] S201: The electronic device receives a second operation on a second file.

[0090] The second file is a private format file, and the second file includes: second data, fourth data and a certificate chain. For the private format file, the second data, fourth data and certificate chain included in the second file, please refer to the relevant description above, which will not be repeated here.

[0091] The second operation is used to instruct the electronic device to open or edit the second file through the specific software. For example, the user clicks a button such as "Open" in the specific software on the electronic device to select the second file, or the user double-clicks the second file, thereby inputting the second operation to the electronic device to instruct the electronic device to open or edit the second file.

[0092] S202: The electronic device decrypts the second data through the encryption lock based on the permission in the encryption lock to obtain fifth data.

[0093] The electronic device can be connected to the dongle for communication so as to exchange information with the dongle. It should be understood that the dongle here and the dongle used for encryption in the above embodiment may be the same dongle or different dongles.

[0094] In some implementations, the electronic device can transmit the second data to the encryption lock as a whole, in batches, or in a data stream, and the encryption lock uses the license corresponding to the second data stored in the encryption lock to decrypt the second data to obtain the fifth data.

[0095] It should be understood that there may be one or more licenses in the dongle. In some implementations, when encrypting data, it is possible to identify or record which license is based on which license, so that when decrypting data, the license can be used to decrypt accordingly.

[0096] It should also be understood that the encryption lock can use one or more different encryption and decryption algorithms to process data. In some implementations, when encrypting data, it is possible to identify or record which one or several algorithms are based on, so that when decrypting data, this one or several algorithms can be used to decrypt accordingly. Exemplarily, when encrypting, the encryption lock first performs a transformation operation on the first data, and then encrypts the operation result based on the license to obtain the second data. Accordingly, when decrypting, the encryption lock can first decrypt the operation result based on the license, and then perform a corresponding transformation inverse operation on the decrypted result to obtain the fifth data.

[0097] After decrypting and obtaining the fifth data, the encryption lock may return the fifth data to the electronic device, or perform other processing steps on it, such as calculating a hash value of the fifth data and returning the hash value to the electronic device. In some application scenarios, since the encryption lock has not yet verified the fourth data contained in the second file, it may not return the fifth data to the electronic device first, so as to prevent malicious attackers from obtaining the fifth data from the electronic device before the fourth data passes the verification. After the fourth data passes the verification, the fifth data is returned to the electronic device. In other application scenarios, such as Figure 5 As shown, the encryption lock can return the fifth data to the electronic device. The electronic device can temporarily store it in the memory and set it to not be allowed to be read, thereby ensuring that the electronic device is allowed to open or edit the content of the file only after the fourth data passes the verification.

[0098] Optionally, at least one preset file type is stored in the encryption lock. These preset file types may be pre-set by software developers, etc., and may be private format files. In some implementations, the preset file type may be a private format file developed by the software developer itself. The software developer may write the preset file format type into the encryption lock when initializing the encryption lock. In this way, the encryption lock may only process specific file types, but not other file types, thereby further improving the protection strength and pertinence of private format files.

[0099] In some implementations, before the dongle decrypts the second data, it can determine the file type of the second file. If the file type of the second file matches the pre-set file type, the second data is decrypted based on the permission. If the file type of the second file does not match any of the pre-set file types, the second data is not decrypted.

[0100] In other implementations, before the dongle returns the fifth data or the hash value of the fifth data, etc., the dongle can determine whether the file type of the second file matches at least one preset file type. If they match, the dongle can return the fifth data or the hash value of the fifth data; if they do not match, the dongle does not return the above data.

[0101] S203: The electronic device verifies the fourth data based on the certificate chain and the fifth data.

[0102] In some implementations, such as Figure 5As shown, when the electronic device receives the returned fifth data, it can do some processing on the fifth data, such as hash operation, to obtain a hash value (hereinafter referred to as the sixth data for the sake of distinction), and then use the sixth data and the certificate chain to verify the fourth data. In other implementations, when the electronic device receives the returned hash value (calculated by the encryption lock based on the fifth data), it can use it as the sixth data, and use the sixth data and the certificate chain to verify the fourth data.

[0103] Exemplarily, the electronic device may decrypt the fourth data using the device public key indicated by the certificate chain to obtain the seventh data, and then determine whether the seventh data matches the sixth data. If they match, it can be considered that the fourth data can pass the verification. If they do not match, it can be considered that the fourth data cannot pass the verification.

[0104] As another example, the device public key comes from the device public key certificate (i.e., the aforementioned first public key certificate). On the basis of determining that the sixth data and the seventh data match based on the device public key, the second public key contained in the public key certificate of the upper-level CA (i.e., the aforementioned second public key certificate) can also be used to verify the signature of the first public key certificate. On the basis that the signature of the first public key certificate is verified, the third public key contained in the public key certificate of the upper-level CA (i.e., the third public key certificate) can also be used to verify the signature of the second public key certificate. And so on, verify one level at a time until the self-signed position of the root certificate is verified using the public key certificate of the root CA. If all verifications pass, it can be considered that the fourth data can pass the verification. If any level of verification fails, it can be considered that the fourth data cannot pass the verification. The information of the public key used for each level of verification can be indicated by the certificate chain.

[0105] Also illustratively, if Figure 5 As shown, the electronic device can verify the legitimacy of the device public key based on the certificate chain. The verification method is similar to the aforementioned level-by-level verification and will not be repeated here. After verifying that the device public key is legitimate, the electronic device uses the device public key and the fifth data to verify the fourth data. For example, the electronic device can use the device public key to decrypt the fourth data to obtain the seventh data, and then determine whether the sixth data matches the seventh data similar to the aforementioned implementation method.

[0106] It can be understood that, when the fourth data can pass the verification, the device public key indicated by the certificate chain and the device private key in the encryption lock must correspond.

[0107] S204: When the fourth data passes the verification, the electronic device allows the second operation on the second file.

[0108] In some implementations, when the fourth data can pass the verification of step S203, the electronic device may be allowed to perform the aforementioned second operation. In this way, the specific software on the electronic device may open or allow the current user to edit the second file. The second operation may be an operation on the decrypted fifth data, or an operation on other contents in the second file, which is not limited in the present application.

[0109] In some other implementations, when the fourth data also includes other information, the electronic device can also use the other information it includes to perform other possible verifications. Exemplarily, when the fourth data also includes the unique identifier of the encryption lock (hereinafter referred to as the first lock identifier for ease of distinction), the electronic device can receive the unique identifier of the current encryption lock (hereinafter referred to as the second lock identifier for ease of distinction). Then, the electronic device can compare the first lock identifier and the second lock identifier. If the two are the same or meet some preset rules, it can be considered that the verification is successful. In the case where the verification based on the unique identifier of the encryption lock is successful, the electronic device can be allowed to perform the aforementioned second operation, such as Figure 5 shown.

[0110] It should be understood that if the current user edits the second file and needs to store the file, the aforementioned step S101 may be triggered again. In this case, the edited second file can be regarded as the aforementioned first file, and the aforementioned steps S101 to S104 are cycled.

[0111] Exemplarily, after the second file is modified, it is still temporarily stored in the memory of the electronic device. The electronic device receives a first operation for the modified second file (used to indicate storage of the modified second file), and encrypts the eighth data through the currently connected encryption lock based on the permission in the encryption lock to obtain the ninth data; wherein the eighth data is included in the modified second file. The electronic device signs the eighth data through the encryption lock based on the device private key in the encryption lock to obtain the tenth data. The electronic device then persistently stores the third file, which is also a private format file, and the third file includes: the ninth data, the tenth data, and the certificate chain.

[0112] Optionally, in one implementation, the second data, the fourth data, the certificate chain, the unique identifier of the encryption lock, and one or more data of the timestamp stored previously, together with the eighth data, can be encrypted by the encryption lock to obtain the ninth data. In this way, the data related to the private format file stored previously will be used to form the file stored next time, and there is a connection between the private format files stored each time, which makes the stored private format files, including the data related to the editing history recorded therein, more difficult to be tampered with. This also helps to trace the editing and storage history of the private format file more accurately.

[0113] Please combine Figure 6 In an embodiment of the present application, an electronic device is further provided. The electronic device 300 may include:

[0114] Memory 301, configured to store predetermined computer instructions;

[0115] The processor 302 is configured to execute predetermined computer instructions to implement part or all of the steps implemented by the electronic device in any of the aforementioned implementations.

[0116] An encryption lock is also provided in an embodiment of the present application, and the encryption lock may include:

[0117] a memory configured to store predetermined computer instructions;

[0118] The processor is configured to execute predetermined computer instructions to implement part or all of the steps implemented by the encryption lock in any of the aforementioned implementations.

[0119] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, devices, computer-readable storage media or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware.

[0120] The present application may also be in the form of a computer program product implemented on one or more computer-readable storage media containing computer-usable program code. That is, a computer-readable storage medium is also provided in an embodiment of the present application, storing a computer program, and when the computer program is executed by a processor, the processor executes part or all of the steps implemented by the first electronic device or the second electronic device in any of the aforementioned implementations. Of course, in some cases, the storage medium may also store computer programs executed by two electronic devices.

[0121] When implemented by software, the functions may be stored in or transmitted as one or more instructions or codes on a computer-readable medium.

[0122] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0123] The product embodiments described above are merely illustrative. For example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0124] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Those skilled in the art may select some or all of the units according to actual needs to achieve the purpose of the solution of this embodiment.

[0125] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0126] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the part of the technical solution of the present application that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), disk or optical disk and other media that can store programs.

[0127] It should be understood that in various embodiments of the present application, the execution order of each step should be determined by its function and internal logic, and the size of the sequence number of each step does not mean the order of execution, and does not constitute any limitation on the implementation process of the embodiment. For example, the aforementioned step S102 and step S103 can be performed simultaneously or in any order, and the present application does not limit this, but step S104 needs to be performed after steps S102 and S103.

[0128] It should also be understood that, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, the words "first", "second", etc. are used in the embodiments of the present application to distinguish between the same items or similar items with substantially the same functions and effects, or concepts with certain differences. Those skilled in the art can understand that the words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not necessarily limit the difference.

[0129] The same or similar parts between the various embodiments in this specification can be referred to each other. As long as there is no logical contradiction, different embodiments can be combined with each other.

Claims

1. A method for processing a private format file, characterized in that: include: The electronic device receives a first operation on a first file, the first file being a private format file, the first operation being used to instruct specific software corresponding to the private format file to store the first file, the specific software encapsulating a read-write interface at an application level so that the first file is located in a memory of the electronic device and is not allowed to be stored in a hard disk; The electronic device encrypts the first data by using the first encryption lock based on the license issued for the private format file in the first encryption lock to obtain the second data, wherein the first file includes the first data; The electronic device signs the first data based on the device private key in the first encryption lock through the first encryption lock, and generates fourth data based on the signature result and the unique identifier of the first encryption lock; wherein the device private key corresponds to the developer of the specific software associated with the private format file; The electronic device persistently stores a second file, the second file is a private format file, and the second file includes: the second data, the fourth data, and a first certificate chain; wherein the first certificate chain comes from the first encryption lock and is used to verify the fourth data; The second file is located in the memory of the electronic device after being modified, and can be persistently stored as a third file through the second encryption lock, the third file includes ninth data, tenth data and a second certificate chain, the ninth data is obtained by the second encryption lock encrypting at least the eighth data included in the modified second file and the unique identifier of the first encryption lock based on the license in the second encryption lock, the tenth data is generated by the second encryption lock signing at least the eighth data based on the device private key in the second encryption lock and based on the signature result and the unique identifier of the second encryption lock, and the second certificate chain comes from the second encryption lock.

2. The method according to claim 1, characterized in that: The first encryption lock includes at least one preset file type; The second data is: data obtained by encrypting the first data by the first encryption lock when the type of the first file matches any one of the at least one preset file type; and / or, The fourth data is data obtained by signing the first data with the first encryption lock when the first file matches any one of the at least one preset file type.

3. The method according to any one of claims 1 to 2, characterized in that: The electronic device signs the first data based on the device private key in the first encryption lock through the first encryption lock, and generates fourth data based on the signature result and the unique identifier of the first encryption lock, including: The electronic device processes the first data to obtain third data; The electronic device transmits the third data to the first encryption lock; The electronic device receives the fourth data from the first encryption lock, and the fourth data is obtained by the first encryption lock signing the third data based on the device private key and concatenating the signature result with the unique identifier of the first encryption lock.

4. The method according to any one of claims 1 to 2, characterized in that: Also includes: When the second file is modified and indicates to store the modified second file, the electronic device encrypts the second data, the fourth data, at least one of the first certificate chain, and the unique identifier of the first encryption lock and the eighth data through the second encryption lock based on the permission in the second encryption lock to obtain ninth data.

5. A method for processing a private format file, characterized in that: include: The electronic device receives a second operation on a second file; The second file is a private format file, and the second file includes: second data, fourth data, and a first certificate chain; the second operation is used to instruct a specific software corresponding to the private format file to open or edit the second file; The electronic device decrypts the second data through the second encryption lock based on the license issued for the private format file in the second encryption lock to obtain fifth data; The electronic device verifies the fourth data based on the first certificate chain and the fifth data; When the signature result included in the fourth data passes the verification, and the unique identifier of the first encryption lock included in the fourth data and the unique identifier of the second encryption lock meet a preset rule, the electronic device allows the second operation on the second file; Wherein, in the case where the fourth data passes the verification, the device public key indicated by the first certificate chain corresponds to the device private key in the first dongle, and the device private key is the developer of the specific software associated with the privatization format file; The method further comprises: The electronic device, through the second encryption lock, persistently stores the modified second file in the memory as a third file, wherein the third file includes at least ninth data, tenth data and a second certificate chain, wherein the ninth data is obtained by the second encryption lock encrypting at least the eighth data included in the modified second file and the unique identifier of the first encryption lock based on the license, the tenth data is generated by the second encryption lock signing at least the eighth data based on the device private key in the second encryption lock and based on the signature result and the unique identifier of the second encryption lock, and the second certificate chain comes from the second encryption lock.

6. The method according to claim 5, characterized in that The second encryption lock includes at least one preset file type; The fifth data is: data obtained by decrypting the second data by the second encryption lock when the type of the second file matches any one of the at least one preset file type; or When the type of the second file matches any one of the at least one preset file type, the second encryption lock returns the fifth data to the electronic device.

7. The method according to claim 5 or 6, characterized in that: The step of the electronic device verifying the fourth data based on the first certificate chain and the fifth data comprises: The electronic device determines sixth data, where the sixth data is data obtained by processing the fifth data; The electronic device verifies the legitimacy of the device public key based on the first certificate chain, and verifies the fourth data based on the device public key and the sixth data; wherein the first certificate chain indicates the device public key.

8. An electronic device, characterized in that: include: a memory configured to store predetermined computer instructions; A processor configured to execute the predetermined computer instructions to implement the method according to any one of claims 1 to 7.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and system for encrypting data

    CN101950347A

  • Multifunctional encryption lock and operating method thereof

    CN104050398A

  • Software protection method and system

    CN104392153A

  • Data backup method and device for software protection device

    CN107391974A

  • Method of recovering administrator lock of encryption machine and encryption machine

    CN109286502A