Resource package updating method, device, equipment and storage medium
1. A method for resource packet update, the method comprising:
acquiring an encrypted resource packet, and decrypting the encrypted resource packet to obtain a decrypted resource packet;
acquiring an index file and a resource file set contained in the decrypted resource packet;
performing first accuracy check on the index file;
when the first accuracy check is passed, performing second accuracy check on the resource file set through the index file to obtain a second accuracy check result;
acquiring a resource file which passes the second accuracy check in the resource file set according to the second accuracy check result;
and replacing the historical resource file by using the resource file which passes the second accuracy check, and updating the resource information by using the block chain record.
2. The method of claim 1, wherein the performing a first accuracy check on the index file comprises:
performing hash processing on the index file by using a preset first hash algorithm to obtain a hash value of the index file;
comparing the index file hash value with the index hash value recorded in the decryption resource packet;
if the index file hash value is inconsistent with the index hash value, determining that the index file is tampered, and determining that the first accuracy check does not pass;
and if the index file hash value is consistent with the index hash value, determining that the index file is not tampered, and determining that the first accuracy check passes.
3. The method for updating the resource package according to claim 1, wherein the performing a second accuracy check on the resource file set through the index file to obtain a second accuracy check result comprises:
traversing the resource files in the resource file set, and performing hash processing on the resource files by using a preset second hash algorithm to obtain resource hash values of the resource files;
and comparing the resource hash values of all the resource files with the hash values recorded in the index file to obtain a second accuracy verification result.
4. The resource package updating method according to claim 3, wherein the comparing the resource hash values of all the resource files with the hash values recorded in the index file to obtain a second accuracy check result includes:
sequentially acquiring relative paths of all resource files and the decrypted resource packet;
searching the hash value recorded in the index file by taking the relative path as an index;
comparing the found hash value with the resource hash value of the resource file;
if the hash value is inconsistent with the resource hash value, determining that the resource file does not pass a second accuracy check;
and if the hash value is consistent with the resource hash value, determining that the resource file passes a second accuracy check.
5. The resource package updating method of claim 1, wherein said replacing the historical resource file with the resource file that passed the second accuracy check comprises:
marking the resource file which passes the second accuracy check as a target resource file;
performing security check on the content of the target resource file;
if the security check fails, determining that the target resource file is abnormal, and sending an abnormal prompt;
and if the security verification is passed, updating the historical resource file by using the target resource file.
6. The method of claim 5, wherein the updating the resource information using the blockchain record comprises:
storing the target resource file passing the security verification to a preset updating normal file in the block chain so as to record the resource file updated each time;
and storing the target resource file which does not pass the security verification to a preset updating abnormal file in the block chain so as to record the abnormal resource file each time.
7. The method for updating the resource package according to any one of claims 1 to 6, wherein the decrypting the encrypted resource package to obtain a decrypted resource package comprises:
acquiring a decryption public key, and decrypting the encrypted resource packet by using the decryption public key;
if the decryption public key fails to decrypt the encrypted resource packet, determining that the source of the encrypted resource packet is abnormal;
and if the decryption public key successfully decrypts the encrypted resource packet, determining that the source of the encrypted resource packet is normal, and obtaining a decrypted resource packet.
8. An apparatus for resource packet update, the apparatus comprising:
the resource package decryption module is used for acquiring the encrypted resource package and decrypting the encrypted resource package to obtain a decrypted resource package;
the first accuracy verification module is used for acquiring the index file and the resource file set contained in the decrypted resource packet; performing first accuracy check on the index file;
the second accuracy checking module is used for carrying out second accuracy checking on the resource file set through the index file when the first accuracy checking passes to obtain a second accuracy checking result;
the resource updating module is used for acquiring the resource files which pass the second accuracy verification in the resource file set according to the second accuracy verification result; and replacing the historical resource file by using the resource file which passes the second accuracy check, and updating the resource information by using the block chain record.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the resource package update method of any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the resource package updating method according to any one of claims 1 to 7.
Background
The front-end technology is widely used in the era of mobile internet, and with the rapid development of business, a pure native App cannot perfectly meet business requirements, and often needs to be updated. In the prior art, updating App by H5 resource offline is a common approach in the industry. However, the problem that arises when the resource is offline follows, for example, after the H5 resource is offline, the client App acquires the latest offline resource through an http request, but the offline resource is easily tampered, so that there is a problem that the acquired offline resource is inaccurate when the resource is updated, and there may be a security risk due to the inaccuracy of the offline resource.
Disclosure of Invention
The invention provides a resource package updating method, a device, equipment and a storage medium, and mainly aims to solve the problems of inaccurate resource updating and safety risk.
In order to achieve the above object, a resource packet updating method provided by the present invention includes:
acquiring an encrypted resource packet, and decrypting the encrypted resource packet to obtain a decrypted resource packet;
acquiring an index file and a resource file set contained in the decrypted resource packet;
performing first accuracy check on the index file;
when the first accuracy check is passed, performing second accuracy check on the resource file set through the index file to obtain a second accuracy check result;
acquiring a resource file which passes the second accuracy check in the resource file set according to the second accuracy check result;
and replacing the historical resource file by using the resource file which passes the second accuracy check, and updating the resource information by using the block chain record.
Optionally, the performing a first accuracy check on the index file includes:
performing hash processing on the index file by using a preset first hash algorithm to obtain a hash value of the index file;
comparing the index file hash value with the index hash value recorded in the decryption resource packet;
if the index file hash value is inconsistent with the index hash value, determining that the index file is tampered, and determining that the first accuracy check does not pass;
and if the index file hash value is consistent with the index hash value, determining that the index file is not tampered, and determining that the first accuracy check passes.
Optionally, the performing, by the index file, a second accuracy check on the resource file set to obtain a second accuracy check result includes:
traversing the resource files in the resource file set, and performing hash processing on the resource files by using a preset second hash algorithm to obtain resource hash values of the resource files;
and comparing the resource hash values of all the resource files with the hash values recorded in the index file to obtain a second accuracy verification result.
Optionally, the comparing the resource hash values of all the resource files with the hash values recorded in the index file to obtain a second accuracy check result includes:
sequentially acquiring relative paths of all resource files and the decrypted resource packet;
searching the hash value recorded in the index file by taking the relative path as an index;
comparing the found hash value with the resource hash value of the resource file;
if the hash value is inconsistent with the resource hash value, determining that the resource file does not pass a second accuracy check;
and if the hash value is consistent with the resource hash value, determining that the resource file passes a second accuracy check.
Optionally, the replacing the historical resource file with the resource file passing through the second accuracy check includes:
marking the resource file which passes the second accuracy check as a target resource file;
performing security check on the content of the target resource file;
if the security check fails, determining that the target resource file is abnormal, and sending an abnormal prompt;
and if the security verification is passed, updating the historical resource file by using the target resource file.
Optionally, the updating the resource information by using the blockchain record includes:
storing the target resource file passing the security verification to a preset updating normal file in the block chain so as to record the resource file updated each time;
and storing the target resource file which does not pass the security verification to a preset updating abnormal file in the block chain so as to record the abnormal resource file each time.
Optionally, the decrypting the encrypted resource packet to obtain a decrypted resource packet includes:
acquiring a decryption public key, and decrypting the encrypted resource packet by using the decryption public key;
if the decryption public key fails to decrypt the encrypted resource packet, determining that the source of the encrypted resource packet is abnormal;
and if the decryption public key successfully decrypts the encrypted resource packet, determining that the source of the encrypted resource packet is normal, and obtaining a decrypted resource packet.
In order to solve the above problem, the present invention further provides a resource package updating apparatus, including:
the resource package decryption module is used for acquiring the encrypted resource package and decrypting the encrypted resource package to obtain a decrypted resource package;
the first accuracy verification module is used for acquiring the index file and the resource file set contained in the decrypted resource packet; performing first accuracy check on the index file;
the second accuracy checking module is used for carrying out second accuracy checking on the resource file set through the index file when the first accuracy checking passes to obtain a second accuracy checking result;
the resource updating module is used for acquiring the resource files which pass the second accuracy verification in the resource file set according to the second accuracy verification result; and replacing the historical resource file by using the resource file which passes the second accuracy check, and updating the resource information by using the block chain record.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one instruction; and
and the processor executes the instructions stored in the memory to realize the resource packet updating method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, which stores at least one instruction, where the at least one instruction is executed by a processor in an electronic device to implement the resource package updating method described above.
According to the method and the device, the encrypted resource package is decrypted to obtain the decrypted resource package, the index file in the decrypted resource package is subjected to first accuracy verification, when the first accuracy verification is passed, the resource file set in the decrypted resource package is subjected to second accuracy verification through the index file, and the resource file subjected to multiple times of accuracy verification is used for resource updating, so that the resource file can be effectively prevented from being tampered, the accuracy of the obtained resource file is improved, and the safety of resource updating is improved. And the condition of resource updating is recorded through the block chain, so that the traceability and maintainability of the resource updating are further improved. Therefore, the resource package updating method, the resource package updating device, the electronic equipment and the computer readable storage medium provided by the invention can solve the problems of inaccurate resource updating and safety risk.
Drawings
Fig. 1 is a flowchart illustrating a resource package updating method according to an embodiment of the present invention;
FIG. 2 is a functional block diagram of a resource package updating apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device implementing the resource package updating method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a resource package updating method. The execution subject of the resource package updating method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server, a terminal, and the like. In other words, the resource package updating method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Fig. 1 is a schematic flow chart of a resource package updating method according to an embodiment of the present invention. In this embodiment, the resource package updating method includes:
s1, obtaining the encrypted resource packet, and decrypting the encrypted resource packet to obtain a decrypted resource packet.
In the embodiment of the present invention, the encrypted resource packet may be constructed according to an original resource packet. For example, the original resource package is an H5 offline resource package for performing offline update on a client (such as APP), and a service person adds a resource file to the resource package directory through a standard H5 command to obtain the original resource package.
Further, each resource file in the original resource package may be traversed, hash processing may be performed on contents in the resource file to obtain a hash value of the resource file, a relative path between the resource file and the original resource package is obtained, the relative path is used as a value of a key, the hash value is used as a value of a value, an index key value pair (key-value) is constructed, each resource file in the original resource package may be accurately recorded by using the index key value pair, all the index key value pairs are summarized to obtain an index file, hash processing is performed on the index file to obtain an index hash value, and the index file and the index hash value are assembled to the original resource package to obtain the encrypted resource package.
In an optional embodiment of the present invention, the hash process (hash code) may convert any data into a data string with a fixed length, that is, a hash value, through an algorithm function, so as to improve security of resource file transmission. Meanwhile, the index file and the index hash value set can be encrypted by using an encryption algorithm, wherein the encryption algorithm can be an RSA algorithm and the like.
Specifically, the decrypting the encrypted resource packet to obtain a decrypted resource packet includes:
acquiring a decryption public key, and decrypting the encrypted resource packet by using the decryption public key;
if the decryption public key fails to decrypt the encrypted resource packet, determining that the source of the encrypted resource packet is abnormal;
and if the decryption public key successfully decrypts the encrypted resource packet, determining that the source of the encrypted resource packet is normal, and obtaining a decrypted resource packet.
In the embodiment of the invention, the RSA algorithm is taken as an example, the RSA algorithm includes an encryption private key and a decryption public key, for example, bank a issues a patch resource package of a bank client for all users to update, first, bank a prints a digital signature on the patch resource package (namely, encrypts and issues the resource package by using the encryption private key of bank a), and the user needs to install a digital certificate of bank a (namely, the decryption public key issued by the bank to the outside) in a computer, and the digital certificate decrypts the digital signature of the resource package, so that the patch is successfully decrypted and used, and meanwhile, the source of the patch can be confirmed to be bank a indeed.
And S2, acquiring the index file and the resource file set contained in the decrypted resource package.
In this embodiment, the decryption resource package includes an index file and a resource file set, where the resource file set includes one or at least two resource files, such as pictures, audio, video, and other files.
The index file may be pre-constructed, and in particular, the method for constructing the index file is described in S1, and is not described herein again.
And S3, carrying out first accuracy check on the index file.
In the embodiment of the invention, the index file is used for listing the hash value of each resource file in the original resource package, the data in the index file is ensured to accurately correspond to the data in the resource package by using the hash value, and meanwhile, the data structure in the index file is simpler and is easy to tamper, so that whether the index file is tampered or not needs to be verified.
Specifically, the performing a first accuracy check on the index file includes:
performing hash processing on the index file by using a preset first hash algorithm to obtain a hash value of the index file;
comparing the index file hash value with the index hash value recorded in the decryption resource packet;
if the index file hash value is inconsistent with the index hash value, determining that the index file is tampered, and determining that the first accuracy check does not pass;
and if the index file hash value is consistent with the index hash value, determining that the index file is not tampered, and determining that the first accuracy check passes.
In an embodiment of the present invention, the preset first hash algorithm may be an MD5 algorithm. Due to the irreversibility of the hash algorithm and the characteristic that the same hash value can be generated for the same content, whether the index file is tampered or not can be accurately judged by comparing the index file hash value with the index hash value recorded in the decryption resource packet.
And S4, when the first accuracy check is passed, performing second accuracy check on the resource file set through the index file to obtain a second accuracy check result.
In the embodiment of the present invention, the second accuracy check specifically checks the content of the resource file in the decrypted resource package according to the index file that passes the index verification, so as to ensure that the content of each resource file is not tampered.
Further, the performing, by the index file, a second accuracy check on the resource file set to obtain a second accuracy check result includes:
traversing the resource files in the resource file set, and performing hash processing on the resource files by using a preset second hash algorithm to obtain resource hash values of the resource files;
and comparing the resource hash values of all the resource files with the hash values recorded in the index file to obtain a second accuracy verification result.
In an optional embodiment of the present invention, the second hash algorithm may be an SHA-1 algorithm, etc.
Further, the comparing the resource hash values of all the resource files with the hash values recorded in the index file to obtain a second accuracy check result includes:
sequentially acquiring relative paths of all resource files and the decrypted resource packet;
searching the hash value recorded in the index file by taking the relative path as an index;
comparing the found hash value with the resource hash value of the resource file;
if the hash value is inconsistent with the resource hash value, determining that the resource file does not pass a second accuracy check;
and if the hash value is consistent with the resource hash value, determining that the resource file passes a second accuracy check.
In the embodiment of the invention, because the index file comprises the relative path of the resource file and the hash value of the content of the index file, if the content of the resource file is not tampered, the hash value searched by the relative path is consistent with the resource hash value of the resource file, and meanwhile, the relative path is taken as the index, so that the speed of searching the hash value can be improved, and the hash comparison rate in resource verification is further increased.
And S5, acquiring the resource files passing the second accuracy check in the resource file set according to the second accuracy check result.
S6, replacing the historical resource file with the resource file passing the second accuracy check, and updating the resource information with the block chain record.
Further, the replacing the historical resource file with the resource file passing through the second accuracy check includes:
marking the resource file which passes the second accuracy check as a target resource file;
performing security check on the content of the target resource file;
if the security check fails, determining that the target resource file is abnormal, and sending an abnormal prompt;
and if the security verification is passed, updating the historical resource file by using the target resource file.
In an optional embodiment of the present invention, the performing security check on the target resource file includes performing check on a data format and whether the target resource file includes information that is prohibited from being issued. By checking the content of the target resource file again, the resource updating accuracy can be ensured, and the safety of resource updating is improved.
In the embodiment of the invention, when any one of the first accuracy check, the second accuracy check and the security check fails, an abnormal alarm can be sent to the user in real time so as to improve the maintainability of resource updating.
Further, the updating the resource information by using the blockchain record includes:
storing the target resource file passing the security verification to a preset updating normal file in the block chain so as to record the resource file updated each time;
and storing the target resource file which does not pass the security verification to a preset updating abnormal file in the block chain so as to record the abnormal resource file each time.
In this embodiment, by recording the updated and abnormal resource files in the block chain, the security of the updated resource and the traceability and maintainability of the resource files can be further improved.
According to the method and the device, the encrypted resource package is decrypted to obtain the decrypted resource package, the index file in the decrypted resource package is subjected to first accuracy verification, when the first accuracy verification is passed, the resource file set in the decrypted resource package is subjected to second accuracy verification through the index file, whether the resource file is falsified or not can be effectively checked, the resource file subjected to multiple times of accuracy verification is used for resource updating, the accuracy of the obtained resource file can be improved, and therefore the safety of resource updating is improved. And the condition of resource updating is recorded through the block chain, so that the traceability and maintainability of updating are further improved. Therefore, the resource package updating method provided by the invention can solve the problems of inaccurate resource updating and safety risk.
Fig. 2 is a functional block diagram of a resource package updating apparatus according to an embodiment of the present invention.
The resource package updating apparatus 100 of the present invention may be installed in an electronic device. According to the implemented functions, the resource package updating apparatus 100 may include a resource package decryption module 101, a first accuracy check module 102, a second accuracy check module 103, and a resource updating module 104. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the resource package decryption module 101 is configured to obtain an encrypted resource package, and decrypt the encrypted resource package to obtain a decrypted resource package.
In the embodiment of the present invention, the encrypted resource packet may be constructed according to an original resource packet. For example, the original resource package is an H5 offline resource package for performing offline update on a client (such as APP), and a service person adds a resource file to the resource package directory through a standard H5 command to obtain the original resource package.
Further, each resource file in the original resource package may be traversed, hash processing may be performed on contents in the resource file to obtain a hash value of the resource file, a relative path between the resource file and the original resource package is obtained, the relative path is used as a value of a key, the hash value is used as a value of a value, an index key value pair (key-value) is constructed, each resource file in the original resource package may be accurately recorded by using the index key value pair, all the index key value pairs are summarized to obtain an index file, hash processing is performed on the index file to obtain an index hash value, and the index file and the index hash value are assembled to the original resource package to obtain the encrypted resource package.
In an optional embodiment of the present invention, the hash process (hash code) may convert any data into a data string with a fixed length, that is, a hash value, through an algorithm function, so as to improve security of resource file transmission. Meanwhile, the index file and the index hash value set can be encrypted by using an encryption algorithm, wherein the encryption algorithm can be an RSA algorithm and the like.
Specifically, the resource package decryption module 101 obtains the decrypted resource package by performing the following operations:
acquiring a decryption public key, and decrypting the encrypted resource packet by using the decryption public key;
if the decryption public key fails to decrypt the encrypted resource packet, determining that the source of the encrypted resource packet is abnormal;
and if the decryption public key successfully decrypts the encrypted resource packet, determining that the source of the encrypted resource packet is normal, and obtaining a decrypted resource packet.
In the embodiment of the invention, the RSA algorithm is taken as an example, the RSA algorithm includes an encryption private key and a decryption public key, for example, bank a issues a patch resource package of a bank client for all users to update, first, bank a prints a digital signature on the patch resource package (namely, encrypts and issues the resource package by using the encryption private key of bank a), and the user needs to install a digital certificate of bank a (namely, the decryption public key issued by the bank to the outside) in a computer, and the digital certificate decrypts the digital signature of the resource package, so that the patch is successfully decrypted and used, and meanwhile, the source of the patch can be confirmed to be bank a indeed.
The first accuracy check module 102 is configured to obtain an index file and a resource file set included in the decrypted resource packet, and perform a first accuracy check on the index file.
In this embodiment, the decryption resource package includes an index file and a resource file set, where the resource file set includes one or at least two resource files, such as pictures, audio, video, and other files.
The index file may be pre-constructed, and in particular, the method for constructing the index file is already described in the resource package decryption module 101, and is not described herein again.
In the embodiment of the invention, the index file is used for listing the hash value of each resource file in the original resource package, the data in the index file is ensured to accurately correspond to the data in the resource package by using the hash value, and meanwhile, the data structure in the index file is simpler and is easy to tamper, so that whether the index file is tampered or not needs to be verified.
Specifically, the first accuracy checking module 102 performs a first accuracy check on the index file by performing the following operations:
performing hash processing on the index file by using a preset first hash algorithm to obtain a hash value of the index file;
comparing the index file hash value with the index hash value recorded in the decryption resource packet;
if the index file hash value is inconsistent with the index hash value, determining that the index file is tampered, and determining that the first accuracy check does not pass;
and if the index file hash value is consistent with the index hash value, determining that the index file is not tampered, and determining that the first accuracy check passes.
In an embodiment of the present invention, the preset first hash algorithm may be an MD5 algorithm. Due to the irreversibility of the hash algorithm and the characteristic that the same hash value can be generated for the same content, whether the index file is tampered or not can be accurately judged by comparing the index file hash value with the index hash value recorded in the decryption resource packet.
The second accuracy checking module 103 is configured to, when the first accuracy check passes, perform a second accuracy check on the resource file set through the index file to obtain a second accuracy check result.
In the embodiment of the present invention, the second accuracy check specifically checks the content of the resource file in the decrypted resource package according to the index file that passes the index verification, so as to ensure that the content of each resource file is not tampered.
Further, the second accuracy checking module 103 obtains a second accuracy checking result by performing the following operations:
traversing the resource files in the resource file set, and performing hash processing on the resource files by using a preset second hash algorithm to obtain resource hash values of the resource files;
and comparing the resource hash values of all the resource files with the hash values recorded in the index file to obtain a second accuracy verification result.
In an optional embodiment of the present invention, the second hash algorithm may be an SHA-1 algorithm, etc.
Further, the second accuracy check module 103 compares the resource hash values of all the resource files with the hash values recorded in the index file by performing the following operations to obtain a second accuracy check result:
sequentially acquiring relative paths of all resource files and the decrypted resource packet;
searching the hash value recorded in the index file by taking the relative path as an index;
comparing the found hash value with the resource hash value of the resource file;
if the hash value is inconsistent with the resource hash value, determining that the resource file does not pass a second accuracy check;
and if the hash value is consistent with the resource hash value, determining that the resource file passes a second accuracy check.
In the embodiment of the invention, because the index file comprises the relative path of the resource file and the hash value of the content of the index file, if the content of the resource file is not tampered, the hash value searched by the relative path is consistent with the resource hash value of the resource file, and meanwhile, the relative path is taken as the index, so that the speed of searching the hash value can be improved, and the hash comparison rate in resource verification is further increased.
The resource updating module 104 is configured to obtain a resource file that passes the second accuracy check in the resource file set according to the second accuracy check result, replace a historical resource file with the resource file that passes the second accuracy check, and update resource information with the block chain record.
Specifically, the resource update module 104 replaces the historical resource file by performing the following operations:
marking the resource file which passes the second accuracy check as a target resource file;
performing security check on the content of the target resource file;
if the security check fails, determining that the target resource file is abnormal, and sending an abnormal prompt;
and if the security verification is passed, updating the historical resource file by using the target resource file.
In an optional embodiment of the present invention, the performing security check on the target resource file includes performing check on a data format and whether the target resource file includes information that is prohibited from being issued. By checking the content of the target resource file again, the resource updating accuracy can be ensured, and the safety of resource updating is improved.
In the embodiment of the invention, when any one of the first accuracy check, the second accuracy check and the security check fails, an abnormal alarm can be sent to the user in real time so as to improve the maintainability of resource updating.
Further, the resource updating module 104 records and updates the resource information by performing the following operations:
storing the target resource file passing the security verification to a preset updating normal file in the block chain so as to record the resource file updated each time;
and storing the target resource file which does not pass the security verification to a preset updating abnormal file in the block chain so as to record the abnormal resource file each time.
In this embodiment, by recording the updated and abnormal resource files in the block chain, the security of the updated resource and the traceability and maintainability of the resource files can be further improved.
According to the method and the device, the encrypted resource package is decrypted to obtain the decrypted resource package, the index file in the decrypted resource package is subjected to first accuracy verification, when the first accuracy verification is passed, the resource file set in the decrypted resource package is subjected to second accuracy verification through the index file, whether the resource file is falsified or not can be effectively checked, the resource file subjected to multiple times of accuracy verification is used for resource updating, the accuracy of the obtained resource file can be improved, and therefore the safety of resource updating is improved. And the condition of resource updating is recorded through the block chain, so that the traceability and maintainability of updating are further improved. Therefore, the resource packet updating device provided by the invention can solve the problems of inaccurate resource updating and safety risk.
Fig. 3 is a schematic structural diagram of an electronic device for implementing a resource package updating method according to an embodiment of the present invention, including a processor 111, a communication interface 112, a memory 113, and a communication bus 114, where the processor 111, the communication interface 112, and the memory 113 complete mutual communication via the communication bus 114,
a memory 113 for storing computer programs, such as a resource package update program;
in an embodiment of the present application, when the processor 111 is configured to execute the program stored in the memory 113, the method for updating the resource package provided in any one of the foregoing method embodiments is implemented, including:
acquiring an encrypted resource packet, and decrypting the encrypted resource packet to obtain a decrypted resource packet;
acquiring an index file and a resource file set contained in the decrypted resource packet;
performing first accuracy check on the index file;
when the first accuracy check is passed, performing second accuracy check on the resource file set through the index file to obtain a second accuracy check result;
acquiring a resource file which passes the second accuracy check in the resource file set according to the second accuracy check result;
and replacing the historical resource file by using the resource file which passes the second accuracy check, and updating the resource information by using the block chain record.
The communication bus 114 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 114 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 112 is used for communication between the above-described electronic apparatus and other apparatuses.
The memory 113 may include a Random Access Memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory 113 may also be at least one storage device located remotely from the processor 111.
The processor 111 may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the integrated circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring an encrypted resource packet, and decrypting the encrypted resource packet to obtain a decrypted resource packet;
acquiring an index file and a resource file set contained in the decrypted resource packet;
performing first accuracy check on the index file;
when the first accuracy check is passed, performing second accuracy check on the resource file set through the index file to obtain a second accuracy check result;
acquiring a resource file which passes the second accuracy check in the resource file set according to the second accuracy check result;
and replacing the historical resource file by using the resource file which passes the second accuracy check, and updating the resource information by using the block chain record.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.