A method and system for installing and running software packages based on digital signatures

By obtaining the unique identifier of the target machine and combining it with the national cryptographic algorithm for signature processing, the problem of software running on unauthorized devices is solved, ensuring the integrity and source credibility of the software package, ensuring that the software runs effectively on authorized devices, preventing piracy and unauthorized use, and improving system security and stability.

CN121479749BActive Publication Date: 2026-04-28KYLIN CORP
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
KYLIN CORP
Filing Date
2026-01-08
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing technologies are insufficient to effectively prevent software from running on unauthorized devices, cannot achieve fine-grained installation control and lifecycle management, and digital signature technology lacks deep integration with the hardware characteristics of the target machine.

Method used

By obtaining the unique identifier of the target machine, and combining the SM3 algorithm and the SM2-WITH-SM3 national cryptographic algorithm, the software package and program files are signed. A new section is added to store the signature value, certificate and signature validity period. Multiple verifications are performed during installation and runtime to ensure that the software can only run effectively on authorized devices.

Benefits of technology

It ensures the integrity and source trustworthiness of the software package, prevents tampering and malicious code, ensures that the software is installed and run only on authorized devices, prevents piracy and unauthorized use, and improves system stability and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121479749B_ABST
    Figure CN121479749B_ABST
Patent Text Reader

Abstract

The application relates to a software package installation and running control method and system based on digital signature, which comprises the following steps: S100, obtaining the unique identification of a target machine for software package installation and running; S200, submitting a software package use application by a terminal user; S300, auditing the application information by a server, and after passing, signing the software package and program files in the software package to obtain a signed software package and delivering the signed software package to the terminal user; S400, installing the signed software package by the terminal user, executing an installation verification process, and allowing installation after passing; and S500, executing a running verification process when the program runs after installation, and allowing execution after passing. The main purpose of the application is to bind the software package digital signature and the target machine, set a signature validity period, verify the software signature and the signature validity period during software package installation and running, and only the software package within the target machine binding range, the signature validity period and the signature verification can be installed and run.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of operating system security, and more specifically to a method and system for controlling the installation and operation of software packages based on digital signatures. Background Technology

[0002] With the widespread adoption of internet technology, software applications have become deeply integrated into all sectors of society. However, software faces numerous security risks during transmission, storage, and use, such as code tampering and malicious implantation. These threats can lead to software malfunctions, data leaks, and even systemic security incidents. While traditional access control and encryption technologies can provide basic protection, they are insufficient to effectively address the issue of ensuring information integrity after a breach.

[0003] Meanwhile, software piracy and unauthorized use have long been a problem facing the industry. Illegal copying, distribution, and use of software not only harm the rights of developers but may also introduce inferior or malicious code, threatening user system security. Traditional licensing methods that rely on license files or hardware locks have drawbacks such as being easily lost or forged, making it difficult to meet the needs for fine-grained control over software usage permissions.

[0004] Digital signature technology, through public-key encryption and hash algorithms, can verify the source and integrity of data, providing important protection for software security. However, existing digital signature applications mostly focus on verification at the data transmission level, lacking deep binding with the hardware characteristics of the target machine, making it difficult to effectively prevent software from running on unauthorized devices.

[0005] With the advancement of enterprise informatization and industrial automation, higher demands are being placed on software lifecycle management. Developers not only need to ensure the legal distribution of software, but also need to control its installation scope, runtime, and even the usage permissions of functional modules. For example, in the field of industrial control, software must be strictly bound to designated devices to prevent unauthorized copying and use from causing production accidents.

[0006] To address the aforementioned issues, Chinese patent CN113254965A discloses a method for obtaining a set of software packages to be encrypted, decompressing the set of software packages to be encrypted, identifying files of a predetermined format from the decompressed set of software packages to be encrypted, encrypting the identified files of the predetermined format, and finally compressing the encrypted set of software packages. This method enables encryption of multiple software packages at once, improving the efficiency of software package encryption. However, this method only improves the efficiency of software package encryption and cannot perform integrity verification or installation control of the software packages.

[0007] Chinese patent CN118740392A discloses a method, apparatus, and electronic device for signing software packages. The method includes: in response to a signature addition instruction, obtaining file content from the software package; based on the file content, calling a first signature interface corresponding to a first national cryptographic algorithm to obtain first signature data returned by the first signature interface; based on the first signature data, calling a second signature interface corresponding to a second national cryptographic algorithm to obtain second signature data returned by the second signature interface; based on the first signature data and the second signature data, obtaining signature summary information, wherein the signature summary information at least characterizes the algorithm type of the first national cryptographic algorithm and the algorithm type of the second national cryptographic algorithm; and adding the signature summary information, the first signature data, and the second signature data to the software package. However, this method only provides a method for signing software packages and cannot provide control over the installation and operation of the software package.

[0008] Chinese patent CN112699343A proposes a method and apparatus for software integrity protection and verification. The protection process includes: a first device acquiring a first software package, which includes a first signature of a second software package by a first party using a first private key; the first device performing a signature operation on the first software package using a second private key to obtain a third software package including a second signature, where the first private key is controlled by the first party and the second private key is controlled by the second party. After sending the third software package to a second device, the verification process includes: the second device acquiring the first software package, which includes a first signature, a second signature, and a second software package; the second device verifying the first signature and the second signature based on pre-stored first and second public keys respectively, and obtaining a verification result. This method uses keys provided by the manufacturer and user for software integrity protection, providing users with dual software integrity verification evidence and solving the user trust issue. However, this solution only provides a basis for software integrity verification and cannot solve the problem of unauthorized and prohibited use of software packages.

[0009] Chinese patent CN118585968A proposes a method to parse software installation packages and obtain verification certificates, which include a signature certificate and a custom certificate. The signature certificate is verified; if successful, the device is allowed to install the software. Similarly, the custom certificate is verified; if successful, the software is allowed to access the corresponding system permissions. However, this method only controls the installation of the software package after verification and grants access to the corresponding system permissions. It cannot solve the problems of installation control and target machine binding, nor can it set a signature validity period. Summary of the Invention

[0010] The main objective of this invention is to provide a method and system for controlling the installation and operation of software packages based on digital signatures. This method binds the digital signature of the software package to the target machine and sets a signature validity period. During installation and operation, the software signature and its validity period are verified. Only software packages that are within the target machine's binding range, within the signature validity period, and whose signature verification is successful can be installed and run, thereby achieving the following objectives:

[0011] Enhance software package security: Digital signature technology can ensure the integrity and authenticity of software packages, preventing tampering or malicious code injection.

[0012] Implement device-level binding control: Bind digital signatures to the unique identifier of the target machine to restrict software packages to be installed and run only on authorized devices.

[0013] Enhance the ability to manage software with precision: strictly bind software to designated devices and control its installation scope and runtime to prevent unauthorized copying and use that could lead to production accidents.

[0014] To achieve the above objectives, the present invention provides a software package installation and execution control method based on digital signatures, comprising the following steps:

[0015] S100: Obtain the unique identifier of the target machine for the installation and operation of the software package;

[0016] S200: The end user submits a software package usage application. The application information for the software package includes the software package name, version information, the unique identifier of the target machine obtained through step S100, and the signature validity period.

[0017] The S300 and server review the application information. After approval, they sign the software package and its program files to obtain a signed software package, which is then distributed to the end user.

[0018] The signature processing includes: obtaining the key data content of the object to be signed; appending the unique identifier of the target machine and the signature validity period to the key data content; calculating the digest value of the appended content using the SM3 algorithm; signing the digest value using the private key and the SM2-WITH-SM3 national cryptographic algorithm to obtain the signature value; and appending the signature value, the certificate corresponding to the private key, and the signature validity period to a new section of the object to be signed, wherein the object to be signed is a software package or program file.

[0019] S400 When an end user installs a signed software package, an installation verification process is executed. If the verification is successful, the installation is allowed; otherwise, the installation is rejected.

[0020] S500: When the installed program is run, a verification process is executed. If the verification is successful, the program is allowed to run; otherwise, it is prohibited from running.

[0021] Preferably, in step S100, the unique identifier of the target machine is obtained by the end user calling a system-specified command.

[0022] Preferably, in step S300, when signing the program file, the newly added section includes three sections named ofself.sig, ofself.cert, and ofself.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively.

[0023] Preferably, in step S300, when signing the software package, the newly added section includes three sections named ospackage.sig, ospackage.cert, and ospackage.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively.

[0024] Preferably, in step S400, the installation verification process includes the following steps:

[0025] S410. Obtain the signature validity period from the newly added section of the software package, compare the current time with the signature validity period, and refuse to install if the current time is not within the signature validity period.

[0026] S420. If the current time is within the valid signature period, obtain the certificate from the newly added section of the software package, verify the certificate's validity using the system's default integrated root certificate and certificate revocation list, and refuse installation if the certificate is invalid.

[0027] S430. If the certificate is valid, obtain the signature value from the newly added section of the software package, obtain the key data content of the software package, call the system interface to obtain the unique identifier of the currently installed machine, append the unique identifier of the currently installed machine and the signature validity period to the key data content of the software package, calculate the digest value using the SM3 algorithm, obtain the public key from the certificate, and verify the signature using the signature value, digest value and public key. If the signature verification is successful, installation is allowed; otherwise, installation is rejected.

[0028] Preferably, in step S500, the verification process includes the following sub-steps:

[0029] S510. Obtain the signature validity period from the newly added section of the program file, compare the current time with the signature validity period, and prohibit execution if the current time is not within the signature validity period.

[0030] S520. If the current time is within the valid signature period, obtain the certificate from the newly added section of the program file, and verify the legality of the certificate using the system's default integrated root certificate and certificate revocation list. If the certificate is invalid, prohibit the program from running.

[0031] S530. If the certificate is valid, obtain the signature value from the newly added section of the program file, obtain the key data content of the program file, call the system interface to obtain the unique identifier of the currently running machine, append the unique identifier of the currently running machine and the signature validity period to the key data content of the program file, calculate the digest value using the SM3 algorithm, obtain the public key from the certificate, and use the signature value, digest value and public key to verify the signature. If the signature verification is successful, the program is allowed to run; otherwise, the program is prohibited from running.

[0032] This invention also provides a software package installation and operation control system based on digital signatures, characterized in that it includes:

[0033] The target machine identifier acquisition module is used to obtain the unique identifier of the target machine for software package installation and operation.

[0034] The application submission module is used by end users to submit applications for the use of software packages. The application information for the software packages includes the package name, version information, the unique identifier of the target machine obtained through the target machine identifier acquisition module, and the signature validity period.

[0035] The server-side signature module is used to review application information. After approval, it signs the software package and its program files to obtain a signed software package, which is then distributed to the end user. The signature process includes: obtaining the key data content of the object to be signed; appending the target machine's unique identifier and signature validity period to the key data content; calculating the digest value of the appended content using the SM3 algorithm; signing the digest value using the private key and the SM2-WITH-SM3 national cryptographic algorithm to obtain the signature value; and appending the signature value, the certificate corresponding to the private key, and the signature validity period to a new section of the object to be signed. The object to be signed is either a software package or a program file.

[0036] The installation verification module is used to perform an installation verification process when an end user installs a signed software package. If the verification is successful, the installation is allowed; otherwise, the installation is rejected.

[0037] The runtime verification module is used to perform a runtime verification process when the program is installed. If the verification is successful, the program is allowed to run; otherwise, it is prohibited from running.

[0038] Preferably, the server-side signing module includes a program file signing unit and a software package signing unit;

[0039] The program file signing unit is used to sign program files. The newly added sections include three sections named ofself.sig, ofself.cert, and ofself.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively.

[0040] The package signing unit is used to sign packages. The newly added sections include three sections named ospackage.sig, ospackage.cert, and ospackage.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively.

[0041] Preferably, the installation verification process executed by the installation verification module includes:

[0042] Obtain the signature validity period from the newly added section of the software package, compare the current time with the signature validity period, and refuse installation if the current time is not within the signature validity period;

[0043] If the current time is within the valid signature period, obtain the certificate from the newly added section of the package, verify the certificate's validity using the system's default integrated root certificate and certificate revocation list, and refuse installation if the certificate is invalid.

[0044] If the certificate is valid, obtain the signature value from the newly added section of the software package, obtain the key data content of the software package, call the system interface to obtain the unique identifier of the currently installed machine, append the unique identifier of the currently installed machine and the signature validity period to the key data content of the software package, calculate the digest value using the SM3 algorithm, obtain the public key from the certificate, and use the signature value, digest value and public key to verify the signature. If the signature verification is successful, the installation is allowed; otherwise, the installation is rejected.

[0045] Preferably, the runtime verification process executed by the runtime verification module includes:

[0046] Obtain the signature validity period from the newly added section of the program file, compare the current time with the signature validity period, and prohibit execution if the current time is not within the signature validity period;

[0047] If the current time is within the valid signature period, retrieve the certificate from the newly added section of the program file, verify the certificate's validity using the system's default integrated root certificate and certificate revocation list, and prohibit operation if the certificate is invalid;

[0048] If the certificate is valid, the signature value is obtained from the newly added section of the program file, the key data content of the program file is obtained, the system interface is called to obtain the unique identifier of the currently running machine, the unique identifier of the currently running machine and the signature validity period are appended to the key data content of the program file, the digest value is calculated using the SM3 algorithm, the public key is obtained from the certificate, and the signature is verified using the signature value, digest value and public key. If the signature verification is successful, the program is allowed to run; otherwise, the program is prohibited from running.

[0049] The beneficial effects of this invention are as follows:

[0050] Binding the package signature to a unique identifier on the target machine prevents unauthorized porting. By binding the package signature to a unique identifier on the target machine, attackers cannot copy the package to other devices for installation or execution.

[0051] It provides encryption using national cryptographic algorithms to enhance its resistance to cracking. Employing a combination of SM2 (asymmetric encryption) and SM3 (hash algorithm), it offers higher security strength compared to traditional RSA / SHA-1 algorithms.

[0052] Multiple pre-installation checks prevent the deployment of problematic software. During installation, the system sequentially checks the signature validity period, certificate validity, and signature verification results. If the signature expires (e.g., trial version expires), the certificate is revoked (e.g., private key is leaked), or signature verification fails (e.g., files are tampered with), the system automatically refuses to install, preventing problematic software from entering the production environment.

[0053] Continuous runtime verification prevents dynamic attacks. Re-verification upon program startup detects whether malicious code has been injected or configurations modified during runtime. For example, if an attacker tampers with program logic via memory injection, the signature verification process will terminate due to a mismatch in digest values, ensuring system stability.

[0054] Preventing software piracy and unauthorized use. A dual verification mechanism combining digital signatures and machine signatures prevents the software package from being installed on unauthorized devices, effectively curbing piracy and unauthorized use. The system monitors the software's legitimacy during runtime, ensuring it always runs within an authorized environment. Simultaneously, the signature validity period is checked during installation and runtime, ensuring the software can only be used within the authorized timeframe. Attached Figure Description

[0055] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0056] Figure 1 This is a flowchart of the software package installation control process of the present invention;

[0057] Figure 2 This is the program execution control flowchart of the present invention. Detailed Implementation

[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0059] Example 1

[0060] This embodiment provides a method for controlling the installation and operation of software packages based on digital signatures, specifically including the following steps:

[0061] Step S100: Obtain the unique identifier of the target machine

[0062] In this step, the end user triggers the generation and acquisition of the target machine's unique identifier by invoking a pre-defined dedicated command. This command reads the target machine's core hardware information (such as the motherboard's unique serial number, CPU hardware identifier, and network card's physical MAC address), and generates an irreversible, unique string identifier (example format: c7603c45329fdbdada893ff1d3601a44483c2dbc666c035152c55f53a4e9e3b7) through hash operations (such as SM3). This identifier serves as the core basis for binding the software package to the target machine, ensuring that the software can only be installed and run on the machine corresponding to this identifier.

[0063] Step S200: The end user submits a request to use the software package.

[0064] In this step, the end user fills out the software package usage application as required. The application information must include the following complete details:

[0065] Basic package information: Package name (e.g., "wps-office"), version information (e.g., "V2.1.0.202405");

[0066] Binding association information: The unique identifier of the target machine obtained in step S100;

[0067] Authorization validity period information: The validity period of the signature (e.g., "June 1, 2024 - May 31, 2025").

[0068] After the application is submitted, the relevant information will be transmitted to the server and await the triggering of the review process.

[0069] Step S300: Server-side signature processing and distribution of signed software packages

[0070] The server verifies the legality of the received application information (such as verifying the validity of the target machine identifier and the completeness of the software package information). After the verification is successful, the signing process is initiated, which consists of two steps: "program file signing" and "software package signing".

[0071] 1. Program file signing (the object to be signed is a program file within the software package)

[0072] The server first unzips the original software package and extracts all program files (such as executable files, dependency library files, etc.).

[0073] For a single program file, first obtain its key data content;

[0074] Key data in program files: These mainly include the program's code section, data section, dynamic linking related section, debugging and symbol information section, and other core metadata of the program file;

[0075] After the above key data content, the unique identifier of the target machine obtained in step S100 and the validity period of the signature submitted in step S200 are added to form combined data;

[0076] The SM3 cryptographic hash function is used to calculate the digest value of the combined data;

[0077] Using the server's private key, the above digest value is signed using the SM2-WITH-SM3 national cryptographic algorithm to generate a signature value;

[0078] Based on the structural characteristics of the program file (such as the ELF file format), three dedicated sections are added to the program file, named isoself.sig, isoself.cert, and isoself.time, respectively. These sections store the signature value generated in each step, the digital certificate (including the public key) corresponding to the private key (i.e. the private key used for signing), and the signature validity period, respectively.

[0079] Repeat the above steps for all program files in the software package to complete the signing of all program files.

[0080] 2. Package signing (the object to be signed is the repackaged software package)

[0081] Repackage all the signed program files to form a package to be signed;

[0082] Obtain key data content of the package to be signed (such as the file index table, file size, checksum and other core metadata);

[0083] Key data of the software package: mainly includes core metadata of the software package such as package control files, program files, configuration files, and data files;

[0084] After the above key data content, add the target machine's unique identifier and the signature's validity period to form combined data;

[0085] The SM3 algorithm is used to calculate the summary value of the combined data;

[0086] Using the same private key as the program file signature, the digest value is signed using the SM2-WITH-SM3 algorithm to generate the package signature value;

[0087] Based on the structural characteristics of the software package, three dedicated sections are added to the software package, named ospackage.sig, ospackage.cert, and ospackage.time, respectively, which store the software package signature value, the digital certificate corresponding to the private key, and the signature validity period.

[0088] After signing is completed, the server will send the signed software package to the end user through an encrypted channel.

[0089] Step S400: Package Installation Verification Process

[0090] When an end user initiates the installation of a signed software package, the system automatically triggers an installation verification process. The process consists of three steps, and installation is refused if any step fails to verify the package.

[0091] like Figure 1 As shown, the specific steps are as follows:

[0092] S410, Signature validity period verification

[0093] Based on the characteristics of the package structure, the installer locates the ospackage.time section, obtains relevant information about the section (such as the location and size of the data stored in the section), and reads the signature validity period stored therein.

[0094] Call the system interface to obtain the current system time, and compare the current time with the signature validity period: if the current time is not within the signature validity period, terminate the installation immediately; if it is within the period, proceed to the next verification step.

[0095] S420, Certificate Validity Verification

[0096] The installer locates the ospackage.cert section, obtains relevant information about the section, such as the location and size of the data stored in the section, and extracts the digital certificate stored therein.

[0097] The system calls the root certificate and Certificate Revocation List (CRL) integrated by default to perform a validity check on the digital certificate (including verifying the validity of the certificate signature, whether the certificate is within its validity period, and whether the certificate has been revoked). If the certificate is invalid, the installation will terminate; if it is valid, proceed to the next verification step.

[0098] S430, Signature Verification

[0099] The installer locates the ospackage.sig section and extracts the package signature value stored therein;

[0100] Obtain key data content of the software package, and simultaneously call system interfaces to obtain the unique identifier of the currently installed machine;

[0101] Append the unique identifier of the currently installed machine and the signature validity period to the key data content of the software package to form combined data;

[0102] The SM3 algorithm is used to calculate the summary value of the combined data;

[0103] Obtain the public key from the digital certificate extracted in the above steps. Use the public key, the signature value extracted in the above steps, and the calculated digest value to perform the SM2-WITH-SM3 signature verification operation: if the signature verification fails, terminate the installation; if the signature verification succeeds, allow the package installation to continue.

[0104] Step S500: Program execution verification process

[0105] When the installed program starts running, the system automatically triggers a verification process, which is executed in three steps. If any step fails verification, the program will be prohibited from running.

[0106] like Figure 2 As shown, the specific steps are as follows:

[0107] S510, Signature Validity Verification

[0108] When the program starts, it locates the oself.time section based on its own file structure characteristics and reads the signature validity period.

[0109] Obtain the current system time and compare it with the signature validity period: if the current time is not within the validity period, immediately terminate the program startup; if it is within the validity period, proceed to the next verification step.

[0110] S520, Certificate Validity Verification

[0111] The program locates the oself.cert section and extracts the digital certificate;

[0112] The system root certificate and CRL list are retrieved to verify the certificate's validity: if the certificate is invalid, the startup process is terminated; if it is valid, the process proceeds to the next verification step.

[0113] S530, Signature Verification

[0114] The program locates the oself.sig section and extracts the program file signature value;

[0115] It obtains its own key data content and calls the system interface to obtain the unique identifier of the currently running machine;

[0116] After the key data content of the program, append the unique identifier of the currently running machine and the validity period of the signature to form combined data;

[0117] The SM3 algorithm is used to calculate the summary value of the combined data;

[0118] Obtain the public key from the digital certificate, and use the public key, signature value, and digest value to perform SM2-WITH-SM3 signature verification: if the signature verification fails, terminate the startup; if the signature verification succeeds, allow the program to run normally.

[0119] Example 2

[0120] This embodiment provides a software package installation and operation control system based on digital signatures, according to the method of the previous embodiment. The system includes a target machine identifier acquisition module, an application submission module, a server-side signature module, an installation verification module, and an operation verification module. Wherein:

[0121] The target machine identifier acquisition module is primarily responsible for acquiring and outputting the unique identifier of the target machine, providing the core basis for software package binding. This module is integrated into the operating system's command-line tools or API interface. It generates a unique identifier by reading core machine hardware information (motherboard serial number, CPU identifier, etc.) and performing a hash operation.

[0122] The application submission module is used by end users to submit applications for the use of software packages. The application information for the software packages includes the package name, version information, the unique identifier of the target machine obtained through the target machine identifier acquisition module, and the signature validity period.

[0123] The server-side signature module is used to review application information. After approval, it signs the software package and its program files to obtain a signed software package, which is then distributed to the end user. The signature process includes: obtaining the key data content of the object to be signed; appending the target machine's unique identifier and signature validity period to the key data content; calculating the digest value of the appended content using the SM3 algorithm; signing the digest value using the private key and the SM2-WITH-SM3 national cryptographic algorithm to obtain the signature value; and appending the signature value, the certificate corresponding to the private key, and the signature validity period to a new section of the object to be signed. The object to be signed is a software package or a program file.

[0124] The server-side signature module includes a program file signature unit and a software package signature unit. The program file signature unit is used to sign program files, and its newly added sections include three sections named ofself.sig, ofself.cert, and ofself.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively. The software package signature unit is used to sign software packages, and its newly added sections include three sections named ospackage.sig, ospackage.cert, and ospackage.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively.

[0125] The installation verification module is used to perform an installation verification process when an end user installs a signed software package. If the verification is successful, the installation is allowed; otherwise, the installation is rejected.

[0126] The installation verification process executed by the installation verification module includes: obtaining the signature validity period from the newly added section of the software package; comparing the current time with the signature validity period; if the current time is not within the signature validity period, installation is rejected; if the current time is within the signature validity period, obtaining the certificate from the newly added section of the software package; verifying the certificate's legality using the system's default integrated root certificate and certificate revocation list; if the certificate is invalid, installation is rejected; if the certificate is valid, obtaining the signature value from the newly added section of the software package; obtaining the key data content of the software package; calling the system interface to obtain the unique identifier of the currently installed machine; appending the unique identifier of the currently installed machine and the signature validity period to the key data content of the software package; calculating the digest value using the SM3 algorithm; obtaining the public key from the certificate; and verifying the signature using the signature value, digest value, and public key; if the verification passes, installation is allowed; otherwise, installation is rejected.

[0127] The runtime verification module is used to perform a runtime verification process when the program is installed. If the verification is successful, the program is allowed to run; otherwise, it is prohibited from running.

[0128] The execution verification process performed by the execution verification module includes: obtaining the signature validity period from the newly added section of the program file, comparing the current time with the signature validity period, and prohibiting execution if the current time is not within the signature validity period; if the current time is within the signature validity period, obtaining the certificate from the newly added section of the program file, verifying the certificate's legality using the system's default integrated root certificate and certificate revocation list, and prohibiting execution if the certificate is invalid; if the certificate is valid, obtaining the signature value from the newly added section of the program file, obtaining the key data content of the program file, calling the system interface to obtain the unique identifier of the currently running machine, appending the unique identifier of the currently running machine and the signature validity period to the key data content of the program file, calculating the digest value using the SM3 algorithm, obtaining the public key from the certificate, and verifying the signature using the signature value, digest value, and public key. If the verification passes, execution is allowed; otherwise, execution is prohibited.

[0129] Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

Claims

1. A method for controlling the installation and operation of software packages based on digital signatures, characterized in that, Includes the following steps: S100. Obtain the unique identifier of the target machine for the installation and operation of the software package; In step S100, the unique identifier of the target machine is obtained by the terminal user calling a system-specified command; This command reads the core hardware information of the target machine and generates an irreversible and unique string identifier through hash operation; S200: The end user submits a software package usage application. The application information for the software package includes the software package name, version information, the unique identifier of the target machine obtained through step S100, and the signature validity period. The S300 and server review the application information. After approval, they sign the software package and its program files to obtain a signed software package, which is then distributed to the end user. The signature processing includes: obtaining the key data content of the object to be signed; appending the target machine's unique identifier and the signature validity period to the key data content; calculating the digest value of the appended content using the SM3 algorithm; signing the digest value using the private key and the SM2-WITH-SM3 national cryptographic algorithm to obtain the signature value; and appending the signature value, the certificate corresponding to the private key, and the signature validity period to a new section of the object to be signed. The objects to be signed are software packages and program files; In step S300, when signing the program file, three dedicated sections are added to the program file. The new sections are named ofself.sig, ofself.cert, and ofself.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively. In step S300, when signing the software package, three dedicated sections are added to the software package. The new sections are named ospackage.sig, ospackage.cert, and ospackage.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively. S400 When an end user installs a signed software package, an installation verification process is executed. If the verification is successful, the installation is allowed; otherwise, the installation is rejected. In step S400, the installation verification process includes the following steps: S410. Obtain the signature validity period from the newly added section of the software package, compare the current time with the signature validity period, and refuse to install if the current time is not within the signature validity period. S420. If the current time is within the valid signature period, obtain the certificate from the newly added section of the software package, verify the certificate's validity using the system's default integrated root certificate and certificate revocation list, and refuse installation if the certificate is invalid. S430. If the certificate is valid, obtain the signature value from the newly added section of the software package, obtain the key data content of the software package, call the system interface to obtain the unique identifier of the currently installed machine, append the unique identifier of the currently installed machine and the signature validity period to the key data content of the software package, calculate the digest value using the SM3 algorithm, obtain the public key from the certificate, and use the signature value, digest value and public key to verify the signature. If the signature verification is successful, the installation is allowed; otherwise, the installation is rejected. S500: When the installed program runs, it performs a verification process. If the verification is successful, it is allowed to run; otherwise, it is prohibited from running. In step S500, the verification process includes the following sub-steps: S510. Obtain the signature validity period from the newly added section of the program file, compare the current time with the signature validity period, and prohibit execution if the current time is not within the signature validity period. S520. If the current time is within the valid signature period, obtain the certificate from the newly added section of the program file, and verify the legality of the certificate using the system's default integrated root certificate and certificate revocation list. If the certificate is invalid, prohibit the program from running. S530. If the certificate is valid, obtain the signature value from the newly added section of the program file, obtain the key data content of the program file, call the system interface to obtain the unique identifier of the currently running machine, append the unique identifier of the currently running machine and the signature validity period to the key data content of the program file, calculate the digest value using the SM3 algorithm, obtain the public key from the certificate, and use the signature value, digest value and public key to verify the signature. If the signature verification is successful, the program is allowed to run; otherwise, the program is prohibited from running.

2. A software package installation and operation control system based on digital signatures, characterized in that, include: The target machine identifier acquisition module is used to obtain the unique identifier of the target machine for software package installation and operation. The application submission module is used by end users to submit applications for the use of software packages. The application information for the software packages includes the package name, version information, the unique identifier of the target machine obtained through the target machine identifier acquisition module, and the signature validity period. The server-side signature module is used to review application information. After approval, it signs the software package and its program files to obtain a signed software package, which is then distributed to the end user. The signature process includes: obtaining the key data content of the object to be signed; appending the target machine's unique identifier and signature validity period to the key data content; calculating the digest value of the appended content using the SM3 algorithm; signing the digest value using the private key and the SM2-WITH-SM3 national cryptographic algorithm to obtain the signature value; and appending the signature value, the certificate corresponding to the private key, and the signature validity period to a new section of the object to be signed. The objects to be signed are software packages and program files. The installation verification module is used to perform an installation verification process when an end user installs a signed software package. If the verification is successful, the installation is allowed; otherwise, the installation is rejected. The runtime verification module is used to perform a runtime verification process when the program is installed. If the verification is successful, the program is allowed to run; otherwise, the program is prohibited from running. The server-side signing module includes a program file signing unit and a software package signing unit; The program file signing unit is used to sign program files. The newly added sections include three sections named ofself.sig, ofself.cert, and ofself.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively. The package signing unit is used to sign packages. The newly added sections include three sections named ospackage.sig, ospackage.cert, and ospackage.time, which are used to store the signature value, the certificate corresponding to the private key, and the signature validity period, respectively. The installation verification process executed by the installation verification module includes: Obtain the signature validity period from the newly added section of the software package, compare the current time with the signature validity period, and refuse installation if the current time is not within the signature validity period; If the current time is within the valid signature period, obtain the certificate from the newly added section of the package, verify the certificate's validity using the system's default integrated root certificate and certificate revocation list, and refuse installation if the certificate is invalid. If the certificate is valid, obtain the signature value from the newly added section of the software package, obtain the key data content of the software package, call the system interface to obtain the unique identifier of the currently installed machine, append the unique identifier of the currently installed machine and the signature validity period to the key data content of the software package, calculate the digest value using the SM3 algorithm, obtain the public key from the certificate, and use the signature value, digest value and public key to verify the signature. If the signature verification is successful, the installation is allowed; otherwise, the installation is rejected. The runtime verification process executed by the runtime verification module includes: Obtain the signature validity period from the newly added section of the program file, compare the current time with the signature validity period, and prohibit execution if the current time is not within the signature validity period; If the current time is within the valid signature period, retrieve the certificate from the newly added section of the program file, verify the certificate's validity using the system's default integrated root certificate and certificate revocation list, and prohibit operation if the certificate is invalid; If the certificate is valid, the signature value is obtained from the newly added section of the program file, the key data content of the program file is obtained, the system interface is called to obtain the unique identifier of the currently running machine, the unique identifier of the currently running machine and the signature validity period are appended to the key data content of the program file, the digest value is calculated using the SM3 algorithm, the public key is obtained from the certificate, and the signature is verified using the signature value, digest value and public key. If the signature verification is successful, the program is allowed to run; otherwise, the program is prohibited from running.

Citation Information

Patent Citations

  • Software integrity protection and verification method and device

    CN112699343A

  • Software package encryption method, computing device and storage medium

    CN113254965A

  • Authority control method and system based on custom certificate and memory

    CN118585968A

  • Method and device for processing signature for software package and electronic equipment

    CN118740392A

  • Software installation package signature method and system based on digital certificate state check

    CN119299110A