CN108390759A - Code encryption, decryption method, device, computer equipment and storage medium - Google Patents

Code encryption, decryption method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN108390759A
CN108390759A CN201810235343.4A CN201810235343A CN108390759A CN 108390759 A CN108390759 A CN 108390759A CN 201810235343 A CN201810235343 A CN 201810235343A CN 108390759 A CN108390759 A CN 108390759A
Authority
CN
China
Prior art keywords
code
byte
key sequence
ciphertext
current
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
CN201810235343.4A
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 Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201810235343.4A priority Critical patent/CN108390759A/en
Publication of CN108390759A publication Critical patent/CN108390759A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Theoretical Computer Science (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Power Engineering (AREA)
  • Storage Device Security (AREA)

Abstract

This application involves a kind of code encryption, decryption method, device, computer equipment and storage mediums.Code encryption method includes:Pending encrypted object code is obtained, obtains the encryption key sequence that object code is encrypted, encryption key sequence includes multiple encryption keys;Current byte to be encrypted is obtained from object code according to the byte order of object code, current encryption key is obtained from encryption key sequence according to the cipher key sequence of encryption key sequence;Current byte to be encrypted is encrypted according to current encryption key, obtains corresponding current byte ciphertext;The step of returning and obtains from object code current byte to be encrypted according to the byte order of object code, current encryption key is obtained from encryption key sequence according to the cipher key sequence of encryption key sequence, encrypts up to the byte to be encrypted of object code and finishes;Obtained each byte cryptogram is combined, the corresponding code ciphertext of object code is obtained.This method can improve code safety.

Description

Code encryption, decryption method, device, computer equipment and storage medium
Technical field
This application involves encryption technology fields, are set more particularly to a kind of code encryption, decryption method, device, computer Standby and storage medium.
Background technology
With the development of information technology, application is more and more, and the code of generation is also more and more, the generation much applied at present Code is all the code write using higher level of abstraction language such as java, it is easy to is disassembled, to illegally be read or be usurped Change, code safety is low.
Invention content
Based on this, it is necessary in view of the above technical problems, provide a kind of code encryption, decryption method, device, computer and set Standby and storage medium is capable of the byte order of combining target code byte and includes the encryption key sequence of multiple encryption keys Cipher key sequence object code is encrypted, and be that code is encrypted as unit of byte, therefore, code is compiled by counter The difficulty translated is big, improves code safety.
A kind of code encryption method, the method includes:Pending encrypted object code is obtained, is obtained to the target The encryption key sequence that code is encrypted, the encryption key sequence include multiple encryption keys;According to the object code Byte order current byte to be encrypted is obtained from the object code, according to the cipher key sequence of the encryption key sequence from Current encryption key is obtained in the encryption key sequence;According to the current encryption key to the current byte to be encrypted into Row encryption, obtains corresponding current byte ciphertext;The byte order according to the object code is returned from the target generation Current byte to be encrypted is obtained in code, is obtained from the encryption key sequence according to the cipher key sequence of the encryption key sequence The step of current encryption key, until the byte to be encrypted encryption of the object code finishes;The each byte cryptogram that will be obtained It is combined, obtains the corresponding code ciphertext of the object code.
A kind of code decryption method, the method includes:The corresponding code ciphertext of object code is obtained, is obtained to the mesh The decruption key sequence that mark code is decrypted, the decruption key sequence includes multiple decruption keys;It is close according to the code The byte order of text obtains current byte to be decrypted from the code ciphertext, according to the cipher key sequence of the decruption key sequence Current decryption key is obtained from the decruption key sequence;According to the current decryption key to the current byte to be decrypted It is decrypted, obtains corresponding current byte in plain text;The byte order according to the code ciphertext is returned from the code Current byte to be decrypted is obtained in ciphertext, is obtained from the decruption key sequence according to the cipher key sequence of the decruption key sequence The step of taking current decryption key, until the byte to be decrypted decryption of the code ciphertext finishes;Obtained each byte is bright Text is combined, and obtains the corresponding object code of the code ciphertext.
A kind of code encryption device, described device include:Code and Key Acquisition Module, it is pending encrypted for obtaining Object code, obtains the encryption key sequence that the object code is encrypted, and the encryption key sequence includes multiple adds Key;Encrypted byte and Key Acquisition Module are used for the byte order according to the object code from the object code Current byte to be encrypted is obtained, is obtained currently from the encryption key sequence according to the cipher key sequence of the encryption key sequence Encryption key;Encrypting module obtains pair for the current byte to be encrypted to be encrypted according to the current encryption key The current byte ciphertext answered;First returns to module, for returning to the byte order according to the object code from the mesh It marks and obtains current byte to be encrypted in code, according to the cipher key sequence of the encryption key sequence from the encryption key sequence The step of obtaining current encryption key, until the byte to be encrypted encryption of the object code finishes;Ciphertext composite module, is used for Obtained each byte cryptogram is combined, the corresponding code ciphertext of the object code is obtained.
A kind of code decryption device, described device include:Ciphertext and Key Acquisition Module, for obtaining object code pair The code ciphertext answered, obtains the decruption key sequence that the object code is decrypted, and the decruption key sequence includes more A decruption key;Byte is decrypted with Key Acquisition Module, for close from the code according to the byte order of the code ciphertext Current byte to be decrypted is obtained in text, is obtained from the decruption key sequence according to the cipher key sequence of the decruption key sequence Current decryption key;Deciphering module is obtained for the current byte to be decrypted to be decrypted according to the current decryption key In plain text to corresponding current byte;Second returns to module, for returning to the byte order according to the code ciphertext from institute It states and obtains current byte to be decrypted in code ciphertext, according to the cipher key sequence of the decruption key sequence from the decruption key sequence The step of current decryption key is obtained in row, until the byte to be decrypted decryption of the code ciphertext finishes;Plaintext composite module, For obtained each byte to be combined in plain text, the corresponding object code of the code ciphertext is obtained.
A kind of computer equipment, including memory, processor and storage can be run on a memory and on a processor The step of computer program, the processor realizes above-mentioned code encryption method when executing the computer program.
A kind of computer equipment, including memory, processor and storage can be run on a memory and on a processor The step of computer program, the processor realizes above-mentioned code decryption method when executing the computer program.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor The step of above-mentioned code encryption method is realized when row.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor The step of above-mentioned code decryption method is realized when row.
Above-mentioned code encryption method, by obtaining pending encrypted object code, object code is encrypted in acquisition Encryption key sequence, encryption key sequence includes multiple encryption keys, according to the byte order of object code from object code It is middle to obtain current byte to be encrypted, it is close that current crypto is obtained from encryption key sequence according to the cipher key sequence of encryption key sequence Key is encrypted current byte to be encrypted according to current encryption key, obtains corresponding current byte ciphertext, return according to mesh The byte order of mark code obtains currently byte to be encrypted from object code, according to the cipher key sequence of encryption key sequence from adding The step of current encryption key is obtained in close key sequence, until the byte to be encrypted encryption of object code finishes, by what is obtained Each byte cryptogram is combined, and obtains the corresponding code ciphertext of object code.Due to capableing of the suitable of combining target code byte Object code is encrypted in the cipher key sequence of sequence and encryption key sequence including multiple encryption keys, and is with byte Code is encrypted for unit, therefore, code is cracked and the difficulty of decompiling is big, improves code safety.
Above-mentioned code decryption method obtains the corresponding code ciphertext of object code, what object code was decrypted in acquisition Decruption key sequence, decruption key sequence include multiple decruption keys;According to the byte order of code ciphertext from code ciphertext Current byte to be decrypted is obtained, it is close that current decryption is obtained from decruption key sequence according to the cipher key sequence of decruption key sequence Key is decrypted current byte to be decrypted according to current decryption key, obtains corresponding current byte in plain text, return according to generation The byte order of code ciphertext obtains currently byte to be decrypted from code ciphertext, according to the cipher key sequence of decruption key sequence from solution The step of current decryption key is obtained in close key sequence, until the byte to be decrypted decryption of code ciphertext finishes, by what is obtained Each byte is combined in plain text, obtains the corresponding object code of code ciphertext.Since the byte of code ciphertext can be combined suitable The corresponding ciphertext of object code is decrypted in the cipher key sequence of sequence and decruption key sequence including multiple decruption keys, and And be that code is decrypted as unit of byte, therefore, the decrypted difficulty of code is big, improves code safety.
Description of the drawings
Fig. 1 is the application scenario diagram of code encryption and decryption method in one embodiment;
Fig. 2 is the flow diagram of code encryption method in one embodiment;
Fig. 3 is the flow diagram of code encryption method in another embodiment;
Fig. 4 is the flow diagram of code decryption method in one embodiment;
Fig. 5 is the flow diagram of code decryption method in one embodiment;
Fig. 6 is the structure diagram of code encryption device in one embodiment;
Fig. 7 is the structure diagram of code encryption device in another embodiment;
Fig. 8 is the structure diagram of code decryption device in one embodiment;
Fig. 9 is the structure diagram of code decryption device in another embodiment;
Figure 10 is the internal structure chart of one embodiment Computer equipment;
Figure 11 is the internal structure chart of another embodiment Computer equipment.
Specific implementation mode
It is with reference to the accompanying drawings and embodiments, right in order to make the object, technical solution and advantage of the application be more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
Code encryption method provided by the present application, can be applied in application environment as shown in Figure 1.Wherein, terminal 102 It is communicated by network with server 104 by network.Application program is installed in terminal 102, plug-in unit can be utilized Core code in application is separated into an independent add-on file and is stored in server 104 by technology, works as application program When terminal 102 is run, if desired operational objective plug-in unit, terminal 102 send plug-in unit to server 104 and obtain request, and plug-in unit obtains Request is taken to carry target plug-in mark, server 104 receives plug-in unit and obtains request, and correspondence is acquired according to target plug-in mark Target plug-in, and target plug-in is encrypted using code encryption method provided in an embodiment of the present invention, is obtained corresponding Code ciphertext is sent in terminal 102 by code ciphertext, and terminal 102 receives code ciphertext, is executed provided in an embodiment of the present invention Code decryption method obtains target plug-in and operational objective plug-in unit.Wherein, terminal 102 can be, but not limited to be various personal meters Calculation machine, laptop, smart mobile phone, tablet computer and portable wearable device, server 104 can use independent service The server cluster of device either multiple servers composition is realized.
In one embodiment, as shown in Fig. 2, providing a kind of code encryption method, it is applied in Fig. 1 in this way It illustrates, includes the following steps for server:
Step S202 obtains pending encrypted object code, obtains the encryption key sequence that object code is encrypted Row, encryption key sequence includes multiple encryption keys.
Specifically, object code is the code for needing to be encrypted, and object code can be in response to obtain in the code of terminal Acquisition request is taken to obtain, the code that server can also store needs stores again after being encrypted.Encryption key sequence Number is multiple, can be specifically configured as needed.Such as the encryption key in encryption key sequence can be 4.Add What close key sequence can be randomly generated, can also be pre-set.It, can be with for example, after acquiring object code 4 random numbers are generated, this 4 random numbers are formed into encryption key sequence.Alternatively, can be using the public key of terminal as encryption key Sequence.
Step S204 obtains from object code current byte to be encrypted according to the byte order of object code, according to adding The cipher key sequence of close key sequence obtains current encryption key from encryption key sequence.
Specifically, current byte to be encrypted refers to the byte for currently needing to be encrypted in object code, and current crypto is close Key refers to the key that current byte to be encrypted is encrypted.Object code includes multiple bytes, can be according to object code Byte order obtains current byte to be encrypted successively, can obtain current crypto successively according to the cipher key sequence of encryption key sequence Then key is encrypted the current byte to be encrypted of acquisition according to corresponding current encryption key.In one embodiment, The number of encryption key sequence be less than object code byte number, therefore, when the encryption key in encryption key sequence successively After acquisition, acquisition encryption key can be started the cycle over from first encryption key of encryption key sequence, until target generation The byte of code is encrypted finish.For example, it is assumed that there are two current key sequences, it is corresponding for the first character section of object code Encryption key be first encryption key, for second byte of object code, corresponding encryption key be second plus Key.For the third byte of object code, corresponding encryption key is that first encryption key ... so recycles, directly Byte to be encrypted to object code is obtained and is finished.
Step S206 is encrypted current byte to be encrypted according to current encryption key, obtains corresponding current byte Ciphertext.
Specifically, Encryption Algorithm can be according to being actually configured, such as can be and operation or operation or exclusive or are transported It is one or more in calculation, it is not limited herein.Since a byte may include 8 bits, it can be to first 4 Bit carries out and operation, and XOR operation etc. is carried out to rear 4 bits.
In one embodiment, current byte to be encrypted is encrypted according to current encryption key, obtains corresponding work as The step of preceding byte cryptogram includes:Cutting is carried out to current byte to be encrypted, obtains multiple corresponding number of bits evidences to be encrypted Block.Each bit data block to be encrypted is encrypted using different Encryption Algorithm according to current encryption key, is obtained each The corresponding bit ciphertext of a bit data block to be encrypted.Each bit ciphertext is combined, is obtained corresponding current Byte cryptogram.
Specifically, the number of bit data block to be encrypted can be specifically configured as needed.Such as can be 2 It is a.Different Encryption Algorithm can refer to encryption key difference or one or both of the method difference of cryptographic calculation.It is right Each bit data block needs that operation is encrypted using different Encryption Algorithm, obtains each bit data block to be encrypted Then each bit ciphertext is combined by corresponding bit ciphertext, obtain corresponding current byte ciphertext.For example, will Byte is indicated with 16 systems, it is assumed that current byte to be encrypted is 0x55, current encryption key 0xCA, by preceding 4 ratios of byte Rear 4 bits of byte are to be used as low four as four high by special position.0x55 point corresponding can then be waited for for high four Encrypting bit bit data block and low four corresponding bit data blocks to be encrypted.Then by current byte 0x55's to be encrypted High four of high four exclusive or current keys 0xCA obtain corresponding first bit ciphertext, by current byte 0x55's to be encrypted Low four of low four exclusive or current keys 0xCA obtain corresponding second bit ciphertext, by the first bit ciphertext and Two bit ciphertexts obtain the corresponding current byte ciphertexts of 0x55 after being combined be 0x9A.
In one embodiment, it can also treat after decryption byte is shifted and be added further according to current encryption key It is close.It is obtained for example, carrying out exclusive or computations with high four of current key 0xCA again after being shifted to high four of 0x55 Bit ciphertext.
It in one embodiment, can also be by current encryption key cutting before being encrypted according to current encryption key For multiple corresponding key bit bit data blocks, different modes of texturing is respectively adopted to each key bit bit data block and is carried out Deformation obtains deformed key bit bit data block.For example, can using preceding 4 bits as high four key data blocks, 4 bits are as low four key data blocks by after.For high four key data blocks, displacement mode may be used and become Shape, and for low four key data blocks, it may be used and with predetermined value deformed with the method calculated.
Step S208 is returned and is obtained current byte to be encrypted, root from object code according to the byte order of object code The step of current encryption key is obtained from encryption key sequence according to the cipher key sequence of encryption key sequence, until object code Byte encryption to be encrypted finishes.
Specifically, if the byte to be encrypted also unencryption in object code finishes, according to the byte order of object code Next byte to be encrypted is obtained from object code as current byte to be encrypted, according to the cipher key sequence of encryption key sequence Using next encryption key as current encryption key, step S202~208 are repeated, until the byte to be encrypted of object code adds It is close to finish.For example, it is assumed that object code includes n byte, encryption key sequence includes k encryption key, wherein n is more than k, And n and k is the positive integer more than 1.When then starting encryption, the first character section of object code is obtained as current word to be encrypted Section, obtains first encryption key of encryption key sequence as current encryption key, according to first encryption key pair first A byte is encrypted, and after first character section is encrypted successfully, obtains second byte of object code as current to be encrypted Byte obtains second encryption key of encryption key sequence as current encryption key, according to second encryption key pair Two bytes are encrypted, and after second byte is encrypted successfully, continue to obtain current byte to be encrypted according to byte order, directly Successfully stop afterwards to being encrypted according to a-th of key pair, n-th of byte.Wherein, when the remainder of n divided by k is between 1~k-1 Numerical value when, a be equal to n divided by k remainder.When the remainder of n divided by k is 0, a is equal to k.
Obtained each byte cryptogram is combined by step S210, obtains the corresponding code ciphertext of object code.
Specifically, after the byte to be encrypted of object code is encrypted, obtained each byte cryptogram is combined, Obtain the corresponding code ciphertext of object code.If for example, the corresponding byte cryptogram of first character section of object code be b1, second The corresponding byte cryptogram of a byte is b2, and the corresponding byte cryptogram of third byte is b3.The code ciphertext then combined is b1b2b3。
In above-mentioned code encryption method, above-mentioned code encryption method is obtained by obtaining pending encrypted object code To the encryption key sequence that object code is encrypted, encryption key sequence includes multiple encryption keys, according to object code Byte order obtains current byte to be encrypted from object code, according to the cipher key sequence of encryption key sequence from encryption key sequence Current encryption key is obtained in row, and current byte to be encrypted is encrypted according to current encryption key, is obtained corresponding current Byte cryptogram returns and obtains current byte to be encrypted from object code according to the byte order of object code, close according to encrypting The cipher key sequence of key sequence obtains the step of current encryption key from encryption key sequence, until the word to be encrypted of object code Section encryption finishes, and obtained each byte cryptogram is combined, the corresponding code ciphertext of object code is obtained.Due to that can tie Close object code byte sequence and encryption key sequence including multiple encryption keys cipher key sequence to object code into Row encryption, and be that code is encrypted as unit of byte, therefore, code is cracked and the difficulty of decompiling is big, carries High code safety.
In one embodiment, as shown in figure 3, code encryption method further includes step S302:Receive the mesh that terminal is sent Code obtaining request is marked, object code obtains request and carries object code mark.Step S202 includes:It is identified according to object code Obtain pending encrypted object code.After obtaining object code, code encryption method can also include step S304:By code Ciphertext and encryption key sequence are combined, and code data packet is sent to terminal by the code data packet after being combined.
Specifically, object code can be that the application program of terminal installation corresponding is stored in corresponding to the plug-in unit of server Code.When terminal needs operational objective plug-in unit during running application program, sends object code to server and obtain Request is taken, the correspondence of marking code and code is provided in server, request is obtained when server receives object code When, corresponding object code is obtained according to object code mark.S204~S210 when then executing step, obtains object code pair The code ciphertext answered.Meanwhile in order to allow terminal to receive code ciphertext after, code ciphertext can be decrypted.Therefore, Encryption key sequence can be inserted into code ciphertext, obtain code data packet, and code data packet is sent in terminal. The mode of combination can specifically be pre-set.In one embodiment, the corresponding insertion position of encryption key sequence can be pre- First it is arranged, can be fixed position can also be to be calculated according to certain computational methods.For example, can will encrypt Key sequence is inserted on the corresponding file header of code ciphertext, and file header may include 1024 bit bytes, and random key can be with Be stored in the 256th~259 byte, or can pre-set cryptographic Hash and encryption key sequence file header storage location Correspondence, obtain object code mark after, according to object code identify carry out Hash calculation, obtain target cryptographic Hash, root The insertion position of corresponding current encryption key is obtained according to the target cryptographic Hash being calculated.
In one embodiment, code ciphertext and encryption key sequence are combined, the code number after being combined Further include before according to the step of packet:Object code is identified and carries out Hash calculation, obtains corresponding target cryptographic Hash.According to target Hash is worth to the corresponding data insertion locations of encryption key sequence.Code ciphertext and encryption key sequence are combined, The step of code data packet after being combined includes:Encryption key sequence is inserted into code ciphertext according to data insertion locations Row, the code data packet after being combined.
Specifically, hash algorithm is the output that the input of random length can be transformed by hashing algorithm certain length Computational methods, hashing algorithm can be MD5 (Message-digestAlgorithm5, message digest algorithm 5) algorithms and SHA (Secure Hash Standard, Secure Hash Standard) algorithm etc., can specifically be configured as needed.Encryption key sequence Corresponding insertion position is arranged to identify to obtain according to object code.Correspondence provided with cryptographic Hash and insertion position.Example Such as, can be arranged after cryptographic Hash is the 256th byte that 0~100 corresponding insertion position can be code ciphertext, cryptographic Hash is It 101~500 corresponding insertion positions can be for before the 567th byte of code ciphertext etc..After obtaining object code mark, to mesh It marks marking code and carries out Hash calculation, obtain corresponding target cryptographic Hash.Then corresponding insert is worth to according to target Hash Enter position, encryption key sequence is inserted into corresponding insertion position, obtains code data packet.
In one embodiment, the private key that can also obtain server utilizes the private key pair encryption key sequence of server It is encrypted.
In one embodiment, encryption key sequence can also be carried out being inserted into corresponding insertion after further encrypting In position.For example, server can obtain the public key of terminal, then encryption key sequence is encrypted using public key, is obtained Key ciphertext, then be combined with code ciphertext, obtain code data packet.
In one embodiment, as shown in figure 4, providing a kind of code decryption method, it is applied in Fig. 1 in this way It illustrates, includes the following steps for terminal:
Step S402 obtains the corresponding code ciphertext of object code, obtains the decruption key that object code is decrypted Sequence, decruption key sequence include multiple decruption keys.
Specifically, code ciphertext is the corresponding ciphertext of object code for needing to be decrypted.Code ciphertext can transported During row application program, terminal to server sends Code obtaining request, and server is asked in response to the Code obtaining of terminal It asks and acquires.Code ciphertext can also be the code ciphertext stored in terminal.Decruption key sequence is encryption key sequence Corresponding key sequence, in a symmetric encryption algorithm, encryption key sequence are identical with decruption key sequence, are added in asymmetry In close algorithm, encryption key sequence is different with decruption key sequence.Decruption key sequence can be sent in server It is sent together when code ciphertext, decruption key sequence can also be that server is sent to terminal in advance.
Step S404 obtains current byte to be decrypted according to the byte order of code ciphertext, according to solution from code ciphertext The cipher key sequence of close key sequence obtains current decryption key from decruption key sequence.
Specifically, current byte to be decrypted refers to the byte for currently needing to be decrypted in code ciphertext, and current decryption is close Key refers to the key that current byte to be decrypted is decrypted.Code ciphertext includes multiple bytes, can be according to code ciphertext Byte order obtains current byte to be decrypted successively, can obtain current decryption successively according to the byte order of decruption key sequence Then key is decrypted the current byte to be decrypted of acquisition according to corresponding current decryption key.In one embodiment, The number of decruption key sequence be less than code ciphertext byte number, therefore, when the decruption key in decruption key sequence successively After acquisition, acquisition decruption key can be started the cycle over from first decruption key of decruption key sequence, until code is close The byte of text is decrypted to be finished.
Step S406 is decrypted current byte to be decrypted according to current decryption key, obtains corresponding current byte In plain text.
Specifically, decipherment algorithm is configured according to Encryption Algorithm, such as when Encryption Algorithm is XOR operation, is then corresponded to Decipherment algorithm be XOR operation.When Encryption Algorithm is to when moving to left three, decipherment algorithm is to move right three.Currently waited for It after decrypting byte, is decrypted according to current decryption key, obtains corresponding current byte in plain text.
In one embodiment, current byte to be decrypted is decrypted according to current decryption key, obtains corresponding work as The step of preceding byte plaintext includes:Cutting is carried out to current byte to be decrypted, obtains multiple corresponding number of bits evidences to be decrypted Block.Each bit data block to be decrypted is decrypted using different decipherment algorithms according to current decryption key, is obtained each The corresponding bit of a bit data block to be decrypted is in plain text.Each bit is combined in plain text, is obtained corresponding current Byte is in plain text.
Specifically, the number of bit data block to be decrypted is obtained with specific reference to the number of bit data block to be decrypted. Such as when bit data block to be encrypted is 2, then bit data block to be decrypted is 2.Different decipherment algorithms can be with Refer to decruption key difference or one or both of the method difference of decryption operation.To each bit data block to be decrypted Operation is decrypted using different decipherment algorithms, obtains the corresponding bit of each bit data block to be decrypted in plain text, so Each bit is combined in plain text afterwards, obtains corresponding current byte in plain text.For example, it is assumed that byte 0x9A to be decrypted, when Preceding decruption key is 0xCA, and cryptographic calculation is the four high of currently high four bits and current decryption key of byte to be decrypted Bit carries out XOR operation.Low four bits of byte to be decrypted and low four bits of current decryption key carry out different Or operation.0x9A high four bit exclusive or 0xCA high, four bits can then be taken out and obtain the four high of code plaintext, taken Go out low four bits of the low four bit exclusive or 0xCA of 0x9A and obtain low four of plaintext, by the Gao Siwei of plaintext and plaintext Low four are combined, and obtained byte is 0x55 in plain text.
Step S408 is returned and is obtained current byte to be decrypted, root from code ciphertext according to the byte order of code ciphertext The step of current decryption key is obtained from decruption key sequence according to the cipher key sequence of decruption key sequence, until code ciphertext Byte decryption to be decrypted finishes.
Specifically, it is finished if the byte to be decrypted in code ciphertext is not decrypted also, according to the byte order of code ciphertext Using next byte to be decrypted in code ciphertext as current byte to be decrypted, according to the cipher key sequence of decruption key sequence will under One decruption key repeats step S402~408 as current decryption key is taken, until the byte to be decrypted of code ciphertext is decrypted It finishes.For example, it is assumed that code ciphertext includes n bytes to be decrypted, decruption key sequence includes k decruption key, wherein n is big In k, and n and k is the positive integer more than 1.When then starting decryption, the first character section of acquisition code ciphertext, which is used as, currently to be waited solving Close byte obtains first decruption key of decruption key sequence as current decryption key, according to first decruption key pair First character section is decrypted, and after first character section successful decryption, second byte of acquisition code ciphertext, which is used as, currently to be waited for Byte is decrypted, obtains second decruption key of decruption key sequence as current decryption key, according to second decruption key Second byte is decrypted, after second byte successful decryption, continues to obtain current word to be decrypted according to byte order Section successfully stops afterwards until being decrypted according to a-th of key pair, n-th of byte.Wherein, when 1~k-1 of remainder of n divided by k it Between numerical value when, a be equal to n divided by k remainder.When the remainder of n divided by k is 0, a is equal to k.
Obtained each byte is combined, obtains the corresponding object code of code ciphertext by step S410 in plain text.
Specifically, after the byte to be decrypted of code ciphertext is decrypted, obtained each byte is combined in plain text, Obtain the corresponding object code of code ciphertext.For example, if the byte of the corresponding object code of first character section of code ciphertext is The byte of c1, the corresponding object code of second byte are c2, and the byte of the corresponding object code of third byte is c3.Then group It is c1c2c3 to close obtained object code.
Above-mentioned code decryption method obtains the corresponding code ciphertext of object code, what object code was decrypted in acquisition Decruption key sequence, decruption key sequence include multiple decruption keys;According to the byte order of code ciphertext from code ciphertext Current byte to be decrypted is obtained, it is close that current decryption is obtained from decruption key sequence according to the cipher key sequence of decruption key sequence Key is decrypted current byte to be decrypted according to current decryption key, obtains corresponding current byte in plain text, return according to generation The byte order of code ciphertext obtains currently byte to be decrypted from code ciphertext, according to the cipher key sequence of decruption key sequence from solution The step of current decryption key is obtained in close key sequence, until the byte to be decrypted decryption of code ciphertext finishes, by what is obtained Each byte is combined in plain text, obtains the corresponding object code of code ciphertext.Since the byte of code ciphertext can be combined suitable The corresponding ciphertext of object code is decrypted in the cipher key sequence of sequence and decruption key sequence including multiple decruption keys, and And be that code is decrypted as unit of byte, therefore, the decrypted difficulty of code is big, improves code safety.
In one embodiment, as shown in figure 5, code decryption method can also include the following steps:
Step S502 obtains object code mark during running application.
Specifically, the partial code of application program can be stored in the server in the form of plug-in unit, terminal storage pair The plug-in unit mark answered, i.e. object code identify.When needing operational objective plug-in unit when terminal operating is applied, object code mark is obtained Know.
Step S504 sends object code to server and obtains request, and object code obtains request and carries object code mark Know.
Specifically, it after obtaining object code mark, sends object code to server and obtains request, and carry object code Mark, so that server can identify to obtain object code according to object code.
Step S402 obtains the corresponding code ciphertext of object code, obtains the decruption key that object code is decrypted The step of sequence includes:
S402A, receives the corresponding code data packet of object code, and code data packet is close according to code ciphertext and encryption Key combined sequence obtains, and code ciphertext is that server is encrypted to obtain according to encryption key sequence to object code.
Specifically, object code is that server identifies acquisition according to object code, after obtaining object code, server profit Object code is encrypted with encryption key sequence, obtains code ciphertext, and encryption key sequence and code ciphertext are carried out Combination, obtains code data packet, code data packet is sent to terminal, terminal receives code data packet.
S402B parses code data packet, obtains code ciphertext and encryption key sequence, by encryption key sequence Row are used as decruption key sequence.
Specifically, after present terminal obtains code data packet, code data packet is parsed, extraction obtains code ciphertext And encryption key sequence.For example, if encryption key sequence is inserted into predeterminated position, can be extracted from predeterminated position To encryption key sequence, and using encryption key sequence as decruption key sequence.
In one embodiment, when the corresponding data insertion locations of encryption key sequence are to be identified to calculate according to object code Obtained target Hash be worth to when, terminal can identify according to object code and target cryptographic Hash be calculated, then basis Target cryptographic Hash obtains encryption key sequence in the position of code data packet, is extracted from code data packet and obtains encryption key sequence Row.For example, when encryption key sequence is 4 bytes, the target cryptographic Hash being calculated is 50, when cryptographic Hash is 0~100 correspondence Insertion position be code ciphertext the 256th byte after when, then can be by 4 after the 256th byte in code data packet A byte is as encryption key sequence.
In one embodiment, encryption key sequence can be obtained after being encrypted using the encrypted public key of terminal it is close Key ciphertext, therefore, after obtaining code data packet, parsing obtains key ciphertext, and terminal is decrypted key ciphertext using private key, Obtain encryption key sequence.
In one embodiment, when encryption key sequence is encrypted using the private key of server, terminal can obtain The public key for taking server is decrypted key ciphertext using the public key of server.
Below with a specific embodiment to code encryption method provided in an embodiment of the present invention and decryption method into Row explanation.For terminal in operation in application, detecting needs code to be run to be stored in server, plug-in unit is identified as 001, because This can send Code obtaining request to server, and carry plug-in unit mark 001, and server receives Code obtaining request, according to Plug-in unit mark 001 obtains corresponding plug-in unit, and generate at random random key such as key=that length is 4 bytes 0xCA, 0x75, 0xFD, 0xDC }, it is assumed that plug-in unit includes bytes such as " 0x550xA90xE20xE3....0x55 ", can be by every 4 bytes in plug-in unit It, can be by plug-in unit the first bit byte 0x55 in the block and encryption key sequence by taking first plug-in unit block as an example as a plug-in unit block Calculating is encrypted in 0xCA in row.The 0x75 of plug-in unit the second bit byte 0xA9 in the block and encryption key sequence are encrypted It calculates, calculating is encrypted in the 0xFD of plug-in unit third bit byte 0xE2 in the block and encryption key sequence, plug-in unit is in the block Calculating is encrypted in nib 0xE3 and the 0xDC of encryption key sequence.When computations, with to the first bit byte 0x55 It is encrypted for calculating, the high four exclusive or 0xCA high four that can take out 0x55 obtain the four high of ciphertext, take out 0x55 Low four of low four exclusive or 0xCA obtain low four of ciphertext, by high 4 of ciphertext and it is low 4 be combined after obtain one Encrypted byte 0x9A is added so using every 4 bytes in plug-in unit as a plug-in unit block according to encryption key sequence It is close, encrypted plug-in unit is obtained, and be encrypted to obtain key ciphertext using the RSA private key pair encryption key sequences of server, Key ciphertext is inserted on the predeterminated position of encrypted plug-in unit, obtains code data packet.Wherein key ciphertext is being encrypted The storage location of plug-in unit afterwards can be the 256th~259 byte.After server obtains code data packet, the generation is sent to terminal Code data packet, terminal receive code data packet, using server RSA public keys between the 256th~259 byte be decrypted, It obtains encryption key sequence key={ 0xCA, 0x75,0xFD, 0xDC } and is used as decruption key sequence, and deleted from code data packet Except obtaining code ciphertext, such as 0x9A...0x9A after encryption key sequence.Code ciphertext is carried out cutting by terminal, is obtained multiple big Small is the code ciphertext blocks of 4 bytes, and is decrypted according to the key pair code ciphertext blocks of decruption key sequence.Lift a word The example of section decryption operation, according to the first of decruption key sequence key 0xCA to the first character section 0x9A's of code ciphertext When being decrypted, the exclusive or 0xCA high four of 0x9A high four can be taken out and obtain the four high of code plaintext, take out 0x9A low four Low four of position exclusive or 0xCA obtains the low byte 0,x55 four, obtained after calculating of code plaintext.It is decrypted when to code ciphertext After success, terminal is according to obtained plug-in component operation application program.
It should be understood that although each step in above-mentioned flow chart is shown successively according to the instruction of arrow, These steps are not that the inevitable sequence indicated according to arrow executes successively.Unless expressly stating otherwise herein, these steps Execution there is no stringent sequences to limit, these steps can execute in other order.Moreover, among the above at least one May include that either these sub-steps of multiple stages or stage are held in synchronization to multiple sub-steps step by step Row is completed, but can be executed at different times, the execution sequence in these sub-steps or stage be also not necessarily successively into Row, but can either the sub-step of other steps or at least part in stage are held in turn or alternately with other steps Row.
In one embodiment, as shown in fig. 6, providing a kind of code encryption device, including:Code and key obtain mould Block 602, encrypted byte and Key Acquisition Module 604, encrypting module 606, first return to module 608 and ciphertext composite module 610, Wherein:
Code and Key Acquisition Module 602 are obtained and are carried out to object code for obtaining pending encrypted object code Encrypted encryption key sequence, encryption key sequence include multiple encryption keys.
Encrypted byte and Key Acquisition Module 604, for being obtained from object code according to the byte order of object code Current byte to be encrypted, current encryption key is obtained according to the cipher key sequence of encryption key sequence from encryption key sequence.
Encrypting module 606 obtains corresponding work as current byte to be encrypted to be encrypted according to current encryption key Preceding byte cryptogram.
First returns to module 608, is currently waited for for returning to be obtained from object code according to the byte order of object code Encrypted byte, the step of current encryption key is obtained from encryption key sequence according to the cipher key sequence of encryption key sequence, directly Byte to be encrypted encryption to object code finishes.
Ciphertext composite module 610 obtains object code corresponding generation for obtained each byte cryptogram to be combined Code ciphertext.
Encrypting module 606 is used in one of the embodiments,:Cutting is carried out to current byte to be encrypted, is obtained multiple Corresponding bit data block to be encrypted.Each bit data block to be encrypted is added using different according to current encryption key Close algorithm is encrypted, and obtains the corresponding bit ciphertext of each bit data block to be encrypted.By each bit ciphertext into Row combination, obtains corresponding current byte ciphertext.
In one of the embodiments, as shown in fig. 7, code encryption device further includes:
Request receiving module 702, the object code for receiving terminal transmission obtain request, and object code obtains request and takes Band object code identifies.
Code and Key Acquisition Module 602 are used for:Pending encrypted object code is obtained according to object code mark.
Code encryption device further includes data packet composite module 704, for by code ciphertext and encryption key sequence into Code data packet is sent to terminal by row combination, the code data packet after being combined.
Code encryption device further includes in one of the embodiments,:
Hash calculation module carries out Hash calculation for being identified to object code, obtains corresponding target cryptographic Hash.
Insertion position obtains module, and position is inserted into for being worth to the corresponding data of encryption key sequence according to target Hash It sets.
Data packet composite module is used for:It is inserted into encryption key sequence in code ciphertext according to data insertion locations, is obtained Code data packet after combination.
In one of the embodiments, as shown in figure 8, providing a kind of code encryption device, including:
Ciphertext and Key Acquisition Module 802 are obtained for obtaining the corresponding code ciphertext of object code to object code The decruption key sequence being decrypted, decruption key sequence include multiple decruption keys.
Byte is decrypted with Key Acquisition Module 804, for being obtained from code ciphertext according to the byte order of code ciphertext Current byte to be decrypted, current decryption key is obtained according to the cipher key sequence of decruption key sequence from decruption key sequence.
Deciphering module 806 obtains corresponding work as current byte to be decrypted to be decrypted according to current decryption key Preceding byte is in plain text.
Second returns to module 808, is currently waited for for returning to be obtained from code ciphertext according to the byte order of code ciphertext The step of decrypting byte, current decryption key obtained from decruption key sequence according to the cipher key sequence of decruption key sequence, directly Byte to be decrypted decryption to code ciphertext finishes.
Plaintext composite module 810 obtains the corresponding mesh of code ciphertext for obtained each byte to be combined in plain text Mark code.
Deciphering module 806 is used in one of the embodiments,:Cutting is carried out to current byte to be decrypted, is obtained multiple Corresponding bit data block to be decrypted.Different solutions is used to each bit data block to be decrypted according to current decryption key Close algorithm is decrypted, and obtains the corresponding bit of each bit data block to be decrypted in plain text.By each bit in plain text into Row combination obtains corresponding current byte in plain text.
In one of the embodiments, as shown in figure 9, code decryption device further includes:
Identifier acquisition module 902, for during running application, obtaining object code mark.
Request sending module 904 obtains request for sending object code to server, and object code obtains request and carries Object code identifies.
Ciphertext and Key Acquisition Module 802 are used for:The corresponding code data packet of object code is received, code data packet is Combined according to code ciphertext and encryption key sequence, code ciphertext be server according to encryption key sequence to target What code was encrypted.Code data packet is parsed, code ciphertext and encryption key sequence are obtained, will be encrypted close Key sequence is as decruption key sequence.
Specific restriction about code encryption device and code decryption device may refer to above for code encryption The restriction of method and code decryption method, details are not described herein.In above-mentioned code encryption device and code decryption device Modules can be realized fully or partially through software, hardware and combinations thereof.Above-mentioned each module can be embedded in the form of hardware Or independently of in the processor in computer equipment, can also in a software form be stored in the memory in computer equipment, The corresponding operation of the above modules is executed in order to which processor calls.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junction Composition can be as shown in Figure 10.The computer equipment includes processor, memory and the network interface connected by system bus. Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory of the computer equipment includes non-easy The property lost storage medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program.The built-in storage Operation for operating system and computer program in non-volatile memory medium provides environment.The database of the computer equipment For store code encryption data.The network interface of the computer equipment is used to communicate by network connection with external terminal. To realize a kind of code encryption method when the computer program is executed by processor.
In one embodiment, a kind of computer equipment is provided, which can be terminal, internal structure Figure can be as shown in figure 11.The computer equipment includes the processor connected by system bus, memory, network interface, shows Display screen and input unit.Wherein, the processor of the computer equipment is for providing calculating and control ability.The computer equipment Memory includes non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system and computer Program.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The meter The network interface for calculating machine equipment is used to communicate by network connection with external terminal.When the computer program is executed by processor To realize a kind of code decryption method.The display screen of the computer equipment can be that liquid crystal display or electric ink are shown Screen, the input unit of the computer equipment can be the touch layer covered on display screen, can also be on computer equipment shell Button, trace ball or the Trackpad of setting can also be external keyboard, Trackpad or mouse etc..
It will be understood by those skilled in the art that structure shown in Figure 10 and Figure 11, only with application scheme phase The block diagram of the part-structure of pass does not constitute the restriction for the computer equipment being applied thereon to application scheme, specifically Computer equipment may include either combining certain components or with different than more or fewer components as shown in the figure Component is arranged.
In one embodiment, a kind of computer equipment is provided, including memory, processor and storage are on a memory And the computer program that can be run on a processor, processor realize following steps when executing computer program:It obtains pending Encrypted object code obtains the encryption key sequence that object code is encrypted, and encryption key sequence includes multiple encryptions Key;Current byte to be encrypted is obtained from object code according to the byte order of object code, according to encryption key sequence Cipher key sequence obtains current encryption key from encryption key sequence;Current byte to be encrypted is carried out according to current encryption key Encryption, obtains corresponding current byte ciphertext;Return, which is obtained according to the byte order of object code from object code, currently to be waited for Encrypted byte, the step of current encryption key is obtained from encryption key sequence according to the cipher key sequence of encryption key sequence, directly Byte to be encrypted encryption to object code finishes;Obtained each byte cryptogram is combined, object code correspondence is obtained Code ciphertext.
In one embodiment, current byte to be encrypted is added according to current encryption key performed by processor Close, the step of obtaining corresponding current byte ciphertext, includes:Cutting is carried out to current byte to be encrypted, obtains multiple corresponding wait for Encrypting bit bit data block;According to current encryption key to each bit data block to be encrypted using different Encryption Algorithm into Row encryption, obtains the corresponding bit ciphertext of each bit data block to be encrypted;Each bit ciphertext is combined, is obtained To corresponding current byte ciphertext.
In one embodiment, following steps are also realized when processor executes computer program:Receive the mesh that terminal is sent Code obtaining request is marked, object code obtains request and carries object code mark;Obtain the step of pending encrypted object code Suddenly include:Pending encrypted object code is obtained according to object code mark;Method further includes:By code ciphertext and encryption Key sequence is combined, and code data packet is sent to terminal by the code data packet after being combined.
In one embodiment, being combined code ciphertext and encryption key sequence performed by processor, obtains Further include before the step of code data packet after combination:Object code is identified and carries out Hash calculation, obtains corresponding target Cryptographic Hash;It is worth to the corresponding data insertion locations of encryption key sequence according to target Hash;Code ciphertext and encryption is close The step of key sequence is combined, code data packet after being combined include:According to data insertion locations in code ciphertext It is inserted into encryption key sequence, the code data packet after being combined.
In one embodiment, a kind of computer equipment is provided, including memory, processor and storage are on a memory And the computer program that can be run on a processor, processor realize following steps when executing computer program:Obtain target generation The corresponding code ciphertext of code, obtains the decruption key sequence that object code is decrypted, decruption key sequence includes multiple solutions Key.Current byte to be decrypted is obtained from code ciphertext according to the byte order of code ciphertext, according to decruption key sequence Cipher key sequence obtain current decryption key from decruption key sequence;According to current decryption key to current byte to be decrypted into Row decryption obtains corresponding current byte in plain text;It returns and is obtained currently from code ciphertext according to the byte order of code ciphertext Byte to be decrypted, the step of current decryption key is obtained from decruption key sequence according to the cipher key sequence of decruption key sequence, Until the byte to be decrypted decryption of code ciphertext finishes;Obtained each byte is combined in plain text, obtains code ciphertext pair The object code answered.
In one embodiment, current byte to be decrypted is solved according to current decryption key performed by processor Close, the step of obtaining corresponding current byte plaintext, includes:Cutting is carried out to current byte to be decrypted, obtains multiple corresponding wait for Decrypt bit data block;According to current decryption key to each bit data block to be decrypted using different decipherment algorithms into Row decryption obtains the corresponding bit of each bit data block to be decrypted in plain text;Each bit is combined in plain text, is obtained In plain text to corresponding current byte.
In one embodiment, following steps are also realized when processor executes computer program:In the process of operation application In, obtain object code mark;Object code is sent to server and obtains request, and object code obtains request and carries object code Mark;The step of corresponding code ciphertext of acquisition object code, the decruption key sequence that object code is decrypted in acquisition, wraps It includes:The corresponding code data packet of object code is received, code data packet is combined according to code ciphertext and encryption key sequence It obtains, code ciphertext is that server is encrypted to obtain according to encryption key sequence to object code;To code data packet It is parsed, obtains code ciphertext and encryption key sequence, using encryption key sequence as decruption key sequence.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program realizes following steps when being executed by processor:Pending encrypted object code is obtained, obtains and object code is carried out Encrypted encryption key sequence, encryption key sequence include multiple encryption keys;According to the byte order of object code from target Current byte to be encrypted is obtained in code, obtains current add from encryption key sequence according to the cipher key sequence of encryption key sequence Key;Current byte to be encrypted is encrypted according to current encryption key, obtains corresponding current byte ciphertext;Return to root Current byte to be encrypted is obtained from object code according to the byte order of object code, according to the cipher key sequence of encryption key sequence The step of current encryption key is obtained from encryption key sequence, until the byte to be encrypted encryption of object code finishes;Will To each byte cryptogram be combined, obtain the corresponding code ciphertext of object code.
In one embodiment, current byte to be encrypted is added according to current encryption key performed by processor Close, the step of obtaining corresponding current byte ciphertext, includes:Cutting is carried out to current byte to be encrypted, obtains multiple corresponding wait for Encrypting bit bit data block;According to current encryption key to each bit data block to be encrypted using different Encryption Algorithm into Row encryption, obtains the corresponding bit ciphertext of each bit data block to be encrypted;Each bit ciphertext is combined, is obtained To corresponding current byte ciphertext.
In one embodiment, following steps are also realized when processor executes computer program:Receive the mesh that terminal is sent Code obtaining request is marked, object code obtains request and carries object code mark;Obtain the step of pending encrypted object code Suddenly include:Pending encrypted object code is obtained according to object code mark;Method further includes:By code ciphertext and encryption Key sequence is combined, and code data packet is sent to terminal by the code data packet after being combined.
In one embodiment, being combined code ciphertext and encryption key sequence performed by processor, obtains Further include before the step of code data packet after combination:Object code is identified and carries out Hash calculation, obtains corresponding target Cryptographic Hash;It is worth to the corresponding data insertion locations of encryption key sequence according to target Hash;Code ciphertext and encryption is close The step of key sequence is combined, code data packet after being combined include:According to data insertion locations in code ciphertext It is inserted into encryption key sequence, the code data packet after being combined.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program realizes following steps when being executed by processor:Obtain the corresponding code ciphertext of object code, obtain to object code into The decruption key sequence of row decryption, decruption key sequence includes multiple decruption keys.According to the byte order of code ciphertext from generation Current byte to be decrypted is obtained in code ciphertext, is obtained currently from decruption key sequence according to the cipher key sequence of decruption key sequence Decruption key;Current byte to be decrypted is decrypted according to current decryption key, obtains corresponding current byte in plain text;It returns Current byte to be decrypted is obtained from code ciphertext according to the byte order of code ciphertext, the key according to decruption key sequence is suitable Sequence obtains the step of current decryption key from decruption key sequence, until the byte to be decrypted decryption of code ciphertext finishes;It will Obtained each byte is combined in plain text, obtains the corresponding object code of code ciphertext.
In one embodiment, current byte to be decrypted is solved according to current decryption key performed by processor Close, the step of obtaining corresponding current byte plaintext, includes:Cutting is carried out to current byte to be decrypted, obtains multiple corresponding wait for Decrypt bit data block;According to current decryption key to each bit data block to be decrypted using different decipherment algorithms into Row decryption obtains the corresponding bit of each bit data block to be decrypted in plain text;Each bit is combined in plain text, is obtained In plain text to corresponding current byte.
In one embodiment, following steps are also realized when processor executes computer program:In the process of operation application In, obtain object code mark;Object code is sent to server and obtains request, and object code obtains request and carries object code Mark;The step of corresponding code ciphertext of acquisition object code, the decruption key sequence that object code is decrypted in acquisition, wraps It includes:The corresponding code data packet of object code is received, code data packet is combined according to code ciphertext and encryption key sequence It obtains, code ciphertext is that server is encrypted to obtain according to encryption key sequence to object code;To code data packet It is parsed, obtains code ciphertext and encryption key sequence, using encryption key sequence as decruption key sequence.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with Instruct relevant hardware to complete by computer program, computer program can be stored in a non-volatile computer readable It takes in storage medium, the computer program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, this Shen Any reference to memory, storage, database or other media used in each embodiment please provided, may each comprise Non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above example can be combined arbitrarily, to keep description succinct, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield is all considered to be the range of this specification record.
Above example only expresses the several embodiments of the application, and description is more specific, but can not therefore and It is construed as limiting the scope of the patent.For those of ordinary skill in the art, the application design is not being departed from Under the premise of, various modifications and improvements can be made, these belong to the protection domain of the application.Therefore, the application patent Protection domain should be determined by the appended claims.

Claims (11)

1. a kind of code encryption method, the method includes:
Pending encrypted object code is obtained, the encryption key sequence that the object code is encrypted is obtained, it is described to add Close key sequence includes multiple encryption keys;
Current byte to be encrypted is obtained from the object code according to the byte order of the object code, according to the encryption The cipher key sequence of key sequence obtains current encryption key from the encryption key sequence;
The current byte to be encrypted is encrypted according to the current encryption key, obtains corresponding current byte ciphertext;
It returns to the byte order according to the object code and obtains current byte to be encrypted from the object code, according to The cipher key sequence of the encryption key sequence obtains the step of current encryption key from the encryption key sequence, until described The byte to be encrypted encryption of object code finishes;
Obtained each byte cryptogram is combined, the corresponding code ciphertext of the object code is obtained.
2. according to the method described in claim 1, it is characterized in that, described currently wait for according to the current encryption key described Encrypted byte is encrypted, and the step of obtaining corresponding current byte ciphertext includes:
Cutting is carried out to the current byte to be encrypted, obtains multiple corresponding bit data blocks to be encrypted;
Each bit data block to be encrypted is added using different Encryption Algorithm according to the current encryption key It is close, obtain the corresponding bit ciphertext of each bit data block to be encrypted;
Each bit ciphertext is combined, corresponding current byte ciphertext is obtained.
3. method according to claim 1 or 2, the method further includes:
It receives the object code that terminal is sent and obtains request, the object code obtains request and carries object code mark;
The step of acquisition pending encrypted object code includes:
Pending encrypted object code is obtained according to object code mark;
The method further includes:
The code ciphertext and the encryption key sequence are combined, the code data packet after being combined, it will be described Code data packet is sent to the terminal.
4. according to the method described in claim 3, it is characterized in that, described by the code ciphertext and the encryption key sequence Further include before the step of row are combined, code data packet after being combined:
The object code is identified and carries out Hash calculation, obtains corresponding target cryptographic Hash;
It is worth to the corresponding data insertion locations of the encryption key sequence according to the target Hash;
It is described to be combined the code ciphertext and the encryption key sequence, the step of the code data packet after being combined Suddenly include:
It is inserted into the encryption key sequence in the code ciphertext according to the data insertion locations, the code after being combined Data packet.
5. a kind of code decryption method, the method includes:
The corresponding code ciphertext of object code is obtained, the decruption key sequence that the object code is decrypted is obtained, it is described Decruption key sequence includes multiple decruption keys;
Current byte to be decrypted is obtained from the code ciphertext according to the byte order of the code ciphertext, according to the decryption The cipher key sequence of key sequence obtains current decryption key from the decruption key sequence;
The current byte to be decrypted is decrypted according to the current decryption key, obtains corresponding current byte in plain text;
It returns to the byte order according to the code ciphertext and obtains current byte to be decrypted from the code ciphertext, according to The cipher key sequence of the decruption key sequence obtains the step of current decryption key from the decruption key sequence, until described The byte to be decrypted decryption of code ciphertext finishes;
Obtained each byte is combined in plain text, obtains the corresponding object code of the code ciphertext.
6. a kind of code encryption device, described device include:
Code and Key Acquisition Module, for obtaining pending encrypted object code, acquisition adds the object code Close encryption key sequence, the encryption key sequence include multiple encryption keys;
Encrypted byte and Key Acquisition Module, for being obtained from the object code according to the byte order of the object code Current byte to be encrypted, current crypto is obtained according to the cipher key sequence of the encryption key sequence from the encryption key sequence Key;
Encrypting module obtains corresponding for the current byte to be encrypted to be encrypted according to the current encryption key Current byte ciphertext;
First returns to module, works as returning to the byte order according to the object code and being obtained from the object code It is close to obtain from the encryption key sequence current crypto according to the cipher key sequence of the encryption key sequence for preceding byte to be encrypted The step of key, until the byte to be encrypted encryption of the object code finishes;
Ciphertext composite module obtains the corresponding code of the object code for obtained each byte cryptogram to be combined Ciphertext.
7. a kind of code decryption device, described device include:
Ciphertext and Key Acquisition Module, for obtaining the corresponding code ciphertext of object code, obtain to the object code into The decruption key sequence of row decryption, the decruption key sequence includes multiple decruption keys;
Byte is decrypted with Key Acquisition Module, for being obtained from the code ciphertext according to the byte order of the code ciphertext Current byte to be decrypted, current decryption is obtained according to the cipher key sequence of the decruption key sequence from the decruption key sequence Key;
Deciphering module obtains corresponding for the current byte to be decrypted to be decrypted according to the current decryption key Current byte is in plain text;
Second returns to module, works as returning to the byte order according to the code ciphertext and being obtained from the code ciphertext It is close to obtain from the decruption key sequence current decryption according to the cipher key sequence of the decruption key sequence for preceding byte to be decrypted The step of key, until the byte to be decrypted decryption of the code ciphertext finishes;
Plaintext composite module obtains the corresponding target of the code ciphertext for obtained each byte to be combined in plain text Code.
8. a kind of computer equipment, including memory, processor and storage are on a memory and the meter that can run on a processor Calculation machine program, which is characterized in that the processor realizes any one of claims 1 to 4 institute when executing the computer program The step of stating code encryption method.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program quilt The step of method of code encryption described in any one of claims 1 to 4 is realized when processor executes.
10. a kind of computer equipment, including memory, processor and storage are on a memory and the meter that can run on a processor Calculation machine program, which is characterized in that the processor realizes code decryption side described in claim 5 when executing the computer program The step of method.
11. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of method of code decryption described in claim 5 is realized when being executed by processor.
CN201810235343.4A 2018-03-21 2018-03-21 Code encryption, decryption method, device, computer equipment and storage medium Pending CN108390759A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810235343.4A CN108390759A (en) 2018-03-21 2018-03-21 Code encryption, decryption method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810235343.4A CN108390759A (en) 2018-03-21 2018-03-21 Code encryption, decryption method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN108390759A true CN108390759A (en) 2018-08-10

Family

ID=63068281

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810235343.4A Pending CN108390759A (en) 2018-03-21 2018-03-21 Code encryption, decryption method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108390759A (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446751A (en) * 2018-09-30 2019-03-08 深圳市迷你玩科技有限公司 Generate the method, apparatus and storage medium of the data set including multiple subfiles
CN110069905A (en) * 2019-04-26 2019-07-30 深圳智慧园区信息技术有限公司 A kind of device and method of Springboot program encryption and decryption
CN110636081A (en) * 2019-10-18 2019-12-31 珠海市杰理科技股份有限公司 Data decryption processing method, data encryption processing method and device
CN111131158A (en) * 2019-11-21 2020-05-08 珠海剑心互动娱乐有限公司 Single byte symmetric encryption and decryption method, device and readable medium
CN111245808A (en) * 2020-01-07 2020-06-05 深圳壹账通智能科技有限公司 Data encryption and decryption method and device and computer equipment
CN112151069A (en) * 2020-08-20 2020-12-29 深圳市捷视飞通科技股份有限公司 Voice data processing method and device, computer equipment and storage medium
CN112241516A (en) * 2019-07-16 2021-01-19 福建省天奕网络科技有限公司 Source code protection method and storage medium for project development process
CN112287366A (en) * 2020-10-29 2021-01-29 平安信托有限责任公司 Data encryption method and device, computer equipment and storage medium
CN112597453A (en) * 2020-12-04 2021-04-02 光大科技有限公司 Program code encryption and decryption method and device
CN112887402A (en) * 2021-01-25 2021-06-01 北京云思畅想科技有限公司 Encryption and decryption method, system, electronic equipment and storage medium
CN113489589A (en) * 2021-09-06 2021-10-08 蜂巢能源科技有限公司 Data encryption and decryption method and device and electronic equipment
CN114745181A (en) * 2022-04-11 2022-07-12 中国南方电网有限责任公司 Data processing method and device
CN117811734A (en) * 2024-02-29 2024-04-02 浙江金网信息产业股份有限公司 Service source code encryption storage and evaluation and authentication method
CN117811734B (en) * 2024-02-29 2024-06-04 浙江金网信息产业股份有限公司 Service source code encryption storage and evaluation and authentication method

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070253549A1 (en) * 2006-04-18 2007-11-01 Ufuk Celikkan Encryption apparatus and method for providing an encrypted file system
CN101692636A (en) * 2009-10-27 2010-04-07 中山爱科数字科技有限公司 Data element and coordinate algorithm-based method and device for encrypting mixed data
JP2011123229A (en) * 2009-12-10 2011-06-23 Fuji Xerox Co Ltd Program code encryption device and program
CN102413181A (en) * 2011-11-16 2012-04-11 中国软件与技术服务股份有限公司 Method and system for improving performance of server
CN103685162A (en) * 2012-09-05 2014-03-26 中国移动通信集团公司 File storing and sharing method
CN104410616A (en) * 2014-11-20 2015-03-11 广州日滨科技发展有限公司 Method and system for encrypting, decrypting and transmitting data
CN104426849A (en) * 2013-08-22 2015-03-18 深圳中兴网信科技有限公司 Method and system for realizing data security protection
CN104866738A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Program code protection method and device
CN106850220A (en) * 2017-02-22 2017-06-13 腾讯科技(深圳)有限公司 Data ciphering method, data decryption method and device
CN106953875A (en) * 2017-04-26 2017-07-14 吉林大学珠海学院 Ordered encryption method based on multi-key cipher stream cipher
CN107579962A (en) * 2017-08-24 2018-01-12 中积有限公司 A kind of method and device of source code encryption and decryption

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070253549A1 (en) * 2006-04-18 2007-11-01 Ufuk Celikkan Encryption apparatus and method for providing an encrypted file system
CN101692636A (en) * 2009-10-27 2010-04-07 中山爱科数字科技有限公司 Data element and coordinate algorithm-based method and device for encrypting mixed data
JP2011123229A (en) * 2009-12-10 2011-06-23 Fuji Xerox Co Ltd Program code encryption device and program
CN102413181A (en) * 2011-11-16 2012-04-11 中国软件与技术服务股份有限公司 Method and system for improving performance of server
CN103685162A (en) * 2012-09-05 2014-03-26 中国移动通信集团公司 File storing and sharing method
CN104426849A (en) * 2013-08-22 2015-03-18 深圳中兴网信科技有限公司 Method and system for realizing data security protection
CN104866738A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Program code protection method and device
CN104410616A (en) * 2014-11-20 2015-03-11 广州日滨科技发展有限公司 Method and system for encrypting, decrypting and transmitting data
CN106850220A (en) * 2017-02-22 2017-06-13 腾讯科技(深圳)有限公司 Data ciphering method, data decryption method and device
CN106953875A (en) * 2017-04-26 2017-07-14 吉林大学珠海学院 Ordered encryption method based on multi-key cipher stream cipher
CN107579962A (en) * 2017-08-24 2018-01-12 中积有限公司 A kind of method and device of source code encryption and decryption

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446751A (en) * 2018-09-30 2019-03-08 深圳市迷你玩科技有限公司 Generate the method, apparatus and storage medium of the data set including multiple subfiles
CN110069905A (en) * 2019-04-26 2019-07-30 深圳智慧园区信息技术有限公司 A kind of device and method of Springboot program encryption and decryption
CN112241516A (en) * 2019-07-16 2021-01-19 福建省天奕网络科技有限公司 Source code protection method and storage medium for project development process
CN112241516B (en) * 2019-07-16 2023-11-10 福建省天奕网络科技有限公司 Source code protection method and storage medium for project development process
CN110636081A (en) * 2019-10-18 2019-12-31 珠海市杰理科技股份有限公司 Data decryption processing method, data encryption processing method and device
CN111131158A (en) * 2019-11-21 2020-05-08 珠海剑心互动娱乐有限公司 Single byte symmetric encryption and decryption method, device and readable medium
CN111245808B (en) * 2020-01-07 2022-06-21 深圳壹账通智能科技有限公司 Data encryption and decryption method and device and computer equipment
CN111245808A (en) * 2020-01-07 2020-06-05 深圳壹账通智能科技有限公司 Data encryption and decryption method and device and computer equipment
CN112151069A (en) * 2020-08-20 2020-12-29 深圳市捷视飞通科技股份有限公司 Voice data processing method and device, computer equipment and storage medium
CN112151069B (en) * 2020-08-20 2024-03-15 深圳市捷视飞通科技股份有限公司 Voice data processing method, device, computer equipment and storage medium
CN112287366A (en) * 2020-10-29 2021-01-29 平安信托有限责任公司 Data encryption method and device, computer equipment and storage medium
CN112597453A (en) * 2020-12-04 2021-04-02 光大科技有限公司 Program code encryption and decryption method and device
CN112887402A (en) * 2021-01-25 2021-06-01 北京云思畅想科技有限公司 Encryption and decryption method, system, electronic equipment and storage medium
CN113489589A (en) * 2021-09-06 2021-10-08 蜂巢能源科技有限公司 Data encryption and decryption method and device and electronic equipment
CN114745181A (en) * 2022-04-11 2022-07-12 中国南方电网有限责任公司 Data processing method and device
CN117811734A (en) * 2024-02-29 2024-04-02 浙江金网信息产业股份有限公司 Service source code encryption storage and evaluation and authentication method
CN117811734B (en) * 2024-02-29 2024-06-04 浙江金网信息产业股份有限公司 Service source code encryption storage and evaluation and authentication method

Similar Documents

Publication Publication Date Title
CN108390759A (en) Code encryption, decryption method, device, computer equipment and storage medium
US11184164B2 (en) Secure crypto system attributes
CN113691502B (en) Communication method, device, gateway server, client and storage medium
CN103345609B (en) A kind of text encipher-decipher method and encryption and decryption equipment
CN110781140B (en) Method, device, computer equipment and storage medium for signing data in blockchain
CN112507365B (en) Data matching method, terminal and storage medium
CN108199847B (en) Digital security processing method, computer device, and storage medium
CN110768784B (en) Password transmission method, device, computer equipment and storage medium
CN103414682A (en) Method for cloud storage of data and system
CN113572743B (en) Data encryption and decryption methods and devices, computer equipment and storage medium
US9917695B2 (en) Authenticated encryption method using working blocks
CN102355350A (en) File encryption method applied for mobile intelligent terminal and system thereof
CN109376824A (en) Dynamic Two-dimensional code generating method and system
CN109697370A (en) Database data encipher-decipher method, device, computer equipment and storage medium
CN116155491B (en) Symmetric key synchronization method of security chip and security chip device
CN110381067A (en) IP packet encryption method, decryption method and its device
CN115766244A (en) Internet of vehicles information encryption method and device, computer equipment and storage medium
US20220216999A1 (en) Blockchain system for supporting change of plain text data included in transaction
CN115499118A (en) Message key generation method, message key generation device, file encryption method, message key decryption method, file encryption device, file decryption device and medium
US11595201B2 (en) System and method for generation of a disposable software module for cryptographic material protection
CN114124440A (en) Secure transmission method, device, computer equipment and storage medium
CN116015620B (en) Satellite image data encryption and decryption method and system
CN116074057A (en) Data encryption method, data decryption method, device, equipment and storage medium
CN117850739A (en) Pseudo-random number generation method, device, equipment and storage medium
CN117278212A (en) Key generation method, device, system, electronic equipment and readable 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: 20180810