WO2018177394A1 - 一种安卓so文件的保护方法及装置 - Google Patents
一种安卓so文件的保护方法及装置 Download PDFInfo
- Publication number
- WO2018177394A1 WO2018177394A1 PCT/CN2018/081256 CN2018081256W WO2018177394A1 WO 2018177394 A1 WO2018177394 A1 WO 2018177394A1 CN 2018081256 W CN2018081256 W CN 2018081256W WO 2018177394 A1 WO2018177394 A1 WO 2018177394A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- file
- environment information
- encrypted
- server
- key
- 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.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
-
- 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/06—Network architectures or network communication protocols for network security for supporting key management in a packet data network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3247—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
- H04L9/3249—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures using RSA or related signature schemes, e.g. Rabin scheme
Definitions
- the present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for protecting an Android (Andriod) SO file.
- a separate module file is called a SO file, which can be developed in C or C++.
- SO file which can be developed in C or C++.
- module developers tend to make the interface design of SO files more concise and easy to use.
- the Android program is released, the independent SO file will be distributed to the user's terminal along with one, and anyone can easily obtain all the SO files, and easily obtain all the interfaces of the SO file through analysis, so that the The SO file is used in its own Android program to steal the development results of the SO file program developer.
- the invention provides a method and a device for protecting an Android SO file, which are used to solve the technical problem that the SO file in the prior art is easily easily obtained and stolen, and the security is low.
- the present invention provides a method for protecting an Android SO file, including:
- the SO file is decrypted and called based on the key.
- the data encrypted in the SO file includes: constant data and/or table data.
- the obtaining the environment information of the running of the SO file in the application includes: initiating an initialization function of the SO file; and acquiring, according to the initialization function, environment information of the running of the SO file, where the environment information includes A combination of any one or more of the following: a range of a loaded memory address of the SO file, a permission of a current memory segment, or a path name of the SO file.
- the encrypting the environment information includes: acquiring a package name of the application; and encrypting the environment information based on the package name.
- the encrypting the environment information based on the package name includes: calculating an MD5 value of the package name; and encrypting the environment information based on the MD5 value.
- the method further includes: when not receiving the key returned by the server based on the encrypted environment information, exiting the SO file transfer.
- a method for protecting an Android SO file including:
- the determining whether the encrypted environment information meets a preset requirement includes any one or more of the following combinations: determining whether the encrypted application name can be determined by using a preset application package name. Decrypting the environment information; or determining whether the type of the SO file represented in the environment information satisfies a preset type requirement; or determining whether the parameter of the SO file represented in the environment information satisfies a preset parameter requirement.
- a protection device for an Android SO file where the device is a client, and includes:
- An acquiring module configured to acquire environment information of the running of the SO file when the application loads the SO file, where the SO file is an encrypted file;
- An encryption module configured to encrypt the environmental information
- a first sending module configured to send the encrypted environment information to a server
- a decryption module configured to decrypt and invoke the SO file based on the key when receiving the key returned by the server based on the encrypted environment information.
- a protection device for an Android SO file where the device is a server, including:
- a receiving module configured to receive the encrypted environment information sent by the client, where the environment information is used to represent an operating environment of the SO file loaded by the application;
- a determining module configured to determine whether the encrypted environmental information meets a preset requirement
- a second sending module configured to send a key to the client when the encrypted environment information meets a preset requirement, so that the client can decrypt and invoke the SO file based on the key .
- the method and the device provided by the embodiment of the present application pre-encrypt the SO file, and set the environment information of the SO file to be acquired when the application of the client loads the SO file, and the encrypted environment information is obtained.
- FIG. 1 is a flowchart 1 of a method for protecting an Android SO file according to an embodiment of the present invention
- FIG. 2 is a second flowchart of a method for protecting an Android SO file according to an embodiment of the present invention
- FIG. 3 is a schematic structural diagram 1 of an apparatus for protecting an Android SO file according to an embodiment of the present invention
- FIG. 4 is a schematic structural diagram 2 of an apparatus for protecting an Android SO file according to an embodiment of the present invention.
- the embodiment of the present application provides a method and a device for protecting an Android SO file, which are used to solve the technical problem that the SO file in the prior art is easily easily obtained and stolen, and the security is low.
- the technical effect of improving the security of the SO file is achieved.
- the above method needs to first obtain the environment information of the SO file running by encrypting the SO file in advance and setting the application file of the client to load the SO file, and send the encrypted environment information to the server for the server. Determining whether the application is allowed to invoke the SO file according to the environment information, and only after receiving the key returned by the server, the client can decrypt and invoke the SO file according to the key, thereby avoiding an application that does not meet the requirement.
- the program's theft of SO files effectively improves the security of SO files.
- This embodiment provides a method for protecting an Android SO file. As shown in FIG. 1 , the method includes:
- Step S101 when the application loads the SO file, acquiring environment information of the running of the SO file, where the SO file is an encrypted file;
- Step S102 encrypting the environment information
- Step S103 sending the encrypted environment information to the server
- Step S104 when receiving the key returned by the server based on the encrypted environment information, decrypting and calling the SO file based on the key.
- the method provided in this embodiment is applied to a client, and the client and the server are connected through a wireless or limited network to implement communication.
- the client may be a smart phone, a tablet computer or a desktop computer, and is not limited herein.
- the server may be a stand-alone server or a server group composed of multiple servers, and is not limited herein.
- step S101 is executed.
- the application loads the SO file
- the environment information of the SO file is obtained, where the SO file is an encrypted file.
- the SO file needs to be encrypted in advance, specifically, the SO file is encrypted when it is written.
- the constant data or the table data used in the SO file can be set to be encrypted. Protect the core content.
- the encryption of the SO file may use asymmetric encryption or a symmetric encryption algorithm, which is not limited herein.
- the asymmetric encryption algorithm may be used in advance to encrypt and store the table data in the SO file.
- the correct key that is, the KEY value
- the server the table data can be decrypted.
- the module function of the SO file if the correct KEY value is not obtained, the function of the SO file cannot be used.
- the specific encryption process for SO files can be as follows:
- the server uses the RSA algorithm to generate a pair of public keys PublicKey and private key SecretKey. That is, the RSA algorithm is used to generate a pair of private keys PublicKey and private key SecretKey through the RSA.CreatePairKey (SecretKey, PublicKey) command. The server then stores the pair of keys for subsequent client requests to deliver the private key.
- the RSA algorithm is used to encrypt the constant data and the table data used in the SO file. That is, the encryption interface of the RSA algorithm is called to encrypt the constant table.
- Charg_gloabledata[size] is the table data used in the SO file
- RSA.encrypt is the interface of the RSA encryption algorithm.
- the public key PublicKey is used to encrypt the global table data by the following command:
- the encrypted SO file may be distributed to the client along with the Android application (APP).
- APP Android application
- the obtaining the environment information of the running of the SO file includes:
- environment information of running of the SO file includes a combination of any one or more of the following: a load memory address range of the SO file, a current memory segment permission, or the The path name of the SO file.
- the environment information for acquiring the SO file may be added to the initialization function JNI_OnLoad of the SO file, and the environment information is encrypted and then sent to the server.
- the initialization function JNI_OnLoad of the SO file triggers the acquisition of the environment information of the SO file running.
- 4d575000-4d58a000 indicates the load memory address range of the SO file
- r-xp indicates the permission of the current memory segment
- /lib/ld.so indicates the path name of the loaded SO file.
- the loading range of the SO file and the path name of the SO file can be better judged.
- step S102 is performed to encrypt the environment information.
- the environmental information is encrypted and then transmitted, on the one hand, the protection of the environmental information, and on the other hand, the server can be used to determine whether the application is allowed to invoke the SO file.
- the environment information may be directly encrypted according to the package name of the application, that is, the package name of the application is obtained first, and then the environment information is performed based on the package name. encryption.
- the environment information may be encrypted according to the MD5 value of the package name of the application, that is, the MD5 value of the package name is first calculated, and the environment information is encrypted based on the MD5 value.
- the package name of each application is different, the package name of the application is obtained, and then the MD5 value is calculated for the package name as the KEY used to obtain the encrypted environment information of the client. value.
- the server stores the package name of the application that is allowed to invoke the SO file, so the server will directly decrypt the environment information using its approved package name. If the application that invokes the SO file is not the application allowed by the server, the obtained package name will be different, so that the server cannot decrypt the correct environment information, and thus can refuse to send the decrypted secret to the client. key. Only after the server decrypts the environment information successfully can the content of the environment information be continuously determined to determine whether to allow the SO file to be called.
- the application package name can be obtained by the following methods:
- the specific implementation code can be:
- jmethodID methodID_pack (*env)->GetMethodID(env,context_clazz,”getPackageName”,"()Ljava/lang/String;”);
- the method ID of the package name is used to obtain the package name of the current application, and the specific implementation code can be:
- Jstring application_package (*env)->CallObjectMethod(env, context,methodID_pack);
- the application's package name can also be obtained by sending a request like the application main program, or by querying the application package address, which is not limited here.
- the KEY value may be set to the program name and the MD5 value thereof, and may also be a type identifier of the program, an initial letter or a short name of the program name, and the like, which is not limited herein.
- the encryption of the environmental information may be implemented by the following method:
- the obtained environment information is encrypted by using the encryption algorithm and using the KEY value determined in the foregoing step.
- the encryption algorithm AES can be used to perform encryption using the AES.encrypt(KEY, result) command, where KEY is the previously calculated package name or MD5 value of the package name, and result is the previously obtained memory mapping information. , that is, the environmental information.
- the RSA encryption algorithm and the DES encryption algorithm may also be used to encrypt the environment information, which is not limited herein.
- the environment information is obtained and encrypted in the initialization of the SO file.
- step S103 is executed to send the encrypted environment information to the server.
- the server and the client implement a network connection, where the SO file stores an address of the server, and is provided with a function of communicating with the server, after the server receives the environment information, Whether to return a key to the client can be determined by at least one of the following ways:
- the first type determines whether it can be decrypted by the default password.
- the client is configured to encrypt the environment information by using the information of the application as a KEY value.
- the server stores information about an application that allows the SO file to be called, so the server can directly decrypt the environment information using the information of its approved application as a KEY value, for example, the client uses the current application that calls the SO file.
- the MD5 value of the package name is encrypted, and the corresponding server is decrypted with the MD5 value of the package name of the application that allows the SO file to be called.
- the program information used by the client for encryption will be different from the program information decrypted by the client, so that the server cannot decrypt the correct environment information, thereby rejecting Send the decrypted key to the client. Only after the server decrypts the environment information successfully can the content of the environment information be continuously determined to determine whether to allow the SO file to be called.
- the decryption algorithm used by the server needs to be preset corresponding to the encryption algorithm used by the client.
- the client uses the AES algorithm to encrypt the obtained environment information by using the MD5 value of the package name of the current application as the KEY value
- the server uses the encrypted environment information reported by the client.
- the same AES algorithm and MD8, which allows the name of the package that invokes the SO file, is used as the KEY value to decrypt the environment information. If the decryption fails, the decrypted key is refused to be sent to the client. If the decryption is successful, further judgment is made based on the specific content of the environment information or the key is directly transmitted.
- the server side uses MD5 as the KEY value to decrypt the environment information:
- the AES algorithm is then used to decrypt the reported data.
- the specific command is: AES.decrypt(KEY, result).
- the current environment information obtained is the environment information of the SO file loaded by the current application, because the SO files loaded by different applications are different, so according to the environment information of the acquired SO file. Can be a good distinction between applications.
- the type and parameters of the SO file loaded in the environment information are determined. Since the information of the loaded SO file is pre-stored in the server, for example, the necessary SO files are loaded by the normal program. The information of the SO files is not loaded; or the memory interval of each SO file loaded by the normal program, so the server can easily judge the environment reported by the client according to the information of the pre-stored SO file. Whether the information is correct when the application loads the SO file. If the server determines that the environment information reported by the client meets the loading information of the correct application, the decryption key (SecretKey) is sent to the client, otherwise the rejection information is sent to the client.
- the decryption key SecretKey
- the accuracy of the judgment can be increased. That is, the first method is firstly used to determine whether the environment information can be decrypted. If the decryption fails, the return key is rejected. If the decryption is successful, the second method is further used to further determine whether the specific content of the environmental information meets the requirements. The key is returned, and if it does not, the key is rejected.
- step S104 is executed to decrypt and call the SO file based on the key when receiving the key returned by the server based on the encrypted environment information.
- the SO file is decrypted, and the constant data or the table data in the SO file may be decrypted, so that the SO file can be correctly used.
- the specific decryption instruction can be: RSA.decrypt(g_gloabledata, size, SecretKey);
- the client does not receive the key returned by the server based on the encrypted environment information, the call to the SO file is exited.
- an initialization failure message may be output on the client to remind the user.
- the method provided in this embodiment uses an encryption algorithm to encrypt some key constant data or table data used in the SO file, and when the application calls the SO file, the user program of the SO file is verified. If the verification is unsuccessful, all the functions of the SO file cannot be used, so that the SO file can be protected. Specifically, after the client logs in and starts the application, the application loads the SO file, and when the SO file is initialized, the environment information of the current SO file is obtained, and after the environment information is obtained, the SO file is written. The network connection function with the server is sent, and the server determines whether the current user program is the correct application according to the reported environment information. Only when the server passes the verification, the decryption key will be sent to the client, and the constant data or the table data to be used can be decrypted correctly. Otherwise, the decryption key cannot be obtained, and the SO file cannot be used.
- the present application further provides a method for protecting an Android SO file applied to a server end corresponding to the protection method of the Android SO file in the first embodiment.
- a method for protecting an Android SO file applied to a server end corresponding to the protection method of the Android SO file in the first embodiment For details, refer to the second embodiment.
- This embodiment provides a method for protecting an Android SO file. As shown in FIG. 2, the method includes:
- Step S201 receiving the encrypted environment information sent by the client, where the environment information is used to represent an operating environment of the SO file loaded by the application;
- Step S202 determining whether the encrypted environment information meets a preset requirement
- Step S203 When the encrypted environment information meets a preset requirement, send a key to the client, so that the client can decrypt and invoke the SO file based on the key.
- the method provided in this embodiment is applied to a server, and the server is connected to the client in the first embodiment through a wireless or limited network to implement communication.
- the client may be a smart phone, a tablet computer or a desktop computer, and is not limited herein.
- the server may be a stand-alone server or a server group composed of multiple servers, and is not limited herein.
- the determining whether the encrypted environment information meets a preset requirement includes any one or more of the following combinations:
- the method introduced in the second embodiment of the present invention is the same as the method in the first embodiment, and the specific implementation steps and principles for determining whether the encrypted environmental information meets the preset requirement in the second embodiment are also A detailed description is given in the first embodiment. Based on the first embodiment, those skilled in the art should understand the implementation steps and principles of the method provided in the second embodiment, and therefore will not be further described herein.
- the present application further provides an apparatus corresponding to the protection method of the Android SO file in the first embodiment.
- an apparatus corresponding to the protection method of the Android SO file in the first embodiment.
- the embodiment provides a protection device for an Android SO file, and the device is a client, as shown in FIG. 3, and includes:
- the obtaining module 301 is configured to acquire environment information of the running of the SO file when the application loads the SO file, where the SO file is an encrypted file;
- the encryption module 302 is configured to encrypt the environment information.
- the first sending module 303 is configured to send the encrypted environment information to the server;
- the decryption module 304 is configured to decrypt and invoke the SO file based on the key when receiving the key returned by the server based on the encrypted environment information.
- the client may be a smart phone, a tablet computer or a desktop computer, and is not limited herein.
- the device introduced in the third embodiment of the present invention is a device used in the method for protecting the Android SO file according to the first embodiment of the present invention. Therefore, those skilled in the art can understand the device according to the method introduced in the first embodiment of the present invention. The specific structure and deformation, and therefore will not be described here.
- the apparatus used in the method of the first embodiment of the present invention is within the scope of the present invention.
- the present application further provides an apparatus corresponding to the protection method of the Android SO file in the second embodiment.
- an apparatus corresponding to the protection method of the Android SO file in the second embodiment For details, see Embodiment 4.
- the embodiment provides a protection device for the Android SO file, and the device is a server. As shown in FIG. 4, the method includes:
- the receiving module 401 is configured to receive the encrypted environment information sent by the client, where the environment information is used to represent an operating environment of the SO file loaded by the application;
- the determining module 402 is configured to determine whether the encrypted environment information meets a preset requirement
- the second sending module 403 is configured to send a key to the client when the encrypted environment information meets a preset requirement, so that the client can decrypt and invoke the SO based on the key. file.
- the server may be an independent server or a server group composed of multiple servers, which is not limited herein.
- the device described in the fourth embodiment of the present invention is a device for implementing the method for protecting the Android SO file according to the second embodiment of the present invention. Therefore, those skilled in the art can understand the device according to the method described in the second embodiment of the present invention. The specific structure and deformation, and therefore will not be described here.
- the apparatus used in the method of the second embodiment of the present invention is within the scope of the present invention.
- the method and the device provided by the embodiment of the present application pre-encrypt the SO file, and set the environment information of the SO file to be acquired when the application of the client loads the SO file, and the encrypted environment information is obtained.
- embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
- computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
- the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
- the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
- These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
- the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Theoretical Computer Science (AREA)
- Power Engineering (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Bioethics (AREA)
- Health & Medical Sciences (AREA)
- Telephone Function (AREA)
- Storage Device Security (AREA)
- Telephonic Communication Services (AREA)
Abstract
本发明公开一种安卓SO文件的保护方法及装置,该方法包括:当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件;对所述环境信息进行加密;发送加密后的所述环境信息至服务器;当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。本申请提供的方法和装置可以解决现有技术中SO文件容易被轻易获取和盗用,存在的安全性低的技术问题。实现了提高SO文件的安全性的技术效果。
Description
本发明涉及计算机技术领域,尤其涉及一种安卓(Andriod)SO文件的保护方法及装置。
随着移动设备的日益普及,移动应用产业尤其是Andriod应用得到飞速的发展,相应的,其开发模式和代码框架也都发生了巨大的变化。由于程序的功能日益丰富,为了节约开发时间,模块化开发已经成为一种开发趋势,且Android系统也提供独立模块的文件以及独立模块的加载和使用方式。
独立的模块文件称为SO文件,该文件可以使用C或者C++语言开发。模块开发者为了保障程序的可用性和易用性,往往会将SO文件的接口设计的更为简洁和好用。在Android程序发布时,独立的SO文件会随之一同发布到用户的终端中,任何人就可以轻易的获取到所有的SO文件,并且通过分析轻易的获取SO文件的所有接口,从而可以将该SO文件使用到自己的Android程序中,以盗取该SO文件程序开发厂商的研发成果。目前,急需一种SO文件的保护方法,来防止其他人员直接盗用厂商辛苦开发出的SO文件。
可见,现有技术中SO文件容易被轻易获取和盗用,存在安全性低的技术问题。
发明内容
本发明提供一种安卓SO文件的保护方法及装置,用以解决现有技术中SO文件容易被轻易获取和盗用,存在的安全性低的技术问题。
一方面,本发明提供了一种安卓SO文件的保护方法,包括:
当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件;
对所述环境信息进行加密;
发送加密后的所述环境信息至服务器;
当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。
可选的,所述SO文件中加密的数据包括:常量数据和/或表格数据。
可选的,所述获取所述应用程序中SO文件运行的环境信息,包括:调用SO文件的初始化函数;基于所述初始化函数,获取所述SO文件的运行的环境信息,所述环境信息包括以下任意一种或多种的组合:所述SO文件的加载内存地址范 围、当前内存段的权限或所述SO文件的路径名称。
可选的,所述对所述环境信息进行加密,包括:获取所述应用程序的程序包名称;基于所述程序包名称,对所述环境信息进行加密。
可选的,所述基于所述程序包名称,对所述环境信息进行加密,包括:计算所述程序包名称的MD5值;基于所述MD5值,对所述环境信息进行加密。
可选的,在所述发送加密后的所述环境信息至服务器后,还包括:当没有接收到所述服务器基于加密后的所述环境信息返回的密钥时,退出对所述SO文件的调用。
另一方面,提供一种安卓SO文件的保护方法,包括:
接收客户端发送的加密后的环境信息,其中,所述环境信息用于表征应用程序加载的SO文件的运行环境;
判断所述加密后的环境信息是否符合预设要求;
当所述加密后的环境信息符合预设要求时,发送密钥至所述客户端,以使所述客户端能基于所述密钥,解密并调用所述SO文件。
可选的,所述判断所述加密后的环境信息是否符合预设要求,包括以下任意一种或多种的组合:判断是否能通过预设应用程序的程序包名称,对所述加密后的环境信息进行解密;或者判断所述环境信息中表征的SO文件的类型是否满足预设类型要求;或者判断所述环境信息中表征的SO文件的参数是否满足预设参数要求。
再一方面,提供一种安卓SO文件的保护装置,所述装置为客户端,包括:
获取模块,用于当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件;
加密模块,用于对所述环境信息进行加密;
第一发送模块,用于发送加密后的所述环境信息至服务器;
解密模块,用于当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。
再一方面,提供一种安卓SO文件的保护装置,所述装置为服务器,包括:
接收模块,用于接收客户端发送的加密后的环境信息,其中,所述环境信息用于表征应用程序加载的SO文件的运行环境;
判断模块,用于判断所述加密后的环境信息是否符合预设要求;
第二发送模块,用于当所述加密后的环境信息符合预设要求时,发送密钥至所述客户端,以使所述客户端能基于所述密钥,解密并调用所述SO文件。
本发明实施例中提供的一个或多个技术方案,至少具有如下技术效果或优点:
本申请实施例提供的方法及装置,预先对SO文件进行加密,并设置在客户端的应用程序加载SO文件时,需要先获取所述SO文件运行的环境信息,并将加密后的所述环境信息发送至服务器,以供服务器根据所述环境信息来判断是否允许所述应用程序调用该SO文件,只有收到服务器返回的密钥后,客户端才能根据密钥解密并调用所述SO文件,以避免了不符合要求的应用程序对SO文件的盗用,有效提高了SO文件的安全性。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例中安卓SO文件的保护方法的流程图一;
图2为本发明实施例中安卓SO文件的保护方法的流程图二;
图3为本发明实施例中安卓SO文件的保护装置的结构示意图一;
图4为本发明实施例中安卓SO文件的保护装置的结构示意图二。
本申请实施例通过提供一种安卓SO文件的保护方法及装置,用以解决现有技术中SO文件容易被轻易获取和盗用,存在的安全性低的技术问题。实现了提高SO文件的安全性的技术效果。
本申请实施例中的技术方案,总体思路如下:
当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件;对所述环境信息进行加密;发送加密后的所述环境信息至服务器;当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。
上述方法通过预先对SO文件进行加密,并设置在客户端的应用程序加载SO文件时,需要先获取所述SO文件运行的环境信息,并将加密后的所述环境信息发送至服务器,以供服务器根据所述环境信息来判断是否允许所述应用程序调用该SO文件,只有收到服务器返回的密钥后,客户端才能根据密钥解密并调用所述SO文件,以避免了不符合要求的应用程序对SO文件的盗用,有效提高了SO 文件的安全性。
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
实施例一
本实施例提供一种安卓SO文件的保护方法,如图1所示,该方法包括:
步骤S101,当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件;
步骤S102,对所述环境信息进行加密;
步骤S103,发送加密后的所述环境信息至服务器;
步骤S104,当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。
需要说明的是,本实施例提供的方法应用于客户端,所述客户端与所述服务器通过无线或有限网络进行连接,以实现通信。
在具体实施过程中,所述客户端可以为智能手机,平板电脑或台式机,在此也不作限制。所述服务器可以是一台独立的服务器,也可以是多台服务器组成的服务器群,在此也不作限制。
下面,结合图1详细介绍本实施例提供的安卓SO文件的保护方法的具体实施步骤:
首先,执行步骤S101,当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件。
具体来讲,需要预先对SO文件进行加密,具体可以是在编写SO文件时对其进行加密。
进一步,考虑到在编写核心SO文件的模块代码时,其中会使用到一些常量的表格,或者是函数使用的参数等,故可以设置主要对SO文件中使用的常量数据或者表格数据进行加密,以保护最核心的内容。
在具体实施过程中,对所述SO文件的加密可以使用非对称加密,也可以使用对称加密算法,在此不作限制。
举例来说,可以预先使用非对称加密算法来对SO文件中表格数据进行加密后存储,调用SO文件时则需要从服务器获取到正确的密钥,即KEY值,才能解密出这些表格数据,从而才能使用SO文件的模块功能,如果获取不到正确的KEY值,则无法使用SO文件的功能。对SO文件的具体加密过程可以如下:
首先,服务器使用RSA算法来生成一对公钥PublicKey和私钥SecretKey。即通过RSA.CreatePairKey(SecretKey,PublicKey)命令,使用RSA算法来生成一对私钥PublicKey和私钥SecretKey。然后,服务器存储这对密钥,以供后续客户端请求下发私钥。
然后,使用RSA算法来对SO文件中使用的常量数据和表格数据进行加密。即调用RSA算法的加密接口来对常量表格进行加密。例如,Charg_gloabledata[size]为SO文件中使用的表格数据,RSA.encrypt则是RSA加密算法的接口,通过下述命令使用公钥PublicKey来对全局的表格数据进行加密:
Char g_gloabledata[size]={.....};
RSA.encrypt(g_gloabledata,size,PublicKey);
其中,Char g_gloabledata[size]={.....}表征需要加密的表格数据,用加密后的数据替换SO文件中表格数据的内容,从而保证SO文件中存储的表格是已加密状态。
当对所述SO文件加密后,可以将加密后的SO文件随着Android的应用程序(APP)发布到客户端,当有应用程序要加载SO文件时,必须先获取所述SO文件运行的环境信息。
在本申请实施例中,所述获取所述SO文件运行的环境信息,包括:
调用SO文件的初始化函数;
基于所述初始化函数,获取所述SO文件的运行的环境信息,所述环境信息包括以下任意一种或多种的组合:所述SO文件的加载内存地址范围、当前内存段的权限或所述SO文件的路径名称。
具体来讲,可以预先在SO文件的初始化函数JNI_OnLoad中加入获取所述SO文件运行的环境信息,并对所述环境信息加密后再发送至服务器的指令,当应用程序加载SO文件是,必须调用SO文件的初始化函数JNI_OnLoad,则会触发获取所述SO文件运行的环境信息。
举例来讲,加入初始化函数中的获取所述环境信息的指令可以是:先定义ProcessBuilder processBuilder=new ProcessBuilder(“cat/proc/PID/maps”),以用来创建一个新的进程,其中PID是当前应用程序的ID,其中“/proc/PID/maps”则标示获取当前程序的内存映射信息,包含SO的加载信息;再执行process=processBuilder.start(),以执行创建的进程;再执行is=process.getInputStream(),以获取进程的输出信息;然后,执行ByteArrayOutputStream info=new ByteArrayOutputStream(),来定义一个输出流;再下来,执行while(is.read()!=-1){info.write(read);},以通过编写一个While循环来将进程的输出信息写入到所述输出流中;然后, 执行byte[]data=info.toByteArray(),将输出流的信息转换到byte数组中;再执行String result=new String(data),将byte数组的信息转换成一个字符串信息。例如,采用上述步骤获取的信息类似于如下一条SO文件的环境信息:
“4d575000-4d58a000r-xp 00000000 03:06 736549/lib/ld.so”
其中,4d575000-4d58a000标示SO文件的加载内存地址范围;r-xp则标示当前内存段的权限;/lib/ld.so则表示加载的SO文件的路径名称。
因此,根据所述环境信息能较好的判断出SO文件的加载范围和SO文件的路径名称。
在获取了所述环境信息后,执行步骤S102,对所述环境信息进行加密。
在具体实施过程中,对所述环境信息进行加密后再传送一方面是对所述环境信息的保护,另一方面能通过预先沟通好加密方式来帮助服务器判断所述应用程序是否允许调用所述SO文件。
在具体实施过程中,可以直接根据应用程序的程序包名称来对所述环境信息进行加密,即先获取所述应用程序的程序包名称,再基于所述程序包名称,对所述环境信息进行加密。
进一步,可以根据应用程序的程序包名称的MD5值来对所述环境信息进行加密,即先计算所述程序包名称的MD5值,再基于所述MD5值,对所述环境信息进行加密。
具体来讲,由于每个应用程序的程序包名称都是不同的,所以获取应用程序的程序包名称,然后对程序包名称计算其MD5值来做为获取到的客户端的环境信息加密使用的KEY值。而服务器存储有允许调用所述SO文件的应用程序的程序包名称,所以服务器会直接使用其认可的程序包名称来解密所述环境信息。而如果客户端是调用SO文件的应用程序不是服务器允许的应用程序,那么获取到的程序包名称则会不一样,从而服务器无法解密出正确的环境信息,从而可以拒绝给客户端发送解密的密钥。只有当服务器对所述环境信息解密成功后,才能继续根据所述环境信息的本文内容来判断是否允许调用SO文件。
在具体实施过程中,应用程序的程序包名称可以采取下述方法获取:
首先,通过在SO文件中使用JNI层的接口来获取程序包名称的方法ID,具体实现代码可以为:
jmethodID methodID_pack=(*env)->GetMethodID(env,context_clazz,"getPackageName","()Ljava/lang/String;");
然后,通过程序包名称的方法ID来获取当前应用程序的程序包名称,具体实现代码可以为:
jstring application_package=(*env)->CallObjectMethod(env, context,methodID_pack);
其中,application_package则是应用程序的程序包名称。
当然,应用程序的程序包名还可以通过像应用程序主程序发送请求,或查询应用程序程序包地址的方式获取,在此不作限制。
在具体实施过程中,获取了应用程序的程序包名称后,可以对所述程序包名称使用MD5算法来计算其MD5值,以作为后续加密使用的KEY值。即设置KEY=MD5.create(application_package)。
当然,在具体实施过程中,所述KEY值除了可以设置为所述程序包名称和其MD5值外,还可以为程序的类型标识,程序名称的首字母或简称等,在此不作限制。
在具体实施过程中,确定KEY值后,对所述环境信息的加密可以采取下述方法实现:
使用加密算法,采用前述步骤确定的KEY值来对获取到的所述环境信息进行加密。例如,可以采取加密算法AES,使用AES.encrypt(KEY,result)命令来进行加密,其中,KEY为之前计算得出的程序包名称或程序包名称的MD5值,result为之前获取的内存映射信息,即所述环境信息。
当然,在具体实施过程中,也可以采用RSA加密算法和DES加密算法来对所述环境信息进行加密,在此不作限制。
通过上述步骤就实现了在SO文件的初始化中获取环境信息并加密。
接下来,执行步骤S103,发送加密后的所述环境信息至服务器。
在本申请实施例中,所述服务器与所述客户端实现网络连接,所述SO文件中存储有服务器的地址,并设置有与服务器通信的功能,所述服务器接收到所述环境信息后,可以通过以下至少一种方式判断是否返回密钥至所述客户端:
第一种,判断是否能按预设密码解密。
具体来讲,设置客户端以应用程序的信息作为KEY值来对所述环境信息进行加密。而服务器存储有允许调用所述SO文件的应用程序的信息,所以服务器可以直接使用其认可的应用程序的信息作为KEY值来解密所述环境信息,例如,客户端用调用SO文件的当前应用程序的程序包名称的MD5值来加密,对应的服务器用允许调用SO文件的应用程序的程序包名称的MD5值来解密。如果客户端调用SO文件的当前应用程序不是服务器允许的应用程序,那么客户端用于加密的程序信息与客户端解密的程序信息则会不一样,从而服务器无法解密出正确的环境信息,从而拒绝给客户端发送解密的密钥。只有当服务器对所述环境信息解密成功后,才能继续根据所述环境信息的本文内容来判断是否允许调用SO文件。
需要说明的是,服务器端使用的解密算法需要与客户端使用的加密算法预先对应设置。
举例来说,客户端采用AES算法,以当前应用程序的程序包名称的MD5值作为KEY值,来对获得的所述环境信息进行加密,服务器收到客户端上报的加密后环境信息后,使用同样的AES算法并且使用允许调用SO文件的程序包名称的MD5做为KEY值来对所述环境信息进行解密。如果解密失败,拒绝给客户端发送解密的密钥,如果解密成功,再基于所述环境信息的具体内容进行进一步判断或直接发送密钥。
服务器端使用MD5做为KEY值来对所述环境信息进行解密的方法为:
首先,使用允许调用SO文件的应用程序的程序包名称计算MD5值。具体命令为:KEY=MD5.create(application_package);
然后,使用AES算法来对上报的数据进行解密。具体命令为:AES.decrypt(KEY,result)。
第二种,或者判断所述环境信息中表征的SO文件的类型或参数是否满足预设要求。
具体来讲,获取的当前环境信息本文是获取当前应用程序所加载的SO文件的环境信息,因为不同的应用程序所需要加载的SO文件是不一样的,所以根据获取加载的SO文件的环境信息可以很好的区分应用程序。
即在解密后,对所述环境信息中加载的SO文件的类型和参数进行判断,由于服务器中预先存储有加载的SO文件的信息,例如,存储有正常的程序会加载哪些必要的SO文件,不会加载哪些SO文件的信息;或者,正常的程序加载的每个SO文件的加载内存区间,故服务器根据预存的加载的SO文件的信息,可以很容易的判断出客户端上报的所述环境信息是否是正确的应用程序加载SO文件时的信息。如果服务器判断出客户端上报的所述环境信息符合正确的应用程序的加载信息,则向客户端下发解密使用的密钥(SecretKey),否则向客户端下发拒绝信息。
当然,在具体实施过程中,结合上述第一种和第二种方法来一同判断是否返回密钥,能够增加判断的准确性。即先采取第一种方法判断能否对所述环境信息进行解密,如果解密失败则拒绝返回密钥,如果解密成功再采取第二种方法进一步判断所述环境信息的具体内容是否符合要求,符合则返回密钥,不符合则拒绝返回密钥。
再下来,执行步骤S104,当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。
具体来讲,如果客户端接收到所述服务器下发的密钥信息,则对SO文件进 行解密,具体可以是对SO文件中的常量数据或表格数据进行解密,从而SO文件才能正确的使用。具体的解密指令可以为:RSA.decrypt(g_gloabledata,size,SecretKey);
进一步,如果客户端没有接收到所述服务器基于加密后的所述环境信息返回的密钥时,退出对所述SO文件的调用。
进一步,退出对所述SO文件的调用后,可以在所述客户端上输出初始化失败信息以提醒用户。
本实施例提供的方法,对SO文件中所使用到的关键性的一些常量数据或者表格数据使用加密算法来进行加密,在应用程序调用SO文件时,会对SO文件的使用方程序进行验证,如果验证不成功则无法使用SO文件的所有功能,从而可以对SO文件进行保护。具体来讲,在客户端登陆启动应用程序后,应用程序加载SO文件,而在SO文件进行初始化的同时,会获取当前SO文件所处的环境信息,获取到环境信息后会通过SO文件中编写的与服务器的网络连接功能来进行发送,而服务器则会根据上报的所述环境信息判断当前使用方程序是否是正确的应用程序。只有当服务器校验通过时,才会将解密密钥下发至客户端,才能够正确的解密出需要使用的常量数据或者表格数据,否则无法获取到解密密钥,从而无法使用SO文件中的功能。
基于同一发明构思,本申请还提供了与实施例一中安卓SO文件的保护方法对应的应用于服务器端的安卓SO文件的保护方法,详见实施例二。
实施例二
本实施例提供了一种安卓SO文件的保护方法,如图2所示,该方法包括:
步骤S201,接收客户端发送的加密后的环境信息,其中,所述环境信息用于表征应用程序加载的SO文件的运行环境;
步骤S202,判断所述加密后的环境信息是否符合预设要求;
步骤S203,当所述加密后的环境信息符合预设要求时,发送密钥至所述客户端,以使所述客户端能基于所述密钥,解密并调用所述SO文件。
需要说明的是,本实施例提供的方法应用于服务器端,所述服务器端与实施例一中的客户端通过无线或有限网络进行连接,以实现通信。
在具体实施过程中,所述客户端可以为智能手机,平板电脑或台式机,在此也不作限制。所述服务器可以是一台独立的服务器,也可以是多台服务器组成的服务器群,在此也不作限制。
在本申请实施例中,所述判断所述加密后的环境信息是否符合预设要求,包括以下任意一种或多种的组合:
判断是否能通过预设应用程序的程序包名称,对所述加密后的环境信息进 行解密;或者
判断所述环境信息中表征的SO文件的类型是否满足预设类型要求;或者
判断所述环境信息中表征的SO文件的参数是否满足预设参数要求。
由于本发明实施例二所介绍的方法与实施例一中所介绍的方法属于同一发明构思,而实施例二中判断所述加密后的环境信息是否符合预设要求的具体实施步骤及原理也在实施例一中做了详细描述,基于实施例一本领域技术人员应该了解实施例二提供方法的实施步骤及原理,故而在此不再赘述。
基于同一发明构思,本申请还提供了与实施例一中安卓SO文件的保护方法对应的装置,详见实施例三。
实施例三
本实施例提供一种安卓SO文件的保护装置,所述装置为客户端,如图3所示,包括:
获取模块301,用于当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件;
加密模块302,用于对所述环境信息进行加密;
第一发送模块303,用于发送加密后的所述环境信息至服务器;
解密模块304,用于当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。
在具体实施过程中,所述客户端可以为智能手机,平板电脑或台式机,在此不作限制。
由于本发明实施例三所介绍的装置,为实施本发明实施例一的安卓SO文件的保护方法所采用的装置,故而基于本发明实施例一所介绍的方法,本领域所属人员能够了解该装置的具体结构及变形,故而在此不再赘述。凡是本发明实施例一的方法所采用的装置都属于本发明所欲保护的范围。
基于同一发明构思,本申请还提供了与实施例二中安卓SO文件的保护方法对应的装置,详见实施例四。
实施例四
本实施例提供一种安卓SO文件的保护装置,所述装置为服务器,如图4所示,包括:
接收模块401,用于接收客户端发送的加密后的环境信息,其中,所述环境信息用于表征应用程序加载的SO文件的运行环境;
判断模块402,用于判断所述加密后的环境信息是否符合预设要求;
第二发送模块403,用于当所述加密后的环境信息符合预设要求时,发送密钥至所述客户端,以使所述客户端能基于所述密钥,解密并调用所述SO文件。
在本申请实施例中,所述服务器可以是一台独立的服务器,也可以是多台服务器组成的服务器群,在此不作限制。
由于本发明实施例四所介绍的装置,为实施本发明实施例二的安卓SO文件的保护方法所采用的装置,故而基于本发明实施例二所介绍的方法,本领域所属人员能够了解该装置的具体结构及变形,故而在此不再赘述。凡是本发明实施例二的方法所采用的装置都属于本发明所欲保护的范围。
本申请实施例中提供的技术方案,至少具有如下技术效果或优点:
本申请实施例提供的方法及装置,预先对SO文件进行加密,并设置在客户端的应用程序加载SO文件时,需要先获取所述SO文件运行的环境信息,并将加密后的所述环境信息发送至服务器,以供服务器根据所述环境信息来判断是否允许所述应用程序调用该SO文件,只有收到服务器返回的密钥后,客户端才能根据密钥解密并调用所述SO文件,以避免了不符合要求的应用程序对SO文件的盗用,有效提高了SO文件的安全性。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基 本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明实施例进行各种改动和变型而不脱离本发明实施例的精神和范围。这样,倘若本发明实施例的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。
Claims (10)
- 一种安卓SO文件的保护方法,其特征在于,包括:当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件;对所述环境信息进行加密;发送加密后的所述环境信息至服务器;当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。
- 如权利要求1所述的方法,其特征在于,所述SO文件中加密的数据包括:常量数据和/或表格数据。
- 如权利要求1所述的方法,其特征在于,所述获取所述SO文件运行的环境信息,包括:调用SO文件的初始化函数;基于所述初始化函数,获取所述SO文件的运行的环境信息,所述环境信息包括以下任意一种或多种的组合:所述SO文件的加载内存地址范围、当前内存段的权限或所述SO文件的路径名称。
- 如权利要求1所述的方法,其特征在于,所述对所述环境信息进行加密,包括:获取所述应用程序的程序包名称;基于所述程序包名称,对所述环境信息进行加密。
- 如权利要求4所述的方法,其特征在于,所述基于所述程序包名称,对所述环境信息进行加密,包括:计算所述程序包名称的MD5值;基于所述MD5值,对所述环境信息进行加密。
- 如权利要求1-5任一所述的方法,其特征在于,在所述发送加密后的所述环境信息至服务器后,还包括:当没有接收到所述服务器基于加密后的所述环境信息返回的密钥时,退出对所述SO文件的调用。
- 一种安卓SO文件的保护方法,其特征在于,包括:接收客户端发送的加密后的环境信息,其中,所述环境信息用于表征应用程序加载的SO文件的运行环境;判断所述加密后的环境信息是否符合预设要求;当所述加密后的环境信息符合预设要求时,发送密钥至所述客户端,以使所述客户端能基于所述密钥,解密并调用所述SO文件。
- 如权利要求7所述的方法,其特征在于,所述判断所述加密后的环境信息是否符合预设要求,包括以下任意一种或多种的组合:判断是否能通过预设应用程序的程序包名称,对所述加密后的环境信息进行解密;或者判断所述环境信息中表征的SO文件的类型是否满足预设类型要求;或者判断所述环境信息中表征的SO文件的参数是否满足预设参数要求。
- 一种安卓SO文件的保护装置,其特征在于,所述装置为客户端,包括:获取模块,用于当应用程序加载SO文件时,获取所述SO文件运行的环境信息,其中,所述SO文件为加密文件;加密模块,用于对所述环境信息进行加密;第一发送模块,用于发送加密后的所述环境信息至服务器;解密模块,用于当接收到所述服务器基于加密后的所述环境信息返回的密钥时,基于所述密钥,解密并调用所述SO文件。
- 一种安卓SO文件的保护装置,其特征在于,所述装置为服务器,包括:接收模块,用于接收客户端发送的加密后的环境信息,其中,所述环境信息用于表征应用程序加载的SO文件的运行环境;判断模块,用于判断所述加密后的环境信息是否符合预设要求;第二发送模块,用于当所述加密后的环境信息符合预设要求时,发送密钥至所述客户端,以使所述客户端能基于所述密钥,解密并调用所述SO文件。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710211363.3A CN107196907B (zh) | 2017-03-31 | 2017-03-31 | 一种安卓so文件的保护方法及装置 |
| CN201710211363.3 | 2017-03-31 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2018177394A1 true WO2018177394A1 (zh) | 2018-10-04 |
Family
ID=59871390
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2018/081256 Ceased WO2018177394A1 (zh) | 2017-03-31 | 2018-03-30 | 一种安卓so文件的保护方法及装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN107196907B (zh) |
| WO (1) | WO2018177394A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115114590A (zh) * | 2021-03-22 | 2022-09-27 | 武汉斗鱼网络科技有限公司 | 一种Android平台so文件注册保护方法及系统 |
| CN115422572A (zh) * | 2022-07-14 | 2022-12-02 | 江苏通付盾科技有限公司 | 一种基于aab文件的安全保护方法及系统 |
Families Citing this family (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107196907B (zh) * | 2017-03-31 | 2018-08-03 | 武汉斗鱼网络科技有限公司 | 一种安卓so文件的保护方法及装置 |
| CN109657480A (zh) * | 2017-10-11 | 2019-04-19 | 中国移动通信有限公司研究院 | 一种文件处理方法、设备及计算机可读存储介质 |
| CN109194625B (zh) * | 2018-08-10 | 2021-06-11 | 厦门市美亚柏科信息股份有限公司 | 一种基于云端服务器的客户端应用保护方法、装置及存储介质 |
| CN109255245A (zh) * | 2018-08-13 | 2019-01-22 | 海南新软软件有限公司 | 一种本地密钥保护方法、装置及系统 |
| CN109271758B (zh) * | 2018-08-24 | 2021-04-20 | 阿里巴巴(中国)有限公司 | 防止So文件被盗用的方法、设备、装置及服务器 |
| CN111310131B (zh) * | 2020-01-19 | 2022-11-04 | Oppo广东移动通信有限公司 | so库调用处理方法、装置、电子装置及存储介质 |
| CN111639311A (zh) * | 2020-05-29 | 2020-09-08 | 杭州安恒信息技术股份有限公司 | 防止反编译可执行文件的方法、装置、计算机设备和介质 |
| CN111666580B (zh) * | 2020-06-24 | 2022-11-04 | 北京航天数据股份有限公司 | 文件的加密方法、解密方法和装置 |
| CN119808174B (zh) * | 2025-03-07 | 2025-08-19 | 蜜度科技股份有限公司 | 一种应用程序篡改验证方法、装置、电子设备及介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106203009A (zh) * | 2016-06-30 | 2016-12-07 | 珠海市魅族科技有限公司 | 一种终端设备处理方法及装置 |
| CN106899463A (zh) * | 2017-02-27 | 2017-06-27 | 宁夏凯速德科技有限公司 | 智能家居中环境信息与设备交互方法及系统 |
| CN107135408A (zh) * | 2017-03-31 | 2017-09-05 | 武汉斗鱼网络科技有限公司 | 一种视频流地址的鉴权方法及装置 |
| CN107196907A (zh) * | 2017-03-31 | 2017-09-22 | 武汉斗鱼网络科技有限公司 | 一种安卓so文件的保护方法及装置 |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR101503785B1 (ko) * | 2013-10-10 | 2015-03-18 | (주)잉카엔트웍스 | 동적 라이브러리를 보호하는 방법 및 장치 |
| CN104408371B (zh) * | 2014-10-14 | 2017-12-19 | 中国科学院信息工程研究所 | 一种基于可信执行环境高安全应用系统的实现方法 |
| CN104504311A (zh) * | 2015-01-19 | 2015-04-08 | 炫彩互动网络科技有限公司 | 一种安全的sdk制作和运行方法 |
| CN104932902B (zh) * | 2015-07-09 | 2019-07-12 | 魅族科技(中国)有限公司 | 一种生成apk文件的方法及终端 |
| CN105205398B (zh) * | 2015-11-04 | 2018-03-09 | 北京鼎源科技有限公司 | 一种基于apk加壳软件动态行为的查壳方法 |
| CN106203006A (zh) * | 2016-08-31 | 2016-12-07 | 北京鼎源科技有限公司 | 基于dex与so文件动态执行的Android应用加固方法 |
-
2017
- 2017-03-31 CN CN201710211363.3A patent/CN107196907B/zh active Active
-
2018
- 2018-03-30 WO PCT/CN2018/081256 patent/WO2018177394A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106203009A (zh) * | 2016-06-30 | 2016-12-07 | 珠海市魅族科技有限公司 | 一种终端设备处理方法及装置 |
| CN106899463A (zh) * | 2017-02-27 | 2017-06-27 | 宁夏凯速德科技有限公司 | 智能家居中环境信息与设备交互方法及系统 |
| CN107135408A (zh) * | 2017-03-31 | 2017-09-05 | 武汉斗鱼网络科技有限公司 | 一种视频流地址的鉴权方法及装置 |
| CN107196907A (zh) * | 2017-03-31 | 2017-09-22 | 武汉斗鱼网络科技有限公司 | 一种安卓so文件的保护方法及装置 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115114590A (zh) * | 2021-03-22 | 2022-09-27 | 武汉斗鱼网络科技有限公司 | 一种Android平台so文件注册保护方法及系统 |
| CN115422572A (zh) * | 2022-07-14 | 2022-12-02 | 江苏通付盾科技有限公司 | 一种基于aab文件的安全保护方法及系统 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN107196907B (zh) | 2018-08-03 |
| CN107196907A (zh) | 2017-09-22 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN107196907B (zh) | 一种安卓so文件的保护方法及装置 | |
| CN108833091B (zh) | 一种日志文件的加密方法、解密方法及装置 | |
| CN107743133B (zh) | 移动终端及其基于可信安全环境的访问控制方法和系统 | |
| CN109634619B (zh) | 可信执行环境实现方法及装置、终端设备、可读存储介质 | |
| CN106063183B (zh) | 用于云辅助密码学的方法和装置 | |
| KR101891420B1 (ko) | DaaS를 위한 컨텐츠 보호 | |
| CN111654367B (zh) | 密码运算、创建工作密钥的方法、密码服务平台及设备 | |
| WO2019105290A1 (zh) | 数据处理方法、可信用户界面资源数据的应用方法及装置 | |
| CN110661748B (zh) | 一种日志的加密方法、解密方法及装置 | |
| CN104468562B (zh) | 一种面向移动应用透明的数据安全保护便携式终端 | |
| CN114629639A (zh) | 基于可信执行环境的密钥管理方法、装置和电子设备 | |
| KR102065833B1 (ko) | 데이터 동기화 방법 및 장치 | |
| WO2016058487A1 (zh) | 一种信息处理方法及装置 | |
| WO2020042798A1 (zh) | 密码运算、创建工作密钥的方法、密码服务平台及设备 | |
| WO2020073712A1 (zh) | 一种移动终端中共享安全应用的方法及移动终端 | |
| CN111628863B (zh) | 一种数据签名的方法、装置、电子设备及存储介质 | |
| CN107609410A (zh) | 基于HOOK的Android系统数据保护方法、终端设备及存储介质 | |
| US20110154436A1 (en) | Provider Management Methods and Systems for a Portable Device Running Android Platform | |
| CN109150811B (zh) | 一种实现可信会话的方法及装置、计算设备 | |
| CN103530169B (zh) | 虚拟机文件保护方法和用户终端 | |
| CN112995109B (zh) | 数据加密系统、方法、数据处理方法、装置及电子设备 | |
| TW202009773A (zh) | 可信執行環境的啟動方法和裝置 | |
| CN119094120B (zh) | 一种数据通信方法、装置、设备及存储介质 | |
| WO2015196525A1 (zh) | 加密方法及装置、内核加密数据的操作方法及装置 | |
| CN110457959B (zh) | 一种基于Trust应用的信息传输方法及装置 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18777426 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 18777426 Country of ref document: EP Kind code of ref document: A1 |