CN109474617B - Method, device, terminal and storage medium for calling functions in SO file - Google Patents

Method, device, terminal and storage medium for calling functions in SO file Download PDF

Info

Publication number
CN109474617B
CN109474617B CN201811541574.4A CN201811541574A CN109474617B CN 109474617 B CN109474617 B CN 109474617B CN 201811541574 A CN201811541574 A CN 201811541574A CN 109474617 B CN109474617 B CN 109474617B
Authority
CN
China
Prior art keywords
key
broadcast
file
function
thread
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811541574.4A
Other languages
Chinese (zh)
Other versions
CN109474617A (en
Inventor
周志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201811541574.4A priority Critical patent/CN109474617B/en
Publication of CN109474617A publication Critical patent/CN109474617A/en
Application granted granted Critical
Publication of CN109474617B publication Critical patent/CN109474617B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic 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/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0863Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic 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/3297Cryptographic 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 time stamps, e.g. generation of time stamps

Abstract

The embodiment of the invention discloses a method, a device, a terminal and a storage medium for calling functions in SO files, wherein the method comprises the following steps: creating a service process when an application is started, and creating a broadcast thread in the service process; writing a broadcast message in the broadcast thread, wherein the broadcast message comprises time information and key information, and sending the broadcast message to a message receiving function of an SO file through the broadcast thread; receiving the broadcast message through a message receiving function of the SO file, and acquiring time information and key information in the broadcast message; and decrypting the key information according to the time information to obtain an original key, and calling a function in the SO file according to the original key. The method, the device, the terminal and the storage medium for calling the function in the SO file provided by the embodiment of the invention realize legal calling of the function in the SO file.

Description

Method, device, terminal and storage medium for calling functions in SO file
Technical Field
The embodiment of the invention relates to computer technology, in particular to a method, a device, a terminal and a storage medium for calling a function in an SO file.
Background
In a Shared file (SO file) under the Android system, some core function functions, such as a decryption function of a network protocol or an authentication parameter function of calculating a video stream address, are usually encapsulated, and are called by an application layer to prevent a lawbreaker from reversely or inversely compiling the core function functions.
However, if a lawbreaker obtains a complete SO file, the functional function in the SO file can be called according to the original calling method of the application layer for the functional function in the SO file, and the process of decompiling the core functional function is avoided. Therefore, a method for calling a function in an SO file is needed to prevent the function in the SO file from being called by a lawbreaker.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a terminal, and a storage medium for calling a function in an SO file, SO as to implement legal calling of the function in the SO file.
In a first aspect, an embodiment of the present invention provides a method for calling a function in an SO file, including:
creating a service process when an application is started, and creating a broadcast thread in the service process;
writing a broadcast message in the broadcast thread, wherein the broadcast message comprises time information and key information, and sending the broadcast message to a message receiving function of an SO file through the broadcast thread;
receiving the broadcast message through a message receiving function of the SO file, and acquiring time information and key information in the broadcast message;
and decrypting the key information according to the time information to obtain an original key, and calling a function in the SO file according to the original key.
Optionally, the creating a service process, and creating a broadcast thread in the service process, include:
and calling a process creation method to create a service process, and calling a thread creation method to create a broadcast thread in the service process.
Optionally, the writing a broadcast message in the broadcast thread includes:
acquiring a timestamp in the broadcast thread, and taking the timestamp as time information;
carrying out Hash operation on the timestamp to obtain an encryption key;
and encrypting the original key according to the encryption key, and taking the encryption result as key information.
Optionally, the message receiving function for sending the broadcast message to the SO file through the broadcast thread includes:
and sending the broadcast message to a message receiving function of the SO file through a message sending function in the broadcast thread every other preset period.
Optionally, the acquiring time information and key information in the broadcast information includes:
and acquiring the time information in the broadcast information through a time information acquisition function, and acquiring the key information through a key information acquisition function.
Optionally, the decrypting the key information according to the time information to obtain an original key includes:
carrying out Hash operation on the time information to obtain a decryption key;
and decrypting the key information according to the decryption key to obtain an original key.
Optionally, the calling a function in the SO file according to the original key includes:
decrypting the original key according to a preset key to obtain a verification key;
and verifying the verification key according to the key verification interface, and calling a function in the SO file when the verification is passed.
In a second aspect, an embodiment of the present invention provides an apparatus for calling a function in an SO file, including:
the thread creating module is used for creating a service process when an application is started and creating a broadcast thread in the service process;
a broadcast message sending module, configured to compile a broadcast message in the broadcast thread, where the broadcast message includes time information and key information, and send the broadcast message to a message receiving function of the SO file through the broadcast thread;
a broadcast message receiving module, configured to receive the broadcast message through a message receiving function of the SO file, and obtain time information and key information in the broadcast message;
and the function calling module is used for decrypting the key information according to the time information to obtain an original key and calling a function in the SO file according to the original key.
In a third aspect, an embodiment of the present invention provides a terminal, including:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method for calling a function in an SO file as described in any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a method for calling a function in an SO file according to any embodiment of the present invention.
The method, the device, the terminal and the storage medium for calling the function in the SO file provided by the embodiment of the invention are used for creating a service process when an application is started and creating a broadcast thread in the service process; writing a broadcast message in a broadcast thread, wherein the broadcast message comprises time information and key information, and sending the broadcast message to a message receiving function of the SO file through the broadcast thread; receiving the broadcast message through a message receiving function of the SO file, and acquiring time information and key information in the broadcast message; and decrypting the key information according to the time information to obtain an original key, and calling a function in the SO file according to the original key.
That is, after receiving the broadcast message sent by the broadcast thread, the message receiving function of the SO file determines the original key according to the broadcast message, and calls the function in the SO file according to the original key, that is, if the message receiving function of the SO file does not receive the broadcast message, the function in the SO file cannot be called. Even if lawless persons acquire the complete SO file, the function in the SO file cannot be called because the message receiving function of the SO file cannot receive legal broadcast messages, SO that the function in the SO file cannot be called, and the function in the SO file is prevented from being called by the lawless persons.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description will be given below of the drawings required for the embodiments or the technical solutions in the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart of a method for calling a function in an SO file according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a device for calling a function in an SO file according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a terminal according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described through embodiments with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. In the following embodiments, optional features and examples are provided in each embodiment, and various features described in the embodiments may be combined to form a plurality of alternatives, and each numbered embodiment should not be regarded as only one technical solution.
Example one
Fig. 1 is a flowchart of a method for calling a function in an SO file according to an embodiment of the present invention, where the embodiment is applicable to a case of calling a function in an SO file, and the method may be implemented by a terminal, and may be implemented by software and/or hardware in the terminal. Referring to fig. 1, the method for calling a function in an SO file includes the following steps:
s110, creating a service process when the application is started, and creating a broadcast thread in the service process.
The legal application containing the SO file can automatically create a background service process when being started, and create a broadcast thread in the service process for generating legal broadcast messages and broadcasting SO as to enable functions in the SO file to be called according to the broadcast messages. If the SO file is loaded into an illegal application, the illegal application cannot automatically create a broadcast thread and generate a legal broadcast message, SO that the function in the SO file cannot be called. By creating the broadcast thread, a foundation can be laid for realizing legal calling of the function in the SO file.
Optionally, creating a service process, and creating a broadcast thread in the service process, includes:
and calling a process creation method to create a service process, and calling a thread creation method to create a broadcast thread in the service process.
The method for creating a service process by calling a process may specifically be:
Figure BDA0001908230940000061
wherein, can define a public class DataService, and make DataService class inherit the Service class of the system; an onCreate () function may be defined in the DataService class, and a service process may be created in the onCreate () function by a super. Specifically, the broadcast Thread may be created by calling a new Thread (new Runnable) { } method, and the creation of the broadcast Thread is completed by the new Thread method. The legal broadcast message can be generated through the created thread, and the broadcast message is broadcasted.
S120, writing a broadcast message in the broadcast thread, wherein the broadcast message comprises time information and key information, and sending the broadcast message to a message receiving function of the SO file through the broadcast thread.
The time information may be timestamp information, and the key information may be information obtained by encrypting an original key with a key generated by using a timestamp. The time information and the key information can be added to the broadcast message, and the broadcast message is sent to the message receiving function of the SO file through the broadcast thread, SO that the message receiving function of the SO file calls the function in the SO file according to the time information and the key information in the broadcast message.
Optionally, writing a broadcast message in a broadcast thread, including:
acquiring a timestamp in a broadcast thread, and taking the timestamp as time information; performing Hash operation on the timestamp to obtain an encryption key; and encrypting the original key according to the encryption key, and taking the encryption result as key information.
Specifically, the Timestamp may be obtained by a Timestamp () method, where Time () is a system function and may obtain the current Time; the Timestamp is a name of a Timestamp, and may indicate that the obtaining action corresponds to the Timestamp, and the name of the Timestamp is not limited to the Timestamp.
The Timestamp may be hashed by an encrypt key (Md 5. create) method, where the encrypt key may represent an encryption key obtained by performing Md5 hash on the Timestamp; the Hash Algorithm is not limited to the Md5 Algorithm, but may be other algorithms, such as five algorithms in the Secure Hash Algorithm (SHA) family, namely SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512, or Md4 Algorithm or CRC32 Algorithm.
The original key may be encrypted by an encryption _ g _ encryption (g _ src, encryption) method; the g _ src key may represent an inherent original key, and the inherent original key may be obtained by the broadcast thread from the application automatically after the application is started; wherein the encrypt key is the encryption key; the Encryt _ g _ encrypt represents the key information after the encryption operation is carried out on the original key g _ src; encryption Algorithm is not limited to the AES Algorithm, and may be Data Encryption Standard (DES), Triple Data Encryption Standard (Triple DES, 3DES), Tea Algorithm, Blowfish Algorithm, International Data Encryption Algorithm (IDEA), or the like, without limitation.
Optionally, the sending the broadcast message to the message receiving function of the SO file through the broadcast thread includes:
and sending the broadcast message to a message receiving function of the SO file through a message sending function in the broadcast thread every other preset period.
The method comprises the steps that a broadcast thread can be controlled to send broadcast messages in each preset period through a thread (5000) method; the thread () method can be understood as that the broadcast thread performs subsequent actions at preset time intervals; the 5000 may indicate that the preset period is 5000ms, where the preset period is not limited to 5000ms, and may be set according to actual requirements.
The message sending function in the broadcast thread may be a self-defined sendcondentbroadcast () function, and the specific message sending function may be written as:
Figure BDA0001908230940000081
firstly, an Intent parameter can be created through a new Intent () method and is used for storing time information and key information; the name of the intent can then be set to "encrypt _ action" by the intent.setaction () method; then, time information Timestamp and key information Encryt _ g _ encrypt can be added to the intent parameter by the intent.putExtra () method; and finally, sending the intent parameter containing the time information and the key information to a message receiving function of the SO file through sendBacladcast ().
S130, receiving the broadcast message through a message receiving function of the SO file, and acquiring time information and key information in the broadcast message.
The message receiving function of the SO file may specifically be:
public class ContentReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context,Intent intent){};}
wherein, can define a public class ContentReceiver, and make ContentReceiver class inherit the broadcast receiving class of the system, namely BroadcastReceiver class, is used for receiving the broadcast message; specifically, the broadcast message intent parameter may be received through an onReceive () function defined in the ContentReceiver class.
Optionally, the obtaining time information and key information in the broadcast information includes:
and acquiring time information in the broadcast information through a time information acquisition function, and acquiring key information through a key information acquisition function.
Specifically, time information in the broadcast information may be acquired by a time ═ intent.getstringextra ("time") method, where the time represents the time information, the intent represents the broadcast information, and the time information corresponding to the time information identifier "time" may be acquired by an intent.getstringextra () method; the key information in the broadcast information may be specifically acquired by an encrypt _ g _ encrypt _ key ═ ent.getStringExtra ("data") method, where encrypt _ g _ encrypt represents the key information, intent represents the broadcast information, and the key information corresponding to the time information identifier "data" may be acquired by an intent.getStringExtra () method.
S140, decrypting the key information according to the time information to obtain an original key, and calling a function in the SO file according to the original key.
The process of decrypting the key information according to the time information is the reverse process of the process of encrypting the original key according to the time information in step S120. If the symmetric encryption algorithm is used to encrypt the original key according to the time information in step S120, the encryption key used to encrypt the original key according to the time information in step S120 is the same as the decryption key used to decrypt the key information according to the time information.
Optionally, decrypting the key information according to the time information to obtain the original key, including:
carrying out Hash operation on the time information to obtain a decryption key; and decrypting the key information according to the decryption key to obtain the original key.
For example, when the AES encryption algorithm is used to encrypt the original key according to the time information in step S120, and the encryption key is obtained by performing the Md5 algorithm on the Timestamp, the AES decryption algorithm is needed to be used to decrypt the key information according to the time information, and the decryption key is also obtained by performing the Md5 algorithm on the Timestamp.
The Timestamp is hashed by an encrypt key (Md 5. create) method, where the encrypt key may represent a decryption key obtained by hashing the Timestamp by Md 5; and decrypting the key information encrypt _ g _ encrypt by using an AES decryption algorithm g _ src ═ AES.
Optionally, calling a function in the SO file according to the original key includes:
decrypting the original key according to a preset key to obtain a verification key; and verifying the verification key according to the key verification interface, and calling a function in the SO file when the verification is passed.
After the original key is obtained, the original key needs to be further decrypted to obtain a verification key, the verification key can be verified through a key verification interface written in a function header of the function to be called, if the verification is passed, the function to be called can be called, and if the verification is not passed, the function to be called cannot be called.
The original Key can be decrypted by a Key (ae. decryption, AESKEY) method; wherein Key represents the verification Key decrypted by the original Key; decryption () represents the decryption algorithm adopted, wherein in addition to the Aes decryption algorithm, the decryption algorithm preset in other SO files can be adopted without limitation; wherein g _ srcke represents the original key; wherein AESKEY represents a key pre-stored in the SO file to decrypt the original key.
The key verification interface written in the function header of the function to be called may specifically be:
Void DecryptData(char*encryptdata,int nlen){};
the DescryptData is the name of the key verification interface and represents the key verification interface, and the name of the key verification interface is not limited to the DescryptData; wherein, char encrypt data of function to be called; wherein int nlen may represent the length of the encrypted data of the function to be called. The Key verification interface is used for decrypting the encrypted function to be called by using the verification Key, and the data of the decrypted function to be called can be obtained when the verification Key is correct, so that the function to be called is called.
In the method for calling a function in an SO file provided by this embodiment, a service process is created when an application is started, and a broadcast thread is created in the service process; writing a broadcast message in a broadcast thread, wherein the broadcast message comprises time information and key information, and sending the broadcast message to a message receiving function of the SO file through the broadcast thread; receiving the broadcast message through a message receiving function of the SO file, and acquiring time information and key information in the broadcast message; and decrypting the key information according to the time information to obtain an original key, and calling a function in the SO file according to the original key. Even if lawless persons acquire the complete SO file, the lawless persons cannot call the function in the SO file because the message receiving function of the SO file cannot receive legal broadcast messages, SO that the function in the SO file is prevented from being called by the lawless persons, and the lawful calling of the function in the SO file is realized.
Example two
Fig. 2 is a schematic structural diagram of a device for calling a function in an SO file according to a second embodiment of the present invention, where the device for calling a function in an SO file according to the second embodiment of the present invention is applied to implement the method for calling a function in an SO file, SO as to implement legal calling of a function in an SO file.
Referring to fig. 2, the device for calling a function in an SO file in this embodiment includes:
the thread creating module 210 is configured to create a service process when an application is started, and create a broadcast thread in the service process;
a broadcast message sending module 220, configured to compile a broadcast message in a broadcast thread, where the broadcast message includes time information and key information, and send the broadcast message to a message receiving function of the SO file through the broadcast thread;
a broadcast message receiving module 230, configured to receive a broadcast message through a message receiving function of the SO file, and obtain time information and key information in the broadcast message;
and the function calling module 240 is configured to decrypt the key information according to the time information to obtain an original key, and call a function in the SO file according to the original key.
Optionally, the thread creating module 210 is specifically configured to:
and calling a process creation method to create a service process, and calling a thread creation method to create a broadcast thread in the service process.
Optionally, the broadcast message sending module 220 includes:
the broadcast message compiling submodule is used for acquiring a timestamp in a broadcast thread and taking the timestamp as time information; performing Hash operation on the timestamp to obtain an encryption key; and encrypting the original key according to the encryption key, and taking the encryption result as key information.
Optionally, the broadcast message sending module 220 further includes:
and the broadcast message sending submodule is used for sending the broadcast message to a message receiving function of the SO file through a message sending function in the broadcast thread at intervals of a preset period.
Optionally, the broadcast message receiving module 230 includes:
and the information acquisition submodule is used for acquiring the time information in the broadcast information through the time information acquisition function and acquiring the key information through the key information acquisition function.
Optionally, the function calling module 240 includes:
the original key acquisition submodule is used for carrying out Hash operation on the time information to obtain a decryption key; and decrypting the key information according to the decryption key to obtain the original key.
Optionally, the function call module 240 further includes:
the key verification submodule is used for decrypting the original key according to a preset key to obtain a verification key; and verifying the verification key according to the key verification interface, and calling a function in the SO file when the verification is passed.
The device for calling the function in the SO file provided by the embodiment belongs to the same inventive concept as the method for calling the function in the SO file provided by the first embodiment, and technical details not described in detail in the embodiment can be referred to the first embodiment, and the first embodiment have the same beneficial effects.
EXAMPLE III
The embodiment provides a terminal which can be used for calling functions in SO files. Fig. 3 is a schematic structural diagram of a terminal according to a third embodiment of the present invention. Referring to fig. 3, the terminal includes:
one or more processors 310;
a memory 320 for storing one or more programs;
when executed by the one or more processors 310, cause the one or more processors 310 to implement a method for calling a function in an SO file as set forth in an embodiment.
In FIG. 3, a processor 310 is illustrated as an example; the processor 310 and the memory 320 may be connected by a bus or other means, such as the bus connection shown in FIG. 3.
The memory 320 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the calling methods of the functions in the SO file in the embodiment of the present invention. The processor 310 executes various functional applications of the terminal and data processing, i.e., implements the above-described calling method of the function in the SO file, by executing software programs, instructions, and modules stored in the memory 320. The following method can be mainly realized: creating a service process when an application is started, and creating a broadcast thread in the service process; writing a broadcast message in a broadcast thread, wherein the broadcast message comprises time information and key information, and sending the broadcast message to a message receiving function of the SO file through the broadcast thread; receiving the broadcast message through a message receiving function of the SO file, and acquiring time information and key information in the broadcast message; and decrypting the key information according to the time information to obtain an original key, and calling a function in the SO file according to the original key.
The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 320 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 320 may further include memory located remotely from the processor 310, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The terminal proposed in this embodiment and the method for calling a function in an SO file proposed in the first embodiment belong to the same inventive concept, and technical details that are not described in detail in this embodiment can be referred to in the first embodiment.
Example four
The present embodiment provides a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements a method for calling a function in an SO file as set forth in an embodiment. The following method can be mainly realized: creating a service process when an application is started, and creating a broadcast thread in the service process; writing a broadcast message in a broadcast thread, wherein the broadcast message comprises time information and key information, and sending the broadcast message to a message receiving function of the SO file through the broadcast thread; receiving the broadcast message through a message receiving function of the SO file, and acquiring time information and key information in the broadcast message; and decrypting the key information according to the time information to obtain an original key, and calling a function in the SO file according to the original key.
The storage medium proposed in this embodiment and the method for calling a function in an SO file proposed in the first embodiment belong to the same inventive concept, and technical details that are not described in detail in this embodiment can be referred to in the first embodiment, and this embodiment and the first embodiment have the same beneficial effects.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods of the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments illustrated herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. A method for calling a function in an SO file is characterized by comprising the following steps:
creating a service process when an application is started, and creating a broadcast thread in the service process;
writing a broadcast message in the broadcast thread, wherein the broadcast message comprises time information and key information, and sending the broadcast message to a message receiving function of an SO file through the broadcast thread;
receiving the broadcast message through a self-defined message receiving function of the SO file, and acquiring time information and key information in the broadcast message;
decrypting the key information according to the time information to obtain an original key, and calling a function in an SO file according to the original key;
the creating of the service process when the application is started comprises the following steps:
the legal application containing the SO file automatically creates a background service process when being started;
the composing a broadcast message in the broadcast thread comprises:
acquiring a timestamp in the broadcast thread, and taking the timestamp as time information;
carrying out Hash operation on the timestamp to obtain an encryption key;
and encrypting the original key according to the encryption key, and taking the encryption result as key information.
2. The method of claim 1, wherein the creating a service process in which a broadcast thread is created comprises:
and calling a process creation method to create a service process, and calling a thread creation method to create a broadcast thread in the service process.
3. The method of claim 1, wherein the message receiving function that sends the broadcast message to the SO file via the broadcast thread comprises:
and sending the broadcast message to a message receiving function of the SO file through a message sending function in the broadcast thread every other preset period.
4. The method of claim 1, wherein the obtaining time information and key information in the broadcast information comprises:
and acquiring the time information in the broadcast information through a time information acquisition function, and acquiring the key information through a key information acquisition function.
5. The method of claim 1, wherein decrypting the key information according to the time information to obtain an original key comprises:
carrying out Hash operation on the time information to obtain a decryption key;
and decrypting the key information according to the decryption key to obtain an original key.
6. The method of claim 1, wherein said calling a function in an SO file from the original key comprises:
decrypting the original key according to a preset key to obtain a verification key;
and verifying the verification key according to the key verification interface, and calling a function in the SO file when the verification is passed.
7. An apparatus for calling a function in an SO file, comprising:
the thread creating module is used for creating a service process when an application is started and creating a broadcast thread in the service process;
a broadcast message sending module, configured to compile a broadcast message in the broadcast thread, where the broadcast message includes time information and key information, and send the broadcast message to a message receiving function of the SO file through the broadcast thread;
a broadcast message receiving module, configured to receive the broadcast message through a customized message receiving function of the SO file, and obtain time information and key information in the broadcast message;
the function calling module is used for decrypting the key information according to the time information to obtain an original key and calling a function in the SO file according to the original key;
the creating of the service process when the application is started comprises the following steps:
the legal application containing the SO file automatically creates a background service process when being started;
the broadcast message sending module includes:
the broadcast message compiling submodule is used for acquiring a timestamp in a broadcast thread and taking the timestamp as time information; performing Hash operation on the timestamp to obtain an encryption key; and encrypting the original key according to the encryption key, and taking the encryption result as key information.
8. A terminal, characterized in that the terminal comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of calling a function in an SO file as recited in any of claims 1-6.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method for calling a function in an SO-file according to any one of claims 1 to 6.
CN201811541574.4A 2018-12-17 2018-12-17 Method, device, terminal and storage medium for calling functions in SO file Active CN109474617B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811541574.4A CN109474617B (en) 2018-12-17 2018-12-17 Method, device, terminal and storage medium for calling functions in SO file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811541574.4A CN109474617B (en) 2018-12-17 2018-12-17 Method, device, terminal and storage medium for calling functions in SO file

Publications (2)

Publication Number Publication Date
CN109474617A CN109474617A (en) 2019-03-15
CN109474617B true CN109474617B (en) 2021-07-23

Family

ID=65676103

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811541574.4A Active CN109474617B (en) 2018-12-17 2018-12-17 Method, device, terminal and storage medium for calling functions in SO file

Country Status (1)

Country Link
CN (1) CN109474617B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101005497A (en) * 2006-11-27 2007-07-25 科博技术有限公司 System and method for preventing vicious code attach
CN103970540A (en) * 2014-05-15 2014-08-06 北京华为数字技术有限公司 Method and device for safely calling key function
CN106650355A (en) * 2016-12-08 2017-05-10 武汉斗鱼网络科技有限公司 Method and device for protecting function call
CN106843853A (en) * 2016-12-28 2017-06-13 北京五八信息技术有限公司 The method and apparatus for protecting user profile
CN107196761A (en) * 2017-03-31 2017-09-22 武汉斗鱼网络科技有限公司 A kind of method of core function in protection application program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9129112B2 (en) * 2013-03-15 2015-09-08 Oracle International Corporation Methods, systems and machine-readable media for providing security services

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101005497A (en) * 2006-11-27 2007-07-25 科博技术有限公司 System and method for preventing vicious code attach
CN103970540A (en) * 2014-05-15 2014-08-06 北京华为数字技术有限公司 Method and device for safely calling key function
CN106650355A (en) * 2016-12-08 2017-05-10 武汉斗鱼网络科技有限公司 Method and device for protecting function call
CN106843853A (en) * 2016-12-28 2017-06-13 北京五八信息技术有限公司 The method and apparatus for protecting user profile
CN107196761A (en) * 2017-03-31 2017-09-22 武汉斗鱼网络科技有限公司 A kind of method of core function in protection application program

Also Published As

Publication number Publication date
CN109474617A (en) 2019-03-15

Similar Documents

Publication Publication Date Title
EP2327211B1 (en) Simulcrypt key sharing with hashed keys
CN107659632B (en) File encryption and decryption method and device and computer readable storage medium
KR101052940B1 (en) Methods and Systems for Blackout Regulation in a Distribution Network
CN110062014B (en) Encryption and decryption method and system of network model
CN108111497B (en) Mutual authentication method and device for camera and server
US20170353745A1 (en) Secure media player
US20130290731A1 (en) Systems and methods for storing and verifying security information
WO2017024804A1 (en) Data encryption method, decryption method, apparatus, and system
CN113225352B (en) Data transmission method and device, electronic equipment and storage medium
CN109067805B (en) Live broadcast room data anti-crawling method and device, terminal and readable medium
WO2022193620A1 (en) Encoding method and apparatus for network file protection, and decoding method and apparatus for network file protection
CN113347143A (en) Identity authentication method, device, equipment and storage medium
CN108256346B (en) Key data protection method, encryption protection device and embedded system device
CN109474617B (en) Method, device, terminal and storage medium for calling functions in SO file
CN111382451A (en) Security level identification method and device, electronic equipment and storage medium
US20110179444A1 (en) Apparatus and method for downloading conditional access images
CN113609522B (en) Data authorization and data access method and device
CN113708928B (en) Edge cloud communication method and related device
CN113626146A (en) Container mirror image safe distribution method and device based on user attributes
CN112398655B (en) File transmission method, server and computer storage medium
CN109214425B (en) Picture verification method, picture processing method, equipment and system
CN112131597A (en) Method and device for generating encrypted information and intelligent equipment
CN112000962A (en) Data encryption processing method, device and system based on block chain
CN104113540A (en) Digital music copy-proof system for android platform
CN114598464B (en) Data updating method and controller

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant