CN101706859A - Device and method for protecting source code - Google Patents
Device and method for protecting source code Download PDFInfo
- Publication number
- CN101706859A CN101706859A CN200910236076A CN200910236076A CN101706859A CN 101706859 A CN101706859 A CN 101706859A CN 200910236076 A CN200910236076 A CN 200910236076A CN 200910236076 A CN200910236076 A CN 200910236076A CN 101706859 A CN101706859 A CN 101706859A
- Authority
- CN
- China
- Prior art keywords
- identifier
- information
- source code
- replaceable
- keyword message
- 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.)
- Pending
Links
Images
Landscapes
- Storage Device Security (AREA)
Abstract
The invention discloses a device and a method for protecting a source code. The device comprises a keyword information storage unit, an irreplaceable identifier information storage unit, an identifier replacing information storage unit, an identifier selecting unit, and an identifier replacing unit. The method comprises the following steps: prestoring keyword information, irreplaceable identifier information, and identifier information before and after an identifier is replaced, and executing the following steps: selecting the corresponding identifier in the source code according to a preset rule; comparing the selected identifier with the keyword information and the irreplaceable identifier information; and replacing the identifier different from the keyword information and the irreplaceable identifier information according to the identifier information before and after the identifier is replaced. In the invention, the identifier obtained after replacing the specific identifier in the source code contains no meaning or information. Therefore, the source code of which the identifier is replaced is protected well.
Description
Technical field
The present invention relates to a kind of device and method of computer program protection, relate in particular to a kind of device and method of source code protection.
Background technology
Source code is meant the not text codes of compiling.It is the readable computerese instruction of series of human.In the modern procedures language, source code can be the form appearance with books or tape, but form the most commonly used is a text, and the purpose of this typical format is in order to compile out computer program.The final purpose of computer source code is that human-readable text translation is become the binary command that computing machine can be carried out.
The main function of source code has following two kinds of effects: generate object code, i.e. the code that can discern of computing machine; And, software is described, promptly writing of software described.
Believe that for the software developer who supports the open source code notion revise source code by allowing interested people, application program will be more perfect, and mistake can not occur in for a long time.Yet, consider that from commercial angle open source code also just means has given others in vain the technological achievement of oneself, this is that numerous enterprises is not wanted to see.
In view of the demand and the drawback of above-mentioned open source code, some enterprises also protect code when source code is provided, and method commonly used is encrypted exactly, promptly adopt advanced cryptographic algorithm that source code is encrypted.The shortcoming of this way is that code needs reduction in the process of handling, and process is very complicated, and along with the maturation day by day of decryption technology, above-mentioned method of encrypting is also non-perfectly safe.
Summary of the invention
The present invention is directed to defective of the prior art, a kind of device and method of source code protection is provided,, reach the purpose of protection source code by this by the identifier in the source code is replaced with the identifier of not representing in all senses.
The device of source code protection of the present invention comprises:
Be used to store the keyword message storage element of predetermined keyword message, be used to store the non-replaceable identifier information storage element of predetermined not replaceable identifier information, be used for the store identification symbol and replace the identifier replacement information storage element of the information of front and back, and
Identifier is chosen the unit, is used for choosing corresponding identifier by pre-defined rule from source code;
Identifier is replaced the unit, be used for that identifier is chosen the identifier of unit selection and the keyword message of keyword message storage element and the not replaceable identifier information in the non-replaceable identifier information storage element and compare, the information before and after the identifier that will be different from above-mentioned keyword message and not replaceable identifier information is replaced according to the identifier that stores in the identifier replacement information storage element is replaced.
In the device of source code protection of the present invention, the rule that described identifier is chosen the corresponding identifier of unit selection is: choose the identifier with letter or underscore beginning.
In the device of source code protection of the present invention; if the identifier of choosing that is different from keyword message and not replaceable identifier information is not among the storage of identifier replacement information storage element; then above-mentioned identifier is replaced, and the identifier information before and after will replacing makes an addition in the identifier replacement information storage element by predetermined Substitution Rules.
The present invention also provides a kind of method of source code protection, prestored keyword message, not replaceable identifier information, the identifier information before and after the replacement, and carry out following steps:
Step 1 is chosen corresponding identifier in the source code according to pre-defined rule;
Step 2 compares the identifier chosen and keyword message and not replaceable identifier information, and the identifier that will be different from above-mentioned keyword message and not replaceable identifier information is replaced according to the identifier information before and after replacing.
In the step 1 of the method for source code protection of the present invention, the pre-defined rule of choosing corresponding identifier is: choose the identifier with letter or underscore beginning.
In the step 2 of the method for source code protection of the present invention; further comprise: if the identifier of choosing that is different from keyword message and not replaceable identifier information is not included in the row of the identifier information of replacing front and back; then above-mentioned identifier is replaced, and the identifier information before and after former the replacement is upgraded with the identifier information before and after this replacement by predetermined Substitution Rules.
In the device and method of source code protection of the present invention; by identifier specific in the source code being replaced with the identifier that does not possess in all senses; thereby make the source code of having replaced after the identifier clearly express implication, reached the purpose of protection source code.
Description of drawings
Fig. 1 is the structural representation of source code protective device of the present invention;
Fig. 2 is the schematic flow sheet of source code guard method of the present invention.
Embodiment
The present invention is described in further detail below in conjunction with accompanying drawing, can implement according to this with reference to the instructions literal to make those skilled in the art.
The device of source code protection of the present invention as shown in Figure 1, comprising:
Keyword message storage element, non-replaceable identifier information storage element, identifier replacement information storage element, identifier choose the unit and identifier is replaced the unit.
Wherein, described keyword message storage element is used for storing the keyword message of predefined source code, and in general, the key word in the source code does not allow to replace.
Described non-replaceable identifier information storage element is used for storing the not replaceable identifier information of predefined source code.In general, the pairing identifier of these predefined not replaceable identifier information can not be replaced.
Described identifier replacement information storage element is used for the information that the store identification symbol is replaced front and back, be in the storage source code identifier before replacing information and be replaced after information, the identifier information after the identifier information before this replaces and the replacement is an one-to-one correspondence only.This corresponding relation both can come record by forms mode, also can come record as array way by other.This identifier replacement information storage element can be updated in the source code protection process of reality; promptly for the identifier that is not stored in wherein; to replace according to predetermined rule, identifier information is stored in wherein after the replacement of identifier information before will replacing again and correspondence.
Described identifier is chosen the unit and is used for choosing corresponding identifier by pre-defined rule from source code. in source code, described identifier can comprise letter, numeral, underscore. therefore, among the present invention, in source code, selecting corresponding identifier with the identifier of choosing the beginning of letter or underscore for predetermined selection rule. the identifier of above-mentioned selected taking-up is not the identifier that all need replace among the present invention, also need further judge. specific as follows:
Described identifier is replaced the unit and is used for that identifier is chosen the identifier of unit selection and the keyword message of keyword message storage element and the not replaceable identifier information in the non-replaceable identifier information storage element and compares, and the identifier that will be different from above-mentioned keyword message and not replaceable identifier information is replaced according to the information of the identifier replacement front and back that store in the identifier replacement information storage element.Described identifier replaces that the identifier of unit selection and keyword message are chosen with identifier in the unit and not replaceable identifier information compares, when the identifier of only choosing is different from above-mentioned keyword message and also is different from not replaceable identifier information, just can replace this identifier of choosing.During replacement, be as the criterion,, the identifier of choosing replaced with corresponding one other identification symbol promptly according to the identifier information before and after the replacement of this identifier replacement information storage unit stores with the identifier information before and after the replacement that stores in the identifier replacement information storage element.Certainly, replace in the process of identifier in reality, also can run into the identifier of choosing that keyword message also is different from not replaceable identifier information that is different from, the row that also do not belong to the storage of identifier replacement information storage element simultaneously, at this moment, with predefined Substitution Rules this identifier is replaced, and will replace before and after identifier information be stored in the identifier replacement information storage element, finish renewal to this identifier replacement information storage element.
Among the present invention, the identifier that obtains after described identifier is replaced does not comprise in all senses, information, and therefore, the source code that has been replaced identifier is well protected.
The present invention also provides a kind of method of source code protection, as shown in Figure 2, before carrying out each step, also need to prestore keyword message, not replaceable identifier information, the identifier information before and after the replacement, and carry out following steps:
Wherein, described keyword message correspondence the key word in the source code, these key words generally do not allow to replace.
Described not replaceable identifier information correspondence the identifier information that cannot be replaced in the source code.
Identifier information correspondence before and after described replace identifier information in the source code before replacing it, and the identifier information after replacing it.The two can the form record, also can other modes as array carry out record.
In source code, described identifier can comprise letter, numeral, underscore.Therefore, in the step 101 among the present invention, in source code, select corresponding identifier for predetermined selection rule with the identifier of choosing the beginning of letter or underscore.The identifier of above-mentioned selected taking-up is not the identifier that all need replace among the present invention, also need further judge.Enter step 102 thus.
In step 102; the identifier chosen and keyword message and not replaceable identifier information are compared; and the information of the identifier that will be different from above-mentioned keyword message and not replaceable identifier information before and after replacing according to identifier is replaced. in this step; the identifier chosen and keyword message and not replaceable identifier information are compared; when the identifier of only choosing is different from above-mentioned keyword message and also is different from not replaceable identifier information; just can replace this identifier of choosing. during replacement; be as the criterion with the identifier information before and after the replacement that prestores; promptly according to the identifier information before and after this replacement that prestores; the identifier of choosing is replaced with corresponding one other identification symbol. certainly; replace in the process of identifier in reality; also can run into the identifier of choosing that keyword message also is different from not replaceable identifier information that is different from; the row that also do not belong to the identifier information of the replacement front and back that prestore simultaneously; at this moment; with predefined Substitution Rules this identifier is replaced; and the identifier information before and after former the replacement is upgraded with the identifier information before and after this replacement; so that in follow-up replacement process, be used. so far; finish replacement to identifier in the source code; the former identifier that is about in the source code replaces with the identifier that does not have in all senses; thereby realize protection to source code; thus, the source code after this is replaced can be relieved open.
Although embodiment of the present invention are open as above, but it is not restricted to listed utilization in instructions and the embodiment, it can be applied to various suitable the field of the invention fully, for those skilled in the art, can easily realize other modification, therefore under the universal that does not deviate from claim and equivalency range and limited, the legend that the present invention is not limited to specific details and illustrates here and describe.
Claims (6)
1. the device of a source code protection is characterized in that, comprising:
Be used to store the keyword message storage element of predetermined keyword message, be used to store the non-replaceable identifier information storage element of predetermined not replaceable identifier information, be used for the store identification symbol and replace the identifier replacement information storage element of the information of front and back, and
Identifier is chosen the unit, is used for choosing corresponding identifier by pre-defined rule from source code;
Identifier is replaced the unit, be used for that identifier is chosen the identifier of unit selection and the keyword message of keyword message storage element and the not replaceable identifier information in the non-replaceable identifier information storage element and compare, the information before and after the identifier that will be different from above-mentioned keyword message and not replaceable identifier information is replaced according to the identifier that stores in the identifier replacement information storage element is replaced.
2. the device of source code protection as claimed in claim 1 is characterized in that, the rule that described identifier is chosen the corresponding identifier of unit selection is: choose the identifier with letter or underscore beginning.
3. the device of source code protection as claimed in claim 1; it is characterized in that; if the identifier of choosing that is different from keyword message and not replaceable identifier information is not among the storage of identifier replacement information storage element; then above-mentioned identifier is replaced, and the identifier information before and after will replacing makes an addition in the identifier replacement information storage element by predetermined Substitution Rules.
4. the method for a source code protection is characterized in that, the keyword message that prestores, not replaceable identifier information, the identifier information before and after the replacement, and carry out following steps:
Step 1 is chosen corresponding identifier in the source code according to pre-defined rule;
Step 2 compares the identifier chosen and keyword message and not replaceable identifier information, and the identifier that will be different from above-mentioned keyword message and not replaceable identifier information is replaced according to the identifier information before and after replacing.
5. the method for source code protection as claimed in claim 4 is characterized in that in the described step 1, the pre-defined rule of choosing corresponding identifier is: choose the identifier with letter or underscore beginning.
6. the method for source code protection as claimed in claim 4; it is characterized in that; in the described step 2; further comprise: if the identifier of choosing that is different from keyword message and not replaceable identifier information is not included in the row of the identifier information of replacing front and back; then above-mentioned identifier is replaced, and the identifier information before and after former the replacement is upgraded with the identifier information before and after this replacement by predetermined Substitution Rules.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200910236076A CN101706859A (en) | 2009-10-20 | 2009-10-20 | Device and method for protecting source code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200910236076A CN101706859A (en) | 2009-10-20 | 2009-10-20 | Device and method for protecting source code |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101706859A true CN101706859A (en) | 2010-05-12 |
Family
ID=42377084
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN200910236076A Pending CN101706859A (en) | 2009-10-20 | 2009-10-20 | Device and method for protecting source code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101706859A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103136458A (en) * | 2013-01-21 | 2013-06-05 | 中标软件有限公司 | Code protection method for Linux operating system and module of method |
CN103413069A (en) * | 2013-07-08 | 2013-11-27 | 北京深思数盾科技有限公司 | Method for protecting software written by object--oriented language |
CN103973632A (en) * | 2013-01-25 | 2014-08-06 | 苏州精易会信息技术有限公司 | Browser device for improving outer network data application security |
CN103973633A (en) * | 2013-01-25 | 2014-08-06 | 苏州精易会信息技术有限公司 | Method for improving safety of extranet data applications |
CN105447342A (en) * | 2014-08-28 | 2016-03-30 | 阿里巴巴集团控股有限公司 | Script encryption method, script decryption method and engine |
-
2009
- 2009-10-20 CN CN200910236076A patent/CN101706859A/en active Pending
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103136458A (en) * | 2013-01-21 | 2013-06-05 | 中标软件有限公司 | Code protection method for Linux operating system and module of method |
CN103136458B (en) * | 2013-01-21 | 2016-03-16 | 中标软件有限公司 | A kind of (SuSE) Linux OS dynamic base code protection method and device thereof |
CN103973632A (en) * | 2013-01-25 | 2014-08-06 | 苏州精易会信息技术有限公司 | Browser device for improving outer network data application security |
CN103973633A (en) * | 2013-01-25 | 2014-08-06 | 苏州精易会信息技术有限公司 | Method for improving safety of extranet data applications |
CN103413069A (en) * | 2013-07-08 | 2013-11-27 | 北京深思数盾科技有限公司 | Method for protecting software written by object--oriented language |
CN103413069B (en) * | 2013-07-08 | 2016-09-07 | 北京深思数盾科技股份有限公司 | A kind of method of the software protecting object oriented language to write |
CN105447342A (en) * | 2014-08-28 | 2016-03-30 | 阿里巴巴集团控股有限公司 | Script encryption method, script decryption method and engine |
CN105447342B (en) * | 2014-08-28 | 2018-08-31 | 阿里巴巴集团控股有限公司 | script encryption method, decryption method and engine |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100498712C (en) | Storage medium, method and apparatus for creating a protected executable program | |
US7974942B2 (en) | Data masking system and method | |
CN108595921B (en) | Method and device for confusing character strings in source codes | |
JP5337411B2 (en) | Information concealment method and information concealment device | |
CN108363911B (en) | Python script obfuscating and watermarking method and device | |
CN101706859A (en) | Device and method for protecting source code | |
CN106778100B (en) | Obfuscation compiling method and obfuscation compiler based on android platform and IOS platform | |
CN102780556B (en) | Method and device for encrypting and decrypting digital content section by section | |
CN106503494A (en) | A kind of firmware protection location and guard method with flash memory microcontroller on piece | |
US20140215225A1 (en) | Method for increasing the security of software | |
CN104063635A (en) | Method and system for protecting object files | |
CN102750497A (en) | Method and device for deciphering private information | |
CN105335151A (en) | Installation file protection method and apparatus | |
CN103906039A (en) | Method and device for preventing leakage of mobile phone numbers | |
CN103927164A (en) | Method and system for confusing scripts | |
CN111914225A (en) | Source code protection system and source code encryption method | |
CN109740314A (en) | A kind of method that SWF obscures encryption | |
CN1991870A (en) | Preventing method and preventing system for data deletion | |
CN103379483A (en) | Method, device and mobile terminal for mobile terminal information security management | |
US8533826B2 (en) | Method for protecting the source code of a computer program | |
CN112966227A (en) | Code encryption and decryption method and device and storage medium | |
WO2008118358A2 (en) | System and method for text-based encryption | |
CN103824021A (en) | Setting method and device of browser setting item | |
CN111159661B (en) | Decompilation prevention method and device, electronic equipment and storage medium | |
CN104951705A (en) | Android application data encryption packaging method based on operating system interface rewriting |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Open date: 20100512 |