CN109409033A - Code encryption method, apparatus, computer installation and storage medium - Google Patents

Code encryption method, apparatus, computer installation and storage medium Download PDF

Info

Publication number
CN109409033A
CN109409033A CN201811057790.1A CN201811057790A CN109409033A CN 109409033 A CN109409033 A CN 109409033A CN 201811057790 A CN201811057790 A CN 201811057790A CN 109409033 A CN109409033 A CN 109409033A
Authority
CN
China
Prior art keywords
character string
string constant
object code
constant
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811057790.1A
Other languages
Chinese (zh)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811057790.1A priority Critical patent/CN109409033A/en
Publication of CN109409033A publication Critical patent/CN109409033A/en
Pending legal-status Critical Current

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/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/121Restricting unauthorised execution of programs
    • G06F21/125Restricting unauthorised execution of programs by manipulating the program code, e.g. source code, compiled code, interpreted code, machine code

Abstract

The present invention provides a kind of code encryption method, comprising: is receiving after the instruction that version control system submits code, whether the object code that scanning described instruction instruction is submitted judges in the object code comprising character string constant;If including character string constant in the object code, the character string constant for including in the object code is identified;The character string constant of mark is carried out obscuring processing, obtains obscuring character string;By the character string constant identified in the target string replace with it is described obscure character string, Xiang Suoshu version control system submits the object code.The invention also discloses a kind of code encryption device, computer installation and computer readable storage mediums.The present invention is based on software development life cycle (Software development life cycle, SDLC) exploitation safety can be during code development, timely character string constant is encrypted, the confidentiality of code and the safety of code are improved, software is reduced and cracks brought risk.

Description

Code encryption method, apparatus, computer installation and storage medium
Technical field
The present invention relates to field of computer technology more particularly to a kind of code encryption method, apparatus, computer installation and deposit Storage media.
Background technique
After software publication, after software discloses in use process, software may be cracked by various breaking techniques, After software is cracked, character string constant (such as key) can be exposed.That character string constant exposure after, possible quilt Hacker or criminal's malicious exploitation bring the risk of information security etc. for the user of software and developer.
Summary of the invention
In view of the foregoing, it is necessary to which a kind of code encryption method, apparatus, computer installation and storage medium, energy are provided It is enough that timely character string constant is encrypted during code development, the confidentiality of code is improved, software is reduced and cracks institute Bring risk.
The present invention provides a kind of code encryption method, which comprises
It is receiving after the instruction that version control system submits code, the target generation that scanning described instruction instruction is submitted Whether code judges in the object code comprising character string constant;
If including character string constant in the object code, the character string constant for including in the object code is marked Know;
The character string constant of mark is carried out obscuring processing, obtains obscuring character string;
The character string constant identified in the target string is replaced with and described obscures character string, Xiang Suoshu Version Control System submits the object code.
In the present invention is preferably implemented, if including character string constant in the object code, to the object code In include character string constant be identified and include:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Obtain the length of each character string constant in the character string constant to be processed;
According to the length of each character string constant in the character string constant to be processed to the character string constant to be processed In each character string constant carry out length mark;
Then described pair mark character string constant carry out obscuring processing include:
The character string constant of different length mark is carried out different to obscure processing.
In a preferred embodiment of the invention, if including character string constant in the object code, to the target generation The character string constant for including in code, which is identified, includes:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Determine the processing priority of each character string constant in the character string constant to be processed;
According to the processing priority of each character string constant in the character string constant to be processed to the character to be processed Each character string constant carries out priority tag in string constant;
Then described pair mark character string constant carry out obscuring processing include:
The character string constant of different priorities mark is carried out different to obscure processing.
In the present invention is preferably implemented, the method also includes:
If in the object code including character string constant, sends encryption and remind.
In the present invention is preferably implemented, the method also includes:
If receiving the instruction for the confirmation encryption reminded for the encryption, display obfuscated manner chooses the page;
The character string constant of mark is carried out obscuring processing according to the obfuscated manner that user chooses.
In a preferred embodiment of the invention, described that packet is identified to the character string constant for including in the object code It includes:
Identical character string constant in the object code is identified by identical identifier.
In a preferred embodiment of the invention, described that packet is identified to the character string constant for including in the object code It includes:
Identical character string constant in identical function module in the object code is marked by identical identifier Know.
The present invention provides also a kind of code encryption device, and described device includes:
Judgment module, for receiving after the instruction that version control system submits code, scanning described instruction instruction Whether the object code of submission judges in the object code comprising character string constant;
Mark module, if for including character string constant in the object code, to the word for including in the object code Symbol string constant is identified;
Processing module carries out obscuring processing for the character string constant to mark, obtains obscuring character string;
Submit module, for by the character string constant identified in the target string replace with it is described obscure character string, The object code is submitted to the version control system.
In a preferred embodiment of the invention, the mark module is specifically used for:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Obtain the length of each character string constant in the character string constant to be processed;
According to the length of each character string constant in the character string constant to be processed to the character string constant to be processed In each character string constant carry out length mark;
Then the processing module character string constant of mark is carried out obscuring processing include:
The character string constant of different length mark is carried out different to obscure processing.
In a preferred embodiment of the invention, the mark module is specifically used for:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Determine the processing priority of each character string constant in the character string constant to be processed;
According to the processing priority of each character string constant in the character string constant to be processed to the character to be processed Each character string constant carries out priority tag in string constant;
Then the processing module character string constant of mark is carried out obscuring processing include:
The character string constant of different priorities mark is carried out different to obscure processing.
In a preferred embodiment of the invention, described device further include:
Reminding module, if sending encryption for including character string constant in the object code and reminding.
In a preferred embodiment of the invention, the reminding module is also used to:
If receiving the instruction for the confirmation encryption reminded for the encryption, display obfuscated manner chooses the page;
The character string constant of mark is carried out obscuring processing according to the obfuscated manner that user chooses.
In a preferred embodiment of the invention, the processing module carries out the character string constant for including in the object code Mark includes:
Identical character string constant in the object code is identified by identical identifier.
In a preferred embodiment of the invention, it is described state processing module to the character string constant for including in the object code into Line identifier includes:
Identical character string constant in identical function module in the object code is marked by identical identifier Know.
The present invention also provides a kind of computer installation, the computer installation includes memory and processor, the storage Device is for storing at least one instruction, and the processor is for executing at least one described instruction to realize institute in any embodiment The code encryption method stated.
The present invention also provides a kind of computer readable storage mediums, which is characterized in that the computer readable storage medium It is stored at least one instruction, at least one described instruction realizes that code described in any embodiment adds when being executed by processor Decryption method.
Found out by above technical scheme, the present invention by receiving to version control system submit code instruction after, The object code that described instruction instruction is submitted is scanned, whether is judged in the object code comprising character string constant;If the mesh Marking in code includes character string constant, is identified to the character string constant for including in the object code;To the character of mark String constant carries out obscuring processing, obtains obscuring character string;The character string constant identified in the target string is replaced with into institute It states and obscures character string, Xiang Suoshu version control system submits the object code.Due in development process, it will usually use version Control system carries out the management of code, therefore, when submitting code to version control system, is judged as whether it includes character string Constant, and to it includes character string constant carry out obscuring processing, to be encrypted to the content that may be exposed in code.Make It obtains during code development, timely character string constant is encrypted, improve the confidentiality of code, reduce software and crack institute Bring risk.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow chart of code encryption method provided in an embodiment of the present invention;
Fig. 2 is the functional block diagram of code encryption device provided in an embodiment of the present invention;
Fig. 3 is the structural schematic diagram of the computer installation for the preferred embodiment that the present invention realizes code encryption method.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real Applying mode, the present invention is described in further detail.
As shown in FIG. 1, FIG. 1 is a kind of flow charts of code encryption method provided in an embodiment of the present invention.According to different Demand, the sequence of step can change in the flow chart, and certain steps can be omitted.
S11 is being received after the instruction that version control system submits code, the target that scanning described instruction instruction is submitted Whether code judges in the object code comprising character string constant.
Code encryption method described in this programme is used to carry out code when carrying out code submission to version control system Encryption.
Wherein, version control system is a kind of application software for carrying out code administration and multiple person cooperational exploitation.For example, version Control system is Git either SVN.Code can be then managed by Git.For example, a certain application software by Git come The code for saving its 1.0 version can save the code of its 2.0 version after the application software upgrade in Git.Meanwhile When developing the application software, different modules can be developed respectively by tetra- developers of A, B, C, D, be concentrated by Git Manage the code of each developer.
It is above-mentioned to submit the instruction of code to can be used for submitting generation to the server of version control system to version control system Code can be used for submitting code to local client in the client of installation version control system.Therefore, receive to After version control system submits the instruction of code, the available code to be submitted.Above-mentioned object code refers to will be to version The code that control system is submitted.
In general, character string or escape character sequence within double quotation marks " " are character string constant, character in code String constant identifies the fixed numbers that can not change.For example, " how do you do ", " JAVA language ", " $ 123.78 ", " a n " is character string normal amount.
Therefore, when scanning object code, can wherein be sentenced with the presence or absence of the content of double quotation marks " " form by detecting It whether include character string constant in disconnected object code.For example, judging if including the content of double quotation marks " " form in object code It include character string constant in object code.
S12: if in the object code include character string constant, to the character string constant for including in the object code into Line identifier.
When in object code including character string constant, to each character string constant and can be identified.Specifically, can To be identified with identifiers such as number or letters.
For example, comprising following character string constant in object code: string1 ", " string2 ", " xyz ", " #201867 ", " a n ", then be individually identified as a1, a2, a3, a4, a5 for character string.
In the specific implementation, the alphabet string for including in object code can be identified, or to its middle part Point character string is identified.
Further, in an alternative embodiment of the invention, it is described to the character string constant for including in the object code into Line identifier includes:
Identical character string constant in the object code is identified by identical identifier.
Identical character string constant can be identified by identical identifier when carrying out character string constant mark. It is then subsequent when processing, identical character string is similarly obscured, the carry out batch replacement after obscuring, improves encryption Efficiency.
Further, in an alternative embodiment of the invention, it is described to the character string constant for including in the object code into Line identifier includes:
Identical character string constant in identical function module in the object code is marked by identical identifier Know.
Character string amount commonly identical in identical function module can also be led to when character string constant is identified Identical identifier is crossed to be identified.Then be identified in identical function with same identifier, can subsequent replacement when batch Replacement, so that treatment effeciency is improved, meanwhile, it is also not identical after obscuring for the identical characters string of different function module, it is improving On the basis of encryption efficiency, the difficulty of decryption is improved.
S13: the character string constant of mark is carried out obscuring processing, obtains obscuring character string.
Wherein, to the character string constant of mark obscure processing can be by encryption function by the character string constant into Row encryption, then encrypted character string is properly termed as obscuring character string.
For example, can carry out base64 encryption for character string constant " xyz ", then character string constant " xyz " is encrypted Obscuring character string is " eHl6 ".
Further, in an alternative embodiment of the invention, if including character string constant in the object code, to institute It states the character string constant for including in object code and is identified and include:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Obtain the length of each character string constant in the character string constant to be processed;
According to the length of each character string constant in the character string constant to be processed to the character string constant to be processed In each character string constant carry out length mark;
Then described in step S13 pair a character string constant for mark carry out obscuring processing include:
The character string constant of different length mark is carried out different to obscure processing.
Wherein, the above-mentioned length according to each character string constant in the character string constant to be processed is to the word to be processed Each character string constant carries out length mark and is specifically in symbol string constant: by length be more than preset length long character string constant with Length is less than the short character strings constant distinguishing identifier of preset length.Then, when the character string to mark carries out obscuring processing, needle Long character string constant and short character strings constant are carried out different to obscure processing.
It is encrypted specifically, can be chosen for long character string for the Encryption Algorithm of big data quantity, it is normal for short character strings Amount is chosen to be encrypted for the Encryption Algorithm of non-big data quantity.
For example, obtaining obscuring character string for long character string constant des encryption algorithm;Short character strings constant is used RSA cryptographic algorithms encryption, obtains obscuring character string.
Due to when carrying out obscuring processing, if to the character string constant of different length and short character strings constant all with carrying out phase Same obscures processing, long character string constant may be made longer, code is not succinct enough.Therefore, in the present embodiment, for difference Length character string constant carry out it is different obscure processing, the readability of code can be improved.
Further, in an alternative embodiment of the invention, if including character string constant in the object code, to institute It states the character string constant for including in object code and is identified and include:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Determine the processing priority of each character string constant in the character string constant to be processed;
According to the processing priority of each character string constant in the character string constant to be processed to the character to be processed Each character string constant carries out priority tag in string constant;
Then described in step S13 pair a character string constant for mark carry out obscuring processing include:
The character string constant of different priorities mark is carried out different to obscure processing.
Wherein, the processing priority of above-mentioned character string constant can be preset or be known according to scheduled rule Que Ding not.For example, determining should when character string constant includes network address or when character string constant includes the version information of product The processing priority of character string constant is height.
Specifically, the character string constant high to processing priority can be added using the high Encryption Algorithm of encryption intensity Close, the character string constant low to processing priority can be encrypted using the common Encryption Algorithm of encryption intensity.
For example, the character string constant AES encryption algorithm high for priority, obtains obscuring character string;For priority Low character string constant is encrypted with DSA Encryption Algorithm, obtains obscuring character string.
In the present embodiment, for the processing priority of character string constant carry out it is different obscure processing, can be to important Property higher code preferably protected, improve the difficulty that code cracks.Also, due to the high Encryption Algorithm of encryption intensity into When row encryption, enciphering rate may be longer, therefore carries out different obscuring processing for the character string constant of different importance It can faster obtain obscuring character string in the case where improving safety to avoid the processing time of too long encryption.
The character string constant identified in the target string is replaced with and described obscures character string, Xiang Suoshu version by S14 Control system submits the object code.
After obtaining obscuring character string, the character string constant identified in object code is replaced with and obscures character string, had Body, be that each character string constant of the mark in object code is replaced with to its corresponding to obscure character string.
After submitting object code to version control system, the target generation of submission can be saved in version control system Code.
For example, if including in object code: String str=" xyz ";Certain is passed through to character string constant therein " xyz " Function is handled, available String str=Encode (xyz);If Encode function representation carries out character string constant Base64 is encrypted, then String str=" eHl6 ".String when submitting the object code to Git, in object code The part str=" xyz " can become String str=Encode (xyz) and be submitted.At the same time it can also submit together The definition of Encode function, and the function for decrypting Encode, then other developers use Git when co-development When, decryption function removal can be called to obscure, so that other developers know the content of encrypted characters string in development process.
In general, when object code is packaged into executable file (for example, exe file or apk file etc.), it can be from version Object code is obtained in this control system and is packaged by compilation tool, and then will execute text publication again.If then other people After having cracked the executable file, processing is obscured since character string constant has been carried out, it is normal can not to understand character string The content of amount improves the confidentiality of object code.
Further, in other embodiments of the present invention, it can also be encrypted in the following manner.Specifically, this hair The bright method further include:
If in the object code including character string constant, sends encryption and remind.
The client that can be in version control system is reminded to be reminded specifically, sending encryption.Due to Version Control The client of system is visible developer, therefore, developer can be made timely to recognize in object code and wrapped Containing character string constant, so that developer can according to need the carry out Code obfuscation processing of active.
Further, the method also includes:
If receiving the instruction for the confirmation encryption reminded for the encryption, display obfuscated manner chooses the page;
The character string constant of mark is carried out obscuring processing according to the obfuscated manner that user chooses.
The instruction of the above-mentioned confirmation encryption reminded for the encryption shows that user confirms the character for including to object code String constant is encrypted.
The client that above-mentioned obfuscated manner is chosen the page and be can be in version control system is shown.For example, in version The client of control system shows three kinds of obfuscated manners, so that user chooses;It is the when getting obscuring for user's selection When two kinds of obfuscated manners, carry out obscuring processing by character string constant of second of obfuscated manner to label.
Through this embodiment, preset obfuscated manner can be shown, and the obfuscated manner chosen according to user is to mark Character string constant carries out obscuring processing.
Code encryption method provided by the invention is receiving after the instruction that version control system submits code, scans institute The object code that instruction instruction is submitted is stated, whether is judged in the object code comprising character string constant;If the object code In include character string constant, the character string constant for including in the object code is identified;To the character string constant of mark It carries out obscuring processing, obtains obscuring character string;The character string constant identified in the target string is replaced with and described is obscured Character string, Xiang Suoshu version control system submit the object code.Due in development process, it will usually use Version Control system System carries out the management of code, therefore, when submitting code to version control system, is judged as whether it includes character string constant, And to it includes character string constant carry out obscuring processing, to be encrypted to the content that may be exposed in code.So that During code development, timely character string constant is encrypted, improves the confidentiality of code, reduction software, which cracks, to be brought Risk.
As shown in Fig. 2, Fig. 2 is the functional block diagram of code encryption device provided in an embodiment of the present invention.The code adds Close device includes judgment module 210, mark module 220, processing module 230 and submits module 240.The so-called module of the present invention is Refer to it is a kind of performed by the processor by computer installation and can complete the series of computation machine program segment of fixed function, It is stored in the memory of computer installation.It in the present embodiment, will be in subsequent embodiment about the function of each module It is described in detail.
Judgment module 210, for receiving after the instruction that version control system submits code, scanning described instruction refers to Whether the object code for showing submission judges in the object code comprising character string constant.
Code encryption device described in this programme is used to carry out code when carrying out code submission to version control system Encryption.
Wherein, version control system is a kind of application software for carrying out code administration and multiple person cooperational exploitation.For example, version Control system is Git either SVN.Code can be then managed by Git.For example, a certain application software by Git come The code for saving its 1.0 version can save the code of its 2.0 version after the application software upgrade in Git.Meanwhile When developing the application software, different modules can be developed respectively by tetra- developers of A, B, C, D, be concentrated by Git Manage the code of each developer.
It is above-mentioned to submit the instruction of code to can be used for submitting generation to the server of version control system to version control system Code can be used for submitting code to local client in the client of installation version control system.Therefore, receive to After version control system submits the instruction of code, the available code to be submitted.Above-mentioned object code refers to will be to version The code that control system is submitted.
In general, character string or escape character sequence within double quotation marks " " are character string constant, character in code String constant identifies the fixed numbers that can not change.For example, " how do you do ", " JAVA language ", " $ 123.78 ", " a n " is character string normal amount.
Therefore, when scanning object code, can wherein be sentenced with the presence or absence of the content of double quotation marks " " form by detecting It whether include character string constant in disconnected object code.For example, judging if including the content of double quotation marks " " form in object code It include character string constant in object code.
Mark module 220, if for including character string constant in the object code, to including in the object code Character string constant is identified.
When in object code including character string constant, to each character string constant and can be identified.Specifically, can To be identified with identifiers such as number or letters.
For example, comprising following character string constant in object code: string1 ", " string2 ", " xyz ", " #201867 ", " a n ", then be individually identified as a1, a2, a3, a4, a5 for character string.
In the specific implementation, the alphabet string for including in object code can be identified, or to its middle part Point character string is identified.
Further, in an alternative embodiment of the invention, the mark module 220 is to the word for including in the object code Symbol string constant, which is identified, includes:
Identical character string constant in the object code is identified by identical identifier.
Identical character string constant can be identified by identical identifier when carrying out character string constant mark. It is then subsequent when processing, identical character string is similarly obscured, the carry out batch replacement after obscuring, improves encryption Efficiency.
Further, in an alternative embodiment of the invention, the mark module 220 is to the word for including in the object code Symbol string constant, which is identified, includes:
Identical character string constant in identical function module in the object code is marked by identical identifier Know.
Character string amount commonly identical in identical function module can also be led to when character string constant is identified Identical identifier is crossed to be identified.Then be identified in identical function with same identifier, can subsequent replacement when batch Replacement, so that treatment effeciency is improved, meanwhile, it is also not identical after obscuring for the identical characters string of different function module, it is improving On the basis of encryption efficiency, the difficulty of decryption is improved.
Processing module 230 carries out obscuring processing for the character string constant to mark, obtains obscuring character string.
Wherein, to the character string constant of mark obscure processing can be by encryption function by the character string constant into Row encryption, then encrypted character string is properly termed as obscuring character string.
For example, can carry out base64 encryption for character string constant " xyz ", then character string constant " xyz " is encrypted Obscuring character string is " eHl6 ".
Further, in an alternative embodiment of the invention, the mark module is specifically used for:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Obtain the length of each character string constant in the character string constant to be processed;
According to the length of each character string constant in the character string constant to be processed to the character string constant to be processed In each character string constant carry out length mark;
Then 230 pairs of processing module mark character string constants carry out obscuring processing include:
The character string constant of different length mark is carried out different to obscure processing.
Wherein, the above-mentioned length according to each character string constant in the character string constant to be processed is to the word to be processed Each character string constant carries out length mark and is specifically in symbol string constant: by length be more than preset length long character string constant with Length is less than the short character strings constant distinguishing identifier of preset length.Then, when the character string to mark carries out obscuring processing, needle Long character string constant and short character strings constant are carried out different to obscure processing.
It is encrypted specifically, can be chosen for long character string for the Encryption Algorithm of big data quantity, it is normal for short character strings Amount is chosen to be encrypted for the Encryption Algorithm of non-big data quantity.
For example, obtaining obscuring character string for long character string constant des encryption algorithm;Short character strings constant is used RSA cryptographic algorithms encryption, obtains obscuring character string.
Due to when carrying out obscuring processing, if to the character string constant of different length and short character strings constant all with carrying out phase Same obscures processing, long character string constant may be made longer, code is not succinct enough.Therefore, in the present embodiment, for difference Length character string constant carry out it is different obscure processing, the readability of code can be improved.
Further, in an alternative embodiment of the invention, the mark module is specifically used for:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Determine the processing priority of each character string constant in the character string constant to be processed;
According to the processing priority of each character string constant in the character string constant to be processed to the character to be processed Each character string constant carries out priority tag in string constant;
Then 230 pairs of processing module mark character string constants carry out obscuring processing include:
The character string constant of different priorities mark is carried out different to obscure processing.
Wherein, the processing priority of above-mentioned character string constant can be preset or be known according to scheduled rule Que Ding not.For example, determining should when character string constant includes network address or when character string constant includes the version information of product The processing priority of character string constant is height.
Specifically, the character string constant high to processing priority can be added using the high Encryption Algorithm of encryption intensity Close, the character string constant low to processing priority can be encrypted using the common Encryption Algorithm of encryption intensity.
For example, the character string constant AES encryption algorithm high for priority, obtains obscuring character string;For priority Low character string constant is encrypted with DSA Encryption Algorithm, obtains obscuring character string.
In the present embodiment, for the processing priority of character string constant carry out it is different obscure processing, can be to important Property higher code preferably protected, improve the difficulty that code cracks.Also, due to the high Encryption Algorithm of encryption intensity into When row encryption, enciphering rate may be longer, therefore carries out different obscuring processing for the character string constant of different importance It can faster obtain obscuring character string in the case where improving safety to avoid the processing time of too long encryption.
Module 240 is submitted, described obscures character for replacing with the character string constant identified in the target string String, Xiang Suoshu version control system submit the object code.
After obtaining obscuring character string, the character string constant identified in object code is replaced with and obscures character string, had Body, be that each character string constant of the mark in object code is replaced with to its corresponding to obscure character string.
After submitting object code to version control system, the target generation of submission can be saved in version control system Code.
For example, if including in object code: String str=" xyz ";Certain is passed through to character string constant therein " xyz " Function is handled, available String str=Encode (xyz);If Encode function representation carries out character string constant Base64 is encrypted, then String str=" eHl6 ".String when submitting the object code to Git, in object code The part str=" xyz " can become String str=Encode (xyz) and be submitted.At the same time it can also submit together The definition of Encode function, and the function for decrypting Encode, then other developers use Git when co-development When, decryption function removal can be called to obscure, so that other developers know the content of encrypted characters string in development process.
In general, when object code is packaged into executable file (for example, exe file or apk file etc.), it can be from version Object code is obtained in this control system and is packaged by compilation tool, and then will execute text publication again.If then other people After having cracked the executable file, processing is obscured since character string constant has been carried out, it is normal can not to understand character string The content of amount improves the confidentiality of object code.
Further, in other embodiments of the present invention, it can also be encrypted in the following manner.Specifically, this hair The bright device further includes reminding module.
Reminding module, if sending encryption for including character string constant in the object code and reminding.
The client that can be in version control system is reminded to be reminded specifically, sending encryption.Due to Version Control The client of system is visible developer, therefore, developer can be made timely to recognize in object code and wrapped Containing character string constant, so that developer can according to need the carry out Code obfuscation processing of active.
Further, the reminding module is also used to: if receiving the instruction for the confirmation encryption reminded for the encryption, Show that obfuscated manner chooses the page;The character string constant of mark is carried out obscuring processing according to the obfuscated manner that user chooses.
The instruction of the above-mentioned confirmation encryption reminded for the encryption shows that user confirms the character for including to object code String constant is encrypted.
The client that above-mentioned obfuscated manner is chosen the page and be can be in version control system is shown.For example, in version The client of control system shows three kinds of obfuscated manners, so that user chooses;It is the when getting obscuring for user's selection When two kinds of obfuscated manners, carry out obscuring processing by character string constant of second of obfuscated manner to label.
Through this embodiment, preset obfuscated manner can be shown, and the obfuscated manner chosen according to user is to mark Character string constant carries out obscuring processing.
Code encryption device provided by the invention is being received by judgment module to version control system submission code After instruction, whether the object code that scanning described instruction instruction is submitted judges in the object code comprising character string constant;If It include character string constant in the object code, mark is identified the character string constant for including in the object code;Place Reason module carries out obscuring processing to the character string constant of mark, obtains obscuring character string;Submit module by the target string The character string constant of middle mark obscures character string described in replacing with, and Xiang Suoshu version control system submits the object code.By In development process, it will usually carry out the management of code using version control system, therefore, submit generation to version control system Code when, be judged as whether it includes character string constant, and to it includes character string constant carry out obscuring processing, in code The content that may be exposed is encrypted.So that timely being encrypted to character string constant during code development, improve The confidentiality of code reduces software and cracks brought risk.
The above-mentioned integrated unit realized in the form of software function module, can store and computer-readable deposit at one In storage media.Above-mentioned software function module is stored in a storage medium, including some instructions are used so that a computer It is each that equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute the present invention The part steps of embodiment the method.
As shown in figure 3, the structure that Fig. 3 is the computer installation for the preferred embodiment that the present invention realizes code encryption method is shown It is intended to.The computer installation include at least one sending device 31, at least one processor 32, at least one processor 33, At least one reception device 34 and at least one communication bus.Wherein, the communication bus is for realizing between these components Connection communication.
The computer installation be it is a kind of can according to the instruction for being previously set or store, it is automatic carry out numerical value calculate with/ Or the equipment of information processing, hardware include but is not limited to microprocessor, specific integrated circuit (Application Specific Integrated Circuit, ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), number Word processing device (Digital Signal Processor, DSP), embedded device etc..The computer installation may also include net Network equipment and/or user equipment.Wherein, the network equipment includes but is not limited to single network server, multiple network services The server group of device composition or being made of a large amount of hosts or network server based on cloud computing (Cloud Computing) Cloud, wherein cloud computing is one kind of distributed computing, a super virtual meter consisting of a loosely coupled set of computers Calculation machine.
The computer installation may be, but not limited to, any one and can be set with user by keyboard, touch tablet or acoustic control The modes such as standby carry out the electronic product of human-computer interaction, for example, the terminals such as tablet computer, smart phone, monitoring device.
Network locating for the computer installation includes, but are not limited to internet, wide area network, Metropolitan Area Network (MAN), local area network, virtual Dedicated network (Virtual Private Network, VPN) etc..
Wherein, the reception device 34 and the sending device 31 can be wired sending port, or wirelessly set It is standby, for example including antenna assembly, for carrying out data communication with other equipment.
The memory 32 is for storing program code.The memory 32, which can be, does not have physical form in integrated circuit The circuit with store function, such as RAM (Random-Access Memory, random access memory), FIFO (First In First Out, push-up storage) etc..Alternatively, the memory 32 is also possible to the memory with physical form, such as Memory bar, TF card (Trans-flash Card), smart media card (smart media card), safe digital card (secure Digital card), storage facilities such as flash memory cards (flash card) etc..
The processor 33 may include one or more microprocessor, digital processing unit.The processor 33 is adjustable With the program code stored in memory 32 to execute relevant function.For example, each unit described in Fig. 3 is stored in institute The program code in memory 32 is stated, and as performed by the processor 33, to realize a kind of code encryption method.The processing Device 33 is also known as central processing unit (CPU, Central Processing Unit), is one piece of ultra-large integrated circuit, is fortune Calculate core (Core) and control core (Control Unit).
In several embodiments provided by the present invention, it should be understood that disclosed system, device and method can be with It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the module It divides, only a kind of logical function partition, there may be another division manner in actual implementation.
The module as illustrated by the separation member may or may not be physically separated, aobvious as module The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.Some or all of the modules therein can be selected to realize the mesh of this embodiment scheme according to the actual needs 's.
It, can also be in addition, each functional module in each embodiment of the present invention can integrate in one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of hardware adds software function module.
It is obvious to a person skilled in the art that invention is not limited to the details of the above exemplary embodiments, Er Qie In the case where without departing substantially from spirit or essential attributes of the invention, the present invention can be realized in other specific forms.Therefore, no matter From the point of view of which point, the present embodiments are to be considered as illustrative and not restrictive, and the scope of the present invention is by appended power Benefit requires rather than above description limits, it is intended that all by what is fallen within the meaning and scope of the equivalent elements of the claims Variation is included in the present invention.Any attached associated diagram label in claim should not be considered as right involved in limitation to want It asks.Furthermore, it is to be understood that one word of " comprising " does not exclude other units or steps, odd number is not excluded for plural number.It is stated in system claims Multiple units or device can also be implemented through software or hardware by a unit or device.Second equal words are used to table Show title, and does not indicate any particular order.
Finally it should be noted that the above examples are only used to illustrate the technical scheme of the present invention and are not limiting, although reference Preferred embodiment describes the invention in detail, those skilled in the art should understand that, it can be to of the invention Technical solution is modified or equivalent replacement, without departing from the spirit and scope of the technical solution of the present invention.

Claims (10)

1. a kind of code encryption method, which is characterized in that the described method includes:
It is receiving after the instruction that version control system submits code, the object code that scanning described instruction instruction is submitted is sentenced Whether break in the object code comprising character string constant;
If including character string constant in the object code, the character string constant for including in the object code is identified;
The character string constant of mark is carried out obscuring processing, obtains obscuring character string;
The character string constant identified in the target string is replaced with and described obscures character string, Xiang Suoshu version control system Submit the object code.
2. the method as described in claim 1, which is characterized in that right if in the object code including character string constant The character string constant for including in the object code, which is identified, includes:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Obtain the length of each character string constant in the character string constant to be processed;
According to the length of each character string constant in the character string constant to be processed to every in the character string constant to be processed A character string constant carries out length mark;
Then described pair mark character string constant carry out obscuring processing include:
The character string constant of different length mark is carried out different to obscure processing.
3. the method as described in claim 1, which is characterized in that right if in the object code including character string constant The character string constant for including in the object code, which is identified, includes:
If including character string constant in the object code, the character string constant to be processed in the object code is obtained;
Determine the processing priority of each character string constant in the character string constant to be processed;
It is normal to the character string to be processed according to the processing priority of each character string constant in the character string constant to be processed Each character string constant carries out priority tag in amount;
Then described pair mark character string constant carry out obscuring processing include:
The character string constant of different priorities mark is carried out different to obscure processing.
4. method according to any one of claims 1 to 3, which is characterized in that the method also includes:
If in the object code including character string constant, sends encryption and remind.
5. method according to any one of claims 1 to 3, which is characterized in that the method also includes:
If receiving the instruction for the confirmation encryption reminded for the encryption, display obfuscated manner chooses the page;
The character string constant of mark is carried out obscuring processing according to the obfuscated manner that user chooses.
6. the method as described in claim 1, which is characterized in that it is described to the character string constant for including in the object code into Line identifier includes:
Identical character string constant in the object code is identified by identical identifier.
7. the method as described in claim 1, which is characterized in that it is described to the character string constant for including in the object code into Line identifier includes:
Identical character string constant in identical function module in the object code is identified by identical identifier.
8. a kind of code encryption device, which is characterized in that described device includes:
Judgment module, for receiving after the instruction that version control system submits code, scanning described instruction instruction is submitted Object code, whether judge in the object code comprising character string constant;
Mark module, if for including character string constant in the object code, to the character string for including in the object code Constant is identified;
Processing module carries out obscuring processing for the character string constant to mark, obtains obscuring character string;
Submit module, for by the character string constant identified in the target string replace with it is described obscure character string, to institute It states version control system and submits the object code.
9. a kind of computer installation, which is characterized in that the computer installation includes memory and processor, and the memory is used In storing at least one instruction, the processor is for executing at least one described instruction to realize as appointed in claim 1 to 7 Code encryption method described in one.
10. a kind of computer readable storage medium, is stored thereon with computer instruction, it is characterised in that: the computer instruction The code encryption method as described in any one of claims 1 to 7 is realized when being executed by processor.
CN201811057790.1A 2018-09-11 2018-09-11 Code encryption method, apparatus, computer installation and storage medium Pending CN109409033A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811057790.1A CN109409033A (en) 2018-09-11 2018-09-11 Code encryption method, apparatus, computer installation and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811057790.1A CN109409033A (en) 2018-09-11 2018-09-11 Code encryption method, apparatus, computer installation and storage medium

Publications (1)

Publication Number Publication Date
CN109409033A true CN109409033A (en) 2019-03-01

Family

ID=65464751

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811057790.1A Pending CN109409033A (en) 2018-09-11 2018-09-11 Code encryption method, apparatus, computer installation and storage medium

Country Status (1)

Country Link
CN (1) CN109409033A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110059455A (en) * 2019-04-09 2019-07-26 北京迈格威科技有限公司 Code encryption method, apparatus, electronic equipment and computer readable storage medium
CN110177116A (en) * 2019-06-10 2019-08-27 北京交通大学 Intelligence melts the safety data transmission method and device of mark network
CN111400736A (en) * 2020-03-17 2020-07-10 同盾(广州)科技有限公司 Application program encryption method and device, storage medium and electronic equipment
CN113609517A (en) * 2021-10-11 2021-11-05 深圳市沃易科技有限公司 Data encryption method for computer software development based on Internet of things
CN114124358A (en) * 2021-11-24 2022-03-01 中国银行股份有限公司 Ciphertext generating method, device, server and medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080120595A1 (en) * 2006-11-17 2008-05-22 O'farrell Bill System and method for hot code replace
US20130014267A1 (en) * 2011-07-07 2013-01-10 Farrugia Augustin J Computer protocol generation and obfuscation
CN103198240A (en) * 2012-09-29 2013-07-10 网易(杭州)网络有限公司 Method and device for protecting security of code
CN105005718A (en) * 2015-06-23 2015-10-28 电子科技大学 Method for implementing code obfuscation by Markov chain
CN105205359A (en) * 2015-10-12 2015-12-30 厦门飞信网络科技有限公司 Method and device for protecting JavaScript codes
CN105303073A (en) * 2015-11-26 2016-02-03 北京深思数盾科技有限公司 Protecting method for software codes
CN105701410A (en) * 2015-12-31 2016-06-22 华为技术有限公司 Information, device and system for obtaining information in source codes
CN106326693A (en) * 2016-08-18 2017-01-11 广州优视网络科技有限公司 Obfuscation method and obfuscation device for application program code
US9596263B1 (en) * 2015-02-23 2017-03-14 Amazon Technolgies, Inc. Obfuscation and de-obfuscation of identifiers
CN107908933A (en) * 2017-11-08 2018-04-13 北京顶象技术有限公司 A kind of character string encryption method based on intermediate language
CN108197440A (en) * 2017-11-28 2018-06-22 五八有限公司 A kind of Code obfuscation method, equipment and computer readable storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080120595A1 (en) * 2006-11-17 2008-05-22 O'farrell Bill System and method for hot code replace
US20130014267A1 (en) * 2011-07-07 2013-01-10 Farrugia Augustin J Computer protocol generation and obfuscation
CN103198240A (en) * 2012-09-29 2013-07-10 网易(杭州)网络有限公司 Method and device for protecting security of code
US9596263B1 (en) * 2015-02-23 2017-03-14 Amazon Technolgies, Inc. Obfuscation and de-obfuscation of identifiers
CN105005718A (en) * 2015-06-23 2015-10-28 电子科技大学 Method for implementing code obfuscation by Markov chain
CN105205359A (en) * 2015-10-12 2015-12-30 厦门飞信网络科技有限公司 Method and device for protecting JavaScript codes
CN105303073A (en) * 2015-11-26 2016-02-03 北京深思数盾科技有限公司 Protecting method for software codes
CN105701410A (en) * 2015-12-31 2016-06-22 华为技术有限公司 Information, device and system for obtaining information in source codes
CN106326693A (en) * 2016-08-18 2017-01-11 广州优视网络科技有限公司 Obfuscation method and obfuscation device for application program code
CN107908933A (en) * 2017-11-08 2018-04-13 北京顶象技术有限公司 A kind of character string encryption method based on intermediate language
CN108197440A (en) * 2017-11-28 2018-06-22 五八有限公司 A kind of Code obfuscation method, equipment and computer readable storage medium

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110059455A (en) * 2019-04-09 2019-07-26 北京迈格威科技有限公司 Code encryption method, apparatus, electronic equipment and computer readable storage medium
CN110177116A (en) * 2019-06-10 2019-08-27 北京交通大学 Intelligence melts the safety data transmission method and device of mark network
CN111400736A (en) * 2020-03-17 2020-07-10 同盾(广州)科技有限公司 Application program encryption method and device, storage medium and electronic equipment
CN113609517A (en) * 2021-10-11 2021-11-05 深圳市沃易科技有限公司 Data encryption method for computer software development based on Internet of things
CN113609517B (en) * 2021-10-11 2022-02-08 深圳市沃易科技有限公司 Data encryption method for computer software development based on Internet of things
CN114124358A (en) * 2021-11-24 2022-03-01 中国银行股份有限公司 Ciphertext generating method, device, server and medium
CN114124358B (en) * 2021-11-24 2023-12-22 中国银行股份有限公司 Ciphertext generating method, ciphertext generating device, server and medium

Similar Documents

Publication Publication Date Title
CN109409033A (en) Code encryption method, apparatus, computer installation and storage medium
TWI505681B (en) A method, a computer usable program product and a data processing system for securing asynchronous client server transactions
US10956596B2 (en) System and method for automatically securing sensitive data in public cloud using a serverless architecture
WO2019200799A1 (en) Short message verification code pushing method, electronic device and readable storage medium
CN109766134A (en) System start method, device, electronic equipment and storage medium
CN107204986A (en) High in the clouds storage encryption method, decryption method and high in the clouds storage encryption device
CN106685905A (en) Systems and methods of encrypted transmission of web pages
CN104796257A (en) Flexible data authentication
CN108075888B (en) Dynamic URL generation method and device, storage medium and electronic equipment
CN114124502B (en) Message transmission method, device, equipment and medium
KR101351435B1 (en) Protection of series data
CN110351672A (en) Information-pushing method, device and electronic equipment
CN113127915A (en) Data encryption desensitization method and device, electronic equipment and storage medium
CN111209557A (en) Cross-domain single sign-on method and device, electronic equipment and storage medium
CN114553532A (en) Data secure transmission method and device, electronic equipment and storage medium
CN101212301A (en) Authentication device and method
CN111368322A (en) File decryption method and device, electronic equipment and storage medium
WO2022073336A1 (en) Secure payment method and apparatus, electronic device, and storage medium
US8838709B2 (en) Anti-phishing electronic message verification
CN115080147A (en) H5 page loading method, device, equipment and medium based on artificial intelligence
US11489830B2 (en) Source authentication of website content
CN114036364A (en) Method, apparatus, device, medium and product for identifying a crawler
CN114826725A (en) Data interaction method, device, equipment and storage medium
CN114285815B (en) Application jump method and application jump device
CN113961292B (en) Security product generation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190301