Software and source code intellectual property protection method

By using the encryption binding of device-unique identification and verification code between the client and the server, combined with packet encryption and digital signature technology, the problem of insufficient security of certificates and source codes in the existing technology is solved, and the software is realized and efficient protection of source code to prevent unauthorized use and tampering.

CN118898055APending Publication Date: 2024-11-05YUNNAN KUNGANG ELECTRONICS INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410808521.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

Existing software protection technology cannot effectively prevent the leakage of certificate files and source code, unauthorized use, copying, modification and reverse engineering, and cannot effectively ensure the security of certificates and source code.

Method used

By establishing encryption binding of device unique identification and verification code between the client and the server, using packet encryption algorithms and digital signature technology, ensuring the security of certificates and source codes, preventing unauthorized access and tampering, and realizing The effect of one device and one certificate.

Benefits of technology

Effectively prevent unauthorized use of certificate files and source code, enhance the security of software and source code, prevent reverse engineering and tampering, and ensure the protection of intellectual property rights.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118898055A_ABST
    Figure CN118898055A_ABST
Patent Text Reader

Abstract

The invention relates to a software and source code intellectual property protection method, and belongs to the technical field of software protection. The method comprises a client side and a server side. And the client is used for downloading the private component package formed by the protected source code, verifying the certificate and verifying the private component, and the software can be normally used after the verification is passed. And the server is used for generating a certificate, packaging private components of source codes needing to be protected for the client, storing the private components, and providing the packaged private components for the client to download. According to the method, the security of the certificate file and the source code is effectively guaranteed, and unauthorized software use, source code viewing, copying and modifying, reverse engineering and tampering are prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of software protection, and in particular relates to a method for protecting software and source code intellectual property rights. Background Art

[0002] As the degree of social informatization continues to deepen, software products have become an indispensable infrastructure, covering all industries and fields, supporting the development and operation of all fields of society. Intellectual property protection of software source code can effectively protect the achievements of software development teams, encourage development teams to carry out more innovation and R&D work, and promote scientific and technological progress and social development.

[0003] The commonly used software protection technology at present is to provide users with certificate files, and verify the legitimacy of the software product by verifying the certificate when the software is started. However, during the transmission and storage of certificates, there is a risk of leakage, interception, illegal copying or theft, and the certificate can only limit the use rights of the software, but cannot prevent unauthorized viewing, copying or modification of the source code, nor can it prevent reverse engineering and tampering of the software. Neither the security of certificate files nor the security of source code is effectively guaranteed.

[0004] How to effectively ensure the security of certificate files and source code, prevent unauthorized software use, source code viewing, copying or modification or reverse engineering and tampering, is a problem that urgently needs to be solved in this technical field. Summary of the invention

[0005] The purpose of the present invention is to solve the deficiencies of the prior art and provide a method for protecting software and source code intellectual property rights, so as to improve the security of software and source code and protect intellectual property rights.

[0006] To achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0007] A method for protecting software and source code intellectual property rights includes two parts: a client and a server. The specific steps of the client part are as follows:

[0008] Step 1-1: First, download all required private components from the server according to the component unique ID;

[0009] Step 1-2: Read the hardware information of the device currently running the client;

[0010] Step 1-3: Based on the acquired device hardware information, encrypt the device identification key through an encryption algorithm to generate a device unique identifier bound to the device hardware information; and encrypt the device unique identifier twice using a block encryption algorithm and a verification key to generate a verification code;

[0011] Step 1-4: Read the certificate. If the certificate can be read, go to step 1-6; if the certificate cannot be read, go to step 1-5; send a request to the server to obtain the certificate and save it;

[0012] Step 1-5: Use the device's unique identifier and verification code to request a certificate from the server and save it, then go to step 1-6;

[0013] Step 1-6: Read the certificate information and use the certificate decryption public key to decrypt the certificate information to obtain the decrypted certificate information; then verify the certificate information. If the verification passes, go to step 1-7; if the verification fails, go to step 1-9;

[0014] Step 1-7: After the certificate information is verified, verify the validity of each downloaded private component; if the verification passes, go to step 1-8; if the verification fails, go to step 1-9;

[0015] Step 1-8: Normal startup;

[0016] Step 1-9: Deny access and exit.

[0017] Further, preferably, the device hardware information includes the device MAC address, hardware serial number and processor ID.

[0018] Further, preferably, in steps 1-3, encryption is performed using a device identification key through an SM4 block encryption algorithm based on the acquired device hardware information.

[0019] Further, preferably, in steps 1-6, verifying the certificate information specifically includes:

[0020] Verify that the unique device identifier and verification code in the certificate information are consistent with the unique device identifier and verification code generated in steps 1-3;

[0021] Check whether the current time does not exceed the authorization deadline;

[0022] Verify whether the current device IP is included in the authorized IP in the certificate;

[0023] Verify that the number of online users on the current device does not exceed the maximum number of online users in the certificate;

[0024] If both are true, the verification passes, otherwise it fails.

[0025] Further, preferably, in steps 1-7, the specific method for verifying the validity of each downloaded private component is:

[0026] First, use the anti-tampering algorithm to regenerate the private component verification code and compare it with the verification code generated when the server is packaged;

[0027] If the comparison is successful, the digital signature information during packaging is verified;

[0028] If the digital signature information is verified, the private component is decrypted using the component decryption public key;

[0029] If the decryption is successful, the verification is passed. If the decryption is unsuccessful, the verification fails.

[0030] Further, preferably, the server part includes private component packaging, and the specific steps are as follows:

[0031] Obtain the source code of the software you wish to protect;

[0032] Use an obfuscation dictionary to randomly rename variable names, method names, and class names in the source code, and obfuscate the code by inserting invalid code, disguised code snippets, or anti-debugging code;

[0033] Use the component packaging private key to encrypt the obfuscated code;

[0034] Digitally sign the obfuscated and encrypted code. After completion, use the anti-tampering algorithm to generate a verification code and save it;

[0035] Push the packaged private components to the server storage space for storage.

[0036] Furthermore, preferably, when the component packaging private key is used to encrypt the obfuscated code, an RSA asymmetric encryption method is used for encryption.

[0037] Furthermore, preferably, the server part also includes certificate generation, and the specific steps are as follows:

[0038] The server receives the unique device identifier and verification code uploaded by the client, encrypts the unique device identifier using the SM4 block encryption algorithm and the verification key, and compares the calculated verification code with the verification code uploaded by the client to verify the validity of the unique device identifier and verification code;

[0039] Write the device unique identification, verification code, maximum number of online users allowed for the device, authorized device IP, and certificate expiration time information into the certificate information;

[0040] The certificate information is encrypted using the RSA asymmetric encryption algorithm and the private key generated by the certificate. The private key generated by the certificate is only stored on the server.

[0041] Package the certificate and send it back to the client for use.

[0042] Compared with the prior art, the present invention has the following beneficial effects:

[0043] (1) Existing certificate technology can prevent ordinary users from using software without authorization, but it cannot prevent malicious attackers from parsing client certificate files to generate their own certificates and bypass certificate verification. The present invention encrypts and packages the certificate information through the server, which is more effective;

[0044] (2) The existing technology mainly targets unauthorized use of software, but does not provide sufficient protection against source code viewing, copying, modification, reverse engineering and tampering. The present invention, by constructing private component technology, not only protects against unauthorized use of software, but also increases the protection of source code;

[0045] (3) The present invention achieves the effect of one device, one certificate by binding the certificate to the unique identifier of the device, effectively avoiding the situation where one certificate is applied for and provided to other unauthorized devices for use, and effectively preventing unauthorized use of software. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 This is a schematic diagram of the overall structure of the client of the present invention;

[0047] Figure 2 This is a schematic diagram of the packaging of private components on the server side;

[0048] Figure 3 This is a schematic diagram of server certificate generation;

[0049] Figure 4 This is a schematic diagram of client certificate verification;

[0050] Figure 5 This is a schematic diagram of client private component verification. DETAILED DESCRIPTION

[0051] The present invention is further described in detail below in conjunction with embodiments.

[0052] Those skilled in the art will appreciate that the following examples are only used to illustrate the present invention and should not be considered to limit the scope of the present invention. If no specific techniques or conditions are specified in the examples, the techniques or conditions described in the literature in the art or the product specifications are used. If the manufacturer of the materials or equipment used is not specified, they are all conventional products that can be purchased.

[0053] Example 1

[0054] like Figure 1 As shown, a method for protecting intellectual property rights of software and source code includes two parts, a client and a server, wherein the specific steps of the client part are as follows:

[0055] Step 1-1: First, download all required private components from the server according to the component unique ID;

[0056] Step 1-2: Read the hardware information of the device currently running the client;

[0057] Step 1-3: Based on the acquired device hardware information, encrypt the device identification key through an encryption algorithm to generate a device unique identifier bound to the device hardware information; and encrypt the device unique identifier twice using a block encryption algorithm and a verification key to generate a verification code;

[0058] Step 1-4: Read the certificate. If the certificate can be read, go to step 1-6; if the certificate cannot be read, go to step 1-5; send a request to the server to obtain the certificate and save it;

[0059] Step 1-5: Use the device's unique identifier and verification code to request a certificate from the server and save it, then go to step 1-6;

[0060] Step 1-6: Read the certificate information and use the certificate decryption public key to decrypt the certificate information to obtain the decrypted certificate information; then verify the certificate information. If the verification passes, go to step 1-7; if the verification fails, go to step 1-9;

[0061] Step 1-7: After the certificate information is verified, verify the validity of each downloaded private component; if the verification passes, go to step 1-8; if the verification fails, go to step 1-9;

[0062] Step 1-8: Normal startup;

[0063] Step 1-9: Deny access and exit.

[0064] Example 2

[0065] like Figure 1 , Figure 4 and Figure 5 As shown, a method for protecting intellectual property rights of software and source code includes two parts, a client and a server, wherein the specific steps of the client part are as follows:

[0066] Step 1-1: First, download all required private components from the server according to the component unique ID;

[0067] Step 1-2: Read the hardware information of the device currently running the client;

[0068] Step 1-3: Based on the acquired device hardware information, encrypt the device identification key through an encryption algorithm to generate a device unique identifier bound to the device hardware information; and encrypt the device unique identifier twice using a block encryption algorithm and a verification key to generate a verification code;

[0069] Step 1-4: Read the certificate. If the certificate can be read, go to step 1-6; if the certificate cannot be read, go to step 1-5; send a request to the server to obtain the certificate and save it;

[0070] Step 1-5: Use the device's unique identifier and verification code to request a certificate from the server and save it, then go to step 1-6;

[0071] Step 1-6: Read the certificate information and use the certificate decryption public key to decrypt the certificate information to obtain the decrypted certificate information; then verify the certificate information. If the verification passes, go to step 1-7; if the verification fails, go to step 1-9;

[0072] Step 1-7: After the certificate information is verified, verify the validity of each downloaded private component; if the verification passes, go to step 1-8; if the verification fails, go to step 1-9;

[0073] Step 1-8: Normal startup;

[0074] Step 1-9: Deny access and exit.

[0075] Device hardware information includes device MAC address, hardware serial number, and processor ID.

[0076] In steps 1-3, the device identification key is used to encrypt the acquired device hardware information using the SM4 block encryption algorithm.

[0077] In steps 1-6, the certificate information is then verified, including:

[0078] Verify that the unique device identifier and verification code in the certificate information are consistent with the unique device identifier and verification code generated in steps 1-3;

[0079] Check whether the current time does not exceed the authorization deadline;

[0080] Verify whether the current device IP is included in the authorized IP in the certificate;

[0081] Verify that the number of online users on the current device does not exceed the maximum number of online users in the certificate;

[0082] If both are true, the verification passes, otherwise it fails.

[0083] In steps 1-7, the specific method for verifying the validity of each downloaded private component is:

[0084] First, use the anti-tampering algorithm to regenerate the private component verification code and compare it with the verification code generated when the server is packaged;

[0085] If the comparison is successful, the digital signature information during packaging is verified;

[0086] If the digital signature information is verified, the private component is decrypted using the component decryption public key;

[0087] If the decryption is successful, the verification is passed. If the decryption is unsuccessful, the verification fails.

[0088] Example 3

[0089] like Figures 1 to 5 As shown, a method for protecting intellectual property rights of software and source code includes two parts, a client and a server, wherein the specific steps of the client part are as follows:

[0090] Step 1-1: First, download all required private components from the server according to the component unique ID;

[0091] Step 1-2: Read the hardware information of the device currently running the client;

[0092] Step 1-3: Based on the acquired device hardware information, encrypt the device identification key through an encryption algorithm to generate a device unique identifier bound to the device hardware information; and encrypt the device unique identifier twice using a block encryption algorithm and a verification key to generate a verification code;

[0093] Step 1-4: Read the certificate. If the certificate can be read, go to step 1-6; if the certificate cannot be read, go to step 1-5; send a request to the server to obtain the certificate and save it;

[0094] Step 1-5: Use the device's unique identifier and verification code to request a certificate from the server and save it, then go to step 1-6;

[0095] Step 1-6: Read the certificate information and use the certificate decryption public key to decrypt the certificate information to obtain the decrypted certificate information; then verify the certificate information. If the verification passes, go to step 1-7; if the verification fails, go to step 1-9;

[0096] Step 1-7: After the certificate information is verified, verify the validity of each downloaded private component; if the verification passes, go to step 1-8; if the verification fails, go to step 1-9;

[0097] Step 1-8: Normal startup;

[0098] Step 1-9: Deny access and exit.

[0099] Device hardware information includes device MAC address, hardware serial number, and processor ID.

[0100] In steps 1-3, the device identification key is used to encrypt the acquired device hardware information using the SM4 block encryption algorithm.

[0101] In steps 1-6, the certificate information is then verified, including:

[0102] Verify that the unique device identifier and verification code in the certificate information are consistent with the unique device identifier and verification code generated in steps 1-3;

[0103] Check whether the current time does not exceed the authorization deadline;

[0104] Verify whether the current device IP is included in the authorized IP in the certificate;

[0105] Verify that the number of online users on the current device does not exceed the maximum number of online users in the certificate;

[0106] If both are true, the verification passes, otherwise it fails.

[0107] In steps 1-7, the specific method for verifying the validity of each downloaded private component is:

[0108] First, use the anti-tampering algorithm to regenerate the private component verification code and compare it with the verification code generated when the server is packaged;

[0109] If the comparison is successful, the digital signature information during packaging is verified;

[0110] If the digital signature information is verified, the private component is decrypted using the component decryption public key;

[0111] If the decryption is successful, the verification is passed. If the decryption is unsuccessful, the verification fails.

[0112] The server part includes private component packaging, the specific steps are as follows:

[0113] Obtain the source code of the software you wish to protect;

[0114] Use an obfuscation dictionary to randomly rename variable names, method names, and class names in the source code, and obfuscate the code by inserting invalid code, disguised code snippets, or anti-debugging code;

[0115] Use the component packaging private key to encrypt the obfuscated code;

[0116] Digitally sign the obfuscated and encrypted code. After completion, use the anti-tampering algorithm to generate a verification code and save it;

[0117] Push the packaged private components to the server storage space for storage.

[0118] When the component packaging private key is used to encrypt the obfuscated code, RSA asymmetric encryption is used for encryption.

[0119] The server part also includes certificate generation, the specific steps are as follows:

[0120] The server receives the unique device identifier and verification code uploaded by the client, encrypts the unique device identifier using the SM4 block encryption algorithm and the verification key, and compares the calculated verification code with the verification code uploaded by the client to verify the validity of the unique device identifier and verification code;

[0121] Write the device unique identification, verification code, maximum number of online users allowed for the device, authorized device IP, and certificate expiration time information into the certificate information;

[0122] The certificate information is encrypted using the RSA asymmetric encryption algorithm and the private key generated by the certificate. The private key generated by the certificate is only stored on the server.

[0123] Package the certificate and send it back to the client for use.

[0124] Example 4

[0125] A method for protecting intellectual property rights of software and source code includes two parts: a client and a server. The client is used to download a private component package of the protected source code, verify the certificate and verify the private component. The software can be used normally only after the verification is passed. The server is used to generate and provide the certificate to the client, package the source code to be protected into a private component and save it, and provide the packaged private component to the client for download.

[0126] Client:

[0127] During the startup process, all required private components are first downloaded from the server according to the component unique ID.

[0128] After completion, the hardware information of the device currently running the client will be read, including the device MAC address, hardware serial number, processor ID, etc. This hardware information can be bound to the unique hardware currently running the client.

[0129] According to the acquired device hardware information, the device identification key is encrypted using the SM4 block encryption algorithm to generate a device unique identifier bound to the device hardware information. The device unique identifier is encrypted again using the block encryption algorithm and the verification key to generate a verification code.

[0130] Read the certificate. If the certificate is not read, send a request to the server to obtain the certificate and save it.

[0131] Read the certificate information and use the certificate decryption public key to decrypt the certificate information to obtain the decrypted certificate information. Verify whether the device unique identifier and verification code in the certificate information are consistent with the device unique identifier and verification code regenerated during the startup process. Verify whether the current time exceeds the authorization deadline, whether the current device IP is included in the authorized IP in the certificate, and whether the number of online users of the current device exceeds the maximum number of online users in the certificate.

[0132] After the certificate is verified, the validity of each downloaded private component is verified. First, the private component verification code is regenerated using the anti-tampering algorithm, and compared with the verification code generated when the server is packaged. Then the digital signature information during packaging is verified. Then the private component is decrypted using the component decryption public key.

[0133] After all the above verifications are passed, the service will be started. If any verification fails, access will be denied and the program will be exited.

[0134] Server:

[0135] Private component packaging:

[0136] Obtain the software source code that you want to protect, which can be a unit code or multiple source code modules.

[0137] Use multiple methods to obfuscate the source code: use an obfuscation dictionary to randomly rename variable names, method and class names, insert invalid code and disguised code snippets, insert anti-debugging code, etc. This makes the code difficult to analyze and understand, while preventing attackers from using debugging tools to reverse engineer the code.

[0138] Use the component packaging private key to encrypt the obfuscated code. Prevent code tampering by modifying / overwriting to bypass obfuscation. Encryption uses RSA asymmetric encryption, using a set of secret key pairs. The content encrypted by the private key can only be decrypted by the public key. The private key is stored on the server and the public key is stored on the client. This effectively protects component information from being leaked and tampered with.

[0139] Digitally sign the obfuscated and encrypted code. After completion, use the anti-tampering algorithm to generate a verification code and save it. The anti-tampering algorithm cannot be reversed and can effectively verify the integrity of the component.

[0140] After completing the above steps, the packaged private component is pushed to the server storage space for storage. When needed, the client uses the component unique ID to obtain the private component to be used from the server.

[0141] Certificate Generation:

[0142] The server receives the device unique identifier and verification code uploaded by the client, encrypts the device unique identifier using the SM4 block encryption algorithm and the verification key, and compares the calculated verification code with the verification code uploaded by the client to verify the validity of the device unique identifier and verification code.

[0143] Write the device unique identifier, verification code, maximum number of online users allowed on the device, authorized device IP, and certificate expiration time into the certificate information.

[0144] The above certificate information is encrypted using the RSA asymmetric encryption algorithm and the private key generated by the certificate to prevent the certificate information from being removed or tampered with. The private key generated by the certificate is only stored on the server.

[0145] Package the certificate and send it back to the client for use.

[0146] Figure 1 This is a schematic diagram of the overall structure of the client of the present invention. Figure 1 middle:

[0147] 1-1: Indicates downloading private components from the server. Private components are packaged on the server by the source code that does not want to be copied, accessed, reverse engineered, or tampered with without authorization. The server packaging process is shown in Figure 2 .

[0148] 1-2: Read the device information of the current client, including the device's MAC address, hardware serial number, processor ID, and system architecture information. This information is bound to the hardware device where the current client is running.

[0149] 1-3: Encrypt the hardware device read in 1-2 using the SM4 group encryption algorithm and the device identification key to generate a unique device identification that is bound to the device hardware information. The unique device identification is encrypted again using the group encryption algorithm and the verification key to generate a verification code. The unique device identification and verification code are bound to the device hardware information. The unique device identification and verification code will change after the device is replaced.

[0150] 1-4: Read the certificate. If the certificate can be read, continue to execute the program. If the certificate cannot be read, request the server to obtain the certificate.

[0151] 1-5: Use the device's unique identifier and verification code to request a certificate from the server. For the server certificate generation process, see Figure 3 .

[0152] 1-6: Read the certificate information and verify the certificate information to prevent unauthorized use. If the verification is successful, the process continues. If the verification fails, further access is denied. For detailed verification process, see Figure 4 .

[0153] 1-7: Verify the validity of private components to prevent tampering with private components. If the verification succeeds, the system will continue to start normally. If the verification fails, further access will be denied. For the detailed verification process, see Figure 5 .

[0154] 1-8: All verifications are successful and the program starts normally.

[0155] 1-9: There are items that failed verification, access is denied and the program exits.

[0156] Figure 2 This is a schematic diagram of the packaging of private components on the server side. Figure 2 middle:

[0157] 2-1: Indicates that the software source code is to be protected from unauthorized viewing, copying, access, reverse engineering, and tampering. It can be an independent unit code or multiple source code modules.

[0158] 2-2: During the source code packaging process, the obfuscation dictionary is used to randomly rename the variable names, method names, and class names in the source code, and the code is obfuscated by inserting invalid code or disguised code fragments and anti-debugging code. This makes the code difficult to analyze and understand, while preventing attackers from using debugging tools to reverse engineer the code.

[0159] 2-3: Use the RSA asymmetric encryption algorithm and the component packaging private key to encrypt the obfuscated code. Modification of the obfuscated class name and file content is not allowed to prevent code tampering by bypassing obfuscation through modification and overwriting. The component packaging private key is stored on the server and will not be provided to the outside. Figure 5 The component decryption public key in 1-7-2 constitutes a key pair. Data encrypted with a private key can only be restored to its original state using the corresponding public key in the key pair. At the same time, data encrypted with a public key cannot be decrypted using the public key, but only using the private key. The private key is only stored on the server and is not disclosed to the public. This effectively protects the component information from being leaked or tampered with.

[0160] 2-4: Digitally sign the obfuscated and encrypted code to ensure the integrity of the package and the credibility of the source.

[0161] 2-5: Use the anti-tampering algorithm to generate the code as a verification code and save it. The verification code generated by the anti-tampering algorithm cannot be reversed. When used, the anti-tampering algorithm is recalculated and compared with the saved value to effectively verify the integrity of the code.

[0162] 2-6: After completing the above packaging and protection steps, push the packaged private component to the server storage space for storage. When the client uses it, it uses the component unique id to obtain the private component it needs to use from the server.

[0163] Figure 3 This is a schematic diagram of server certificate generation. Figure 3 middle:

[0164] 1-5-1: The server receives the unique device identifier and verification code uploaded by the client

[0165] 1-5-2: The server verifies the unique device identifier and verification code uploaded by the client. Specifically, the unique device identifier is encrypted using the SM4 block encryption algorithm and the verification key, and the calculated verification code is compared with the verification code uploaded by the client to prevent external attackers from obtaining the certificate.

[0166] 1-5-3: Write the device unique identifier, verification code, maximum number of online users allowed for the device, device IP, and certificate expiration time into the certificate information.

[0167] 1-5-4: Use the RSA asymmetric encryption algorithm and the certificate generation private key to encrypt the above certificate information to prevent the leakage and tampering of the certificate information. The certificate generation private key is stored on the server and will not be provided to the outside. Figure 4 The certificate decryption public key in 1-6-2 constitutes a key pair. Data encrypted with a private key can only be restored to its original state using the corresponding public key in the key pair. At the same time, data encrypted with a public key cannot be decrypted using the public key but only the private key. The private key is only stored on the server and is not disclosed to the public. This effectively protects the certificate information from being leaked or tampered with.

[0168] 1-5-5: Package the certificates.

[0169] 1-5-6: Generate a certificate and send it back to the client for use.

[0170] Figure 4 This is a schematic diagram of client certificate verification. Figure 4 middle:

[0171] 1-6-1: Obtain the certificate file and read the certificate information.

[0172] 1-6-2: Use the RSA asymmetric encryption algorithm and the certificate decryption public key to decrypt the certificate information. The certificate decryption public key is stored on the client and is Figure 3 The private key generated by the certificate in 1-5-4 constitutes a key pair. Data encrypted with a private key can only be restored to its original state using the corresponding public key in the key pair. At the same time, data encrypted with a public key cannot be decrypted using the public key but only the private key. The private key is only stored on the server and is not disclosed to the public. This effectively protects the certificate information from being leaked or tampered with.

[0173] 1-6-3: Get the unique device identifier and verification code in the decrypted certificate information and Figure 1Compare the unique device identifier and verification code obtained in 1-3. Because both the unique device identifier and verification code are bound to the device hardware information, a successful comparison means that the current device is the corresponding device authorized in the certificate.

[0174] 1-6-4: Get the authorization deadline in the decrypted certificate information and compare it with the current time. If the authorization deadline is later than the current time, the certificate is valid. If the authorization deadline is earlier than the current time, the certificate has expired. If the authorization time is null, it means that the current certificate is a long-term certificate and there is no need to verify the authorization deadline.

[0175] 1-6-5: Get the device IP information in the decrypted certificate information and compare it with the current IP of the device. If the current IP is included in the device IP information, the device IP verification passes, otherwise the verification fails. If the device IP information in the certificate information is null, there is no need to verify the device IP information.

[0176] 1-6-6: Get the current number of online users of this device (computer / server) from the cache database and compare it with the maximum number of online users in the decrypted certificate information. If the current number of online users is less than the maximum number of online users, the verification passes, otherwise it fails. If the maximum number of online users in the certificate information is null, there is no need to verify the maximum number of online users.

[0177] 1-6-7: Continue if verification is successful Figure 1 1-7 Private component verification.

[0178] 1-6-8: If verification fails, proceed to the verification failure process.

[0179] Figure 5 This is a client private component verification diagram. Figure 5 middle:

[0180] 1-7-1: Read Figure 1 In 1-1, the client downloads all private components and performs subsequent verification operations on each private component.

[0181] 1-7-2: Use the anti-tampering algorithm to regenerate the verification code of the private component and compare it with the saved verification code. If the comparison is successful, it means that the code is complete and has not been tampered with.

[0182] 1-7-3: Verify the digital signature during packaging. If verification fails or the verification information is incorrect, it means that the source of the private component is incorrect or incomplete.

[0183] 1-7-4: Use the component decryption public key to decrypt the private component. If the decryption fails, it means that the private component has been modified or overwritten. Figure 2 The component packaged private key in 2-3 constitutes a key pair. Data encrypted with a private key can only be restored to its original data using the corresponding public key in the key pair. At the same time, data encrypted with a public key cannot be decrypted using the public key, but only using the private key. The private key is only stored on the server and is not disclosed to the public. This effectively protects the component information from being leaked and tampered with.

[0184] 1-7-5: Continue if verification is successful Figure 1 1-8 Successful process.

[0185] 1-7-6: If verification fails, proceed to the verification failure process.

[0186] The above shows and describes the basic principles, main features and advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A method for protecting software and source code intellectual property rights, characterized in that: It includes two parts: client and server. The specific steps of the client part are as follows: Step 1-1: First, download all required private components from the server according to the component unique ID; Step 1-2: Read the hardware information of the device currently running the client; Step 1-3: Based on the acquired device hardware information, encrypt the device identification key through an encryption algorithm to generate a device unique identifier bound to the device hardware information; and encrypt the device unique identifier twice using a block encryption algorithm and a verification key to generate a verification code; Step 1-4: Read the certificate. If the certificate can be read, go to step 1-6; if the certificate cannot be read, go to step 1-5; send a request to the server to obtain the certificate and save it; Step 1-5: Use the device's unique identifier and verification code to request a certificate from the server and save it, then go to step 1-6; Step 1-6: Read the certificate information and use the certificate decryption public key to decrypt the certificate information to obtain the decrypted certificate information; then verify the certificate information. If the verification passes, go to step 1-7; if the verification fails, go to step 1-9; Step 1-7: After the certificate information is verified, verify the validity of each downloaded private component; if the verification passes, go to step 1-8; if the verification fails, go to step 1-9; Step 1-8: Normal startup; Step 1-9: Deny access and exit.

2. The method for protecting software and source code intellectual property rights according to claim 1, characterized in that: Device hardware information includes device MAC address, hardware serial number, and processor ID.

3. The method for protecting software and source code intellectual property rights according to claim 1, characterized in that: In steps 1-3, the device identification key is used to encrypt the acquired device hardware information using the SM4 block encryption algorithm.

4. The method for protecting software and source code intellectual property rights according to claim 1, characterized in that: In steps 1-6, the certificate information is then verified, including: Verify that the unique device identifier and verification code in the certificate information are consistent with the unique device identifier and verification code generated in steps 1-3; Check whether the current time does not exceed the authorization deadline; Verify whether the current device IP is included in the authorized IP in the certificate; Verify that the number of online users on the current device does not exceed the maximum number of online users in the certificate; If both are true, the verification passes, otherwise it fails.

5. The method for protecting software and source code intellectual property rights according to claim 1, characterized in that: In steps 1-7, the specific method for verifying the validity of each downloaded private component is: First, use the anti-tampering algorithm to regenerate the private component verification code and compare it with the verification code generated when the server is packaged; If the comparison is successful, the digital signature information during packaging is verified; If the digital signature information is verified, the private component is decrypted using the component decryption public key; If the decryption is successful, the verification is passed. If the decryption is unsuccessful, the verification fails.

6. The method for protecting software and source code intellectual property rights according to claim 1, characterized in that: The server part includes private component packaging, the specific steps are as follows: Obtain the source code of the software you wish to protect; Use an obfuscation dictionary to randomly rename variable names, method names, and class names in the source code, and obfuscate the code by inserting invalid code, disguised code snippets, or anti-debugging code; Use the component packaging private key to encrypt the obfuscated code; Digitally sign the obfuscated and encrypted code. After completion, use the anti-tampering algorithm to generate a verification code and save it; Push the packaged private components to the server storage space for storage.

7. The method for protecting software and source code intellectual property rights according to claim 6, characterized in that: When the component packaging private key is used to encrypt the obfuscated code, RSA asymmetric encryption is used for encryption.

8. The method for protecting software and source code intellectual property rights according to claim 1, characterized in that: The server part also includes certificate generation, the specific steps are as follows: The server receives the unique device identifier and verification code uploaded by the client, encrypts the unique device identifier using the SM4 block encryption algorithm and the verification key, and compares the calculated verification code with the verification code uploaded by the client to verify the validity of the unique device identifier and verification code; Write the device unique identification, verification code, maximum number of online users allowed for the device, authorized device IP, and certificate expiration time information into the certificate information; The certificate information is encrypted using the RSA asymmetric encryption algorithm and the private key generated by the certificate. The private key generated by the certificate is only stored on the server. Package the certificate and send it back to the client for use.