




技术领域technical field
本发明涉及计算机安全领域,特别涉及计算机加密领域,具体的讲是对软件进行加密、解密的方法及加密、解密的装置。The invention relates to the field of computer security, in particular to the field of computer encryption, in particular to a method for encrypting and decrypting software and an encryption and decryption device.
背景技术Background technique
现在,软件已经成为一种具有独立的价值的商品,软件的功能、执行过程和编码等等都很可能成为竞争对手或其它组织或个人抄袭的对象。所以软件,特别是由中间语言,例如,Java,.NET等编程语言编写的软件很容易通过逆向工程被逆向编码,例如使用.NET Reflect(微软的逆向工程工具),JAD(Java的逆向工程工具),从而得到软件的核心算法、编码等信息,这些信息如果被破解者恶意使用会造成开发者的损失,例如,模仿软件的核心算法,绕过注册过的软件等。Now, software has become a commodity with independent value, and the functions, execution process and coding of software are likely to be copied by competitors or other organizations or individuals. So software, especially software written in intermediate languages, such as Java, .NET and other programming languages, can be easily reverse-coded by reverse engineering, such as using .NET Reflect (Microsoft’s reverse engineering tool), JAD (Java’s reverse engineering tool ), so as to obtain information such as the core algorithm and code of the software. If this information is maliciously used by the cracker, it will cause losses to the developer, for example, imitating the core algorithm of the software, bypassing the registered software, etc.
在现有技术中,通过更改程序内部函数名称,重新安排控制流程或其它方法来迷惑破解者的破解行为具有一定的效果,能够使逆向编码后的软件程序很难读懂或者无法读懂,但是这种源代码的保护机制不能避免软件程序被逆向编码,软件程序的信息还是有可能泄漏。In the prior art, changing the name of the internal function of the program, rearranging the control flow or other methods to confuse the cracking behavior of the cracker has a certain effect, which can make the reverse coded software program difficult or impossible to read, but This source code protection mechanism cannot prevent the software program from being reverse-coded, and the information of the software program may still be leaked.
在《计算机与信息技术》2005年5月刊“利用DES加密算法保护Java源代码”一文中,公开了一种将Java编辑的软件进行加密,并在运行时解密的方案。该方案使用数据加密标准(DES:Data Encryption Standard)将可执行的Java程序加密,将加密后的程序编码和密钥存储于存储器内,加载器将加密的Java程序编码和密钥加载到系统中,调出密钥并将程序编码解密,转换为可执行的编码形式,并载入Java虚拟机(JVM)中运行。In the May 2005 issue of "Computer and Information Technology", "Using the DES Encryption Algorithm to Protect the Java Source Code", a scheme for encrypting the software edited by Java and decrypting it at runtime is disclosed. This scheme uses the Data Encryption Standard (DES: Data Encryption Standard) to encrypt the executable Java program, store the encrypted program code and key in the memory, and the loader loads the encrypted Java program code and key into the system , call out the key and decrypt the program code, convert it into an executable code form, and load it into a Java virtual machine (JVM) to run.
上述方法很容易被破解者跟踪,破解者只要使用调试工具就可以跟踪程序启动的每一步。如果程序在每次运行时都访问某一个文件,从该文件中获得密钥或者获得系统符号名,这样会使破解者怀疑该文件可能为该软件的密钥文件或者系统符号名对照表,如果破解者确定了该文件就是密钥文件,则会千方百计的破解该密钥文件,如果破解了密钥文件,则就可以将密文的软件编码转换为明文的软件编码,对该软件就可以进行逆向工程以生成源代码,从而造成软件所有人的损失。The above method is easy to be tracked by the cracker, and the cracker can track every step of the program startup as long as he uses a debugging tool. If the program accesses a certain file every time it runs, and obtains the key or the system symbol name from the file, this will make the cracker suspect that the file may be the key file of the software or the system symbol name comparison table, if If the cracker determines that the file is the key file, he will do everything possible to crack the key file. If the key file is cracked, the software code of the ciphertext can be converted into the software code of the plain text, and the software can be processed. Reverse engineering to generate source code at the loss of the owner of the software.
发明内容Contents of the invention
为了解决以上问题,增加软件被反编译的难度,本发明的目的在于提供一种对软件进行加密的方法和一种相应的解密方法,加入了门限加密特征,在每次启动软件时获取门限密钥因子的地址都不一样,使破解者不能确定哪些是密钥地址。In order to solve the above problems and increase the difficulty of software decompilation, the purpose of the present invention is to provide a method for encrypting software and a corresponding decryption method, adding a threshold encryption feature, and obtaining the threshold encryption every time the software is started. The addresses of the key factors are different, so that the cracker cannot determine which are the key addresses.
本发明还提供了一种对软件进行加密的装置和一种相应的解密装置,能够随机的将多个门限密钥因子存储于软件的不同段中,解密时随机的从某些段中取得门限密钥因子用于解密软件。The present invention also provides a device for encrypting software and a corresponding decryption device, which can randomly store multiple threshold key factors in different segments of the software, and randomly obtain thresholds from certain segments when decrypting. The key factor is used to decrypt the software.
步骤101,利用第一加密模块将存储介质中的软件明文加密为第一软件密文,其中解密所用的密钥为第一密钥SK;
步骤102,第二加密模块利用n个门限密钥因子生成第二密钥,使用该第二密钥将所述第一密钥SK加密为密钥密文PSK,并将所述密钥密文PSK拼接于所述第一软件密文中,其中n>1的正整数;
步骤103,利用封装模块将所述密钥密文PSK和第一软件密文作为一体分为n段,将所述门限密钥因子拼接于所述分段中,形成第二软件密文,并存储于所述存储介质中。
根据本发明加密方法的一个进一步的方面,所述步骤101中所述的加密方法包括,对称加密算法或非对称加密算法。According to a further aspect of the encryption method of the present invention, the encryption method described in
根据本发明加密方法的再一个进一步的方面,所述步骤102中使用的门限密钥算法包括沙米尔门限密钥算法。According to a further aspect of the encryption method of the present invention, the threshold key algorithm used in
根据本发明加密方法的另一个进一步的方面,所述步骤103中,所述封装模块将所述密钥密文PSK和第一软件密文作为一体分为n段,C代表所述n段中的任意一段,段C由块C0,C2,…,Cm-1构成,针对于每一段C和相应的k计算:According to another further aspect of the encryption method of the present invention, in the
C′0=C0×k (E0)C′0 =C0 ×k (E0)
C′1=C1×k+C0 (E2)C'1 =C1 ×k+C0 (E2)
C′2=C2×k+C1 (E3)C'2 =C2 ×k+C1 (E3)
… … …... ... ...
C′m-1=Cm-1×k+Cm-2 (Em-1)C'm-1 =Cm-1 ×k+Cm-2 (Em-1)
C′m=Cm-1 (Em)C′m =Cm-1 (Em)
以上的×为算术乘法运算,同时计算门限密钥因子k的的哈希值h,合并C′0至C′m形成C’,将n段C’和相应的哈希值h拼接到一起形成所述的第二软件密文。The above × is an arithmetic multiplication operation. At the same time, the hash value h of the threshold key factor k is calculated, and C'0 to C'm are combined to form C', and n segments of C' and the corresponding hash value h are spliced together to form The second software ciphertext.
一种对软件进行解密的方法,在软件加载的过程中包括以下步骤:A method for decrypting software includes the following steps in the software loading process:
步骤201,解封装模块从第二软件密文的n个段中随机取t个门限密钥因子,将所述第二软件密文恢复为第一软件密文和密钥密文PSK,其中1≤t≤n,n为大于1的正整数;
步骤202,提取所述密钥密文PSK,第二解密模块根据所述t个门限密钥因子生成第二密钥,利用该第二密钥将密钥密文PSK解密为第一密钥SK;
步骤203,第一解密模块使用所述第一密钥SK将所述第一软件密文解密,并将软件明文传送给CPU,以执行该软件。
根据本发明解密方法的一个进一步的方面,所述步骤201中,所述解封装模块分别对n段第二软件密文中的每一段计算:根据E0至Em消去C0,C1,…,Cm-1,得到等式0=-C′mkm+C′m-1×km-1-C′m-2×km-2+...+(-1)m-1×C′0 (P0),According to a further aspect of the decryption method of the present invention, in the
求解该等式中的k,当k的哈希值等于该C’段相应的哈希值h时,用该k将C′0至C′m恢复为C0至Cm-1,将C0至Cm-1合并以获得段C,该段C为第一软件密文和密钥密文作为一体的n段中的一段;求出n个k,并将第二软件密文恢复为第一软件密文和密钥密文PSK。Solve the k in the equation, when the hash value of k is equal to the corresponding hash value h of the C' segment, use this k to restore C'0 to C'm to C0 to Cm-1 , and C0 to Cm-1 are merged to obtain segment C, and this segment C is a segment in the n segments in which the first software ciphertext and the key ciphertext are integrated; find n k, and recover the second software ciphertext as A first software ciphertext and a key ciphertext PSK.
根据本发明解密方法的再一个进一步的方面,使用多项式的牛顿迭代法所述求解等式(P0)中的k。According to yet a further aspect of the decryption method of the present invention, equation (P0) is solved for k using the polynomial Newton iterative method.
一种对软件进行加密的装置,其特征在于包括,第一加密模块,第二加密模块和封装模块;所述第一加密模块,利用第一密钥SK将软件明文加密为第一软件密文;所述第二加密模块与所述第一加密模块相连接,利用n个门限密钥因子生成第二密钥,使用该第二密钥将所述第一密钥SK加密为密钥密文PSK,并将所述密钥密文PSK存储于所述第一软件密文中;所述封装模块与所述第二加密模块相连接,将所述第一软件密文分为n段,将所述门限密钥因子拼接于所述分段中,形成第二软件密文。A device for encrypting software, characterized in that it includes a first encryption module, a second encryption module and an encapsulation module; the first encryption module uses a first key SK to encrypt software plaintext into a first software ciphertext ; The second encryption module is connected to the first encryption module, using n threshold key factors to generate a second key, using the second key to encrypt the first key SK into a key ciphertext PSK, and store the key ciphertext PSK in the first software ciphertext; the encapsulation module is connected to the second encryption module, divides the first software ciphertext into n sections, and divides the The threshold key factor is spliced into the segment to form the second software ciphertext.
一种对软件进行解密的装置,其特征在于包括,解封装模块,第二解密模块和第一解密模块;所述解封装模块将第二软件密文解封装为第一软件密文和密钥密文PSK,并在所述第一软件密文的n个段中随机取t个门限密钥因子;所述第二解密模块与所述解封装模块相连接,根据所述t个门限密钥因子生成第二密钥,利用该第二密钥将密钥密文PSK解密为第一密钥SK;所述第一解密模块与所述第二解密模块相连接,使用所述第一密钥SK将所述第一软件密文解密,获得软件明文并传送给CPU,以执行该软件。A device for decrypting software, characterized in that it includes a decapsulation module, a second decryption module and a first decryption module; the decapsulation module decapsulates the second software ciphertext into the first software ciphertext and a key Ciphertext PSK, and randomly select t threshold key factors in the n segments of the first software ciphertext; the second decryption module is connected to the decapsulation module, and according to the t threshold key factors factor to generate a second key, and use the second key to decrypt the key ciphertext PSK into a first key SK; the first decryption module is connected to the second decryption module, and the first key is used The SK decrypts the first software ciphertext, obtains the software plaintext and sends it to the CPU to execute the software.
本发明的有益效果在于,加强了软件加密密钥的保护,使破解者很难通过跟踪软件加载过程,获得密钥物理地址从而通过分析密钥实现软件破解的目的本发明通过动态存储密钥的技术加强了现有给软件加密,以提高其安全性的方案。The beneficial effect of the present invention is that the protection of the software encryption key is strengthened, making it difficult for crackers to obtain the physical address of the key by tracking the software loading process, thereby realizing the purpose of software cracking by analyzing the key. The technology enhances existing schemes for encrypting software to increase its security.
附图说明Description of drawings
图1为本发明进行软件加密的流程图;Fig. 1 is the flow chart that the present invention carries out software encryption;
图2为本发明进行软件解密的流程图;Fig. 2 is the flow chart that the present invention carries out software decryption;
图3为本发明进行软件加密的装置结构示意图;Fig. 3 is a schematic structural diagram of a device for encrypting software in the present invention;
图4为本发明进行软件解密的装置结构示意图;Fig. 4 is a schematic structural diagram of a device for decrypting software according to the present invention;
图5为实施本发明时的装置结构示意图。Fig. 5 is a schematic diagram of the device structure when implementing the present invention.
具体实施方式Detailed ways
下面,结合附图对于本发明进行如下详细说明。Hereinafter, the present invention will be described in detail in conjunction with the accompanying drawings.
本发明使用门限密钥的理论对所述第一密钥进一步保护,并将门限密钥因子拼接被加密的软件中,这样使破解者每次跟踪程序运行时都获得不同的跳转地址,使破解者无法确定去哪寻找所述的第一密钥。本发明所能够保护的软件不仅限于可执行程序,还包括功能模块和软件的核心算法等。现有的门限加密方法是,利用一个随机数作为第二密钥将所述第一密钥SK加密为密钥密文PSK,同时生成用于计算该随机数的n个门限密钥因子;在需要密钥进行解密的时候,只需要t个门限密钥因子(t≤n)生成所述第二密钥用于解密。门限密码学提出的目的是为了权利分散及提高安全性,权利分散性体现于在使用门限密码方法进行解密时,当每个人都持有一个密钥因子,则必须达到一定数量(门限值t)的人合作才能完成解密;安全性,一方面是为了防止获得一个密钥因子就使加密失去意义,在这群人中只要少于门限值的人被攻陷,那么还是无法解密的;另一方面,防止密钥因子丢失影响正常的解密工作,因为只要有多于或等于门限值的人拥有有效的密钥因子,还是能够解密。本发明具体实施方式中使用门限加密算法以沙米尔方案(Shamir)为例,但不限于沙米尔方案,还可以使用阿斯木斯-布隆门限密钥方案(Asmuth-Bloom)。The present invention uses the threshold key theory to further protect the first key, and splices the threshold key factor into the encrypted software, so that the cracker can obtain different jump addresses every time the tracking program runs, so that Crackers cannot determine where to find said first key. The software protected by the present invention is not limited to executable programs, but also includes functional modules and core algorithms of the software. The existing threshold encryption method is to use a random number as the second key to encrypt the first key SK into a key ciphertext PSK, and generate n threshold key factors for calculating the random number; When a key is needed for decryption, only t threshold key factors (t≤n) are required to generate the second key for decryption. The purpose of threshold cryptography is to decentralize rights and improve security. The decentralization of rights is reflected in the use of threshold cryptographic methods for decryption. When everyone holds a key factor, it must reach a certain number (threshold value t ) people cooperate to complete the decryption; security, on the one hand, is to prevent encryption from being meaningless after obtaining a key factor. As long as people who are less than the threshold are compromised in this group of people, it is still impossible to decrypt; on the other hand, On the one hand, it prevents the loss of the key factor from affecting the normal decryption work, because as long as there are people with valid key factors greater than or equal to the threshold value, they can still decrypt. The Shamir scheme (Shamir) is used as an example of the threshold encryption algorithm used in the specific embodiment of the present invention, but it is not limited to the Shamir scheme, and the Asmuth-Bloom threshold key scheme (Asmuth-Bloom) can also be used.
在销售软件之前,软件的卖主利用加密算法对明文的软件进行加密,该加密算法为现有的对称或非对称加密算法,例如,AES,DES或RSA,ECC等。如果使用了对称加密算法,则软件加密密钥与解密密钥相同,也可用于解密,该解密密钥为密钥SK(即,第一密钥)。如果使用非对称加密算法,则加密密钥与所述非对称加密算法的解密密钥存在着对应关系,在本发明中解密密钥为密钥SK(即,第一密钥)。因为软件的密钥SK是关系到软件能否被破解的关键,所以关于该密钥SK的安全就相当重要,本发明特别使用门限加密的沙米尔方案通过n个门限密钥因子K1,K2,…,Kn的运算生成第二密钥,利用该第二密钥将该密钥SK加密为密钥密文PSK,将密钥密文PSK拼接到被加密的软件中,例如将其拼接于被加密软件的头部或者尾部。并且将该n个门限密钥因子由一个强壮的拼接算法(或者简单的拼接方式)拼接于被加密的软件不同的物理段落中,例如,拼接于软件的头部或尾部。本发明通过第一步,加密需要保护的软件;第二步,加密第一步中的第一密钥SK;第三步,拼接实现第二步加密的密钥因子;在软件运行需要解密时,随机地从被保护的软件密文中取得t(1≤t≤n,t和n均为正整数)个门限密钥因子,然后通过沙米尔方案就可以从密钥密文PSK中将被加密软件的第一密钥SK解出,从而对软件密文进行解密。门限密钥恢复方法使软件加载的过程产生了动态特性,每次都从软件中不同的位置获得门限密钥因子用于解密,可以有效针对跟踪软件加载的破解方法,增加破解的难度。Before selling the software, the vendor of the software encrypts the plaintext software with an encryption algorithm, which is an existing symmetric or asymmetric encryption algorithm, such as AES, DES or RSA, ECC, etc. If a symmetric encryption algorithm is used, the software encryption key is the same as the decryption key and can also be used for decryption, and the decryption key is the key SK (ie, the first key). If an asymmetric encryption algorithm is used, there is a corresponding relationship between the encryption key and the decryption key of the asymmetric encryption algorithm. In the present invention, the decryption key is the key SK (ie, the first key). Because the software key SK is the key to whether the software can be cracked, the security of the key SK is very important. The present invention especially uses the Shamir scheme of threshold encryption to pass n threshold key factors K1 , K2 , ..., the operation ofKn generates the second key, and encrypts the key SK into the key ciphertext PSK by using the second key, and splicing the key ciphertext PSK into the encrypted software, for example, it Spliced at the head or tail of the encrypted software. And the n threshold key factors are spliced into different physical sections of the encrypted software by a strong splicing algorithm (or a simple splicing method), for example, spliced at the head or tail of the software. In the present invention, the first step is to encrypt the software to be protected; the second step is to encrypt the first key SK in the first step; the third step is to splicing to realize the key factor of the second step encryption; when the software operation needs to be decrypted , randomly obtain t (1≤t≤n, t and n are both positive integers) threshold key factors from the protected software ciphertext, and then use the Shamir scheme to encrypt the key ciphertext PSK The first key SK of the software is decrypted to decrypt the software ciphertext. The threshold key recovery method makes the process of software loading dynamic, and each time the threshold key factor is obtained from different positions in the software for decryption, which can effectively target the cracking method of tracking software loading and increase the difficulty of cracking.
如图1所示,为本发明软件加密过程的流程图。As shown in Fig. 1, it is a flow chart of the software encryption process of the present invention.
步骤101,选择合适的对称加密算法,例如AES,DES等,利用第一加密模块将软件的明文加密为第一软件密文,其所使用密钥为第一密钥SK。
步骤102,第二加密模块利用门限加密算法中的Shamir算法保护上述密钥SK,在域Zp中使用拉格朗日插值多项式算法的Shamir方案,其中Zp是由素数域,生成t-1次的多项式:
Pn(x)=a0+a1x+a2x2+...+at-1xt-1,Pn (x)=a0 +a1 x+a2 x2 +...+at-1 xt-1 ,
其中Pn(x)的系数a0,…,an是随机生成的。The coefficients a0 ,..., an of Pn (x) are randomly generated.
令x1=1,计算Pn(1)=a0+a1+a2+...+at-1,Let x1 =1, calculate Pn (1)=a0 +a1 +a2 +...+at-1 ,
… … …... ...
令xn=n,计算Pn(n)=a0+a1n+a2n2+...+at-1nt-1。Let xn =n, and calculate Pn (n)=a0 +a1 n+a2 n2 +...+at-1 nt-1 .
其中,Pn(1),…,Pn(n)<264,n为大于1的正整数,t为大于等于1小于n的正整数。Wherein, Pn (1), ..., Pn (n)<264 , n is a positive integer greater than 1, and t is a positive integer greater than or equal to 1 and less than n.
然后生成了n个门限密钥因子对K1=(1,Pn(1)),…,Kn=(n,Pn(n)),使用a0为第二密钥将密钥SK加密为密钥密文PSK。并将加密后的密钥密文PSK拼接于所述第一软件密文的头部或尾部,本步骤可以使用现有技术中的存储方法。Then, n threshold key factor pairs K1 =(1, Pn (1)),..., Kn =(n, Pn (n)) are generated, using a0 as the second key to convert the key SK Encrypted as key ciphertext PSK. And splicing the encrypted key ciphertext PSK to the head or tail of the first software ciphertext, this step can use the storage method in the prior art.
步骤103,封装模块将第一软件密文和密钥密纹作为一体分割为n个段,将n个门限密钥因子分别拼接于n个段中。在此,可以直接将n个密钥因子分别拼接于第一软件密文每一段的头部或尾部,如图中所示黑色的部分为密钥因子,白色部分为n段,形成第二软件密文并存储于存储介质中,也可以使用下面的拼接方法,形成更加复杂的第二软件密文。In
C代表第一软件密文的某一段,其中每段C由块C0,C2,…,Cm-1构成,k代表门限密钥因子对Ki中的Pn(i),具体拼接过程如下,C represents a certain section of the first software ciphertext, where each section C is composed of blocks C0 , C2 , ..., Cm-1 , k represents the Pn (i) in the threshold key factor pair Ki , the specific splicing The process is as follows,
C′0=C0×k (E0)C′0 =C0 ×k (E0)
C′1=C1×k+C0 (E2)C'1 =C1 ×k+C0 (E2)
C′2=C2×k+C1 (E3)C'2 =C2 ×k+C1 (E3)
… … …... ... ...
C′m-1=Cm-1×k+Cm-2 (Em-1)C'm-1 =Cm-1 ×k+Cm-2 (Em-1)
C′m=Cm-1 (Em)C′m =Cm-1 (Em)
其中×为算术乘法运算。作为优选的实施例,每一块Ci的长度等于k的长度,即length(Ci)=length(k)。例如,软件加密后分为n个段,其中某一段C的长度为128字节,密钥因子的长度为16字节,则将C分成8块,即m=7,C的每一块Ci的长度为16字节。同时计算h=hash(k),即将门限密钥因子k的哈希值记录下来,用于解密时验证恢复的门限密钥因子是否正确。C′0至C′m合并成一段完整的C’后,再和哈希值h进行拼接(h加在C’段的前面或后面),然后拼接所有段C’和相应的哈希值h形成最终存储的软件密文,即第二软件密文,并将第二软件密文存储于存储介质中。Where × is an arithmetic multiplication operation. As a preferred embodiment, the length of each block Ci is equal to the length of k, that is, length(Ci )=length(k). For example, after the software is encrypted, it is divided into n segments, and the length of a certain segment C is 128 bytes, and the length of the key factor is 16 bytes, then C is divided into 8 blocks, that is, m=7, and each block of C is Ci The length is 16 bytes. At the same time, calculate h=hash(k), that is, record the hash value of the threshold key factor k, and use it to verify whether the restored threshold key factor is correct during decryption. C'0 to C'm are merged into a complete C', and then spliced with the hash value h (h is added before or after the C' segment), and then spliced all segments C' and the corresponding hash value h The finally stored software ciphertext, that is, the second software ciphertext is formed, and the second software ciphertext is stored in the storage medium.
在Shamir门限密钥加密方案中,可以用任意的t个密钥因子恢复第二密钥a0,以用于解密PSK,因此软件装载器在每次装载被加密的软件时,都将会随机的从n个密钥因子中选择t个,用于解密PSK,以提供一种高强度的防止破解者跟踪、分析软件装载过程,并具有动态特点的保护机制。In the Shamir threshold key encryption scheme, any t key factors can be used to restore the second key a0 to decrypt the PSK, so the software loader will randomly Select t from n key factors to decrypt the PSK, so as to provide a high-strength protection mechanism that prevents crackers from tracking and analyzing the software loading process and has dynamic characteristics.
图2为本发明软件加载解密的流程图。软件的启动阶段,由加载器从存储介质中将第二软件密文加载到内存中,其中黑色部分为密钥因子,白色部分为第一软件密文和PSK,如果在加密步骤中没有使用如步骤103那样的拼接方法,而只是将n个密钥因子直接拼接于软件密文相应段落的头部或尾部,则步骤201可以通过解封装模块直接从随机选取的t段密文中直接得到t个密钥因子,并将第二软件密文恢复为第一软件密文和PSK。如果在加密时使用了如步骤103中所述那样的拼接方法,则通过解封装模块选择一段密文C’和相应的哈希值h,恢复该段密文上携带的门限密钥因子k。恢复算法如下:Fig. 2 is a flow chart of software loading and decryption in the present invention. In the startup phase of the software, the loader loads the second software ciphertext from the storage medium into the memory, wherein the black part is the key factor, and the white part is the first software ciphertext and PSK, if no such as
消去E0至Em中的C0至Cm-1,将Cm-1=C′m代入(Em-1),获得等式Cm-2=C′m-1-C′m×k+Cm×k2,将该等式代入(Em-2)……,直到代入(E0),最后形成0=-C′mkm+C′m-1×km-1-C′m-2×km-2+...+(-1)m-1×C′0,将0=-C′mkm+C′m-1×km-1-C′m-2×km-2+...+(-1)m-1×C′0标记为P0,密钥因子k为上述多项式的根,通过在多项式数值域的计算找出根,可以从第二软件密文C′0,C′1,…,C′m中恢复k。在本实施例中使用牛顿迭代算法寻找多项式P0的一个或多个根。C0 to Cm-1 in E0 to Em are eliminated, Cm-1 =C'm is substituted into (Em-1), and the equation Cm-2 =C'm-1 -C'm ×k+ Cm × k2 , substitute this equation into (Em-2)... until it is substituted into (E0), and finally form 0=-C′m km +C′m-1 ×km-1 -C′m -2 ×km-2 +...+(-1)m-1 ×C′0 , put 0=-C′m km +C′m-1 ×km-1 -C′m-2 ×km-2 +...+(-1)m-1 ×C′0 is marked as P0, and the key factor k is the root of the above polynomial. The root can be found by calculation in the polynomial value field, which can be obtained from the second Recover k from the software ciphertext C′0 , C′1 , . . . , C′m . In this embodiment, the Newton iteration algorithm is used to find one or more roots of the polynomial P0.
(a)令y=-C′mkm+C′m-1×km-1-C′m-2×km-2+...+(-1)m-1×C′0=f(k)(P1),任意选择起始k0,例如k0=2lengh(k)-1。(a) Let y=-C′m km +C′m-1 ×km-1 -C′m-2 ×km-2 +...+(-1)m-1 ×C′0 =f(k)(P1), select the starting k0 arbitrarily, for example k0 =2lengh(k)-1 .
(b)计算
(c)重复步骤b,直到|ki+1-ki|<1,此时ki+1近似为P1的根。(c) Repeat step b until |ki+1 -ki |<1, at this time ki+1 is approximately the root of P1.
(d)如果hash(ki+1)=h,或者hash(ki+1+1)=h,hash(ki+1-1)=h,其中h为加密步骤(4)中的h值,则本步骤算出的ki+1就为加密步骤中的门限密钥因子k,跳转到步骤(f),如果不相等,则数字根k寻找算法失败,进入步骤(e)。本发明中所述的哈希算法,即散列算法,是一个单向算法,即数据被演算后无法反推出原数据,因而若要比较数据传输前后是否被改动过,只需比较传输前后的哈希值是否相等即可。(d) If hash(ki+1 )=h, or hash(ki+1 +1)=h, hash(ki+1 -1)=h, wherein h is h in the encryption step (4) value, then the ki+1 calculated in this step is the threshold key factor k in the encryption step, jump to step (f), if not equal, the digital root k search algorithm fails, and enter step (e). The hash algorithm described in the present invention, that is, the hash algorithm, is a one-way algorithm, that is, the original data cannot be reversed after the data is calculated, so if you want to compare whether the data has been changed before and after transmission, you only need to compare the data before and after transmission The hash values are equal.
(e)如果在步骤(d)中没有找到k,则意味着P0有多个实根,其他的实根可以通过下面方法获得:(e) If k is not found in step (d), it means that P0 has multiple real roots, and other real roots can be obtained by the following methods:
使用步骤(d)中的根ki+1作为新的k0。Use the root ki+1 in step (d) as new k0 .
令b0=-C′m,bk=(-1)k-1×C′m-k+k0×bk-1,其中k=1,2,…,m-1,然后建立一个新的多项式,f(k)=b0×km-1+b1×km-2+...+bm-1 (P2);Let b0 =-C′m , bk =(-1)k-1 ×C′mk +k0 ×bk-1 , where k=1, 2,..., m-1, and then create a new Polynomial, f(k)=b0 ×km-1 +b1 ×km-2 +...+bm-1 (P2);
使用上述步骤b-c计算新等式P2的实根,获得P0的其他实根。Compute the real roots of the new equation P2 using steps b-c above to obtain the other real roots of P0.
通过本步骤(e)计算出P0的所有实根,每次经过(e)后,重复检查步骤(d),判断是否得到真正的密钥因子,然后得到门限密钥因子k。Calculate all the real roots of P0 through this step (e), and repeat the inspection step (d) after each pass through (e) to judge whether the real key factor is obtained, and then obtain the threshold key factor k.
(f)得到一段密文中的门限密钥因子k以后,代回方程组E0至Em,将第二软件密文C′0,C′1,…,C′m恢复为第一软件密文C1,C2,…,Cm。(f) After obtaining the threshold key factor k in a piece of ciphertext, substitute back the equations E0 to Em, and restore the second software ciphertext C′0 , C′1 , ..., C′m to the first software ciphertext C1 , C2 , . . . , Cm .
对n段C,分别进行a-f,得出解密钥密文PSK所需的所有门限密钥因子k,并利用k恢复所有的密文C’,形成第一软件密文。For n segments of C, perform a-f respectively to obtain all threshold key factors k required to decrypt the key ciphertext PSK, and use k to restore all ciphertexts C' to form the first software ciphertext.
步骤202,当恢复完t个门限密钥因子后,Ki=(xi,Pn(xi),1≤i≤t,第二解密模块用t个k构建一个新的多项式
其中,yk=Pn(xk),xi和xk为已经恢复的门限密钥因子对中的xi,其中i≠k,最后令x等于0,得出Pn(0)=a0。Among them, yk =Pn (xk ), xi and xk are xi in the recovered threshold key factor pair, where i≠k, and finally set x equal to 0, and obtain Pn (0)= a0 .
在第一软件密文中提取PSK,使用a0作为解密密钥密文PSK的密钥,从而获得解密被加密软件的第一密钥SK。Extract the PSK from the first software ciphertext, and use a0 as the key to decrypt the key ciphertext PSK, so as to obtain the first key SK for decrypting the encrypted software.
步骤203,第一解密模块使用SK对被加密的软件进行解密,获得原始软件明文。
CPU根据该软件明文执行。The CPU executes according to the software in plain text.
如图3所示,为本发明加密装置的示意图,包括,第一加密模块,第二加密模块和封装模块;所述第一加密模块,利用第一密钥SK将软件明文加密为第一软件密文;所述第二加密模块与所述第一加密模块相连接,利用n个门限密钥因子生成第二密钥,使用该第二密钥将所述第一密钥SK加密为密钥密文PSK,并将所述密钥密文PSK存储于所述第一软件密文中;所述封装模块与所述第二加密模块相连接,将所述第一软件密文分为n段,将所述门限密钥因子拼接于所述分段中,形成第二软件密文。As shown in Figure 3, it is a schematic diagram of the encryption device of the present invention, including a first encryption module, a second encryption module and an encapsulation module; the first encryption module uses the first key SK to encrypt the software plaintext into the first software Ciphertext; the second encryption module is connected to the first encryption module, and n threshold key factors are used to generate a second key, and the second key is used to encrypt the first key SK into a key ciphertext PSK, and store the key ciphertext PSK in the first software ciphertext; the encapsulation module is connected with the second encryption module, and divides the first software ciphertext into n segments, The threshold key factor is spliced into the segment to form a second software ciphertext.
如图4所示,为本发明解密装置的示意图,包括,解封装模块,第二解密模块和第一解密模块;所述解封装模块将第二软件密文解封装为第一软件密文,并在所述第一软件密文的n个段中随机取t个门限密钥因子;所述第二解密模块与所述解封装模块相连接,根据所述t个门限密钥因子生成第二密钥,利用该第二密钥将密钥密文PSK解密为第一密钥SK;所述第一解密模块与所述第二解密模块相连接,使用所述第一密钥SK将所述第一软件密文解密,获得软件明文。As shown in Figure 4, it is a schematic diagram of the decryption device of the present invention, including a decapsulation module, a second decryption module and a first decryption module; the decapsulation module decapsulates the second software ciphertext into the first software ciphertext, And randomly take t threshold key factors in the n segments of the first software ciphertext; the second decryption module is connected with the decapsulation module, and generates a second key factor according to the t threshold key factors key, using the second key to decrypt the key ciphertext PSK into a first key SK; the first decryption module is connected to the second decryption module, and uses the first key SK to decrypt the The first software ciphertext is decrypted to obtain the software plaintext.
如图5所示,为本发明装置运行的示意图。包括加载器,用于从存储介质中加载软件,还包括如图4所示的解密装置,相同部分不再赘述。加载器从软件的存储介质中(例如硬盘)加载第二软件密文,将其输入所述解密装置,所述解密装置将所述第二软件密文转换为软件明文,并将其传送给CPU执行软件。As shown in Figure 5, it is a schematic diagram of the operation of the device of the present invention. It includes a loader for loading software from a storage medium, and also includes a decryption device as shown in Figure 4, and the same parts will not be repeated. The loader loads the second software ciphertext from the software storage medium (such as a hard disk), and inputs it into the decryption device, and the decryption device converts the second software ciphertext into software plaintext, and sends it to the CPU Execute the software.
本发明的有益效果在于,加密可执行的软件,使软件破解者不会通过简单的跟踪软件加载获得密钥,从而防止该软件被解密并通过逆向工程等方法逆向编译。加强了软件加密密钥的保护,使破解者很难通过跟踪软件加载过程,获得密钥物理地址从而通过分析密钥实现软件破解的目的本发明通过动态存储密钥的技术加强了现有给软件加密,以提高其安全性的方案。The beneficial effect of the present invention is that, the encrypted executable software prevents software crackers from obtaining keys by simply tracking software loading, thereby preventing the software from being decrypted and reversely compiled through reverse engineering and other methods. The protection of the software encryption key is strengthened, making it difficult for crackers to obtain the physical address of the key by tracking the software loading process, so as to realize the purpose of software cracking by analyzing the key. Encryption to increase its security program.
以上具体实施方式仅用于说明本发明,而非用于限定本发明。The above specific embodiments are only used to illustrate the present invention, but not to limit the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2007101076366ACN101311942B (en) | 2007-05-23 | 2007-05-23 | Method and device for encrypting and decrypting software |
| PCT/EP2008/055912WO2008141992A1 (en) | 2007-05-23 | 2008-05-14 | Method and apparatus for encrypting and decrypting software |
| EP08759593AEP2150917A1 (en) | 2007-05-23 | 2008-05-14 | Method and apparatus for encrypting and decrypting software |
| JP2010508801AJP5167348B2 (en) | 2007-05-23 | 2008-05-14 | Software encryption method, software decryption method, software encryption device, and software decryption device |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2007101076366ACN101311942B (en) | 2007-05-23 | 2007-05-23 | Method and device for encrypting and decrypting software |
| Publication Number | Publication Date |
|---|---|
| CN101311942Atrue CN101311942A (en) | 2008-11-26 |
| CN101311942B CN101311942B (en) | 2011-08-24 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN2007101076366AActiveCN101311942B (en) | 2007-05-23 | 2007-05-23 | Method and device for encrypting and decrypting software |
| Country | Link |
|---|---|
| EP (1) | EP2150917A1 (en) |
| JP (1) | JP5167348B2 (en) |
| CN (1) | CN101311942B (en) |
| WO (1) | WO2008141992A1 (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017000726A1 (en)* | 2015-07-02 | 2017-01-05 | 中兴通讯股份有限公司 | Key transformation method, apparatus, and terminal |
| CN106599628A (en)* | 2016-12-08 | 2017-04-26 | 合肥康捷信息科技有限公司 | Python byte code file protection method based on module hook |
| CN107248914A (en)* | 2017-08-14 | 2017-10-13 | 四川长虹电器股份有限公司 | Novel symmetrical encryption system and encryption method in a kind of iOS device |
| CN107278357A (en)* | 2014-12-24 | 2017-10-20 | 皇家飞利浦有限公司 | Cryptographic system and method |
| CN107579962A (en)* | 2017-08-24 | 2018-01-12 | 中积有限公司 | A kind of method and device of source code encryption and decryption |
| CN108270574A (en)* | 2018-02-11 | 2018-07-10 | 浙江中控技术股份有限公司 | A kind of method for secure loading and device of white list library file |
| CN108880812A (en)* | 2017-05-09 | 2018-11-23 | 北京京东尚科信息技术有限公司 | The method and system of data encryption |
| CN108964912A (en)* | 2018-10-18 | 2018-12-07 | 深信服科技股份有限公司 | PSK generation method, device, user equipment, server and storage medium |
| CN110166236A (en)* | 2019-05-31 | 2019-08-23 | 北京中金国信科技有限公司 | Cipher key processing method, device and system and electronic equipment |
| CN110289955A (en)* | 2019-06-25 | 2019-09-27 | 杭州趣链科技有限公司 | A kind of key management method for serving certificate agency based on threshold cryptography model |
| CN110535642A (en)* | 2019-09-02 | 2019-12-03 | 北京智游网安科技有限公司 | A kind of method, intelligent terminal and the storage medium of dispersion storage key |
| CN111310211A (en)* | 2020-02-19 | 2020-06-19 | 成都三零凯天通信实业有限公司 | Method for encrypting database by using SM4 algorithm |
| CN112464270A (en)* | 2020-12-30 | 2021-03-09 | 广汽本田汽车有限公司 | Bidding file encryption and decryption method, equipment and storage medium |
| CN112565400A (en)* | 2020-12-03 | 2021-03-26 | 东北大学 | Cooperative resource distribution system and method based on IPv6 campus network |
| CN113094664A (en)* | 2021-04-09 | 2021-07-09 | 每日互动股份有限公司 | System for preventing android application program from being decompiled |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104980918B (en)* | 2014-04-04 | 2019-09-17 | 阿里巴巴集团控股有限公司 | Bootstrap information transmission provides the method and device of service based on beacon |
| CN112926074B (en)* | 2021-03-26 | 2022-08-23 | 成都卫士通信息产业股份有限公司 | SM9 key thresholding generation method, device, equipment and storage medium |
| CN116405293B (en)* | 2023-04-07 | 2023-09-01 | 光谷技术有限公司 | Data encryption storage method of safe operation and maintenance system |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS61177479A (en)* | 1985-02-01 | 1986-08-09 | 沖電気工業株式会社 | Coding key managing system |
| US4853962A (en)* | 1987-12-07 | 1989-08-01 | Universal Computer Consulting, Inc. | Encryption system |
| JPH0721688A (en)* | 1993-06-30 | 1995-01-24 | Victor Co Of Japan Ltd | Optical recording medium and reproducing device therefor |
| JP3627384B2 (en)* | 1996-01-17 | 2005-03-09 | 富士ゼロックス株式会社 | Information processing apparatus with software protection function and information processing method with software protection function |
| JP3775175B2 (en)* | 1996-06-28 | 2006-05-17 | 株式会社東芝 | Key processing method and disk manufacturer side processing apparatus |
| GB2325123A (en)* | 1997-05-08 | 1998-11-11 | Ibm | Data encryption/decryption using random numbers |
| US6236729B1 (en)* | 1997-06-06 | 2001-05-22 | Hitachi, Ltd. | Key recovery method and system |
| JP3667988B2 (en)* | 1997-06-06 | 2005-07-06 | 株式会社日立製作所 | Key recovery method and apparatus |
| US6182214B1 (en)* | 1999-01-08 | 2001-01-30 | Bay Networks, Inc. | Exchanging a secret over an unreliable network |
| EP1352307A2 (en)* | 2000-09-22 | 2003-10-15 | EDC Systems, Inc. | Systems and methods for preventing unauthorized use of digital content |
| JP2005275694A (en)* | 2004-03-24 | 2005-10-06 | Hitachi Software Eng Co Ltd | Method and protection system for protecting program from internal analysis |
| JP2006091967A (en)* | 2004-09-21 | 2006-04-06 | Matsushita Electric Ind Co Ltd | Information processing apparatus and debugging apparatus |
| CN100536393C (en)* | 2005-01-14 | 2009-09-02 | 中兴通讯股份有限公司 | Secret shared key mechanism based user management method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107278357B (en)* | 2014-12-24 | 2020-04-07 | 皇家飞利浦有限公司 | Cryptographic system and method |
| CN107278357A (en)* | 2014-12-24 | 2017-10-20 | 皇家飞利浦有限公司 | Cryptographic system and method |
| WO2017000726A1 (en)* | 2015-07-02 | 2017-01-05 | 中兴通讯股份有限公司 | Key transformation method, apparatus, and terminal |
| CN106599628A (en)* | 2016-12-08 | 2017-04-26 | 合肥康捷信息科技有限公司 | Python byte code file protection method based on module hook |
| CN106599628B (en)* | 2016-12-08 | 2019-04-02 | 合肥康捷信息科技有限公司 | A kind of Python byte code files guard method based on module hook |
| CN108880812B (en)* | 2017-05-09 | 2022-08-09 | 北京京东尚科信息技术有限公司 | Method and system for data encryption |
| CN108880812A (en)* | 2017-05-09 | 2018-11-23 | 北京京东尚科信息技术有限公司 | The method and system of data encryption |
| CN107248914A (en)* | 2017-08-14 | 2017-10-13 | 四川长虹电器股份有限公司 | Novel symmetrical encryption system and encryption method in a kind of iOS device |
| CN107579962A (en)* | 2017-08-24 | 2018-01-12 | 中积有限公司 | A kind of method and device of source code encryption and decryption |
| CN107579962B (en)* | 2017-08-24 | 2019-04-30 | 中链科技有限公司 | A kind of method and device of source code encryption and decryption |
| CN108270574B (en)* | 2018-02-11 | 2021-02-09 | 浙江中控技术股份有限公司 | Safe loading method and device for white list library file |
| CN108270574A (en)* | 2018-02-11 | 2018-07-10 | 浙江中控技术股份有限公司 | A kind of method for secure loading and device of white list library file |
| CN108964912A (en)* | 2018-10-18 | 2018-12-07 | 深信服科技股份有限公司 | PSK generation method, device, user equipment, server and storage medium |
| CN110166236A (en)* | 2019-05-31 | 2019-08-23 | 北京中金国信科技有限公司 | Cipher key processing method, device and system and electronic equipment |
| CN110166236B (en)* | 2019-05-31 | 2022-01-18 | 北京中金国信科技有限公司 | Key processing method, device and system and electronic equipment |
| CN110289955A (en)* | 2019-06-25 | 2019-09-27 | 杭州趣链科技有限公司 | A kind of key management method for serving certificate agency based on threshold cryptography model |
| CN110535642A (en)* | 2019-09-02 | 2019-12-03 | 北京智游网安科技有限公司 | A kind of method, intelligent terminal and the storage medium of dispersion storage key |
| CN111310211A (en)* | 2020-02-19 | 2020-06-19 | 成都三零凯天通信实业有限公司 | Method for encrypting database by using SM4 algorithm |
| CN112565400A (en)* | 2020-12-03 | 2021-03-26 | 东北大学 | Cooperative resource distribution system and method based on IPv6 campus network |
| CN112464270A (en)* | 2020-12-30 | 2021-03-09 | 广汽本田汽车有限公司 | Bidding file encryption and decryption method, equipment and storage medium |
| CN113094664A (en)* | 2021-04-09 | 2021-07-09 | 每日互动股份有限公司 | System for preventing android application program from being decompiled |
| Publication number | Publication date |
|---|---|
| JP2010528511A (en) | 2010-08-19 |
| JP5167348B2 (en) | 2013-03-21 |
| CN101311942B (en) | 2011-08-24 |
| WO2008141992A1 (en) | 2008-11-27 |
| EP2150917A1 (en) | 2010-02-10 |
| Publication | Publication Date | Title |
|---|---|---|
| CN101311942A (en) | Software encryption and decryption method and encryption and decryption device | |
| JP6227728B2 (en) | System and method for wireless data protection | |
| CN110008745B (en) | Encryption method, computer equipment and computer storage medium | |
| CN105468940B (en) | Method for protecting software and device | |
| CN104040937A (en) | Multi-key cryptography for encrypting file system acceleration | |
| KR102397579B1 (en) | Method and apparatus for white-box cryptography for protecting against side channel analysis | |
| TWI597960B (en) | Key splitting | |
| JP7024666B2 (en) | ID-based hash certification system configuration device, ID-based cryptographic device and program | |
| US10572635B2 (en) | Automatic correction of cryptographic application program interfaces | |
| US12052348B2 (en) | Computation device using shared shares | |
| CN109726567A (en) | A moving target encryption method based on fully homomorphic encryption | |
| US8862893B2 (en) | Techniques for performing symmetric cryptography | |
| JP7205016B2 (en) | Confidential Information Processing System and Confidential Information Processing Method | |
| KR101440680B1 (en) | Homomorphic Encryption and Decryption Method using Chinese Remainder Theorem and apparatus using the same | |
| CN105426702A (en) | Android operating system based application program encrypting method and device, and Android operating system based application program decrypting method and device | |
| US20220417012A1 (en) | Method for performing cryptographic operations in a processing device, corresponding processing device and computer program product | |
| CN113691373B (en) | A quantum-resistant key escrow system and method based on consortium blockchain | |
| CN118158021B (en) | A data transmission processing method and system based on Glink bus protocol | |
| JP2009271884A (en) | Information processor and information processing program | |
| CN119004492A (en) | Data processing method, device, electronic equipment and storage medium | |
| CN118797683A (en) | A sector encryption method, decryption method and device based on secure storage | |
| KR20160090556A (en) | On-line/off-line electronic signature system for security of off-line token and its method | |
| CN119150323A (en) | Data protection method and device based on chip bus encryption and safety chip | |
| JP2004280678A (en) | Data processor and data processing method | |
| JP2011007962A (en) | Program code encryption device and program |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| C41 | Transfer of patent application or patent right or utility model | ||
| TR01 | Transfer of patent right | Effective date of registration:20150925 Address after:100000 Beijing City, Haidian District information industry base on the information Chronoswiss Road No. 18 Building 2 layer Patentee after:Beijing Siemens Cerberus Electronics Ltd. Address before:100102 Beijing, Wangjing, Central South Road, No. 7, No. Patentee before:Simens Co., Ltd. (China) | |
| C56 | Change in the name or address of the patentee | ||
| CP02 | Change in the address of a patent holder | Address after:100094 Beijing, northwest Wang Feng Road, No. 1 Patentee after:Beijing Siemens Cerberus Electronics Ltd. Address before:Beijing City, Haidian District information industry base on the information Rainbow Road No. 18 Building 2 layer Patentee before:Beijing Siemens Cerberus Electronics Ltd. |