CN117313115A - Method and corresponding device for accessing, acquiring and managing installation package resource file - Google Patents
Method and corresponding device for accessing, acquiring and managing installation package resource file Download PDFInfo
- Publication number
- CN117313115A CN117313115A CN202311091621.0A CN202311091621A CN117313115A CN 117313115 A CN117313115 A CN 117313115A CN 202311091621 A CN202311091621 A CN 202311091621A CN 117313115 A CN117313115 A CN 117313115A
- Authority
- CN
- China
- Prior art keywords
- resource
- resource file
- index table
- encrypted
- installation package
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/174—Redundancy elimination performed by the file system
- G06F16/1744—Redundancy elimination performed by the file system using compression, e.g. sparse files
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/21—Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/2107—File encryption
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- Storage Device Security (AREA)
Abstract
本发明涉及文件管理技术领域,提供一种安装包资源文件存取方法、获取方法以及管理方法,服务器端执行下述过程:对安装包资源文件进行压缩、加密处理,生成压缩加密资源文件;根据所述安装包资源文件生成原始资源文件索引表,所述资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息;对所述原始资源文件索引表进行加密,生成加密资源文件索引表;根据所述原始资源文件索引表对所述压缩加密资源文件、加密资源文件索引表进行存储;应用端基于所述资源加载接口通过网络请求库向服务器端发送资源请求,以获取所述压缩加密资源文件。本发明能够很好地保护安装包资源文件,避免了其被篡改、不当获取。
The invention relates to the technical field of file management and provides an installation package resource file access method, acquisition method and management method. The server side performs the following process: compresses and encrypts the installation package resource file to generate a compressed and encrypted resource file; according to The installation package resource file generates an original resource file index table, and the resource file index table includes a resource file name, a random ID value corresponding to the resource file name, and installation package version information; the original resource file index table is encrypted , generate an encrypted resource file index table; store the compressed encrypted resource file and the encrypted resource file index table according to the original resource file index table; the application side sends a resource request to the server side through the network request library based on the resource loading interface , to obtain the compressed encrypted resource file. The invention can well protect the installation package resource files and prevent them from being tampered with and improperly obtained.
Description
技术领域Technical field
本发明涉及计算机技术领域,尤其涉及一种安装包资源文件管理方法、获取方法以及相应装置。The present invention relates to the field of computer technology, and in particular to an installation package resource file management method, an acquisition method and a corresponding device.
背景技术Background technique
因为安卓应用的安装包文件容易被破解、汉化,其安全性一直是业界关注的问题。目前,大多是采用加壳加固工具对其进行保护,比如使用ProGuard或者DexGuard来保护代码,从而实现相对的代码安全,但是忽略了对资源文件的保护。Because the installation package files of Android applications are easy to be cracked and localized, their security has always been a concern in the industry. At present, most of them use packing and hardening tools to protect them, such as using ProGuard or DexGuard to protect the code, thereby achieving relative code security, but the protection of resource files is ignored.
发明内容Contents of the invention
本发明提供一种安装包资源文件存取方法,该方法包括两部分,其中,第一部分由服务器端执行,包括:The present invention provides a method for accessing installation package resource files. The method includes two parts. The first part is executed by the server and includes:
对安装包资源文件进行压缩、加密处理,生成压缩加密资源文件;Compress and encrypt the installation package resource files to generate compressed and encrypted resource files;
根据所述安装包资源文件生成原始资源文件索引表,所述资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息;Generate an original resource file index table based on the installation package resource file. The resource file index table includes resource file names, random ID values corresponding to the resource file names, and installation package version information;
对所述原始资源文件索引表进行加密,生成加密资源文件索引表;Encrypt the original resource file index table to generate an encrypted resource file index table;
根据所述原始资源文件索引表对所述压缩加密资源文件、加密资源文件索引表进行存储;Store the compressed encrypted resource files and the encrypted resource file index table according to the original resource file index table;
第二部分由应用端执行,包括:The second part is executed by the application side and includes:
调用预定的资源加载接口,所述资源加载接口在应用程序中定义;Call a predetermined resource loading interface, which is defined in the application program;
基于所述资源加载接口通过网络请求库向服务器发送资源请求,所述资源请求包括资源统一定位符URL、ID值以及版本信息;Send a resource request to the server through the network request library based on the resource loading interface, where the resource request includes the resource unified locator URL, ID value and version information;
基于所述资源加载接口接收压缩加密资源文件,所述压缩加密资源文件由服务器端根据所述资源请求利用加密资源文件索引表获取。A compressed and encrypted resource file is received based on the resource loading interface, and the compressed and encrypted resource file is obtained by the server using an encrypted resource file index table according to the resource request.
可选地,第二部分还包括:Optionally, part two also includes:
对接收到的压缩加密资源文件进行解压缩、解密,生成解密解压缩资源文件;Decompress and decrypt the received compressed and encrypted resource files to generate decrypted and decompressed resource files;
根据解密解压缩资源文件的类型选择对应的存储方式,并进行存储。Select the corresponding storage method according to the type of decrypted and decompressed resource files, and store it.
可选地,所述根据解密解压缩资源文件的类型选择对应的本地存储方式,并进行本地存储,包括:Optionally, selecting a corresponding local storage method according to the type of the decrypted and decompressed resource file and performing local storage includes:
在所述解密解压缩资源文件为图像资源的情况下,将所述解密解压缩资源文件存储到本地存储装置,在解密解压缩资源文件为文本资源的情况下,将所述解密解压缩资源文件存储在内存缓存器中。When the decrypted and decompressed resource file is an image resource, the decrypted and decompressed resource file is stored in a local storage device; when the decrypted and decompressed resource file is a text resource, the decrypted and decompressed resource file is stored in the local storage device. Stored in memory cache.
可选地,该方法在服务器端根据所述资源请求利用加密资源文件索引表获取压缩加密资源文件之前,还包括:Optionally, before the server uses the encrypted resource file index table to obtain the compressed encrypted resource file according to the resource request, the method also includes:
根据所述第一身份认证信息对应用端进行身份认证;所述资源请求还包括第一身份认证信息;Perform identity authentication on the application end based on the first identity authentication information; the resource request also includes the first identity authentication information;
在认证通过的情况下,对加密资源文件索引表进行解密,并允许应用端访问解密资源文件索引表。When the authentication is passed, the encrypted resource file index table is decrypted, and the application is allowed to access the decrypted resource file index table.
本发明还提供一种安装包资源文件获取方法,该方法由应用端执行,该方法包括:The present invention also provides a method for obtaining installation package resource files. The method is executed by the application end. The method includes:
调用预定的资源加载接口,所述资源加载接口在应用程序中定义;Call a predetermined resource loading interface, which is defined in the application program;
基于所述资源加载接口通过网络请求库向服务器发送资源请求,所述资源请求包括资源统一定位符URL、随机ID值以及版本信息;Send a resource request to the server through the network request library based on the resource loading interface, where the resource request includes a resource unified locator URL, a random ID value and version information;
基于所述资源加载接口接收压缩加密资源文件,所述压缩加密资源文件由服务器端根据所述资源请求利用加密资源文件索引表获取,所述加密资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息。Receive compressed and encrypted resource files based on the resource loading interface. The compressed and encrypted resource files are obtained by the server according to the resource request using an encrypted resource file index table. The encrypted resource file index table includes the resource file name and the resource file. The random ID value and installation package version information corresponding to the name.
可选地,上述方法还包括:Optionally, the above method also includes:
通过调用加载和解析函数,读取并加载所述存储的解密解压缩资源文件。By calling the loading and parsing functions, the stored decrypted and decompressed resource files are read and loaded.
可选地,在加载解密解压缩资源文件前,上述方法还包括:对读取出的解密解压缩资源文件进行安全性检查;在所述解密解压缩资源文件通过安全性检查后,再行加载。Optionally, before loading the decrypted and decompressed resource file, the above method also includes: performing a security check on the read decrypted and decompressed resource file; and loading the decrypted and decompressed resource file after it passes the security check. .
可选地,在通过网络请求库向服务器发送资源请求前,该方法还包括:在本地查找需要使用的资源文件,在本地存在需要使用的资源文件的情况下,直接加载所述资源文件;在本地不存在需要使用的资源文件的情况下,执行所述通过网络请求库向服务器发送资源请求。Optionally, before sending the resource request to the server through the network request library, the method also includes: searching locally for a resource file that needs to be used, and if the resource file that needs to be used exists locally, directly loading the resource file; If the resource file that needs to be used does not exist locally, the resource request is sent to the server through the network request library.
本发明提供一种安装包资源文件管理方法,该方法由服务器执行,该方法包括:The present invention provides a method for managing installation package resource files. The method is executed by a server. The method includes:
对安装包资源文件进行压缩、加密处理,生成压缩加密资源文件;Compress and encrypt the installation package resource files to generate compressed and encrypted resource files;
根据所述安装包资源文件生成原始资源文件索引表,所述资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息;Generate an original resource file index table based on the installation package resource file. The resource file index table includes resource file names, random ID values corresponding to the resource file names, and installation package version information;
对所述原始资源文件索引表进行加密,生成加密资源文件索引表;Encrypt the original resource file index table to generate an encrypted resource file index table;
根据所述原始资源文件索引表对所述压缩加密资源文件、加密资源文件索引表进行存储。The compressed encrypted resource files and the encrypted resource file index table are stored according to the original resource file index table.
可选的,该方法还包括:Optionally, this method also includes:
接收来自应用端的资源请求,所述资源请求包括资源统一定位符URL、ID值、版本信息;Receive resource requests from the application side, where the resource requests include resource unified locator URL, ID value, and version information;
根据所述资源请求、解密资源文件索引表,获取与所述资源统一定位符URL、ID值、版本信息相对应的压缩加密资源文件,并发送给所述应用端,所述解密资源文件索引表通过对加密资源文件索引表解密得到。According to the resource request and the decrypted resource file index table, obtain the compressed and encrypted resource file corresponding to the resource unified locator URL, ID value, and version information, and send it to the application end. The decrypted resource file index table Obtained by decrypting the encrypted resource file index table.
可选地,所述资源请求第二身份认证信息、该方法还包括:Optionally, the resource requests second identity authentication information, and the method further includes:
根据所述第二身份认证信息和版本信息对应用端进行身份认证;Perform identity authentication on the application end according to the second identity authentication information and version information;
在认证通过的情况下发送压缩加密资源文件给所述应用端。If the authentication is passed, the compressed encrypted resource file is sent to the application end.
可选地,所述资源请求身份认证信息、该方法还包括:Optionally, the resource requests identity authentication information, and the method further includes:
在需要更新资源文件时,对加密资源文件索引表进行解密,生成解密资源文件索引表;When resource files need to be updated, the encrypted resource file index table is decrypted and a decrypted resource file index table is generated;
根据增量资源文件更新所述解密资源文件索引表,生成第二解密资源文件索引表;Update the decrypted resource file index table according to the incremental resource file and generate a second decrypted resource file index table;
对增量资源文件进行加密,生成加密增量资源文件;Encrypt incremental resource files and generate encrypted incremental resource files;
对所述第二解密资源文件索引表进行加密,生成第二加密资源文件索引表;Encrypt the second decrypted resource file index table to generate a second encrypted resource file index table;
根据所述第二解密资源文件索引表对第二加密资源文件索引表、加密增量资源文件进行存储。The second encrypted resource file index table and the encrypted incremental resource file are stored according to the second decrypted resource file index table.
本发明提供一种安装包资源文件存取系统,该系统包括服务器端和应用端,其中服务器端包括:The present invention provides an installation package resource file access system. The system includes a server end and an application end, where the server end includes:
压缩加密模块,用于对安装包资源文件进行压缩、加密处理,生成压缩加密资源文件;The compression encryption module is used to compress and encrypt installation package resource files and generate compressed and encrypted resource files;
原始资源文件索引表生成模块,用于根据所述安装包资源文件生成原始资源文件索引表,所述资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息;An original resource file index table generation module is used to generate an original resource file index table according to the installation package resource file. The resource file index table includes a resource file name, a random ID value corresponding to the resource file name, and installation package version information. ;
资源文件索引表加密模块,用于对所述原始资源文件索引表进行加密,生成加密资源文件索引表;A resource file index table encryption module, used to encrypt the original resource file index table and generate an encrypted resource file index table;
文件存储模块,用于根据所述原始资源文件索引表对所述压缩加密资源文件、加密资源文件索引表进行存储;A file storage module, configured to store the compressed encrypted resource files and the encrypted resource file index table according to the original resource file index table;
应用端包括:The application side includes:
资源加载接口调用模块,用于调用预定的资源加载接口,所述资源加载接口在应用程序中定义;The resource loading interface calling module is used to call a predetermined resource loading interface, and the resource loading interface is defined in the application program;
资源请求发送模块,用于基于所述资源加载接口通过网络请求库向服务器发送资源请求,所述资源请求包括资源统一定位符URL、ID值以及版本信息;A resource request sending module, configured to send a resource request to the server through a network request library based on the resource loading interface, where the resource request includes a resource unified locator URL, an ID value, and version information;
压缩加密资源文件接收模块,用于基于所述资源加载接口接收压缩加密资源文件,所述压缩加密资源文件由服务器端根据所述资源请求利用加密资源文件索引表获取。A compressed and encrypted resource file receiving module is configured to receive a compressed and encrypted resource file based on the resource loading interface. The compressed and encrypted resource file is obtained by the server using an encrypted resource file index table according to the resource request.
本发明提供一种安装包资源文件获取装置,该装置包括:The present invention provides a device for obtaining installation package resource files, which device includes:
资源加载接口调用模块,用于调用预定的资源加载接口,所述资源加载接口在应用程序中定义;The resource loading interface calling module is used to call a predetermined resource loading interface, and the resource loading interface is defined in the application program;
资源请求发送模块,用于基于所述资源加载接口通过网络请求库向服务器发送资源请求,所述资源请求包括资源统一定位符URL、ID值以及版本信息;A resource request sending module, configured to send a resource request to the server through a network request library based on the resource loading interface, where the resource request includes a resource unified locator URL, an ID value, and version information;
压缩加密资源文件接收模块,用于基于所述资源加载接口接收压缩加密资源文件,所述压缩加密资源文件由服务器端根据所述资源请求利用加密资源文件索引表获取,所述加密资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息。A compressed and encrypted resource file receiving module, configured to receive compressed and encrypted resource files based on the resource loading interface. The compressed and encrypted resource files are obtained by the server using an encrypted resource file index table according to the resource request. The encrypted resource file index table Including resource file name, random ID value corresponding to the resource file name, and installation package version information.
本发明提供一种安装包资源文件管理装置,该装置包括:The present invention provides an installation package resource file management device, which includes:
压缩加密模块,用于对安装包资源文件进行压缩、加密处理,生成压缩加密资源文件;The compression encryption module is used to compress and encrypt installation package resource files and generate compressed and encrypted resource files;
原始资源文件索引表生成模块,用于根据所述安装包资源文件生成原始资源文件索引表,所述资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息;An original resource file index table generation module is used to generate an original resource file index table according to the installation package resource file. The resource file index table includes a resource file name, a random ID value corresponding to the resource file name, and installation package version information. ;
资源文件索引表加密模块,用于对所述原始资源文件索引表进行加密,生成加密资源文件索引表;A resource file index table encryption module, used to encrypt the original resource file index table and generate an encrypted resource file index table;
文件存储模块,用于根据所述原始资源文件索引表对所述压缩加密资源文件、加密资源文件索引表进行存储。A file storage module, configured to store the compressed encrypted resource files and the encrypted resource file index table according to the original resource file index table.
本发明提供一种信息存储介质,所述信息存储介质存储有计算机程序,所述计算机程序被执行时,实现前面所述的安装包资源文件存取方法、安装包资源文件获取方法或者安装包资源文件管理方法。The present invention provides an information storage medium. The information storage medium stores a computer program. When the computer program is executed, the aforementioned installation package resource file access method, installation package resource file acquisition method or installation package resources are implemented. Document management methods.
本发明提供一种电子设备,该电子设备包括处理器、存储器,所述存储器存储有计算机程序,处理器执行所述计算机程序以实现前面所述安装包资源文件存取方法、所述安装包资源文件获取方法或者所述安装包资源文件管理方法。The present invention provides an electronic device. The electronic device includes a processor and a memory. The memory stores a computer program. The processor executes the computer program to implement the installation package resource file access method and the installation package resource. File acquisition method or installation package resource file management method.
本发明通过在服务器上根据资源文件生成资源文件索引表,使得资源文件的ID是随机生成的,并采用加密的方式存储所述资源文件索引表以及资源文件,从而能够很好地保护资源文件,应用端通过远程连接可安全地获取服务器上的资源文件,避免了资源文件被篡改、不当获取。The present invention generates a resource file index table based on resource files on the server, so that the IDs of resource files are randomly generated, and uses an encrypted method to store the resource file index table and resource files, so that resource files can be well protected. The application can securely obtain resource files on the server through remote connections, preventing resource files from being tampered with and improperly obtained.
附图说明Description of drawings
为了更清楚地说明本发明或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are of the present invention. For some embodiments of the invention, those of ordinary skill in the art can also obtain other drawings based on these drawings without exerting creative efforts.
图1是本发明提供的安装包资源文件管理方法的流程图;Figure 1 is a flow chart of the installation package resource file management method provided by the present invention;
图2是本发明提供的安装包资源文件管理方法中向应用端提供压缩加密资源文件的过程的流程图;Figure 2 is a flow chart of the process of providing compressed and encrypted resource files to the application end in the installation package resource file management method provided by the present invention;
图3是本发明提供的安装包资源文件管理方法中服务器端资源文件更新过程的流程图;Figure 3 is a flow chart of the server-side resource file update process in the installation package resource file management method provided by the present invention;
图4是本发明提供的安装包资源文件获取方法的流程图;Figure 4 is a flow chart of the installation package resource file acquisition method provided by the present invention;
图5是本发明提供的安装包资源文件管理装置的资源文件上载部分的架构图;Figure 5 is an architectural diagram of the resource file uploading part of the installation package resource file management device provided by the present invention;
图6是本发明提供的安装包资源文件管理装置的资源文件下载部分的架构图;Figure 6 is an architectural diagram of the resource file download part of the installation package resource file management device provided by the present invention;
图7是本发明提供的安装包资源文件获取装置的的架构图;Figure 7 is an architectural diagram of an installation package resource file acquisition device provided by the present invention;
图8是本发明提供的电子设备的结构图。Figure 8 is a structural diagram of the electronic device provided by the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合本发明中的附图,对本发明中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the present invention more clear, the technical solutions in the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention. , not all examples. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
在Android系统中,每一个应用程序一般都会配置很多资源文件,APK(AndroidPackage安卓安装包)资源文件的保护,通常使用加固工具或者AndResGuard等工具对资源文件进行混淆保护,这些工具基本是对APK中资源文件名使用简短无意义名称进行替换,给破解者制造困难,但是资源文件ID仍是唯一的,反编译者只需要消耗一定的时间就能搞清楚这些资源文件的作用,从而可对资源文件进行破坏性地修改。本发明旨在防止资源文件被直接解压或者被通过反编译不当获取,从而提高资源文件的安全性。In the Android system, each application is generally configured with many resource files, and the protection of APK (AndroidPackage Android installation package) resource files. Hardening tools or tools such as AndResGuard are usually used to obfuscate and protect resource files. These tools basically protect the resource files in the APK. Resource file names are replaced with short meaningless names, which creates difficulties for crackers. However, the resource file ID is still unique. It only takes a certain amount of time for the decompiler to figure out the role of these resource files, so that the resource files can be modified. Make destructive changes. The present invention aims to prevent resource files from being directly decompressed or improperly obtained through decompilation, thereby improving the security of resource files.
本发明提供一种安装包资源文件管理方法,该方法由服务器执行,如图1所示,该方法包括:The present invention provides a method for managing installation package resource files. The method is executed by a server. As shown in Figure 1, the method includes:
S11.对安装包资源文件进行压缩、加密处理,生成压缩加密资源文件;S11. Compress and encrypt the installation package resource files to generate compressed and encrypted resource files;
S12.根据所述安装包资源文件生成原始资源文件索引表,所述资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息;S12. Generate an original resource file index table according to the installation package resource file. The resource file index table includes resource file names, random ID values corresponding to the resource file names, and installation package version information;
S13.对所述原始资源文件索引表进行加密,生成加密资源文件索引表;S13. Encrypt the original resource file index table and generate an encrypted resource file index table;
S14.根据所述原始资源文件索引表对所述压缩加密资源文件、加密资源文件索引表进行存储。S14. Store the compressed encrypted resource file and the encrypted resource file index table according to the original resource file index table.
通过上述方法,将资源文件存储到服务器端,通过对资源文件进行动态压缩和加密处理,并建立一个资源文件索引表用来存放资源文件名和对应的随机ID值、版本等信息,以进行版本管理和资源文件维护。一方面,资源文件被加密保护,另一方面,资源文件的ID值是随机生成的,并通过加密资源文件索引表存储,资源文件很难被获取到,从而可靠地提高了资源文件的安全性。同时,所述随机ID值的生成和存储能够使得在应用端运行应用程序时,能够根据所述随机ID值获取到对应的资源文件。Through the above method, the resource files are stored on the server side, the resource files are dynamically compressed and encrypted, and a resource file index table is established to store the resource file names and corresponding random ID values, versions and other information for version management. and resource file maintenance. On the one hand, the resource files are encrypted and protected. On the other hand, the ID values of the resource files are randomly generated and stored through the encrypted resource file index table. The resource files are difficult to obtain, thus reliably improving the security of the resource files. . At the same time, the generation and storage of the random ID value enables the corresponding resource file to be obtained based on the random ID value when the application is run on the application side.
在步骤S11中,对APK资源文件进行动态压缩和加密处理,生成APK压缩加密资源文件,可将APK压缩加密资源存放在远程服务器端或者存储桶、文件服务器上。通过使用高效的压缩算法和强大的加密算法,不仅可以减少对服务器或者存储桶、文件服务器的存储空间占用,而且可以减少在向应用端发送资源文件时资源文件的传输时间和带宽占用。In step S11, the APK resource file is dynamically compressed and encrypted to generate an APK compressed and encrypted resource file. The APK compressed and encrypted resource can be stored on a remote server, a storage bucket, or a file server. By using efficient compression algorithms and powerful encryption algorithms, it can not only reduce the storage space occupied by servers, buckets, and file servers, but also reduce the transmission time and bandwidth usage of resource files when sending resource files to the application.
在加密处理上,本发明可采用单钥密码系统的加密方法,同一个密钥可以同时用作信息的加密和解密,这种加密方法称为对称加密,也称为单密钥加密。需要对加密和解密使用相同密钥的加密算法。由于其速度快,对称性加密通常在消息发送方需要加密大量数据时使用。所谓对称,就是采用这种加密方法的双方使用方式用同样的密钥进行加密和解密。密钥是控制加密及解密过程的指令。算法是一组规则,规定如何进行加密和解密。加密的安全性不仅取决于加密算法本身,密钥管理的安全性更是重要。加密和解密都使用同一个密钥,需要把密钥安全地传递到应用端。In the encryption process, the present invention can adopt the encryption method of a single-key cryptosystem. The same key can be used for encryption and decryption of information at the same time. This encryption method is called symmetric encryption, also called single-key encryption. An encryption algorithm that uses the same key for encryption and decryption is required. Due to its speed, symmetric encryption is often used when the sender of a message needs to encrypt large amounts of data. The so-called symmetry means that both parties using this encryption method use the same key to encrypt and decrypt. Keys are instructions that control the encryption and decryption process. An algorithm is a set of rules that dictate how encryption and decryption are performed. The security of encryption not only depends on the encryption algorithm itself, but the security of key management is even more important. The same key is used for encryption and decryption, and the key needs to be delivered securely to the application.
对称加密算法可采用:DES、3DES、TDEA、Blowfish、RC2、RC4、RC5、IDEA、SKIPJACK、AES等。Symmetric encryption algorithms can be used: DES, 3DES, TDEA, Blowfish, RC2, RC4, RC5, IDEA, SKIPJACK, AES, etc.
对称加密算法的优点是算法公开、计算量小、加密速度快、加密效率高。对称加密算法的缺点是在数据传送前,服务器和应用端必须商定好秘钥,然后使双方都能保存好秘钥。相对于“对称加密算法”这种方法也叫做“非对称加密算法”。The advantages of the symmetric encryption algorithm are that the algorithm is public, the amount of calculation is small, the encryption speed is fast, and the encryption efficiency is high. The disadvantage of the symmetric encryption algorithm is that before data transmission, the server and the application must agree on the secret key, and then both parties can save the secret key. Relative to the "symmetric encryption algorithm", this method is also called the "asymmetric encryption algorithm".
本发明也可使用非对称加密算法,该算法需要两个密钥:公开密钥(publickey)和私有密钥(privatekey)。公开密钥与私有密钥是一对,如果用公开密钥对数据进行加密,只有用对应的私有密钥才能解密;如果用私有密钥对数据进行加密,那么只有用对应的公开密钥才能解密。非对称加密算法实现密钥交换的基本过程是:服务器生成一对密钥,服务器用自己保存的一把专用密钥对原始资源数据进行加密。并将另一把作为公用密钥在响应应用端的资源获取请求时发送给应用端;得到该公用密钥的应用端使用该密钥对加密压缩资源文件进行解密。服务器可用其专用密钥解密由应用端利用公用密钥加密后的任何信息。The present invention can also use an asymmetric encryption algorithm, which requires two keys: a public key and a private key. The public key and the private key are a pair. If the public key is used to encrypt data, only the corresponding private key can be used to decrypt it; if the private key is used to encrypt the data, then only the corresponding public key can be used to decrypt it. Decrypt. The basic process of key exchange using asymmetric encryption algorithms is: the server generates a pair of keys, and the server uses a private key it saves to encrypt the original resource data. And the other one is sent as a public key to the application end in response to the application end's resource acquisition request; the application end that obtains the public key uses the key to decrypt the encrypted compressed resource file. The server can use its private key to decrypt any information encrypted by the application using the public key.
非对称加密算法的保密性比较好,它消除了最终用户交换密钥的需要,经典的非对称加密算法如RSA算法等安全性都相当高。The confidentiality of asymmetric encryption algorithms is relatively good. It eliminates the need for end users to exchange keys. Classic asymmetric encryption algorithms such as RSA algorithms are very secure.
消息认证是指通过对消息或者消息有关的信息进行加密或签名变换进行的认证,目的是为了防止传输和存储的消息被有意无意的篡改,包括消息内容认证(即消息完整性认证)、消息的源和宿认证(即身份认证)、及消息的序号和操作时间认证等。消息认证所用的摘要算法与一般的对称或非对称加密算法不同,它并不用于防止信息被窃取,而是用于证明原文的完整性和准确性,也就是说,消息认证主要用于防止信息被篡改。本发明在后续第一身份认证、第二身份认证的过程中可使用消息认证技术手段。Message authentication refers to authentication through encryption or signature transformation of messages or message-related information. The purpose is to prevent the transmitted and stored messages from being tampered with intentionally or unintentionally, including message content authentication (i.e. message integrity authentication), message integrity authentication, etc. Source and sink authentication (i.e. identity authentication), and message sequence number and operation time authentication, etc. The digest algorithm used in message authentication is different from general symmetric or asymmetric encryption algorithms. It is not used to prevent information from being stolen, but is used to prove the integrity and accuracy of the original text. In other words, message authentication is mainly used to prevent information from being stolen. been tampered with. The present invention can use message authentication technical means in the subsequent processes of first identity authentication and second identity authentication.
在步骤S12中,原始资源文件索引表的字段包括:ID值(随机生成)、版本信息、文件名、资源文件路径、大小时间等信息,通过这些信息方便实现对资源文件的管理。In step S12, the fields of the original resource file index table include: ID value (randomly generated), version information, file name, resource file path, size and time, etc. This information facilitates the management of resource files.
在步骤S13中,通过使用加密算法对资源文件索引表进行加密,以防止恶意用户获取资源文件索引表信息。作为一种优选的实施方式,可设置对资源文件索引表的访问权限,或者限制对资源文件索引表的访问权限,从而能够确保只有授权的用户或应用程序能够对其进行访问。In step S13, the resource file index table is encrypted by using an encryption algorithm to prevent malicious users from obtaining resource file index table information. As a preferred implementation manner, the access rights to the resource file index table can be set, or the access rights to the resource file index table can be restricted, thereby ensuring that only authorized users or applications can access it.
在步骤S14中,服务器上只存储加密资源文件索引表,有效防止了恶意用户获取资源文件索引表。In step S14, only the encrypted resource file index table is stored on the server, which effectively prevents malicious users from obtaining the resource file index table.
上述安装包资源文件管理方法还包括向应用端提供压缩加密资源文件的过程,如图2所示,具体包括:The above installation package resource file management method also includes the process of providing compressed and encrypted resource files to the application side, as shown in Figure 2, specifically including:
S21.接收来自应用端的资源请求,所述资源请求包括资源统一定位符URL、ID值、版本信息;S21. Receive a resource request from the application side, the resource request includes resource unified locator URL, ID value, and version information;
S22.根据所述资源请求、解密资源文件索引表,获取与所述资源统一定位符URL、ID值、版本信息相对应的压缩加密资源文件;所述解密资源文件索引表通过对加密资源文件索引表解密得到;S22. According to the resource request and the decrypted resource file index table, obtain the compressed and encrypted resource file corresponding to the resource unified locator URL, ID value, and version information; the decrypted resource file index table indexes the encrypted resource file. Obtained by decrypting the table;
S23.将获取的压缩加密资源文件发送给所述应用端。S23. Send the obtained compressed and encrypted resource file to the application end.
通过上述过程,服务器根据应用的资源请求利用对加密资源文件索引表解密后的解密资源文件索引表向应用端提供加密资源文件。Through the above process, the server uses the decrypted resource file index table after decrypting the encrypted resource file index table to provide the encrypted resource file to the application end according to the resource request of the application.
作为一种优选的实施方式,所述资源请求还包括第一身份认证信息,所述向应用端提供压缩加密资源文件的过程包括:根据所述第一身份认证信息对应用端进行身份认证;在认证通过的情况下,对加密资源文件索引表进行解密,生成解密资源文件索引表,并允许应用端访问解密资源文件索引表。在该实施方式中,限制或者设置对索引表的访问权限,确保了只有授权的用户或应用程序可以访问资源文件索引表。As a preferred implementation, the resource request also includes first identity authentication information, and the process of providing the compressed and encrypted resource file to the application side includes: performing identity authentication on the application side based on the first identity authentication information; If the authentication is passed, the encrypted resource file index table is decrypted, a decrypted resource file index table is generated, and the application is allowed to access the decrypted resource file index table. In this implementation, the access rights to the index table are restricted or set to ensure that only authorized users or applications can access the resource file index table.
作为另一种实施方式,所述资源请求第二身份认证信息、该方法还包括:根据所述第二身份认证信息和版本信息对应用端进行身份认证;在认证通过的情况下发送压缩加密资源文件给所述应用端。在上述实施方式中,建立认证和授权机制,以使服务器获取资源文件的过程需要进行认证和授权,并确保只有具有足够权限的用户才能获取特定资源文件,所述认证和授权机制可以使用基于角色访问控制,也可以使用常见的身份验证机制,如用户名和密码、API密钥或令牌验证等,本发明对此不作具体限定。As another implementation manner, the resource requests second identity authentication information. The method also includes: performing identity authentication on the application end according to the second identity authentication information and version information; and sending the compressed encrypted resource if the authentication is passed. file to the application. In the above implementation, an authentication and authorization mechanism is established so that the process of obtaining resource files by the server requires authentication and authorization, and ensures that only users with sufficient permissions can obtain specific resource files. The authentication and authorization mechanism can use role-based For access control, common identity verification mechanisms can also be used, such as user name and password, API key or token verification, etc., which are not specifically limited by the present invention.
作为第三种实施方式,在接收到来自应用端的资源请求后,并不直接对其进行解析,而是对所述资源请求进行输入验证、过滤,目的是确保到传递到服务器的参数和数据不包含恶意代码、特殊字符或注入攻击等,以防止服务器被入侵或受到安全漏洞。As a third implementation, after receiving a resource request from the application side, it does not directly parse it, but performs input verification and filtering on the resource request. The purpose is to ensure that the parameters and data passed to the server are not Contains malicious code, special characters or injection attacks to prevent the server from being hacked or subject to security vulnerabilities.
所述安装包资源文件管理方法还包括资源文件更新的过程,如图3,具体包括:The installation package resource file management method also includes a resource file update process, as shown in Figure 3, specifically including:
S31.在需要更新资源文件时,对加密资源文件索引表进行解密,生成解密资源文件索引表;S31. When resource files need to be updated, decrypt the encrypted resource file index table and generate a decrypted resource file index table;
S32.根据增量资源文件更新所述解密资源文件索引表,生成第二解密资源文件索引表;S32. Update the decrypted resource file index table according to the incremental resource file and generate a second decrypted resource file index table;
S33.对增量资源文件进行加密,生成加密增量资源文件;对所述第二解密资源文件索引表进行加密,生成第二加密资源文件索引表;S33. Encrypt the incremental resource file to generate an encrypted incremental resource file; encrypt the second decrypted resource file index table to generate a second encrypted resource file index table;
S34.根据所述第二解密资源文件索引表对第二加密资源文件索引表、加密增量资源文件进行存储。S34. Store the second encrypted resource file index table and the encrypted incremental resource file according to the second decrypted resource file index table.
通过上述过程,服务器端仅需要对增量资源文件进行加密以及存储处理,节省了服务器的处理资源的占用,而且后续应用端需要进行资源文件更新时,仅传输资源文件的增量部分,而不是传输整个资源文件。这样做可以减少数据传输量和更新时间,特别对于大型资源文件更新非常有效。应用端在接收到增量资源后,将其合并到本地资源中,实现资源的实时更新。Through the above process, the server only needs to encrypt and store the incremental resource files, which saves the server's processing resources. Moreover, when the application side needs to update the resource files later, only the incremental part of the resource files will be transmitted instead of Transfer the entire resource file. Doing so can reduce the amount of data transfer and update time, and is especially effective for updating large resource files. After receiving the incremental resources, the application end merges them into local resources to achieve real-time updates of resources.
所述安装包资源文件管理方法还包括行为安全审计和行为监控,具体包括:对服务器的访问、请求和异常行为进行监控和记录,形成安装包资源文件日志,通过对所述安装包资源文件日志进行解析,能够及时发现并处理潜在的安全问题。The installation package resource file management method also includes behavioral security auditing and behavior monitoring, specifically including: monitoring and recording server access, requests and abnormal behaviors to form an installation package resource file log. Through analysis, potential security issues can be discovered and dealt with in a timely manner.
本发明还提供一种安装包资源文件获取方法,该方法由应用端执行,如图4所示,该方法包括:The present invention also provides a method for obtaining installation package resource files. The method is executed by the application end. As shown in Figure 4, the method includes:
S41.调用预定的资源加载接口,所述资源加载接口在应用程序中定义;S41. Call the predetermined resource loading interface, which is defined in the application program;
S42.通过网络请求库向服务器发送资源请求,所述资源请求包括资源统一定位符URL、ID值以及版本信息;S42. Send a resource request to the server through the network request library, where the resource request includes the resource unified locator URL, ID value and version information;
S43.接收压缩加密资源文件,所述压缩加密资源文件由服务器端根据所述资源请求利用加密资源文件索引表获取,所述加密资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息。S43. Receive compressed and encrypted resource files. The compressed and encrypted resource files are obtained by the server using an encrypted resource file index table according to the resource request. The encrypted resource file index table includes the resource file name and a random number corresponding to the resource file name. ID value, installation package version information.
通过上述方法,在应用端(一般为客户端)运行应用程序时,只需要调用预定义的资源加载接口,就可从远程的服务器获取到所需要使用的压缩加密资源文件,能够保证获取和传输的过程安全。Through the above method, when running the application on the application side (usually the client), you only need to call the predefined resource loading interface to obtain the required compressed and encrypted resource files from the remote server, ensuring acquisition and transmission. process safety.
在上述步骤S41中,在应用程序中定义资源加载接口,所述资源加载接口包括资源请求的URL信息。In the above step S41, a resource loading interface is defined in the application program, and the resource loading interface includes the URL information of the resource request.
在上述步骤S42中,所述资源请求URL信息、ID值参数、身份认证信息和当前应用程序版本信息等参数。通过调用资源加载接口,应用程序通过网络请求库向服务器发送资源请求,向服务器请求当前版本所需的资源文件。为了保证资源文件的安全,一般尽量避免将敏感信息(如服务器地址、API密钥等)硬编码在代码中,以免反编译者轻易获取这些敏感信息。可以将这些信息存储在加密配置文件中,并使用适当的加密算法进行保护,所述加密配置文件存储在应用端本地。应用端利用加密配置文件获取需要通信的服务器地址、加密压缩资源文件的密钥。因而,应用端能够防止被窃取获取资源文件的敏感信息。In the above step S42, the resource requests parameters such as URL information, ID value parameters, identity authentication information, and current application version information. By calling the resource loading interface, the application sends a resource request to the server through the network request library and requests the server for the resource files required by the current version. In order to ensure the security of resource files, generally try to avoid hardcoding sensitive information (such as server addresses, API keys, etc.) in the code to prevent decompilers from easily obtaining this sensitive information. This information can be stored in an encrypted configuration file that is stored locally on the application side and protected using appropriate encryption algorithms. The application uses the encrypted configuration file to obtain the server address that needs to be communicated and the key for encrypting the compressed resource file. Therefore, the application side can prevent sensitive information of resource files from being stolen.
在步骤S43中,服务器根据请求的资源URL、ID值、身份认证信息和当前应用程序版本信息等参数进行身份认证,认证通过后将对应程序版本的资源文件作为响应返回给应用端。为了保护资源文件在网络传输过程中的安全性,应用端和服务端之间使用安全的通信协议(如HTTPS),加上服务器端已经采用安全的加密方式对资源文件进行了加密,能够确保资源文件的保密性和完整性,有效防止了中间人攻击、数据窃取和篡改等安全威胁。资源文件的下载可以采用分段下载或断点续传技术,通过这样的下载技术手段能够提高下载效率和稳定性。In step S43, the server performs identity authentication based on parameters such as the requested resource URL, ID value, identity authentication information, and current application version information. After passing the authentication, the server returns the resource file of the corresponding program version to the application end as a response. In order to protect the security of resource files during network transmission, a secure communication protocol (such as HTTPS) is used between the application and the server. In addition, the server has encrypted the resource files using a secure encryption method to ensure that the resources The confidentiality and integrity of files effectively prevent security threats such as man-in-the-middle attacks, data theft and tampering. Resource files can be downloaded using segmented downloading or breakpoint resume downloading technology. This downloading technology can improve downloading efficiency and stability.
应用程序通过网络请求库接收服务器返回的压缩加密资源文件。对接收到的压缩加密资源文件进行解压缩、解密,生成解密解压缩资源文件;根据解密解压缩资源文件的类型选择对应的存储方式,并进行存储。作为一种具体实施方式,在所述解密解压缩资源文件为图像资源的情况下,将所述解密解压缩资源文件存储到本地存储装置,在解密解压缩资源文件为文本资源的情况下,将所述解密解压缩资源文件存储在内存缓存器中。利用该具体实施方式,能够不过多增加内存存储空间,同时又能加快应用程序的运行速度。The application receives the compressed encrypted resource file returned by the server through the network request library. Decompress and decrypt the received compressed and encrypted resource files to generate decrypted and decompressed resource files; select a corresponding storage method according to the type of decrypted and decompressed resource files and store them. As a specific implementation manner, when the decrypted and decompressed resource file is an image resource, the decrypted and decompressed resource file is stored in a local storage device; when the decrypted and decompressed resource file is a text resource, the decrypted and decompressed resource file is stored in a local storage device. The decrypted and decompressed resource files are stored in the memory cache. Using this specific implementation method, the memory storage space can be increased without excessively increasing the running speed of the application program.
在加载解密解压缩资源文件前,对读取出的解密解压缩资源文件进行安全性检查;在所述解密解压缩资源文件通过安全性检查后,再行加载。安全性检查的技术手段可以使用哈希值或数字签名等方式对资源文件进行验证,通过上述技术手段能够防止要使用的资源文件被篡改或替换。Before loading the decrypted and decompressed resource file, a security check is performed on the read decrypted and decompressed resource file; after the decrypted and decompressed resource file passes the security check, it is loaded again. The technical means of security check can use hash values or digital signatures to verify resource files. The above technical means can prevent the resource files to be used from being tampered with or replaced.
在应用程序的运行过程中,需要使用资源文件时,通过调用相应的加载和解析函数,从本地存储或者内存中读取并加载解密解压缩资源文件。为了保证应用程序运行的顺畅性,在应用程序中动态加载资源文件时,进行一些安全性检查,确保资源文件不包含恶意代码或潜在的安全风险。例如,检查图像文件是否包含恶意脚本、检查布局文件是否包含未授权的访问权限等。During the running of the application, when a resource file needs to be used, the corresponding loading and parsing functions are called to read and load the decrypted and decompressed resource file from local storage or memory. In order to ensure the smooth operation of the application, when dynamically loading resource files in the application, some security checks are performed to ensure that the resource files do not contain malicious code or potential security risks. For example, check image files for malicious scripts, check layout files for unauthorized access, etc.
本发明通过动态加载解密解压缩资源文件,用户可以选择要使用的资源文件,而且用户基于所选择的资源文件可以对应用程序的页面布局进行自定义。作为一种具体实施方式,动态加载用于用户自定义的XML布局文件,从而用户可以根据自己的需求灵活设计应用的界面。The present invention dynamically loads, decrypts and decompresses resource files, the user can select the resource files to be used, and the user can customize the page layout of the application based on the selected resource files. As a specific implementation manner, XML layout files for user customization are dynamically loaded, so that users can flexibly design the application interface according to their own needs.
作为一种优选实施方式,应用端可采用资源缓存机制,将已加载的资源文件保存到本地存储或内存缓存中。在需要使用资源文件的情况下,在通过网络请求库向服务器发送资源请求前,在本地存储或者内存中查找需要使用的资源文件,如果本地存在需要使用的资源文件,直接加载缓存的所述资源文件;在本地不存在需要使用的资源文件的情况下,执行所述通过网络请求库向服务器发送资源请求。As a preferred implementation, the application end can use a resource caching mechanism to save loaded resource files to local storage or memory cache. When a resource file needs to be used, before sending a resource request to the server through the network request library, the resource file that needs to be used is searched in local storage or memory. If the resource file that needs to be used exists locally, the cached resource is directly loaded. file; if the resource file that needs to be used does not exist locally, execute the resource request sent to the server through the network request library.
在进行资源文件更新时,应用端仅从服务获取资源文件的增量部分,而不是传输整个资源文件。这样做可以减少数据传输量和更新时间,特别对于大型资源文件更新非常有效。应用端在接收到增量资源后,将其合并到本地资源中,实现资源的实时更新。When updating resource files, the application only obtains the incremental part of the resource file from the service instead of transmitting the entire resource file. Doing so can reduce the amount of data transfer and update time, and is especially effective for updating large resource files. After receiving the incremental resources, the application end merges them into local resources to achieve real-time updates of resources.
在本发明中,应用端通过远程动态获取服务器上存储的压缩加密后资源文件,使得攻击者使用APKTOOL等反编译工具无法获取到资源文件,无法进行替换、修改等恶意操作,从而能够保护资源文件的完整性、保密性和合法性,确保应用程序和用户的安全;并且有效地减小APK安装包的大小,实现资源文件的灵活使用和增量资源文件的局部更新。In the present invention, the application side dynamically obtains the compressed and encrypted resource files stored on the server remotely, so that attackers using decompilation tools such as APKTOOL cannot obtain the resource files, and cannot perform malicious operations such as replacement and modification, thereby protecting the resource files. The integrity, confidentiality and legality ensure the security of applications and users; and effectively reduce the size of the APK installation package, enabling flexible use of resource files and partial updates of incremental resource files.
本发明提供一种安装包资源文件管理装置,如图5所示,该装置包括:The present invention provides an installation package resource file management device. As shown in Figure 5, the device includes:
压缩加密模块51,用于对安装包资源文件进行压缩、加密处理,生成压缩加密资源文件;The compression and encryption module 51 is used to compress and encrypt the installation package resource files and generate compressed and encrypted resource files;
原始资源文件索引表生成模块52,用于根据所述安装包资源文件生成原始资源文件索引表,所述资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息;The original resource file index table generation module 52 is used to generate an original resource file index table according to the installation package resource file. The resource file index table includes a resource file name, a random ID value corresponding to the resource file name, and an installation package version. information;
资源文件索引表加密模块53,用于对所述原始资源文件索引表进行加密,生成加密资源文件索引表;The resource file index table encryption module 53 is used to encrypt the original resource file index table and generate an encrypted resource file index table;
文件存储模块54,用于根据所述原始资源文件索引表对所述压缩加密资源文件、加密资源文件索引表进行存储。The file storage module 54 is configured to store the compressed encrypted resource files and the encrypted resource file index table according to the original resource file index table.
如图6所示,该装置还包括:As shown in Figure 6, the device also includes:
资源请求接收模块61,用于接收来自应用端的资源请求,所述资源请求包括资源统一定位符URL、ID值、版本信息;The resource request receiving module 61 is used to receive resource requests from the application side, where the resource requests include resource unified locator URL, ID value, and version information;
解密资源文件索引表获取模块62,用于根据所述资源请求、获取加密资源文件索引表,并对其解密生成解密资源文件索引表;The decrypted resource file index table acquisition module 62 is used to obtain the encrypted resource file index table according to the resource request, and decrypt it to generate a decrypted resource file index table;
压缩加密资源文件获取模块63,用于获取与所述资源统一定位符URL、ID值、版本信息相对应的压缩加密资源文件;The compressed and encrypted resource file acquisition module 63 is used to obtain the compressed and encrypted resource file corresponding to the resource unified locator URL, ID value, and version information;
压缩加密资源文件发送模块64,用于将获取的压缩加密资源文件发送给所述应用端。The compressed and encrypted resource file sending module 64 is used to send the obtained compressed and encrypted resource file to the application end.
可选的,该装置包括第一身份认证模块,用于根据所述第一身份认证信息对应用端进行身份认证,所述资源请求还包括第一身份认证信息;所述解密资源文件索引表获取模块62,在认证通过的情况下,对加密资源文件索引表进行解密,并允许应用端访问解密资源文件索引表。Optionally, the device includes a first identity authentication module for performing identity authentication on the application end according to the first identity authentication information, and the resource request also includes the first identity authentication information; the decrypted resource file index table is obtained Module 62, if the authentication is passed, decrypts the encrypted resource file index table and allows the application end to access the decrypted resource file index table.
可选的,该装置还包括第二身份认证模块,用于根据所述第二身份认证信息和版本信息对应用端进行身份认证,所述资源请求包括第二身份认证信息;所述压缩加密资源文件发送模块在认证通过的情况下发送压缩加密资源文件给所述应用端。Optionally, the device further includes a second identity authentication module, configured to perform identity authentication on the application end according to the second identity authentication information and version information, the resource request includes the second identity authentication information; the compressed encrypted resource The file sending module sends the compressed encrypted resource file to the application end when the authentication is passed.
可选的,解密资源文件索引表获取模块62,在需要更新资源文件时,对加密资源文件索引表进行解密,生成解密资源文件索引表,该装置还包括:资源文件索引表更新模块,用于根据增量资源文件更新所述解密资源文件索引表,生成第二解密资源文件索引表;增量资源文件加密模块,用于对增量资源文件进行加密,生成加密增量资源文件;所述资源文件索引表加密模块53对所述第二解密资源文件索引表进行加密,生成第二加密资源文件索引表;所述文件存储模块54根据所述第二解密资源文件索引表对第二加密资源文件索引表、加密增量资源文件进行存储。Optionally, the decrypted resource file index table acquisition module 62 decrypts the encrypted resource file index table and generates a decrypted resource file index table when the resource file needs to be updated. The device also includes: a resource file index table update module, for Update the decrypted resource file index table according to the incremental resource file to generate a second decrypted resource file index table; an incremental resource file encryption module is used to encrypt the incremental resource file and generate an encrypted incremental resource file; the resource The file index table encryption module 53 encrypts the second decrypted resource file index table and generates a second encrypted resource file index table; the file storage module 54 encrypts the second encrypted resource file according to the second decrypted resource file index table. Index tables and encrypted incremental resource files are stored.
本发明提供一种安装包资源文件获取装置,如图7所示,该装置包括:The present invention provides a device for obtaining installation package resource files. As shown in Figure 7, the device includes:
资源加载接口调用模块71,用于调用预定的资源加载接口,所述资源加载接口在应用程序中定义;The resource loading interface calling module 71 is used to call a predetermined resource loading interface, which is defined in the application program;
资源请求发送模块72,用于基于所述资源加载接口通过网络请求库向服务器发送资源请求,所述资源请求包括资源统一定位符URL、ID值以及版本信息;The resource request sending module 72 is configured to send a resource request to the server through the network request library based on the resource loading interface, where the resource request includes a resource unified locator URL, an ID value, and version information;
压缩加密资源文件接收模块73,用于接收压缩加密资源文件,所述压缩加密资源文件由服务器端根据所述资源请求利用加密资源文件索引表获取,所述加密资源文件索引表包括资源文件名、与该资源文件名对应的随机ID值、安装包版本信息。The compressed and encrypted resource file receiving module 73 is used to receive compressed and encrypted resource files. The compressed and encrypted resource files are obtained by the server using an encrypted resource file index table according to the resource request. The encrypted resource file index table includes resource file names, The random ID value and installation package version information corresponding to the resource file name.
可选的,该装置还包括:解密解压模块74,用于对接收到的压缩加密资源文件进行解压缩、解密,生成解密解压缩资源文件;本地存储模块75,用于根据解密解压缩资源文件的类型选择对应的存储方式,并根据所选择的存储方式进行存储。Optionally, the device also includes: a decryption and decompression module 74, used to decompress and decrypt the received compressed and encrypted resource files, and generate decrypted and decompressed resource files; a local storage module 75, used to decompress the resource files according to the decryption Select the corresponding storage method for the type and store it according to the selected storage method.
可选的,所述本地存储模块用于:在所述解密解压缩资源文件为图像资源的情况下,将所述解密解压缩资源文件存储到本地存储装置,在解密解压缩资源文件为文本资源的情况下,将所述解密解压缩资源文件存储在内存缓存器中。Optionally, the local storage module is configured to: store the decrypted and decompressed resource file in a local storage device when the decrypted and decompressed resource file is an image resource; when the decrypted and decompressed resource file is a text resource In this case, the decrypted and decompressed resource file is stored in the memory cache.
可选的,该装置还包括资源文件加载模块,用于通过调用加载和解析函数,读取并加载所述存储的解密解压缩资源文件。Optionally, the device also includes a resource file loading module, configured to read and load the stored decrypted and decompressed resource file by calling a loading and parsing function.
可选的,该装置还包括安全性检查模块,用于在加载解密解压缩资源文件前,对读取出的解密解压缩资源文件进行安全性检查;所述资源文件加载模块在所述解密解压缩资源文件通过安全性检查后,再行加载。Optionally, the device also includes a security check module for performing a security check on the read decrypted and decompressed resource files before loading the decrypted and decompressed resource files; the resource file loading module performs a security check on the decrypted and decompressed resource files. After the compressed resource file passes the security check, load it again.
可选的,该装置还包括资源文件本地查找模块,用于在通过网络请求库向服务器发送资源请求前,在本地查找需要使用的资源文件,在本地存在需要使用的资源文件的情况下,所述资源文件加载模块直接加载所述资源文件;在本地不存在需要使用的资源文件的情况下,所述资源请求发送模块72通过网络请求库向服务器发送资源请求。Optionally, the device also includes a local search module for resource files, which is used to search locally for resource files that need to be used before sending a resource request to the server through the network request library. In the case where the resource files that need to be used exist locally, the The resource file loading module directly loads the resource file; when the resource file to be used does not exist locally, the resource request sending module 72 sends a resource request to the server through the network request library.
本发明实施例提供的安装包资源文件管理装置能够实现上述安装包资源文件管理方法的所有步骤,且能够达到相同的技术效果,本发明实施例提供的资源文件获取装置能够实现上述资源文件获取方法的所有步骤,且能够达到相同的技术效果,在此不再对本实施例中与方法实施例相同的部分及有益效果进行具体赘述。The installation package resource file management device provided by the embodiment of the present invention can implement all the steps of the above installation package resource file management method, and can achieve the same technical effect. The resource file acquisition device provided by the embodiment of the present invention can implement the above resource file acquisition method. All the steps can achieve the same technical effect. The same parts and beneficial effects in this embodiment as in the method embodiment will not be described in detail here.
本发明还提供一种电子设备,如图8所示,所述电子设备包括处理器81、存储器82、通信接口83以及通信总线84,所述存储器82存储有计算机程序,所述处理器81与所述存储器82通过通信总线84连接,所述通信接口83用于与外部连接,所述处理器81执行所述计算机程序以执行前面所述的用于安装包资源文件管理方法或者安装资源文件获取方法。The present invention also provides an electronic device. As shown in Figure 8, the electronic device includes a processor 81, a memory 82, a communication interface 83 and a communication bus 84. The memory 82 stores a computer program, and the processor 81 and The memory 82 is connected through a communication bus 84, the communication interface 83 is used to connect to the outside, and the processor 81 executes the computer program to perform the aforementioned installation package resource file management method or installation resource file acquisition. method.
本发明提供一种信息存储介质,所述信息存储介质存储有计算机程序,所述计算机程序被执行时,实现权前面所述的安装包资源文件管理方法或者安装包资源文件获取方法。The present invention provides an information storage medium that stores a computer program. When the computer program is executed, the installation package resource file management method or the installation package resource file acquisition method described above is implemented.
综上所述,本发明通过在服务器上根据资源文件生成资源文件索引表,使得资源文件的ID是随机生成的,并采用加密的方式存储所述资源文件索引表以及资源文件,从而能够很好地保护资源文件,避免了资源文件被篡改、不当获取。To sum up, the present invention generates a resource file index table based on resource files on the server, so that the IDs of resource files are randomly generated, and uses an encrypted method to store the resource file index table and resource files, so that it can effectively Protect resource files effectively and avoid resource files from being tampered with and improperly obtained.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the part of the above technical solution that essentially contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., including a number of instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still be used Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent substitutions are made to some of the technical features; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (13)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311091621.0A CN117313115A (en) | 2023-08-28 | 2023-08-28 | Method and corresponding device for accessing, acquiring and managing installation package resource file |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311091621.0A CN117313115A (en) | 2023-08-28 | 2023-08-28 | Method and corresponding device for accessing, acquiring and managing installation package resource file |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117313115A true CN117313115A (en) | 2023-12-29 |
Family
ID=89296186
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311091621.0A Pending CN117313115A (en) | 2023-08-28 | 2023-08-28 | Method and corresponding device for accessing, acquiring and managing installation package resource file |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117313115A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118627064A (en) * | 2024-05-28 | 2024-09-10 | 国网重庆市电力公司电力科学研究院 | A data extraction method for defending against ransomware based on file system directory table |
-
2023
- 2023-08-28 CN CN202311091621.0A patent/CN117313115A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118627064A (en) * | 2024-05-28 | 2024-09-10 | 国网重庆市电力公司电力科学研究院 | A data extraction method for defending against ransomware based on file system directory table |
CN118627064B (en) * | 2024-05-28 | 2025-01-21 | 国网重庆市电力公司电力科学研究院 | A data extraction method for defending against ransomware based on file system directory table |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11329962B2 (en) | Pluggable cipher suite negotiation | |
US8694467B2 (en) | Random number based data integrity verification method and system for distributed cloud storage | |
CA2892874C (en) | System and method for sharing cryptographic resources across multiple devices | |
US9973481B1 (en) | Envelope-based encryption method | |
CN103731395B (en) | The processing method and system of file | |
US20120131354A1 (en) | Method and system for provision of cryptographic services | |
EP3210114A1 (en) | Data computation in a multi-domain cloud environment | |
JP2002175010A (en) | Home page falsification preventing system | |
CN110855433B (en) | Data encryption method and device based on encryption algorithm and computer equipment | |
US20040088539A1 (en) | System and method for securing digital messages | |
US20210167955A1 (en) | Data transmission | |
CN105827574A (en) | File access system, file access method and file access device | |
US20020021804A1 (en) | System and method for data encryption | |
CN107948235A (en) | Cloud data safety management and audit device based on JAR | |
Junghanns et al. | Engineering of secure multi-cloud storage | |
CN111831978B (en) | A method and device for protecting configuration files | |
CN117313115A (en) | Method and corresponding device for accessing, acquiring and managing installation package resource file | |
CN108462699A (en) | Based on the encrypted Quick Response Code generation of sequential and verification method and system | |
CN113672973B (en) | Database system for embedded devices based on RISC-V architecture based on trusted execution environment | |
US12321481B2 (en) | Cloud-based whitebox node locking | |
CN117439739A (en) | Security protection method and system for interface requests | |
CN113709100B (en) | Shared file access control method, device, equipment and readable storage medium | |
CN112597449B (en) | Software encryption method, device, device and storage medium | |
CN108960385A (en) | Two dimensional code generation and verification method and system based on the encryption of multiple code key | |
Xie et al. | Assured Deletion: A Scheme Based on Strong Nonseparability |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Country or region after: China Address after: 215128 Building 9, No. 1, Guanpu Road, Guoxiang Street, Wuzhong Economic Development Zone, Suzhou, Jiangsu Province Applicant after: Suzhou Yuannao Intelligent Technology Co.,Ltd. Address before: 215128 Building 9, No. 1, Guanpu Road, Guoxiang Street, Wuzhong Economic Development Zone, Suzhou, Jiangsu Province Applicant before: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd. Country or region before: China |