Movatterモバイル変換


[0]ホーム

URL:


CN103809992B - A kind of method and device of the compatible different file format java applications of Dalvik virtual machine - Google Patents

A kind of method and device of the compatible different file format java applications of Dalvik virtual machine
Download PDF

Info

Publication number
CN103809992B
CN103809992BCN201210452681.6ACN201210452681ACN103809992BCN 103809992 BCN103809992 BCN 103809992BCN 201210452681 ACN201210452681 ACN 201210452681ACN 103809992 BCN103809992 BCN 103809992B
Authority
CN
China
Prior art keywords
java programs
java
jar
file
dex
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
CN201210452681.6A
Other languages
Chinese (zh)
Other versions
CN103809992A (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE CorpfiledCriticalZTE Corp
Priority to CN201210452681.6ApriorityCriticalpatent/CN103809992B/en
Publication of CN103809992ApublicationCriticalpatent/CN103809992A/en
Application grantedgrantedCritical
Publication of CN103809992BpublicationCriticalpatent/CN103809992B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

The invention discloses a kind of method and device of the compatible different file format java applications of Dalvik virtual machine, it is related to java application technologies, methods described comprises the following steps:Dalvik virtual machine is judged the file format from outside java programs;If judging the form of the java programs for dex file formats, the java programs are tested by dex file formats, and it is loaded after verifying successfully;If judging the form of the java programs for jar file form, the java programs are tested by jar file form, and it is loaded after verifying successfully.The present invention can make the java applications for the Dalvik virtual machine compatibility jar file form that Android carries.

Description

A kind of method and device of the compatible different file format java applications of Dalvik virtual machine
Technical field
The present invention relates to java application technologies, more particularly to a kind of compatible different file format java of Dalvik virtual machine shouldMethod and relevant apparatus, for increasing function for Dalvik virtual machine, it is set to support the java of jar file form applications.
Background technology
Android is a kind of open source code operating system based on Linux, is mainly used for portable equipment.Android application program is all generated by dex bytecode formats, so the Dalvik virtual machine that Android is carried, does not support originalThe java programs that some is generated by jar bytecode formats.
To protect the original fruit of labour, it is necessary to allow Dalvik virtual machine to support the java programs of jar bytecode formats.NeedSupport Dalvik virtual machine increase, with compatible original java programs.
The content of the invention
It is an object of the invention to provide a kind of method of the compatible different file format java applications of Dalvik virtual machine andDevice, can preferably solve the problems, such as the compatible different file format java applications of Dalvik virtual machine.
According to an aspect of the invention, there is provided a kind of compatible different file format java applications of Dalvik virtual machineMethod, comprise the following steps:
Dalvik virtual machine is judged the file format from outside java programs;
If judging the form of the java programs for dex file formats, the java programs are examined by dex file formatsTest, and it is loaded after verifying successfully;
If judging the form of the java programs for jar file form, the java programs are examined by jar file formTest, and it is loaded after verifying successfully.
Preferably, Dalvik virtual machine reads the file header of java programs, and according to the file header read, described in judgementThe form of java programs is dex file formats or jar file form.
Preferably, described the step of being tested by jar file form to the java programs, includes:
Dalvik virtual machine creates jar checkers, and the metadata of the java programs is entered using the jar checkersRow verification.
Preferably, after to the java program ver-ifies success of the jar file form, in addition to:
Dalvik virtual machine judges with the presence or absence of digital signature the java programs of the jar file form, andWhen judging that the java programs have digital signature, the digital signature is verified.
Preferably, the load step includes:
Dalvik virtual machine using jar file form Classloader loading jar file form java programs, and according toJar file format analysis simultaneously performs loaded java programs.
Preferably, described the step of being verified by dex file formats to the java programs, includes:
Dalvik virtual machine carries out school using its dex checker to the metadata of the java programs of the dex file formatsTest.
Preferably, after to the java program ver-ifies success of the dex file formats, in addition to:
Dalvik virtual machine judges with the presence or absence of digital signature the java programs of the dex file formats, andWhen judging that the java programs have digital signature, the digital signature is verified.
Preferably, the load step includes:
Dalvik virtual machine using dex file formats Classloader loading dex file formats java programs, and according toDex File Format Analysis simultaneously performs loaded java programs.
According to another aspect of the present invention, there is provided a kind of compatible different file format java applications of Dalvik virtual machineDevice, including:
Form judge module, for judging the file format from outside java programs;
Dex file format java program processing modules, in the form for judging the java programs for dex file formatsWhen, the java programs are tested by dex file formats, and it is loaded after verifying successfully;
Jar file form java program processing modules, in the form for judging the java programs for jar file formWhen, the java programs are tested by jar file form, and it is loaded after verifying successfully.
Preferably, in addition to:
Digital signature processing module, for the java programs to Dex file formats or jar file form with the presence or absence of numeralSignature is judged, and when judging that the java programs have digital signature, the digital signature is verified.
Compared with prior art, the beneficial effects of the present invention are:The present invention can make dalvik virtual machine compatibilities jarThe java programs of bytecode format.
Brief description of the drawings
Fig. 1 is the Method And Principle of the compatible different file format java applications of Dalvik virtual machine provided in an embodiment of the present inventionBlock diagram;
Fig. 2 is the flow chart of the compatible different file format java applications of Dalvik virtual machine provided in an embodiment of the present invention;
Fig. 3 is the judgement flow provided in an embodiment of the present invention to the loading of java programs;
Fig. 4 is the device frame of the compatible different file format java applications of Dalvik virtual machine provided in an embodiment of the present inventionFigure.
Embodiment
Below in conjunction with accompanying drawing to a preferred embodiment of the present invention will be described in detail, it will be appreciated that described below is excellentSelect embodiment to be merely to illustrate and explain the present invention, be not intended to limit the present invention.
Fig. 1 is the Method And Principle of the compatible different file format java applications of Dalvik virtual machine provided in an embodiment of the present inventionBlock diagram, as shown in figure 1, step includes:
Step 101, Dalvik virtual machine are judged the file format from outside java programs.
In the step 101, Dalvik virtual machine reads the file header of java programs, and according to the file readHead, the form for judging the java programs are dex file formats or jar file form.
Step 102, if the forms of the java programs is judged for dex file formats, by dex file formats to the java journeysSequence is tested, and it is loaded after verifying successfully.
In the step 102, first, Dalvik virtual machine creates jar checkers, and utilizes the jar checkers pairThe metadata of the java programs is verified.Secondly, the java programs are judged with the presence or absence of digital signature, andWhen judging that the java programs have digital signature, the digital signature is verified.Then, the class of jar file form is utilizedLoader loads the java programs of jar file form, and according to jar file format analysis and performs loaded java programs.
Step 103, if the forms of the java programs is judged for jar file form, by jar file form to the java journeysSequence is tested, and it is loaded after verifying successfully.
In the step 103, first, Dalvik virtual machine is using its dex checker to the dex file formatsThe metadata of java programs is verified.Secondly, the java programs of the dex forms are sentenced with the presence or absence of digital signatureIt is disconnected, and when judging that the java programs have digital signature, the digital signature is verified.Then, dex trays are utilizedThe java programs of the Classloader loading dex file formats of formula, and according to dex File Format Analysis and perform loaded javaProgram.
That is, java programs have file header, for the java programs of jar bytecode formats, its file header using PK asMagic number start, and for the java programs of Dex bytecode formats, its file header is started with dex.Therefore, by rightThe file header of java programs is verified, and can distinguish the file format of java programs, so as to be solved according to different standardsRelease.
Fig. 2 is the flow chart of the compatible different file format java applications of Dalvik virtual machine provided in an embodiment of the present invention,As shown in Fig. 2 including:
Step 200, Dalvik virtual machine judge that the file format of java programs is dex bytecode formats or jar bytesCode form, and when it is dex bytecode formats to judge the java programs, execution step 202, judging that the java programs areDuring jar bytecode formats, step 201 is performed.
Step 201, when the java programs are the java programs of jar bytecode formats, create first for parsing instituteThe jar checkers of java programs are stated, and perform step 203.
Step 202, when the java programs are the java programs of dex bytecode formats, utilize its dex checker, solutionThe metadata of the java programs of analysis verification dex bytecode formats, and perform step 204.
Step 203, utilize created jar checkers, first number of the java programs of parsing verification jar bytecode formatsAccording to, and perform step 205.
Step 204, after verifying successfully, Dalvik virtual machine judges whether the java programs of the dex bytecode formats haveThere is digital signature, if digital signature be present, the digital signature is verified, and after verifying successfully, perform step206, if digital signature is not present, directly perform step 206.
Step 205, after verifying successfully, Dalvik virtual machine judges whether the java programs of the jar bytecode formats haveThere is digital signature, if digital signature be present, the digital signature is verified, and after verifying successfully, perform step207, if digital signature is not present, directly perform step 207.
Step 206, using dex Classloaders, load the java programs of dex bytecode formats, and perform step 208.
Step 207, using jar Classloaders, load the java programs of jar bytecode formats, and perform step 209.
Step 208, according to dex bytecode formats, parse and perform the java programs of loaded dex bytecode formats.
Step 209, according to jar bytecode formats, parse and perform the java programs of loaded jar bytecode formats.
Fig. 3 is the judgement flow provided in an embodiment of the present invention to the loading of java programs, as shown in figure 3, including:
Step 301, judge java program file heads before four bytes whether matched with magic number.
By reading preceding 4 bytes of java program file heads, judge whether java programs are jar file form or dexFile format, if preceding 4 bytes are exactly magic number, judged result is matching, and performs step 302, is otherwise performedStep 308.
Step 302, judge whether to need to create jar checkers.
If the java programs of dex file formats, then java programs are verified by dex file formats, and press original flowCarry out, if the java programs of jar file form, then create jar checkers, and perform step 303, otherwise, perform step308。
The metadata of step 303, parsing verification java programs.
Created jar checkers are utilized, the java programs of the jar file form are verified, if verifying successfully,Step 304 is then performed, otherwise, performs step 308.
Step 304, judge whether the java programs have digital signature.
After metadata according to the java programs of specification validation jar file form, determine whether the java programs haveDigital signature, if digital signature be present, checking treatment is carried out to the digital signature, and perform step successively after verifying successfullyRapid 305, to step 307, otherwise, perform step 308, if digital signature is not present, perform step 305 successively to step 307.
After step 305, verification pass through, the java programs of jar file form are loaded using jar Classloaders.
Step 306, the execution java programs are explained according to jar file form, i.e., according to the java programs, generationThe object code of jar bytecode formats.
Step 307, the operation java programs, that is to say, that when performing jar bytecodes, jar bytecodes are construed toMachine instruction performs.
Step 308, there is mistake, exit flow.
Fig. 4 is the device frame of the compatible different file format java applications of Dalvik virtual machine provided in an embodiment of the present inventionFigure, as shown in figure 4, including:
Form judge module 401, for judging the file format from outside java programs;
Dex file format java programs processing module 403, in the form for judging the java programs for dex traysDuring formula, the java programs are tested by dex file formats, and it is loaded after verifying successfully;
Jar file form java programs processing module 402, in the form for judging the java programs for jar file latticeDuring formula, the java programs are tested by jar file form, and it is loaded after verifying successfully;
Digital signature processing module 404, for whether there is to the java programs of dex file formats or jar file formDigital signature is judged, and when judging that the java programs have digital signature, the digital signature is verified.
The form judge module 401 judges the file format of java programs, and according to obtained different judged results, byDifferent processing module processing java programs, that is, when being judged as jar file form, mould is handled by jar file form java programsBlock 402 handles java programs, and when being judged as dex file formats, java journeys are handled by dex file format java program modules 403Sequence.When jar file form java programs processing module 402 handles the java programs of jar file form, jar verifications are created firstDevice, and checking treatment is carried out to the metadata of java programs using the jar checkers, and after verifying successfully, utilize jar classesLoader, the java programs are loaded, and the java programs to being loaded explain execution.Dex file format java programsWhen processing module 403 handles the java programs of dex file formats, first number using the dex checkers of its own to java programsAccording to carrying out checking treatment, and after verifying successfully, using dex Classloaders, load the java programs, and to being loadedJava programs explain execution.
When the java programs have digital signature, before the loading of java programs, digital signature processing mould can be usedBlock 404 confirms to the legitimacy of the java programs, and after confirming successfully, then carry out the subsequent treatment step of java programsSuddenly.
Although the present invention is described in detail above, the invention is not restricted to this, those skilled in the art of the present techniqueVarious modifications can be carried out according to the principle of the present invention.Therefore, all modifications made according to the principle of the invention, all should be understood toFall into protection scope of the present invention.

Claims (10)

CN201210452681.6A2012-11-132012-11-13A kind of method and device of the compatible different file format java applications of Dalvik virtual machineActiveCN103809992B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201210452681.6ACN103809992B (en)2012-11-132012-11-13A kind of method and device of the compatible different file format java applications of Dalvik virtual machine

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201210452681.6ACN103809992B (en)2012-11-132012-11-13A kind of method and device of the compatible different file format java applications of Dalvik virtual machine

Publications (2)

Publication NumberPublication Date
CN103809992A CN103809992A (en)2014-05-21
CN103809992Btrue CN103809992B (en)2018-01-09

Family

ID=50706816

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201210452681.6AActiveCN103809992B (en)2012-11-132012-11-13A kind of method and device of the compatible different file format java applications of Dalvik virtual machine

Country Status (1)

CountryLink
CN (1)CN103809992B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101847103A (en)*2010-04-212010-09-29华为终端有限公司Method and device for running JAVA application
CN102760219A (en)*2011-12-202012-10-31北京安天电子设备有限公司Android platform software protecting system, method and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20110138382A1 (en)*2009-12-032011-06-09Recursion Software, Inc.System and method for loading resources into a virtual machine

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101847103A (en)*2010-04-212010-09-29华为终端有限公司Method and device for running JAVA application
CN102760219A (en)*2011-12-202012-10-31北京安天电子设备有限公司Android platform software protecting system, method and equipment

Also Published As

Publication numberPublication date
CN103809992A (en)2014-05-21

Similar Documents

PublicationPublication DateTitle
Wang et al.Reassembleable disassembling
CN105094939B (en)A kind of software source file Static Analysis Method realized based on the automatic techniques of compiling of Makefile
CN108446215A (en)Method, apparatus, system and the terminal of POS machine test
RU2010114709A (en) METHOD FOR AUTOMATIC GENERATION SCENARIO FOR CHECKING THE CORRECTNESS OF THE FUNCTIONAL SOFTWARE OF THE SYSTEM INSTALLED ON THE BOARD OF THE AIRCRAFT AND THE DEVICE FOR APPLICATION OF THE METHOD
TWI541669B (en) Detection systems and methods for static detection applications, and computer program products
WO2008078366A1 (en)Data verifying device, data verifying method, and data verifying program
CN109614107B (en)Integration method and device of software development kit
CN106204789B (en) Apparatus and method for handling multiple recording strategies
CN113220518B (en) Chip verification system, chip verification method
CN107329889A (en)A kind of method of C compilers automatic test
CN107015911A (en)The code review method and device of continuous integrating
CN103809992B (en)A kind of method and device of the compatible different file format java applications of Dalvik virtual machine
CN109918292A (en) A kind of processor instruction set testing method and device
CN106874758A (en)A kind of method and apparatus for recognizing document code
CN112925524A (en)Method and device for detecting unsafe direct memory access in driver
CN115562931A (en)Processor debugging module verification method and device, electronic equipment and storage medium
CN114579972B (en) Vulnerability identification method and system for embedded development programs
CN106960138A (en)The method of calibration and device of virtual machine instructions, system
Bandyopadhyay et al.Poster: An efficient equivalence checking method for petri net based models of programs
CN104657184A (en)Upgrading method by corresponding files to multi-embedded equipment
KR101116770B1 (en)Apparatus for?diagnosing and curing malicious code and method thereof
Bleier et al.Of ahead time: Evaluating disassembly of android apps compiled to binary oats through the art
CN105989293A (en)Method and apparatus for implementing upgrade of software version
CN113501034B (en)Test log generation method and device for railway signal system
CN110633204B (en) Method and device for detecting program defects

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp