CN106407818B - Network packet encryption method and device - Google Patents

Network packet encryption method and device Download PDF

Info

Publication number
CN106407818B
CN106407818B CN201610715912.6A CN201610715912A CN106407818B CN 106407818 B CN106407818 B CN 106407818B CN 201610715912 A CN201610715912 A CN 201610715912A CN 106407818 B CN106407818 B CN 106407818B
Authority
CN
China
Prior art keywords
view
xml document
page
attribute information
encryption
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
CN201610715912.6A
Other languages
Chinese (zh)
Other versions
CN106407818A (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.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software 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 Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201610715912.6A priority Critical patent/CN106407818B/en
Publication of CN106407818A publication Critical patent/CN106407818A/en
Application granted granted Critical
Publication of CN106407818B publication Critical patent/CN106407818B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • 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
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • Bioethics (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The disclosure discloses a kind of network packet encryption method and device, belongs to field of computer technology.The network packet encryption method includes: to load the corresponding extensible markup language xml document of the page after a page for opening application program;View in the xml document is rendered, the attribute information of predetermined view is obtained;According to predetermined way by the attribute information composition encryption string of the acquisition, the network packet for obtaining the page related resource file is encrypted using encryption string.The disclosure solves the string of preset encryption in the related technology and is easy to be identified by decompiling, the technical problem for causing cipher mode safety lower, has achieved the effect that improve safety.

Description

Network packet encryption method and device
Technical field
This disclosure relates to field of computer technology, in particular to a kind of network packet encryption method and device.
Background technique
In order to protect the safety of information, when sending network packet, it usually needs Encryption Algorithm is to network packet It is encrypted.
In traditional cipher mode, Encryption Algorithm is using preset encryption string to the network packet for needing to send It is encrypted.Since preset encryption string is easy to be identified by decompiling, the cipher mode safety of this mode Property is lower.
Summary of the invention
The disclosure provides a kind of network packet encryption method and device.The technical solution is as follows:
According to the first aspect of the embodiments of the present disclosure, a kind of network packet encryption method is provided, which comprises After a page for opening application program, the corresponding extensible markup language of the page (English: extensible is loaded Markup language, xml) file;View in the xml document is rendered, the attribute letter of predetermined view is obtained Breath;According to predetermined way by the attribute information composition encryption string of the acquisition, using encryption string to for obtaining the page The network packet of face related resource file is encrypted.
By obtaining the attribute information of predetermined view when rendering to the view in xml document, by attribute information group At encryption string, the network packet for obtaining related resource file is encrypted, due in the page include many views, By the attribute information composition encryption string of at least one predetermined view therein, and decompiling can not identify which is regarded in xml document The attribute information of figure be used to generate encryption string, therefore solves preset encryption string in the related technology and be easy by decompiling It identifies, the technical problem for causing cipher mode safety lower, has achieved the effect that improve safety.
Optionally, the view in the xml document renders, and obtains the attribute information of predetermined view, comprising: When the corresponding xml document of the page of load is one, the view in the xml document is rendered, is obtained at least The attribute information of one predetermined view;When the corresponding xml document of the page of load is at least two, for each xml File renders the view in the xml document, obtains the attribute information of at least one predetermined view.By according to xml The number of file obtains the attribute information of at least one predetermined view, so that more more to the selection of the attribute information for encryption Sample improves the safety of cipher mode.
Optionally, it is described using the encryption string to the network packet for obtaining the page related resource file into Row encryption, comprising: determine to render resource file required when view in the xml document;Using encryption string to being used for The network packet for obtaining the resource file is encrypted.By being gone here and there using encryption to the network number for obtaining resource file It is encrypted according to packet, improves safety when obtaining resource file.
Optionally, the view in the xml document renders, comprising: when needing to render in the xml document Predetermined view be need default display view when, display render successfully the predetermined view;It is needed when in the xml document When the predetermined view to be rendered is self-defined view, the predetermined view of rendering is hidden or shown, the self-defined view is not To need to default the view of display.It is shown, self-defined view is carried out hidden by carrying out rendering to the view for needing default to show Hiding, ensure that user to the normal use of the page.
Optionally, described to go here and there the attribute information composition encryption of the acquisition according to predetermined way, comprising: suitable according to making a reservation for The attribute information sequence combination of the acquisition is obtained the encryption and gone here and there by sequence;Alternatively, according to the acquisition sequence of each attribute information The encryption string is obtained to the attribute information sequence combination of the acquisition.By according to attribute information sort to obtain encryption string or It sorts to obtain encryption string according to acquisition sequence, so that a possibility that combination of encryption string is more various, and reduction is decrypted.
Optionally, the corresponding xml document of the load page, comprising: using described in LayoutInflater load The corresponding xml document of the page.By utilizing the corresponding xml document of LayoutInflater loading page, so that in Android system In being capable of the normal load page.
According to the second aspect of an embodiment of the present disclosure, a kind of network packet encryption device is provided, described device includes: to add Module is carried, is configured as after a page for opening application program, loads the corresponding xml document of the page;Render mould Block is configured as rendering the view in the xml document, obtains the attribute information of predetermined view;Encrypting module is matched Be set to the attribute information composition encryption string for the rendering module being obtained according to predetermined way, using encryption string to for obtaining The network packet of the page related resource file is taken to be encrypted.
Optionally, the rendering module, comprising: the first acquisition submodule is configured as when the page of load is corresponding Xml document be one when, the view in the xml document is rendered, obtain at least one predetermined view attribute letter Breath;Second acquisition submodule is configured as when the corresponding xml document of the page of load is at least two, for each Xml document renders the view in the xml document, obtains the attribute information of at least one predetermined view.
Optionally, the encrypting module, comprising: determine submodule, be configured to determine that out to render and regarded in the xml document Required resource file when figure;First encryption submodule is configured as utilizing the encryption string to for obtaining the determining son The network packet for the resource file that module is determined is encrypted.
Optionally, the rendering module, comprising: the first display sub-module is configured as needing wash with watercolours in the xml document The predetermined view of dye is when needing to default the view of display, and display renders the successfully predetermined view;Second display sub-module, It is configured as hiding or show the described of rendering when the predetermined view for needing to render in the xml document is self-defined view Predetermined view, the self-defined view are not the view for needing to default display.
Optionally, the encrypting module, comprising: the second encryption submodule is configured as obtaining according to predetermined order by described The attribute information sequence combination taken obtains the encryption string;Third encrypts submodule, is configured as according to each attribute information Acquisition sequence obtains the encryption to the attribute information sequence combination of the acquisition and goes here and there.
Optionally, the loading module is additionally configured to load the corresponding xml of the page using LayoutInflater File.
According to the third aspect of an embodiment of the present disclosure, a kind of network packet encryption device is provided, described device includes: place Manage device;For storing the memory of the processor-executable instruction;Wherein, the processor is configured to: open apply After one page of program, the corresponding xml document of the page is loaded;View in the xml document is rendered, is obtained To the attribute information of predetermined view;According to predetermined way by the attribute information composition encryption string of the acquisition, the encryption is utilized String encrypts the network packet for obtaining the page related resource file.
It should be understood that the above general description and the following detailed description are merely exemplary, this can not be limited It is open.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows the implementation for meeting the disclosure Example, and consistent with the instructions for explaining the principles of this disclosure.
Fig. 1 is a kind of flow chart of network packet encryption method shown according to an exemplary embodiment;
Fig. 2A is a kind of flow chart of the network packet encryption method shown according to another exemplary embodiment;
Fig. 2 B is that the view shown according to an exemplary embodiment in xml document renders, and obtains predetermined view Attribute information flow chart;
Fig. 2 C is the flow chart that the view shown according to an exemplary embodiment in xml document is rendered;
Fig. 2 D is that shown according to an exemplary embodiment utilize encrypts string to for obtaining page related resource file The flow chart that network packet is encrypted;
Fig. 3 is a kind of block diagram of network packet encryption device shown according to an exemplary embodiment;
Fig. 4 is a kind of block diagram of the network packet encryption device shown according to another exemplary embodiment;
Fig. 5 is a kind of block diagram of device for encrypted network data packet shown according to an exemplary embodiment.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all implementations consistent with this disclosure.On the contrary, they be only with it is such as appended The example of the consistent device and method of some aspects be described in detail in claims, the disclosure.
Fig. 1 is a kind of flow chart of network packet encryption method shown according to an exemplary embodiment, the network number It can be applied in smart machine according to packet encryption method, smart machine said here includes smart phone, tablet computer, more matchmakers Body playback equipment etc..As shown in Figure 1, the network packet encryption method may comprise steps of.
In step 110, after a page for opening application program, the corresponding xml document of the page is loaded.
Xml document corresponding with the page generally defines the display position of each view in the page, display format and each The title etc. of the corresponding resource file of a view.View said here is the class for the factor that can individually show on the page, than Such as common control, button, picture, text, link.
Common application program would generally include several pages, and each page is required to utilize and page when showing The display position of each view and display format, parse needs and fill to view on the corresponding xml document rendering page in face Resource file title, obtain these resource files from server end and fill into view, thus according to the resource got File shows the complete page in the rendering of corresponding view location.
In general, the code file that the developer that xml document is application program writes, is answered when installing in smart machine After program, it will usually synchronize the xml document got in application program installation kit.Optionally, smart machine can will acquire Xml document store to the installation directory of the application program.
When smart machine opens some page of application program, then it is corresponding directly to transfer out the page stored Xml document.
In the step 120, the view in xml document is rendered, obtains the attribute information of predetermined view.
A usual xml document can define the multiple views for including in the page, and predetermined view here can be in the page The default view for including, default view said here be usually application program needed in displayed page it is more predetermined View.For example the page is defined originally and needs displaying control 1, then the control 1 is denoted as a predetermined view.Therefore, default view Determine the content to page presentation.
Optionally, predetermined view can also be that self-defined view, self-defined view can be hidden in the page, can also show It is shown as unrelated view.Here self-defined view can be research staff and have modified the corresponding xml document of the page, in this document One section is added to for limiting the code of self-defined view.In general, in the feelings for not needing to encrypt network packet Under condition, self-defined view is not defined within usually in the corresponding xml document of the page, and default view is then to need to be defined In the corresponding xml document of the page, so that the effect that page presentation is desired.
Attribute information said here can be display position of the view in the page, the length of view, width, height and One or more of information such as the display format of view.That is, the attribute information of view is for limiting view in the page Show form.
In step 130, the attribute information composition encryption string that will acquire according to predetermined way, using encryption string to for obtaining The network packet of page related resource file is taken to be encrypted.
Carrying out encryption to network packet is utilized to improve the safety in the relevant resource file of the acquisition page The attribute information composition encryption string of the predetermined view of acquisition, encrypts network packet, adds due to being selected to composition The attribute information of the predetermined view of close string is determined by the research staff of application program, application program using xml document into Predetermined view when can learn which view when row rendering, which attribute information in view be used to form encryption string, and black For visitor when the code to application program carries out decompiling, due to having many views in xml document, and these views can be by Rendering, hacker can not learn these predetermined views and the attribute information for forming encryption string in xml document, therefore the encryption The safety of mode is very high.
In conclusion the network packet encryption method provided in the embodiment of the present disclosure, by the view in xml document When figure is rendered, the attribute information of predetermined view is obtained, the encryption string that attribute information is formed, to for obtaining related resource The network packet of file is encrypted, due to including many views in the page, by the category of at least one predetermined view therein Property information composition encryption string, and decompiling identify not Chu the attribute information of which view in xml document be used to generate encrypt go here and there, Therefore solve that the string of preset encryption in the related technology is easy to be identified by decompiling, cause cipher mode safety compared with Low technical problem has achieved the effect that improve safety.
Fig. 2A is a kind of flow chart of the network packet encryption method shown according to another exemplary embodiment, the network Data packet encryption method can be applied in smart machine, and smart machine said here includes smart phone, tablet computer, more Apparatus for media playing etc..As shown in Figure 2 A, which may comprise steps of.
In step 210, after a page for opening application program, the corresponding xml document of the page is loaded.
On Android system platform, the corresponding xml document of LayoutInflater loading page can use. LayoutInflater is the class in Android system, therefore to can be adapted for safety lower for the network packet encryption method On Android system platform.
In a step 220, the view in xml document is rendered, obtains the attribute information of predetermined view.
Smart machine renders the view in xml document, can be by such as when obtaining the attribute information of predetermined view Step shown in Fig. 2 B.
In step 221, when the corresponding xml document of the page of load is one, wash with watercolours is carried out to the view in xml document Dye, obtains the attribute information of at least one predetermined view.
Here the attribute information obtained can be all or part of attribute information an of predetermined view, be also possible to multiple All or part of attribute information of predetermined view.
In step 222, right for each xml document when the corresponding xml document of the page of load is at least two View in xml document is rendered, and the attribute information of at least one predetermined view is obtained.
When the corresponding xml document of the page of load is at least two, for each xml document, in xml document When view is rendered, require to send the relevant resource file of network packet request page to server, therefore, for every A xml document requires to obtain the attribute information of at least one predetermined view, for encrypting to network packet.
Optionally, the view in xml document is rendered, may include step as shown in Figure 2 C.
In step 223, when the predetermined view for needing to render in xml document is to need to default the view of display, display Render successful predetermined view.
It can choose the view for needing to default display in xml when selecting predetermined view, therefore in rendering, by predetermined view Figure rendering is shown, can need to default the view of display on the complete displayed page of user.
In step 224, when the predetermined view for needing to render in xml document is self-defined view, hide or show wash with watercolours The predetermined view of dye.
Self-defined view said here is not the view for needing to default display.Since self-defined view is not generally needs Default the view of display, therefore in order to improve safety, avoids exposing self-defined view, be rendered to self-defined view When, the self-defined view of rendering can be hidden;It, at this time can will be customized it is obvious also possible to show the self-defined view of rendering View is set as more hidden or common display form.In order to avoid user is to the normal use of the page, and avoid hacker It identifies self-defined view, self-defined view can be generally hidden.
In step 230, the attribute information composition encryption string that will acquire according to predetermined way, using encryption string to network number It is encrypted according to packet, the network packet is for obtaining page related resource file.
Composition encryption string when, if predetermined view only one, can use whole attribute information groups of predetermined view It is gone here and there at encryption, the part attribute information that also can choose predetermined view is used to form encryption string, such as can be by predetermined view Display format and display position form encryption according to predetermined way and go here and there.
If the attribute information obtained comes from least two predetermined views, can use complete at least two predetermined views Portion's attribute information composition encryption string, also can choose the part attribute information at least two predetermined views and is used to form encryption String, such as the attribute information obtained can choose the length of the first predetermined view from the first predetermined view and the second predetermined view The display position of degree and the second predetermined view is gone here and there to form encryption, also can choose display format, the display of the first predetermined view The height of position and the second predetermined view is gone here and there to form encryption.
Optionally, when being encrypted using encryption string to the network packet for obtaining page related resource file, It may include step as shown in Figure 2 D.
In step 231, resource file required when view in rendering xml document is determined.
When being rendered to the view in xml document, need to obtain for resource file needed for rendering each view, this In the resource file said can be picture, text or link etc..
In step 232, the network packet for obtaining resource file is encrypted using encryption string.
When obtaining resource file, need to send the acquisition request of resource file to server, namely send to server Network packet, network packet may include the acquisition request of resource file and the identification information of mobile terminal.
Optionally, the attribute information composition encryption string that will acquire according to predetermined way, can be possible by following two Implementation is realized.
In one possible implementation, the attribute information sequence combination that will acquire according to predetermined order is encrypted String.For example the display position attribute of view is k1, display format attribute is k2, and the length attribute of view is k3, the width of view Attribute is k4, and the height attributes of view are k5, display position of the attribute information that can be will acquire according to view, display lattice Formula, length, width, this sequence of height are ranked up combination and obtain encryption string, and obtained encryption string can be k1k2k3k4k5.
In alternatively possible implementation, the attribute information of acquisition is arranged according to the acquisition sequence of each attribute information Sequence combines to obtain encryption string.Such as first get the display position k1 of view, then get the length k3 of view, width k4, Height k5, finally gets the display format k2 of view, then the encryption string obtained according to the sequence of acquisition can be k1k3k4k5k2。
In conclusion the network packet encryption method provided in the embodiment of the present disclosure, by the view in xml document When figure is rendered, the attribute information of predetermined view is obtained, the encryption string that attribute information is formed, to for obtaining related resource The network packet of file is encrypted, due to including many views in the page, by the category of at least one predetermined view therein Property information composition encryption string, and decompiling identify not Chu the attribute information of which view in xml document be used to generate encrypt go here and there, Therefore solve that the string of preset encryption in the related technology is easy to be identified by decompiling, cause cipher mode safety compared with Low technical problem has achieved the effect that improve safety.
The attribute information of at least one predetermined view is obtained by the number according to xml document, so as to for encryption The selection of attribute information is more various, improves the safety of cipher mode.
By being encrypted using encryption string to the network packet for obtaining resource file, improves and obtain resource text Safety when part.
It is shown by carrying out rendering to the view for needing default to show, self-defined view is hidden, ensure that user To the normal use of the page.
By sorting to obtain encryption string according to attribute information or sorting to obtain encryption string according to acquisition sequence, so that encryption A possibility that combination of string is more various, and reduction is decrypted.
By utilizing the corresponding xml document of LayoutInflater loading page, so that can be normal in Android system Loading page.
Following is embodiment of the present disclosure, can be used for executing embodiments of the present disclosure.It is real for disclosure device Undisclosed details in example is applied, embodiments of the present disclosure is please referred to.
Fig. 3 is a kind of block diagram of network packet encryption device shown according to an exemplary embodiment, the network data Packet encryption device can be applied in smart machine, and smart machine said here includes smart phone, tablet computer, multimedia Playback equipment etc..As shown in figure 3, the network packet encryption device includes but is not limited to: loading module 310, rendering module 320 With encrypting module 330.
Loading module 310 is configured as after a page for opening application program, loads the corresponding xml of the page File.
Rendering module 320 is configured as rendering the view in xml document, obtains the attribute information of predetermined view.
Encrypting module 330 is configured as the attribute information composition encryption for obtaining rendering module 320 according to predetermined way String encrypts the network packet for obtaining page related resource file using encryption string.
In conclusion the network packet encryption device provided in the embodiment of the present disclosure, by the view in xml document When figure is rendered, the attribute information of predetermined view is obtained, the encryption string that attribute information is formed, to for obtaining related resource The network packet of file is encrypted, due to including many views in the page, by the category of at least one predetermined view therein Property information composition encryption string, and decompiling identify not Chu the attribute information of which view in xml document be used to generate encrypt go here and there, Therefore solve that the string of preset encryption in the related technology is easy to be identified by decompiling, cause cipher mode safety compared with Low technical problem has achieved the effect that improve safety.
Fig. 4 is a kind of block diagram of the network packet encryption device shown according to another exemplary embodiment, the network number It can be applied in smart machine according to packet encryption device, smart machine said here includes smart phone, tablet computer, more matchmakers Body playback equipment etc..As shown in figure 4, the network packet encryption device includes but is not limited to: loading module 410, rendering module 420 and encrypting module 430.
Loading module 410 is configured as after a page for opening application program, loads the corresponding xml of the page File.
Optionally, loading module 410 is additionally configured to utilize the corresponding xml document of LayoutInflater loading page.
On Android system platform, the corresponding xml document of LayoutInflater loading page can use. LayoutInflater is the class in Android system, therefore to can be adapted for safety lower for the network packet encryption method On Android system platform.
Rendering module 420 is configured as rendering the view in xml document, obtains the attribute information of predetermined view.
Attribute information said here can be display position of the view in the page, the length of view, width, height and One or more of information such as the display format of view.That is, the attribute information of view is for limiting view in the page Show form.
Encrypting module 430 is configured as the attribute information composition encryption for obtaining rendering module 420 according to predetermined way String encrypts the network packet for obtaining page related resource file using encryption string.
Composition encryption string when, if predetermined view only one, can use whole attribute information groups of predetermined view It is gone here and there at encryption, the part attribute information that also can choose predetermined view is used to form encryption string.
If the attribute information obtained comes from least two predetermined views, can use complete at least two predetermined views Portion's attribute information composition encryption string, also can choose the part attribute information at least two predetermined views and is used to form encryption String.
Optionally, rendering module 420 may include: the first acquisition submodule 421 and the second acquisition submodule 422.
First acquisition submodule 421 is configured as when the corresponding xml document of the page of load is one, to xml document In view rendered, obtain the attribute information of at least one predetermined view.
Here the attribute information obtained can be all or part of attribute information an of predetermined view, be also possible to multiple All or part of attribute information of predetermined view.
Second acquisition submodule 422 is configured as when the corresponding xml document of the page of load is at least two, for Each xml document renders the view in xml document, obtains the attribute information of at least one predetermined view.
When the corresponding xml document of the page of load is at least two, for each xml document, in xml document When view is rendered, require to send the relevant resource file of network packet request page to server, therefore, for every A xml document requires to obtain the attribute information of at least one predetermined view, for encrypting to network packet.
Optionally, encrypting module 430 may include: determining submodule 431 and the first encryption submodule 432.
It determines submodule 431, is configured to determine that out resource file required when view in rendering xml document.
When being rendered to the view in xml document, need to obtain for resource file needed for rendering each view, this In the resource file said can be picture, text or link etc..
First encryption submodule 432, is configured as using encryption string to the money determined for obtaining determining submodule 431 The network packet of source file is encrypted.
When obtaining resource file, need to send the acquisition request of resource file to server, namely send to server Network packet, network packet may include the acquisition request of resource file and the identification information of mobile terminal.
Optionally, rendering module 420 can also include: the first display sub-module 423 and the second display sub-module 424.
First display sub-module 423 is configured as the predetermined view for needing to render in xml document to need to default display View when, display renders successful predetermined view.
It can choose the view for needing to default display in xml when selecting predetermined view, therefore in rendering, by predetermined view Figure rendering is shown, can need to default the view of display on the complete displayed page of user.
Second display sub-module 424, being configured as the predetermined view for needing to render in xml document is self-defined view When, hide or show the predetermined view of rendering.
Self-defined view said here is not the view for needing to default display.Since self-defined view is not generally needs Default the view of display, therefore in order to improve safety, avoids exposing self-defined view, be rendered to self-defined view When, the self-defined view of rendering can be hidden;It, at this time can will be customized it is obvious also possible to show the self-defined view of rendering View is set as more hidden or common display form.In order to avoid user is to the normal use of the page, and avoid hacker It identifies self-defined view, self-defined view can be generally hidden.
Optionally, encrypting module 430 can also include:
Second encryption submodule 433 is configured as the attribute information that will acquire according to predetermined order sequence combination and is added Close string.
Third encrypts submodule 434, is configured as the acquisition according to each attribute information sequentially to the attribute information of acquisition Sequence combination obtains encryption string.
In conclusion the network packet encryption device provided in the embodiment of the present disclosure, by the view in xml document When figure is rendered, the attribute information of predetermined view is obtained, the encryption string that attribute information is formed, to for obtaining related resource The network packet of file is encrypted, due to including many views in the page, by the category of at least one predetermined view therein Property information composition encryption string, and decompiling identify not Chu the attribute information of which view in xml document be used to generate encrypt go here and there, Therefore solve that the string of preset encryption in the related technology is easy to be identified by decompiling, cause cipher mode safety compared with Low technical problem has achieved the effect that improve safety.
The attribute information of at least one predetermined view is obtained by the number according to xml document, so as to for encryption The selection of attribute information is more various, improves the safety of cipher mode.
By being encrypted using encryption string to the network packet for obtaining resource file, improves and obtain resource text Safety when part.
It is shown by carrying out rendering to the view for needing default to show, self-defined view is hidden, ensure that user To the normal use of the page.
By sorting to obtain encryption string according to attribute information or sorting to obtain encryption string according to acquisition sequence, so that encryption A possibility that combination of string is more various, and reduction is decrypted.
By utilizing the corresponding xml document of LayoutInflater loading page, so that can be normal in Android system Loading page.
About the device in above-described embodiment, wherein modules execute the concrete mode of operation in related this method Embodiment in be described in detail, no detailed explanation will be given here.
An exemplary embodiment of the present disclosure provides a kind of network packet encryption devices, can be realized disclosure offer Network packet encryption method, the network packet encryption device include: processor, for storage processor executable instruction Memory;
Wherein, processor is configured as:
After a page for opening application program, the corresponding xml document of the page is loaded;
View in xml document is rendered, the attribute information of predetermined view is obtained;
The attribute information composition encryption string that will acquire according to predetermined way, is provided using encryption string to for obtaining page correlation The network packet of source file is encrypted.
Fig. 5 is a kind of block diagram of device for encrypted network data packet shown according to an exemplary embodiment.For example, Device 500 can be mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, doctor Treat equipment, body-building equipment, personal digital assistant etc..
Referring to Fig. 5, device 500 may include following one or more components: processing component 502, memory 504, power supply Component 506, multimedia component 508, audio component 510, input/output (I/O) interface 512, sensor module 514, Yi Jitong Believe component 516.
The integrated operation of the usual control device 500 of processing component 502, such as with display, telephone call, data communication, phase Machine operation and record operate associated operation.Processing component 502 may include that one or more processors 518 refer to execute It enables, to perform all or part of the steps of the methods described above.In addition, processing component 502 may include one or more modules, just Interaction between processing component 502 and other assemblies.For example, processing component 502 may include multi-media module, it is more to facilitate Interaction between media component 508 and processing component 502.
Memory 504 is configured as storing various types of data to support the operation in device 500.These data are shown Example includes the instruction of any application or method for operating on device 500, contact data, and telephone book data disappears Breath, picture, video etc..Memory 504 can be by any kind of volatibility or non-volatile memory device or their group It closes and realizes, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM) is erasable to compile Journey read-only memory (EPROM), programmable read only memory (PROM), read-only memory (ROM), magnetic memory, flash Device, disk or CD.
Power supply module 506 provides electric power for the various assemblies of device 500.Power supply module 506 may include power management system System, one or more power supplys and other with for device 500 generate, manage, and distribute the associated component of electric power.
Multimedia component 508 includes the screen of one output interface of offer between device 500 and user.In some realities It applies in example, screen may include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel, screen can To be implemented as touch screen, to receive input signal from the user.Touch panel include one or more touch sensors with Sense the gesture on touch, slide, and touch panel.Touch sensor can not only sense the boundary of a touch or slide action, and And also detect duration and pressure relevant to touch or slide.In some embodiments, multimedia component 508 includes One front camera and/or rear camera.It is such as in a shooting mode or a video mode, preceding when device 500 is in operation mode It sets camera and/or rear camera can receive external multi-medium data.Each front camera and rear camera can Be a fixed optical lens system or have focusing and optical zoom capabilities.
Audio component 510 is configured as output and/or input audio signal.For example, audio component 510 includes a Mike Wind (MIC), when device 500 is in operation mode, when such as call mode, recording mode, and voice recognition mode, microphone is matched It is set to reception external audio signal.The received audio signal can be further stored in memory 504 or via communication set Part 516 is sent.In some embodiments, audio component 510 further includes a loudspeaker, is used for output audio signal.
I/O interface 512 provides interface between processing component 502 and peripheral interface module, and above-mentioned peripheral interface module can To be keyboard, click wheel, button etc..These buttons may include, but are not limited to: home button, volume button, start button and lock Determine button.
Sensor module 514 includes one or more sensors, and the state for providing various aspects for device 500 is commented Estimate.For example, sensor module 514 can detecte the state that opens/closes of device 500, the relative positioning of component, such as component For the display and keypad of device 500, sensor module 514 can be with the position of 500 1 components of detection device 500 or device Set change, the existence or non-existence that user contacts with device 500, the temperature in 500 orientation of device or acceleration/deceleration and device 500 Variation.Sensor module 514 may include proximity sensor, be configured to detect without any physical contact near The presence of object.Sensor module 514 can also include optical sensor, such as CMOS or ccd image sensor, for answering in imaging With middle use.In some embodiments, which can also include acceleration transducer, gyro sensor, magnetic Sensor, pressure sensor or temperature sensor.
Communication component 516 is configured to facilitate the communication of wired or wireless way between device 500 and other equipment.Device 500 can access the wireless network based on communication standard, such as Wi-Fi, 2G or 3G or their combination.In an exemplary reality It applies in example, communication component 516 receives broadcast singal or the related letter of broadcast from external broadcasting management system via broadcast channel Breath.In one exemplary embodiment, communication component 516 further includes near-field communication (NFC) module, to promote short range communication.Example Such as, NFC module can be based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra wide band (UWB) technology, Bluetooth (BT) technology and other technologies are realized.
In the exemplary embodiment, device 500 can be believed by one or more application specific integrated circuit (ASIC), number Number processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are realized, for executing above-mentioned network packet encryption Method.
In the exemplary embodiment, a kind of non-transitorycomputer readable storage medium including instruction, example are additionally provided It such as include the memory 504 of instruction, above-metioned instruction can be executed by the processor 518 of device 500 to complete above-mentioned network packet Encryption method.For example, non-transitorycomputer readable storage medium can be ROM, random access memory (RAM), CD-ROM, Tape, floppy disk and optical data storage devices etc..
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to its of the disclosure Its embodiment.This application is intended to cover any variations, uses, or adaptations of the disclosure, these modifications, purposes or Person's adaptive change follows the general principles of this disclosure and including the undocumented common knowledge in the art of the disclosure Or conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the disclosure are by following Claim is pointed out.
It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and And various modifications and changes may be made without departing from the scope thereof.The scope of the present disclosure is only limited by the accompanying claims.

Claims (13)

1. a kind of network packet encryption method, which is characterized in that the described method includes:
After a page for opening application program, the corresponding extensible markup language xml document of the page is loaded;
View in the xml document is rendered, the attribute information of predetermined view is obtained;
The attribute information is formed into encryption string according to predetermined way, using encryption string to related for obtaining the page The network packet of resource file is encrypted.
2. being obtained the method according to claim 1, wherein the view in the xml document renders To the attribute information of predetermined view, comprising:
When the corresponding xml document of the page of load is one, the view in the xml document is rendered, is obtained The attribute information of at least one predetermined view;
When the corresponding xml document of the page of load is at least two, for each xml document, in the xml document View rendered, obtain the attribute information of at least one predetermined view.
3. the method according to claim 1, wherein described utilize the encryption string to for obtaining the page The network packet of related resource file is encrypted, comprising:
Determine to render resource file required when view in the xml document;
The network packet for obtaining the resource file is encrypted using encryption string.
4. being wrapped the method according to claim 1, wherein the view in the xml document renders It includes:
When the predetermined view for needing to render in the xml document is to need to default the view of display, display renders successful institute State predetermined view;
When the predetermined view for needing to render in the xml document is self-defined view, hides or the described of display rendering makes a reservation for View, the self-defined view are not the view for needing to default display.
5. the method according to claim 1, wherein described add attribute information composition according to predetermined way Close string, comprising:
The attribute information sequence combination encryption is obtained according to predetermined order to go here and there;
Alternatively,
The encryption is obtained to attribute information sequence combination according to the acquisition sequence of each attribute information to go here and there.
6. any method in -5 according to claim 1, which is characterized in that the corresponding xml text of the load page Part, comprising:
The corresponding xml document of the page is loaded using LayoutInflater.
7. a kind of network packet encryption device, which is characterized in that described device includes:
Loading module is configured as after a page for opening application program, loads the corresponding expansible mark of the page Remember language xml document;
Rendering module is configured as rendering the view in the xml document, obtains the attribute information of predetermined view;
Encrypting module is configured as the attribute information composition encryption string for obtaining the rendering module according to predetermined way, utilizes The encryption string encrypts the network packet for obtaining the page related resource file.
8. device according to claim 7, which is characterized in that the rendering module, comprising:
First acquisition submodule is configured as when the corresponding xml document of the page of load is one, to the xml text View in part is rendered, and the attribute information of at least one predetermined view is obtained;
Second acquisition submodule is configured as when the corresponding xml document of the page of load is at least two, for each Xml document renders the view in the xml document, obtains the attribute information of at least one predetermined view.
9. device according to claim 7, which is characterized in that the encrypting module, comprising:
It determines submodule, is configured to determine that out resource file required when rendering view in the xml document;
First encryption submodule is configured as using encryption string to for obtaining described in the determining submodule determines The network packet of resource file is encrypted.
10. device according to claim 7, which is characterized in that the rendering module, comprising:
First display sub-module, the predetermined view for being configured as needing to render in the xml document are to need to default display When view, display renders the successfully predetermined view;
Second display sub-module is configured as when the predetermined view for needing to render in the xml document is self-defined view, hidden Hiding or the predetermined view of display rendering, the self-defined view are not the view for needing to default display.
11. device according to claim 7, which is characterized in that the encrypting module, comprising:
Second encryption submodule is configured as that the attribute information sequence combination of the acquisition is obtained described add according to predetermined order Close string;
Third encrypts submodule, is configured as sorting to the attribute information of the acquisition according to the acquisition sequence of each attribute information Combination obtains the encryption string.
12. according to the device any in claim 7-11, which is characterized in that the loading module is additionally configured to benefit The corresponding xml document of the page is loaded with LayoutInflater.
13. a kind of network packet encryption device, which is characterized in that described device includes:
Processor;
For storing the memory of the processor-executable instruction;
Wherein, the processor is configured to:
After a page for opening application program, the corresponding extensible markup language xml document of the page is loaded;
View in the xml document is rendered, the attribute information of predetermined view is obtained;
The attribute information is formed into encryption string according to predetermined way, using encryption string to related for obtaining the page The network packet of resource file is encrypted.
CN201610715912.6A 2016-08-24 2016-08-24 Network packet encryption method and device Active CN106407818B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610715912.6A CN106407818B (en) 2016-08-24 2016-08-24 Network packet encryption method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610715912.6A CN106407818B (en) 2016-08-24 2016-08-24 Network packet encryption method and device

Publications (2)

Publication Number Publication Date
CN106407818A CN106407818A (en) 2017-02-15
CN106407818B true CN106407818B (en) 2019-02-12

Family

ID=58004706

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610715912.6A Active CN106407818B (en) 2016-08-24 2016-08-24 Network packet encryption method and device

Country Status (1)

Country Link
CN (1) CN106407818B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108494564B (en) * 2018-04-11 2021-01-08 南京思利华信息科技有限公司 Distributed rendering device and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685108A (en) * 2012-03-31 2012-09-19 奇智软件(北京)有限公司 Method and device for adding and deciphering webpage enciphered data
CN103886230A (en) * 2014-02-24 2014-06-25 四川长虹电器股份有限公司 Software copyright protection method of android system and system thereof
CN105069040A (en) * 2015-07-23 2015-11-18 柳州易旺科技有限公司 Historical webpage data generation method
CN105095776A (en) * 2015-07-23 2015-11-25 柳州易旺科技有限公司 Encryption method for web page data of server side
CN105228157A (en) * 2015-09-16 2016-01-06 华东师范大学 A kind of wireless sensor network security light weight reprogramming method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685108A (en) * 2012-03-31 2012-09-19 奇智软件(北京)有限公司 Method and device for adding and deciphering webpage enciphered data
CN103886230A (en) * 2014-02-24 2014-06-25 四川长虹电器股份有限公司 Software copyright protection method of android system and system thereof
CN105069040A (en) * 2015-07-23 2015-11-18 柳州易旺科技有限公司 Historical webpage data generation method
CN105095776A (en) * 2015-07-23 2015-11-25 柳州易旺科技有限公司 Encryption method for web page data of server side
CN105228157A (en) * 2015-09-16 2016-01-06 华东师范大学 A kind of wireless sensor network security light weight reprogramming method

Also Published As

Publication number Publication date
CN106407818A (en) 2017-02-15

Similar Documents

Publication Publication Date Title
KR102207208B1 (en) Method and apparatus for visualizing music information
CN105847430B (en) Mix application page data access method and device
US10489169B2 (en) Method and device for performing subset of functions of application
CN109032606A (en) The process of compilation method, apparatus and terminal of native applications program
CN104536935B (en) Calculate display methods, calculate edit methods and device
CN105183513A (en) Application recommendation method and apparatus
CN107066172A (en) The document transmission method and device of mobile terminal
CN104020990B (en) Date selects control display methods and device
CN106528255B (en) Kind loading method and device
CN107423106A (en) The method and apparatus for supporting more frame grammars
EP3168755A1 (en) Method and device for adding font
CN106791014A (en) Message display method and device
CN103970576A (en) Installation information displaying method, obtaining method and device
CN103945275A (en) Picture recording control method and device and mobile terminal
CN110569329B (en) Data processing method and device, electronic equipment and storage medium
CN107463372B (en) Data-driven page updating method and device
CN104063424B (en) Web page picture shows method and demonstration device
CN106384586A (en) Method and device for reading text information
CN106537288B (en) The method and device of self-starting is applied in control
CN105183571A (en) Function calling method and device
CN110221739A (en) A kind of data processing method, device and electronic equipment
CN105653320A (en) Loaded icon display method and apparatus
CN106407818B (en) Network packet encryption method and device
CN105630548B (en) Method for updating system and device
CN105682187B (en) Icon display method and device

Legal Events

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