[go: up one dir, main page]

CN103034811B - A kind of method, system and device of file process - Google Patents

A kind of method, system and device of file process Download PDF

Info

Publication number
CN103034811B
CN103034811B CN201110294433.9A CN201110294433A CN103034811B CN 103034811 B CN103034811 B CN 103034811B CN 201110294433 A CN201110294433 A CN 201110294433A CN 103034811 B CN103034811 B CN 103034811B
Authority
CN
China
Prior art keywords
message
layer
file processing
packet
verification code
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.)
Expired - Fee Related
Application number
CN201110294433.9A
Other languages
Chinese (zh)
Other versions
CN103034811A (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.)
New Founder Holdings Development Co ltd
Original Assignee
Peking University Founder Group 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 Peking University Founder Group Co Ltd filed Critical Peking University Founder Group Co Ltd
Priority to CN201110294433.9A priority Critical patent/CN103034811B/en
Publication of CN103034811A publication Critical patent/CN103034811A/en
Application granted granted Critical
Publication of CN103034811B publication Critical patent/CN103034811B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Telephone Function (AREA)
  • Storage Device Security (AREA)

Abstract

本发明公开了一种文件处理的方法、系统及装置,用以在保证Android操作系统的安全性的同时,提高Android操作系统的文件处理能力。该方法包括:内核层接收应用程序层发送的报文,所述内核层对接收到的报文进行验证,验证通过时,执行所述报文中包括的所述应用程序层没有权限执行的文件处理命令。

The invention discloses a file processing method, system and device, which are used to improve the file processing capability of the Android operating system while ensuring the security of the Android operating system. The method includes: the kernel layer receives the message sent by the application layer, the kernel layer verifies the received message, and when the verification is passed, executes the file included in the message that the application layer does not have permission to execute Process commands.

Description

一种文件处理的方法、系统及装置Method, system and device for file processing

技术领域 technical field

本发明涉及操作系统技术领域,特别涉及一种文件处理的方法、系统及装置。The present invention relates to the technical field of operating systems, in particular to a file processing method, system and device.

背景技术 Background technique

近年来,Android操作系统由于它的开源性,越来越被广泛应用,采用android系统开发的智能手机、平板电脑等嵌入式设备层出不穷。In recent years, the Android operating system has become more and more widely used due to its open source nature, and embedded devices such as smartphones and tablet computers developed using the Android system emerge in endlessly.

Android操作系统是基于Linux2.6内核的操作系统,它分为四个层:linux内核层,系统运行库层,应用程序框架层和应用程序层。其中,Linux内核层,即kernel层包括了Android的核心系统服务,如安全性,内存管理,进程管理等;系统运行库层主要包括程序库和android运行库,程序库能被Android系统中不同的组件使用,Android运行库提供了JAVA编程语言核心库的大多数功能;应用程序框架层是核心应用所使用的API框架,开发人员同样可以使用这些框架来开发自己的应用;应用程序层是用Java语言编写的运行在虚拟机上的程序。The Android operating system is an operating system based on the Linux2.6 kernel, which is divided into four layers: the linux kernel layer, the system runtime layer, the application framework layer and the application layer. Among them, the Linux kernel layer, that is, the kernel layer includes the core system services of Android, such as security, memory management, process management, etc.; the system runtime layer mainly includes the program library and the android runtime library, and the program library can be used by different Android systems Component usage, the Android runtime library provides most of the functions of the core library of the JAVA programming language; the application framework layer is the API framework used by the core application, and developers can also use these frameworks to develop their own applications; the application layer uses Java A program written in a language that runs on a virtual machine.

由于Android是基于Linux内核的,所以Android的安全系统也是基于Linux的安全架构建立的。Linux是一个多用户、多任务的操作系统,用户和组件起着重要的作用,不同的用户和组件对同一文件的访问属性不同,这样使Linux系统更为安全。因此,在Android操作系统中,系统为每一个应用程序创建了一个用户和组件。这些用户和组件都是普通用户,不能访问linux内核层的数据,只能访问对应应用程序的文件和目录,也不能访问其他应用程序的数据。这样保护应用程序的私有数据,将应用与应用,应用与系统隔离开,增强系统的安全性和健壮性。Since Android is based on the Linux kernel, the Android security system is also based on the Linux security architecture. Linux is a multi-user, multi-task operating system, and users and components play an important role. Different users and components have different access attributes to the same file, which makes the Linux system more secure. Therefore, in the Android operating system, the system creates a user and component for each application. These users and components are common users, they cannot access the data of the Linux kernel layer, they can only access the files and directories of the corresponding applications, and they cannot access the data of other applications. This protects the private data of the application program, isolates the application from the application, and the application from the system, and enhances the security and robustness of the system.

可见,目前Android操作系统中,每个应用程序只有系统(system)权限,而没有最高权限,即根(root)权限,从而,只能对私有数据进行操作,这样,虽然增强了系统的安全性,但同时也带来了一些问题。当应用层的程序,即应用程序需要对系统文件进行一些操作时,如向系统目录下拷贝或修改文件内容、属性,配置网络地址等,这些都需要拥有最高权限(root权限)的用户才能够操作,由于应用程序只有system权限,因此,不能执行这些操作。It can be seen that in the current Android operating system, each application program has only the system (system) authority, and does not have the highest authority, that is, the root (root) authority, so that only private data can be operated. In this way, although the security of the system is enhanced , but it also brings some problems. When the application layer program, that is, the application program needs to perform some operations on system files, such as copying or modifying file content and attributes to the system directory, configuring network addresses, etc., all of these require users with the highest authority (root authority) to be able to Operations, since the application only has system permissions, these operations cannot be performed.

发明内容 Contents of the invention

本发明实施例提供一种文件处理的方法、系统及装置,用以在保证Android操作系统的安全性的同时,提高Android操作系统的文件处理能力。Embodiments of the present invention provide a file processing method, system and device, which are used to improve the file processing capability of the Android operating system while ensuring the security of the Android operating system.

本发明实施例提供一种文件处理的方法,包括:An embodiment of the present invention provides a method for file processing, including:

内核层接收应用程序层发送的报文;The kernel layer receives the message sent by the application layer;

所述内核层对接收到的报文进行验证,验证通过时,执行所述报文中包括的所述应用程序层没有权限执行的文件处理命令。The kernel layer verifies the received message, and when the verification is passed, executes the file processing command included in the message that the application layer has no authority to execute.

本发明实施例提供一种文件处理的系统,包括:应用程序层和内核层,其中,An embodiment of the present invention provides a file processing system, including: an application layer and a kernel layer, wherein,

所述应用程序层,用于向所述内核层发送报文;The application layer is configured to send a message to the kernel layer;

所述内核层,用于接收所述报文,并对接收到的报文进行验证,验证通过时,执行所述报文中包括的所述应用程序层没有权限执行的文件处理命令。The kernel layer is configured to receive the message, verify the received message, and execute a file processing command included in the message that the application layer has no authority to execute when the verification is passed.

本发明实施例提供一种业务处理的装置,应用于内核层中包括:An embodiment of the present invention provides a service processing device, which is applied to the kernel layer and includes:

接收单元,用于接收应用程序层发送的报文;The receiving unit is used to receive the message sent by the application layer;

处理单元,用于对接收到的报文进行验证,验证通过时,执行所述报文中包括的所述应用程序层没有权限执行的文件处理命令。The processing unit is configured to verify the received message, and execute the file processing command included in the message that the application layer has no authority to execute when the verification is passed.

本发明实施例提供一种业务处理的装置,应用于应用程序层中,包括:An embodiment of the present invention provides a business processing device, which is applied in the application layer, including:

获取单元,用于获取第一报文验证码;an acquisition unit, configured to acquire the first message verification code;

组建单元,用于根据所述第一报文验证码,以及所述应用程序层没有权限执行的文件处理命令,组建报文,其中,所述报文的包头为加密后的第一报文验证码,所述报文的消息体为所述应用程序层没有权限执行的文件处理命令;A building unit, configured to form a message according to the first message verification code and the file processing command executed by the application layer without permission, wherein the header of the message is the encrypted first message verification Code, the message body of the message is a file processing command that the application layer has no authority to execute;

发送单元,用于通过socket通信协议,将所述报文发送给所述内核层。A sending unit, configured to send the message to the kernel layer through a socket communication protocol.

本发明实施例中,Android操作系统中的应用程序层没有权限执行的文件处理命令时,将该文件处理命令生成报文发送给内核层,该内核层具有最高权限,这样,内核层接收到报文后,对该报文进行验证,验证通过时,执行所述报文中包括的所述应用程序层没有权限执行的文件处理命令。从而,只有system权限的应用程序层可通过具有root权限的内核层对系统文件进行处理,提高Android操作系统的文件处理能力。并且,所有的系统文件都只是由内核层进行处理,每个应用程序的私有数据仍各自隔离,确保了操作系统的安全性。In the embodiment of the present invention, when the application program layer in the Android operating system does not have the file processing command executed by authority, the message generated by the file processing command is sent to the kernel layer, and the kernel layer has the highest authority. Like this, the kernel layer receives the message After the file, the message is verified, and when the verification is passed, the file processing command included in the message that the application layer has no authority to execute is executed. Therefore, only the application program layer with system authority can process system files through the kernel layer with root authority, so as to improve the file processing capability of the Android operating system. Moreover, all system files are only processed by the kernel layer, and the private data of each application program is still isolated separately, ensuring the security of the operating system.

附图说明 Description of drawings

图1为本发明实施例中文件处理的流程图;Fig. 1 is the flowchart of file processing in the embodiment of the present invention;

图2为本发明实施例中文件处理系统的架构图;Fig. 2 is the architecture diagram of the file processing system in the embodiment of the present invention;

图3为本发明实施例中内核层中文件处理装置的结构图;3 is a structural diagram of a file processing device in a kernel layer in an embodiment of the present invention;

图4为本发明实施例中应用程序层文件处理装置的结构图。FIG. 4 is a structural diagram of an application layer file processing device in an embodiment of the present invention.

具体实施方式 detailed description

本发明实施例中,Android操作系统的linux内核层即kernel层具有root权限,可对系统文件进行处理,这样,当Android操作系统的应用层的程序需对系统文件进行处理时,因其不具备root权限,则须将该任务发送给kernel层,由kernel层执行该任务。从而,在保证系统的安全性的同时,提高了文件处理能力。In the embodiment of the present invention, the linux kernel layer of the Android operating system, that is, the kernel layer, has root authority and can process system files. In this way, when the program of the application layer of the Android operating system needs to process system files, because it does not have root authority, the task must be sent to the kernel layer, and the task is executed by the kernel layer. Therefore, while ensuring the security of the system, the file processing capability is improved.

本发明实施例中,Android操作系统中的应用程序需要对系统文件进行一些操作时,如向系统目录下拷贝或修改文件内容、属性,配置网络地址等,由于应用程序只有system权限,因此,不能执行这些操作,须将这些没有权限执行的文件处理命令发送给内核层,由内核层执行,即只有system权限的应用程序层可通过具有root权限的内核层对系统文件进行处理。In the embodiment of the present invention, when the application program in the Android operating system needs to perform some operations on system files, such as copying or modifying file content and attributes under the system directory, configuring network addresses, etc., since the application program only has system permissions, it cannot To perform these operations, these file processing commands without permission must be sent to the kernel layer for execution, that is, only the application layer with system permission can process system files through the kernel layer with root permission.

参见图1,Android操作系统中文件处理的过程包括:Referring to Figure 1, the process of file processing in the Android operating system includes:

步骤101:应用程序层向内核层发送报文,该报文中包括的所述应用程序层没有权限执行的文件处理命令。Step 101: the application program layer sends a message to the kernel layer, and the message includes a file processing command that the application program layer does not have permission to execute.

应用程序层执行文件处理命令前,可判断是否有权限执行该文件处理命令,当确定没有权限执行该文件处理命令时,向内核层发送报文,该报文中包括的所述应用程序层没有权限执行的文件处理命令。Before the application layer executes the file processing command, it can judge whether there is authority to execute the file processing command. When it is determined that there is no authority to execute the file processing command, it sends a message to the kernel layer. The application layer included in the message has no Permissions to execute file processing commands.

这里,应用程序层可直接向内核层发送携带文件处理命令的报文。还可以组件一个安全的报文,然后再发送,其具体过程包括:Here, the application layer may directly send a message carrying a file processing command to the kernel layer. It is also possible to assemble a secure message and then send it. The specific process includes:

获取第一报文验证码,并根据第一报文验证码,以及应用程序层没有权限执行的文件处理命令,组建报文,最后,通过socket通信协议,将报文发送给内核层。其中,报文的包头为加密后的第一报文验证码,报文的消息体为所述应用程序层没有权限执行的文件处理命令。Obtain the first message verification code, and construct a message according to the first message verification code and the file processing command that the application layer has no authority to execute, and finally, send the message to the kernel layer through the socket communication protocol. Wherein, the packet header of the message is the encrypted first message verification code, and the message body of the message is a file processing command that the application layer has no authority to execute.

即可通过应用程序层的用户界面获取第一报文验证码,或者,从系统的存储单元中获取第一报文验证码,然后对该第一报文验证码进行加密,将加密后的第一报文验证码作为报文的包头,将应用程序层没有权限执行的文件处理命令作为报文的消息体,然后,通过socket通信协议,将报文发送给内核层。The first message verification code can be obtained through the user interface of the application program layer, or the first message verification code is obtained from the storage unit of the system, and then the first message verification code is encrypted, and the encrypted second message verification code is encrypted. A message verification code is used as the header of the message, and the file processing command that the application layer has no authority to execute is used as the message body of the message, and then the message is sent to the kernel layer through the socket communication protocol.

另外,本发明实施例中,还可直接采用报文验证码对文件处理命令进行加密,生成报文,将该报文发送给内核层。In addition, in the embodiment of the present invention, the file processing command can also be directly encrypted using the message verification code to generate a message and send the message to the kernel layer.

步骤102:内核层接收应用程序层发送的报文。Step 102: The kernel layer receives the message sent by the application layer.

内核层与应用程序层之间可采用多种通信协议。例如:步骤101中,应用程序层通过socket通信协议,将报文发送给内核层,这里,内核层监听socket端口,通过该socket端口接收应用程序层发送的报文。当然,本发明实施例还包括别的通信协议,例如:比如共享文件,消息邮箱等。Various communication protocols can be used between the kernel layer and the application layer. For example: in step 101, the application program layer sends the message to the kernel layer through the socket communication protocol. Here, the kernel layer monitors the socket port and receives the message sent by the application program layer through the socket port. Of course, the embodiment of the present invention also includes other communication protocols, for example, sharing files, message mailboxes, and the like.

步骤103:内核层对接收到的报文进行验证,验证通过时,执行步骤104,否则,流程结束。Step 103: The kernel layer verifies the received message, and if the verification is passed, execute step 104; otherwise, the process ends.

本发明实施例中可只对报文的包头进行验证,或只对报文的消息体进行验证,或者,对报文的包头以及消息体都进行验证。其中,In the embodiment of the present invention, only the packet header of the message, or only the message body of the message, or both the packet header and the message body of the message may be verified. in,

对报文的包头进行验证时,组建报文的方式不同,内核层对报文的验证过程也不同,即验证过程的解密协议与组建报文过程中的加密协议一致。例如,报文的包头加密了,验证过程包括:When verifying the packet header of the message, the method of building the message is different, and the verification process of the message by the kernel layer is also different, that is, the decryption protocol in the verification process is consistent with the encryption protocol in the process of building the message. For example, the packet header of the packet is encrypted, and the verification process includes:

对接收的报文的包头进行解密,获得第二报文验证码,将第二报文验证码与保存的第一报文验证码进行比对,当两者一致时,对报文的包头验证通过;否则,验证未通过。Decrypt the packet header of the received message to obtain the second message verification code, compare the second message verification code with the saved first message verification code, and verify the packet header of the message when the two are consistent Pass; otherwise, validation fails.

本发明实施例中,可以对内核层放开权限,即所有的文件处理命令都可以执行,因此,这里,不需对报文的消息体进行验证,当对报文的包头验证通过时,即可执行步骤104,否则,流程结束。In the embodiment of the present invention, the authority can be released to the kernel layer, that is, all file processing commands can be executed. Therefore, here, there is no need to verify the message body of the message. When the verification of the header of the message is passed, that is Step 104 can be executed; otherwise, the process ends.

本发明另一实施例中,还可只对内核层部分开放权限,即内核层只能执行部分的文件处理命令,因此,内核层中保存了可执行的文件处理命令,对报文的包头验证通过之后,还需对报文的消息体进行验证。具体过程包括:In another embodiment of the present invention, it is also possible to only partially open the authority to the kernel layer, that is, the kernel layer can only execute part of the file processing command, therefore, the executable file processing command is preserved in the kernel layer, and the header verification of the message is performed. After passing, the message body of the message needs to be verified. The specific process includes:

内核层在保存的可执行的文件处理命令中查找是否有接收到的报文的消息体中的文件处理命令;若有,确定该报文为合法报文,执行步骤104,否则,流程结束。这样,只对内核层部分开放权限,进一步提高了操作系统的安全性。The kernel layer checks whether there is a file processing command in the message body of the received message among the stored executable file processing commands; if so, it is determined that the message is a legal message, and step 104 is executed; otherwise, the process ends. In this way, only part of the permission is opened to the kernel layer, which further improves the security of the operating system.

当然,本发明另一实施例中,可只对报文的消息体进行验证,即内核层在保存的可执行的文件处理命令中查找是否有接收到的报文的消息体中的文件处理命令;若有,确定该报文为合法报文,执行步骤104,否则,流程结束。Of course, in another embodiment of the present invention, only the message body of the message can be verified, that is, the kernel layer searches for the file processing command in the message body of the received message in the stored executable file processing command ; If yes, determine that the message is a legal message, and execute step 104, otherwise, the process ends.

步骤104:内核层执行报文中包括的应用程序层没有权限执行的文件处理命令,文件处理过程结束。Step 104: The kernel layer executes the file processing command included in the message that the application layer has no authority to execute, and the file processing process ends.

内核层对接收的报文验证通过了,即可执行报文消息体中的应用程序层没有权限执行的文件处理命令,实现文件的处理。After the kernel layer passes the verification of the received message, it can execute the file processing command that the application layer in the message body of the message does not have permission to execute, so as to realize the file processing.

本发明实施例中,对内核层可通过调用execve(constchar*filename,char*constargv[],char*constenvp[])函数执行应用层程序没有权限执行的文件处理命令。In the embodiment of the present invention, the kernel layer can execute file processing commands that the application layer program does not have permission to execute by calling the execve(constchar*filename, char*constargv[], char*constenvp[]) function.

在上述文件处理过程,Android操作系统中的应用程序层可通过内核层对系统文件进行操作,提高了Android操作系统的文件处理能力。同时,所有的系统文件都只是由内核层进行处理,每个应用程序的私有数据仍各自隔离,确保了操作系统的安全性。In the above file processing process, the application layer in the Android operating system can operate the system files through the kernel layer, which improves the file processing capability of the Android operating system. At the same time, all system files are only processed by the kernel layer, and the private data of each application program is still isolated separately, ensuring the security of the operating system.

本发明实施例中,Android操作系统的内核层必须有最高权限,因此,在内核层接收应用程序层发送的报文之前,还需激活内核层,使内核层具有最高权限。一般应用Android操作系统的终端开机时,该Android操作系统的内核层就被激活。这里,可在Android操作系统的init.rc文件中定义一个服务myserver,将内核层编译好的可执行程序server放入/system/bin目录下,把内核层程序server定义为要运行的服务,如下:In the embodiment of the present invention, the kernel layer of the Android operating system must have the highest authority. Therefore, before the kernel layer receives the message sent by the application layer, the kernel layer needs to be activated so that the kernel layer has the highest authority. Generally, when a terminal using an Android operating system is turned on, the kernel layer of the Android operating system is activated. Here, a service myserver can be defined in the init.rc file of the Android operating system, and the executable program server compiled by the kernel layer can be placed in the /system/bin directory, and the kernel layer program server can be defined as the service to be run, as follows :

servicemyserver/system/bin/serverservicemyserver/system/bin/server

这样,myserver就有了root权限。由于init.rc文件是在安装Android操作系统的开机的时候被系统调用,所以每次开机的时候服务myserver就会被创建。In this way, myserver has root authority. Since the init.rc file is called by the system when the Android operating system is installed, the service myserver will be created every time the system is turned on.

采用了Android操作系统的终端都可通过上述方法对文件进行处理。例如:采用了Android操作系统的家庭信息终端通过上述方法进行网络地址配置。应用程序层的网络地址配置模块获得终端用户输入的IP地址、子网掩码、网关地址和DNS后,该配置模块中将它们组建成报文的消息体,并获取报文验证码进行加密,将加密后的验证码作为报文的包头,与内核层的server进行通信,将报文发送给内核层的server。All terminals using the Android operating system can process files through the above method. For example: the home information terminal using the Android operating system performs network address configuration through the above method. After the network address configuration module of the application layer obtains the IP address, subnet mask, gateway address and DNS input by the end user, the configuration module forms them into the message body of the message, and obtains the message verification code for encryption. Use the encrypted verification code as the packet header of the message, communicate with the server at the kernel layer, and send the message to the server at the kernel layer.

内核层的server收到报文后,将报文进行解析并验证,如果是合法的报文,就获取消息体中的IP地址、子网掩码等相关信息,并调用配置网络的命令进行网络配置。这样就实现了在应用层配置网络地址,即实现了系统文件的处理。After receiving the message, the server at the kernel layer parses and verifies the message. If it is a legal message, it obtains relevant information such as the IP address and subnet mask in the message body, and calls the command to configure the network to configure the network. configuration. In this way, the configuration of the network address at the application layer is realized, that is, the processing of the system file is realized.

其中,内核层具有全部权限时,内核层的server可只对报文的包头进行验证。若内核层只有部分权限,此时,内核层的server对报文的包头进行验证后,还需判断能否执行配置网络的命令,即在保存的可执行命令中查找是否有配置网络的命令,若有,就获取消息体中的IP地址、子网掩码等相关信息,进行网络配置。否则,返回非法报文的指令。Wherein, when the kernel layer has full authority, the server of the kernel layer can only verify the packet header of the message. If the kernel layer has only partial authority, at this time, after verifying the packet header of the packet, the server at the kernel layer needs to determine whether the command for configuring the network can be executed, that is, check whether there is a command for configuring the network in the saved executable commands. If yes, obtain relevant information such as the IP address and subnet mask in the message body, and perform network configuration. Otherwise, return the instruction of illegal message.

由此可见,本发明实施例中,当应用程序需要对系统文件进行一些操作时,如向系统目录下拷贝或修改文件内容、属性,配置网络地址等,虽然应用程序只有system权限,但该应用程序可通过具有root权限的内核层来进行这些操作,,提高Android操作系统的文件处理能力。It can be seen that in the embodiment of the present invention, when the application program needs to perform some operations on the system files, such as copying or modifying file content and attributes to the system directory, configuring the network address, etc., although the application program only has the system authority, the application program The program can perform these operations through the kernel layer with root authority, so as to improve the file processing capability of the Android operating system.

通过上述文件处理的方法,可知本发明实施例中的文件处理的系统,参见图2,包括:应用程序层100和内核层200,其中,Through the above file processing method, it can be known that the file processing system in the embodiment of the present invention, referring to FIG. 2 , includes: an application layer 100 and a kernel layer 200, wherein,

应用程序层100,用于向内核层200发送报文。The application layer 100 is configured to send a message to the kernel layer 200 .

内核层200,用于接收报文,并对接收到的报文进行验证,验证通过时,执行报文中包括的应用程序层100没有权限执行的文件处理命令。The kernel layer 200 is used to receive the message and verify the received message, and execute the file processing command included in the message that the application layer 100 has no authority to execute when the verification is passed.

该系统中,应用程序层100,具体用于获取第一报文验证码,根据第一报文验证码,以及应用程序层没有权限执行的文件处理命令,组建报文,通过socket通信协议,将报文发送给内核层,其中,报文的包头为加密后的第一报文验证码,报文的消息体为应用程序层没有权限执行的文件处理命令。In this system, the application program layer 100 is specifically used to obtain the first message verification code, according to the first message verification code and the file processing command that the application program layer has no authority to execute, to form a message, and through the socket communication protocol, the The message is sent to the kernel layer, wherein the packet header of the message is the encrypted first message verification code, and the message body of the message is a file processing command that the application layer has no authority to execute.

内核层200,具体用于监听socket端口,通过socket端口接收应用程序层发送的报文,对接收的报文的包头进行解密,获得第二报文验证码,将第二报文验证码与保存的第一报文验证码进行比对,当两者一致时,对所述报文的包头验证通过,执行报文中包括的应用程序层没有权限执行的文件处理命令。The kernel layer 200 is specifically used to monitor the socket port, receive the message sent by the application program layer through the socket port, decrypt the packet header of the received message, obtain the second message verification code, and save the second message verification code with the compare the verification codes of the first message, and when the two are consistent, the packet header of the message is verified, and the file processing command included in the message that the application layer has no authority to execute is executed.

本发明实施例中应用程序层100组建报文的方式可以有多种,内核层200对报文的验证过程也有多种,一般,程序层100组建报文过程中的加密协议与内核层200验证过程的解密协议一致。In the embodiment of the present invention, there are multiple ways for the application program layer 100 to construct a message, and the kernel layer 200 also has multiple verification processes for the message. Generally, the encryption protocol in the process of program layer 100 building a message is verified by the kernel layer 200. The decryption protocol of the process is consistent.

另外,应用程序层100与内核层200的通信协议也可以有多种,并不限于socket通信协议。In addition, there may be various communication protocols between the application program layer 100 and the kernel layer 200, and are not limited to socket communication protocols.

内核层200可以对所有的文件处理命令都可以执行,或者,内核层200只能有部分权限,只能执行部分的文件处理命令。The kernel layer 200 can execute all file processing commands, or the kernel layer 200 can only have partial authority, and can only execute part of the file processing commands.

当该内核层200只具有部分权限时,具体用于在保存的可执行的文件处理命令中查找是否有所述报文的消息体中的文件处理命令,若有,确定所述报文为合法报文。When the kernel layer 200 only has partial authority, it is specifically used to find whether there is a file processing command in the message body of the message in the stored executable file processing command, and if so, determine that the message is legal message.

该文件处理系统中,还包括激活装置,用于激活所述内核层,使所述内核层具有最高权限。The file processing system further includes activation means for activating the kernel layer so that the kernel layer has the highest authority.

在上述操作系统中,应用于内核层中的文件处理的装置,参见图3,包括:接收单元310和处理单元320。In the above-mentioned operating system, the apparatus applied to file processing in the kernel layer, referring to FIG. 3 , includes: a receiving unit 310 and a processing unit 320 .

接收单元310,用于接收应用程序层发送的报文。The receiving unit 310 is configured to receive a message sent by the application layer.

处理单元320,用于对接收到的报文进行验证,验证通过时,执行所述报文中包括的所述应用程序层没有权限执行的文件处理命令。The processing unit 320 is configured to verify the received message, and execute the file processing command included in the message that the application layer does not have permission to execute when the verification is passed.

其中,接收单元310,具体用于监听socket端口,通过所述socket端口接收应用程序层发送的报文。Wherein, the receiving unit 310 is specifically configured to monitor the socket port, and receive the message sent by the application program layer through the socket port.

处理单元320,具体用于对接收的报文的包头进行解密,获得第二报文验证码,将所述第二报文验证码与保存的第一报文验证码进行比对,当两者一致时,验证通过,执行所述报文中包括的所述应用程序层没有权限执行的文件处理命令。The processing unit 320 is specifically configured to decrypt the packet header of the received message to obtain a second message verification code, and compare the second message verification code with the stored first message verification code, and when both If it is consistent, the verification is passed, and the file processing command included in the message that the application layer does not have permission to execute is executed.

该处理单元320,具体用于在保存的可执行的文件处理命令中查找是否有所述报文的消息体中的文件处理命令,若有,确定所述报文为合法报文。The processing unit 320 is specifically configured to find out whether there is a file processing command in the message body of the message in the stored executable file processing commands, and if so, determine that the message is a legal message.

在上述操作系统中,应用于应用程序层中的文件处理的装置,参见图4,包括:获取单元410,组建单元420,和发送单元430。In the above-mentioned operating system, the apparatus applied to file processing in the application layer, referring to FIG. 4 , includes: an acquisition unit 410 , an assembly unit 420 , and a sending unit 430 .

获取单元410,用于获取第一报文验证码。The obtaining unit 410 is configured to obtain the first message verification code.

组建单元420,用于根据第一报文验证码,以及应用程序层没有权限执行的文件处理命令,组建报文,其中,报文的包头为加密后的第一报文验证码,报文的消息体为应用程序层没有权限执行的文件处理命令。The building unit 420 is used to form a message according to the first message verification code and the file processing command that the application layer has no authority to execute, wherein the packet header of the message is the encrypted first message verification code, and the packet header of the message is the encrypted first message verification code. The message body is a file processing command that the application layer does not have permission to execute.

发送单元430,用于通过socket通信协议,将报文发送给内核层。The sending unit 430 is configured to send the message to the kernel layer through the socket communication protocol.

上述所有的实施例中都是以Android操作系统为例进行描述的,但是本发明实施例不限于此,基于Linux内核层的所有操作系统都可以应用到上述所有的实施例中,例如:塞班系统。All the above-mentioned embodiments are described with the Android operating system as an example, but the embodiment of the present invention is not limited thereto, and all operating systems based on the Linux kernel layer can be applied to all of the above-mentioned embodiments, for example: Symbian system.

本发明实施例中,基于Linux内核层的操作系统中的应用程序层没有权限执行的文件处理命令时,将该文件处理命令生成报文发送给内核层,该内核层具有最高权限,这样,内核层接收到报文后,对该报文进行验证,验证通过时,执行所述报文中包括的所述应用程序层没有权限执行的文件处理命令。这样,基于Linux内核层的操作系统中只有system权限的应用程序层可通过具有root权限的内核层对系统文件进行操作,提高了基于Linux内核层的操作系统的文件处理能力。同时,所有的系统文件都只是由内核层进行处理,每个应用程序的私有数据仍各自隔离,确保了操作系统的安全性。In the embodiment of the present invention, when the application program layer in the operating system based on the Linux kernel layer has no authority to execute the file processing command, the file processing command generates a message and sends it to the kernel layer, and the kernel layer has the highest authority. Like this, the kernel After the layer receives the message, it verifies the message, and when the verification is passed, executes the file processing command included in the message that the application layer has no authority to execute. In this way, in the operating system based on the Linux kernel layer, only the application program layer with system authority can operate the system files through the kernel layer with root authority, which improves the file processing capability of the operating system based on the Linux kernel layer. At the same time, all system files are only processed by the kernel layer, and the private data of each application program is still isolated separately, ensuring the security of the operating system.

显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.

Claims (12)

1. A file processing method is applied to an Android operating system and is characterized by comprising the following steps:
the kernel layer receives a message sent by the application program layer;
the kernel layer verifies the received message, and executes a file processing command which is not authorized to be executed by the application program layer and is included in the message when the message passes the verification; wherein the sending of the message by the application layer comprises:
acquiring a first message verification code;
according to the first message verification code and the file processing command which is not executed by the application program layer in the permission, a message is established, wherein the packet header of the message is the encrypted first message verification code, and the message body of the message is the file processing command which is not executed by the application program layer in the permission;
and sending the message to the kernel layer through a socket communication protocol.
2. The method of claim 1, wherein the kernel layer receiving the message sent by the application layer comprises:
and the kernel layer monitors a socket port and receives the message sent by the application program layer through the socket port.
3. The method of claim 1, wherein the kernel layer validating the received message comprises:
decrypting the packet header of the received message to obtain a second message verification code;
and comparing the second message verification code with the stored first message verification code, and when the second message verification code is consistent with the stored first message verification code, verifying the packet header of the message.
4. The method of claim 1 or 3, wherein the kernel layer validating the received message comprises:
searching whether a file processing command in the message body of the message exists in the stored executable file processing command;
and if so, determining that the message is a legal message.
5. The method of claim 1, wherein before the kernel layer receives the message sent by the application layer, the method further comprises:
and activating the inner core layer to enable the inner core layer to have the highest authority.
6. A file processing system is applied to an Android operating system and is characterized by comprising: an application layer and a kernel layer, wherein,
the application program layer is used for sending messages to the kernel layer;
the kernel layer is used for receiving the message, verifying the received message and executing a file processing command which is contained in the message and is not authorized to be executed by the application program layer when the verification is passed;
the application program layer is specifically configured to obtain a first message authentication code, construct a message according to the first message authentication code and a file processing command that the application program layer does not have an authority to execute, and send the message to the kernel layer through a socket communication protocol, where a packet header of the message is the encrypted first message authentication code, and a message body of the message is the file processing command that the application program layer does not have the authority to execute.
7. The system of claim 6,
the kernel layer is specifically configured to monitor a socket port, receive a packet sent by the application layer through the socket port, decrypt a packet header of the received packet to obtain a second packet verification code, compare the second packet verification code with the stored first packet verification code, and when the second packet verification code is consistent with the stored first packet verification code, verify the packet header of the packet, and execute a file processing command that the application layer does not have an authority to execute, included in the packet.
8. The system of claim 7,
the kernel layer is specifically configured to search for whether a file processing command in the message body of the message exists in the stored executable file processing commands, and if so, determine that the message is a legal message.
9. The system of claim 6, further comprising:
and the activating device is used for activating the inner core layer to enable the inner core layer to have the highest authority.
10. The device for processing the file is applied to a kernel layer of an Android operating system and comprises the following steps:
the receiving unit is used for receiving the message sent by the application program layer;
the processing unit is used for verifying the received message and executing a file processing command which is not authorized to be executed by the application program layer and is contained in the message when the verification is passed; wherein,
the receiving unit is specifically configured to monitor a socket port, and receive a packet sent by an application layer through the socket port.
11. The apparatus of claim 10,
the processing unit is specifically configured to decrypt a packet header of a received packet to obtain a second packet verification code, compare the second packet verification code with the stored first packet verification code, and if the second packet verification code is identical to the stored first packet verification code, verify the packet header of the packet, and execute a file processing command that the application program layer does not have an authority to execute, included in the packet.
12. The apparatus of claim 10,
the processing unit is specifically configured to search for whether a file processing command in the message body of the message exists in the stored executable file processing commands, and if so, determine that the message is a legal message.
CN201110294433.9A 2011-09-29 2011-09-29 A kind of method, system and device of file process Expired - Fee Related CN103034811B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110294433.9A CN103034811B (en) 2011-09-29 2011-09-29 A kind of method, system and device of file process

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110294433.9A CN103034811B (en) 2011-09-29 2011-09-29 A kind of method, system and device of file process

Publications (2)

Publication Number Publication Date
CN103034811A CN103034811A (en) 2013-04-10
CN103034811B true CN103034811B (en) 2016-08-03

Family

ID=48021697

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110294433.9A Expired - Fee Related CN103034811B (en) 2011-09-29 2011-09-29 A kind of method, system and device of file process

Country Status (1)

Country Link
CN (1) CN103034811B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103544096A (en) * 2013-10-21 2014-01-29 Tcl集团股份有限公司 Method and system for feeding back information in case of operational failure of Android terminal
CN103593218A (en) * 2013-11-29 2014-02-19 苏军生 Terminal suitable for being used by the aged and based on Android operating system
CN106027487B (en) * 2016-04-28 2019-07-23 广州广电运通金融电子股份有限公司 A kind of access management method and system of hardware device
CN106293962B (en) * 2016-08-01 2019-12-20 青岛海信宽带多媒体技术有限公司 Method and device for calling system command
CN106708634B (en) * 2016-12-09 2020-08-25 福建省天奕网络科技有限公司 Communication method and system for VR application equipment and manufacturer equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1349163A (en) * 2001-12-03 2002-05-15 上海交通大学 Safe web page issuing system based on base layer of operation system and capable of preventing distortion of issued file
CN101009699A (en) * 2006-01-25 2007-08-01 姜斌斌 Transparent local security environment system and its implementation method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050182966A1 (en) * 2004-02-17 2005-08-18 Duc Pham Secure interprocess communications binding system and methods

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1349163A (en) * 2001-12-03 2002-05-15 上海交通大学 Safe web page issuing system based on base layer of operation system and capable of preventing distortion of issued file
CN101009699A (en) * 2006-01-25 2007-08-01 姜斌斌 Transparent local security environment system and its implementation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Android OS手机平台的安全机制分析和应用研究;宋杰等;《计算机技术与发展》;20100610;第20卷(第6期);第152-155页 *

Also Published As

Publication number Publication date
CN103034811A (en) 2013-04-10

Similar Documents

Publication Publication Date Title
CN107220083B (en) A method and system for running an application program without installation in an Android system
JP4902636B2 (en) Method and system for preventing software piracy in a corporate environment using machine attributes
CN110333868B (en) Method and system for generating installation packages of sub-applications
WO2016029595A1 (en) Method, device, and equipment for calling open platform and non-volatile computer storage medium
KR101969481B1 (en) Method and apparatus for generating Dynamic Secure Module
WO2011119300A2 (en) System and methods for remote maintenance in an electronic network with multiple clients
CN103034811B (en) A kind of method, system and device of file process
Apvrille Symbian worm Yxes: Towards mobile botnets?
US10965677B2 (en) Data leakage and information security using access control
CN106778348A (en) A kind of method and apparatus for isolating private data
CN112115430A (en) Apk reinforcement method, electronic equipment and storage medium
US20210409432A1 (en) Automatic identification of applications that circumvent permissions and/or obfuscate data flows
US10089494B2 (en) System and method for securing a network device
CN106648770B (en) Generation method, loading method and device of application program installation package
CN105975624B (en) A kind of data transmission method, equipment and system
CN115563588A (en) Method, device, electronic device and storage medium for software offline authentication
Nazar et al. Rooting Android–Extending the ADB by an auto-connecting WiFi-accessible service
CN115130141B (en) Document processing method and device, mobile terminal and storage medium
TW201426556A (en) Software protection system and method in virtual environment
CN104813333A (en) Method for downloading at least one software component onto a computing device, and associated computer program product, computing device and computer system
Cristalli STATIC AND DYNAMIC ANALYSES FOR PROTECTING THE JAVA SOFTWARE EXECUTION ENVIRONMENT
CN111966422B (en) A localized plug-in service method, device, electronic device and storage medium
Kim et al. Self‐Controllable Mobile App Protection Scheme Based on Binary Code Splitting
Xu Security enhancement of secure USB debugging in Android system
CN106789074A (en) The application identity verification method and checking system of a kind of Java card

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220908

Address after: 3007, Hengqin international financial center building, No. 58, Huajin street, Hengqin new area, Zhuhai, Guangdong 519031

Patentee after: New founder holdings development Co.,Ltd.

Address before: 100871, Beijing, Haidian District Cheng Fu Road 298, founder building, 9 floor

Patentee before: PEKING UNIVERSITY FOUNDER GROUP Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160803