Software security verification method, device and storage medium
By obtaining and verifying the first and second certificates of the software package in an electronic device, using the pre-burned root public key and software package public key, the problem of malware burning when downloading software is solved, the security checksum execution of the software package is realized, and the user's software information is protected.
Patent Information
- Application Number
- CN202210594174.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2042-05-27
AI Technical Summary
When downloading the software, the electronic device does not perform secure download and secure startup verification, resulting in the malware being burned and endangering the security of the user's software information.
By obtaining the first certificate and the second certificate in the software package, decrypting the signature of the first certificate using the pre-burned root public key, obtaining the hash value of the software package public key, and decrypting the signature of the second certificate through the software package public key, obtaining the hash value of the software package, ensuring the validity of the certificate authentication file and the encrypted certificate file, and then verifying the security of the software package.
By performing double certificate verification on the software package, the security of the software package is ensured, thereby preventing the burning of malware and protecting the security of users' software information.
Smart Images

Figure CN115208575B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a software security verification method, device and storage medium. Background Art
[0002] Currently, most threats come from the content downloaded by users. Take the scenario of downloading software as an example. When downloading software, the electronic device does not perform safe download and safe boot verification, which may cause someone to maliciously burn uncertified software into the electronic device, thereby endangering the user's software information security. Summary of the invention
[0003] The present application provides a software security verification method, device and storage medium, which are used to solve the problem in the related art that someone maliciously burns uncertified software into an electronic device, causing damage to the user's software information security.
[0004] In a first aspect, a method for verifying software security is provided, comprising:
[0005] Obtaining a first certificate and a second certificate in a software package, wherein the first certificate is used to verify a software package public key of the software package, and the second certificate is used to verify the software package;
[0006] Decrypting the signature of the first certificate based on the pre-burned root public key to obtain a public key hash value of the software package;
[0007] When it is determined based on the software package public key hash value that the software package public key in the first certificate is correct, decrypting the signature of the second certificate using the software package public key to obtain the software package hash value;
[0008] When it is determined that the software package hash value is the same as the software package hash value in the second certificate, the software package is executed.
[0009] Optionally, before obtaining the first certificate and the second certificate in the software package, the method further includes:
[0010] Obtaining a certificate authentication file and an encryption certificate file of the software, wherein the certificate authentication file includes a certificate authentication file public key;
[0011] When it is determined that the certificate authentication file public key is valid based on the pre-burned root public key, the encrypted certificate file is decrypted using the certificate authentication file public key to obtain the certificate file;
[0012] The software package is downloaded according to the certificate file.
[0013] Optionally, determining that the certificate authentication file public key is valid based on the pre-burned root public key includes:
[0014] Decrypting the signature in the certificate authentication file based on the pre-burned root public key to obtain a decrypted certificate authentication file public key;
[0015] When the decrypted certificate authentication file public key is consistent with the certificate file public key, it is determined that the certificate authentication file public key is valid.
[0016] Optionally, before decrypting the signature in the certificate authentication file based on the pre-burned root public key to obtain the public key for decrypting the certificate authentication file, the method further includes:
[0017] Obtain the root public key in the certificate authentication file;
[0018] Calculate a first hash value of the root public key in the certificate authentication file and a second hash value of the pre-burned root public key;
[0019] It is determined that the first hash value is the same as the second hash value.
[0020] Optionally, before decrypting the signature of the first certificate based on the pre-burned root public key to obtain the hash value of the software package public key, the method further includes:
[0021] Obtaining the root public key in the first certificate;
[0022] Calculate a third hash value of the root public key in the first certificate and a second hash value of the pre-burned root public key;
[0023] It is determined that the second Hash value is the same as the third Hash value.
[0024] Optionally, determining, based on the software package public key hash value, that the software package public key in the first certificate is correct includes:
[0025] Obtaining the software package public key in the first certificate;
[0026] Calculating a hash value of the software package public key in the first certificate;
[0027] When it is determined that the software package public key hash value is the same as the software package public key hash value in the first certificate, it is determined that the software package public key in the first certificate is correct.
[0028] Optionally, after determining that the software package public key in the first certificate is correct based on the software package public key hash value, using the software package public key to decrypt the signature of the second certificate before obtaining the software package hash value, the method further includes:
[0029] Obtaining the software package public key in the second certificate;
[0030] It is determined that the software package public key in the second certificate is the same as the software package public key in the first certificate.
[0031] In a second aspect, a method for verifying the security of a software package is provided, comprising:
[0032] Encrypting the software package public key hash value in the software package using a root private key to obtain a signature of a first certificate, wherein the root private key matches a root public key pre-burned into the electronic device; and encrypting the software package hash value of the software package using a software package private key to obtain a signature of a second certificate, wherein the software package private key matches the software package public key;
[0033] Based on the signature of the first certificate and the public key of the software package, generate the first certificate; based on the signature of the second certificate and the hash value of the software package, generate the second certificate;
[0034] When the issuing condition of the software package is met, the software package including the first certificate and the second certificate is issued.
[0035] In a third aspect, an electronic device is provided, comprising: a processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus;
[0036] The memory is used to store computer programs;
[0037] The processor is used to execute the program stored in the memory to implement the method described in the first aspect or the second aspect.
[0038] According to a fourth aspect, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect or the second aspect is implemented.
[0039] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application obtains the first certificate and the second certificate in the software package of the software, the first certificate is used to verify the software package public key of the software package, and the second certificate is used to verify the software package; the signature of the first certificate is decrypted based on the pre-burned root public key to obtain the software package public key hash value; when the software package public key in the first certificate is determined to be correct based on the software package public key hash value, the signature of the second certificate is decrypted using the software package public key to obtain the software package hash value; when the software package hash value is determined to be the same as the software package hash value in the second certificate, the software package is executed. Since the first certificate and the second certificate can be used to verify the software package, and the software package is executed only after the verification passes, the security of executing the software package can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0042] Figure 1 A flowchart of a method for verifying software security in an embodiment of the present application;
[0043] Figure 2 It is another flowchart of the method for verifying software security in the embodiment of the present application;
[0044] Figure 3 A schematic diagram of the structure of a software security verification system in an embodiment of the present application;
[0045] Figure 4 This is another structural diagram of the software security verification device in the embodiment of the present application;
[0046] Figure 5 This is another structural diagram of the software security verification device in the embodiment of the present application;
[0047] Figure 6 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0049] The embodiment of the present application provides a method for verifying software security, which can be applied to electronic devices; the electronic device can specifically be a module capable of realizing communication functions or a terminal device containing the module, etc., and the terminal device can be a mobile terminal or a smart terminal. The mobile terminal can specifically be at least one of a mobile phone, a tablet computer, a laptop computer, etc.; the smart terminal can specifically be a terminal containing a wireless communication module such as a smart car, a smart watch, a shared bicycle, a smart cabinet, etc.; the module can specifically be a wireless communication module, such as any one of a 2G communication module, a 3G communication module, a 4G communication module, a 5G communication module, and a NB-IOT communication module.
[0050] like Figure 1 As shown, the method may include the following steps:
[0051] Step 101: Obtain a first certificate and a second certificate in a software package, wherein the first certificate is used to verify a software package public key of the software package, and the second certificate is used to verify the software package.
[0052] Since the DA (Download Agent) file indicates the download configuration of the software package, for example, the DA file can indicate the size of the software package, the download order, etc., in order to further ensure the security of the software, the DA file can also be verified before the first certificate and the second certificate are verified to ensure the security of the download of the software package.
[0053] In an optional embodiment, before obtaining the first certificate and the second certificate in the software package, the certificate authentication file and the encrypted certificate file of the software are obtained, and the certificate authentication file includes a public key of the certificate authentication file; when the public key of the certificate authentication file is determined to be valid based on the pre-burned root public key, the public key of the certificate authentication file is used to decrypt the encrypted certificate file to obtain the certificate file; and the software package is downloaded according to the certificate file.
[0054] In this embodiment, the signature in the certificate authentication file is used to verify the validity of the public key of the certificate authentication file.
[0055] In an optional embodiment, the signature in the certificate authentication file is decrypted based on the pre-burned root public key to obtain the decrypted certificate authentication file public key; when the decrypted certificate authentication file public key is consistent with the certificate file public key, it is determined that the certificate authentication file public key is valid.
[0056] In this embodiment, in order to ensure that the pre-burned root public key matches the encryption key of the signature in the certificate authentication file, the root public key may be further verified before the signature in the certificate authentication file is decrypted.
[0057] In an optional embodiment, a root public key in a certificate authentication file is obtained; a first hash value of the root public key in the certificate authentication file and a second hash value of a pre-burned root public key are calculated; and it is determined that the first hash value is the same as the second hash value.
[0058] It should be understood that here, when the first hash value is the same as the second hash value, it is confirmed that the root public key in the certificate authentication file is the same as the pre-burned root public key.
[0059] Step 102: Decrypt the signature of the first certificate based on the pre-burned root public key to obtain a public key hash value of the software package.
[0060] In this embodiment, in order to ensure that the pre-burned root public key matches the encryption key of the signature of the first certificate, the root public key may be further verified before the signature of the first certificate is decrypted.
[0061] In an optional embodiment, a root public key in the first certificate is obtained; a third hash value of the root public key in the first certificate and a second hash value of the pre-burned root public key are calculated; and it is determined that the second hash value is the same as the third hash value.
[0062] It should be understood that when the second hash value and the third hash value are the same, it is confirmed that the root public key in the first certificate is the same as the pre-burned root public key.
[0063] Step 103: When it is determined based on the software package public key hash value that the software package public key in the first certificate is correct, the software package public key is used to decrypt the signature of the second certificate to obtain the software package hash value.
[0064] In this embodiment, whether the software package public key in the first certificate is correct is determined by matching the software package public key hash value obtained by decrypting the first certificate with the software package public key in the first certificate.
[0065] In an optional embodiment, the software package public key in the first certificate is obtained; a hash value of the software package public key in the first certificate is calculated; and when it is determined that the software package public key hash value is the same as the software package public key hash value in the first certificate, it is determined that the software package public key in the first certificate is correct.
[0066] In this embodiment, the software package public key in the second certificate may also be used to verify the software package public key in the first certificate.
[0067] In an optional embodiment, after determining that the software package public key in the first certificate is correct based on the software package public key hash value, the software package public key is used to decrypt the signature of the second certificate, and before obtaining the software package hash value, the software package public key in the second certificate is obtained; and it is determined that the software package public key in the second certificate is the same as the software package public key in the first certificate.
[0068] Step 104: When it is determined that the software package hash value is the same as the software package hash value in the second certificate, execute the software package.
[0069] The execution software package in this embodiment includes but is not limited to an installation software package and / or a running software package.
[0070] In the technical solution provided by this embodiment, the first certificate and the second certificate in the software package are obtained, the first certificate is used to verify the software package public key of the software package, and the second certificate is used to verify the software package; the signature of the first certificate is decrypted based on the pre-burned root public key to obtain the software package public key hash value; when the software package public key in the first certificate is determined to be correct based on the software package public key hash value, the signature of the second certificate is decrypted using the software package public key to obtain the software package hash value; when it is determined that the software package hash value is the same as the software package hash value in the second certificate, the software package is executed. Since the software package can be verified using the first certificate and the second certificate, and the software package is executed only after the verification passes, the security of executing the software package can be guaranteed.
[0071] The embodiment of the present application provides a method for verifying software security, which can be applied to a software providing platform; the software providing platform may include a terminal or a server. The terminal may be a module capable of realizing a communication function or a terminal device including the module, etc., and the terminal device may be a mobile terminal or a smart terminal. The mobile terminal may specifically be at least one of a mobile phone, a tablet computer, a laptop computer, etc.; the smart terminal may specifically be a terminal containing a wireless communication module such as a smart car, a smart watch, a shared bicycle, a smart cabinet, etc.; the module may specifically be a wireless communication module, such as any one of a 2G communication module, a 3G communication module, a 4G communication module, a 5G communication module, and a NB-IOT communication module.
[0072] like Figure 2 As shown, the method may include the following steps:
[0073] Step 201: encrypt the software package public key hash value in the software package using the root private key to obtain the signature of the first certificate, and the root private key matches the root public key pre-burned into the electronic device; and encrypt the software package hash value of the software package using the software package private key to obtain the signature of the second certificate, and the software package private key matches the software package public key.
[0074] Step 202: Generate a first certificate based on the signature of the first certificate and the public key of the software package; generate a second certificate based on the signature of the second certificate and the hash value of the software package.
[0075] Step 203: When the conditions for issuing the software package are met, issue the software package including the first certificate and the second certificate.
[0076] In the application, satisfying the distribution condition of the software package includes but is not limited to receiving a distribution request for the software package.
[0077] In the technical solution provided in the embodiment of the present application, since the root private key can be used to encrypt the hash value of the software package public key, and the software package hash value of the software package can be encrypted using the software package private key, the electronic device can perform security verification on the software package based on the first certificate and the second certificate after obtaining the software package.
[0078] The above technical solution is explained below in conjunction with an example. In this example, for the sake of easy understanding, the first certificate is represented by cert1, the second certificate is represented by cert2, the software package public key is represented by DAA public key, the software package private key is represented by DAA private key, the software package is represented by image, the software package public key hash value is represented by image public keyhash, the pre-burned root public key is represented by root public key and the pre-burned root public key is stored in OTP, the root private key is represented by root private key, the data packet in the software package is represented by image, the software package hash value is represented by image hash, the certificate authentication file is represented by auth file, and the certificate file is represented by DA.
[0079] When implementing:
[0080] The software provider platform uses the root private key to sign the DAA public key and obtains the signature in the authfile.
[0081] There is a root public key in the auth file. When verifying, the electronic device first takes out the root public key and calculates the hash to compare with the root public key hash in the OTP. If it passes, it means that the root public key in the auth file is correct. Then use this root public key to verify the signature of the auth file. If the verification passes, the DAA public key in the auth file is valid and is used to verify the received DA in the next step.
[0082] The software providing platform uses the DAA private key to sign the DA file and obtain an encrypted certificate file.
[0083] The electronic device uses the DAA public key in the auth file to verify the encrypted certificate file. If the verification is successful, it enters the DA program.
[0084] The root public key in cert1 is hashed internally.
[0085] The electronic device compares the hash obtained in cert1 with the root public key hash in the OTP. If they are equal, the root public key in cert1 is the correct root public key.
[0086] On the software providing platform, use the root private key to sign the image public key hash to obtain the signature in cert1. On the electronic device, use the root public key to decrypt the signature in cert1 to obtain the hash value of the image public key.
[0087] The electronic device compares the hash value of the decrypted image public key with the hash value calculated by the image publickey in cert1. If they are equal, the image public key in cert1 is the correct image publickey.
[0088] If the image public key in cert1 is equal to the image public key in cert2, the verification in cert2 is started.
[0089] The electronic device uses the image public key to decrypt cert2 and obtain the hash value of the image.
[0090] If the hash value of the image obtained by decrypting cert2 is equal to the image hash value in cert2, the software package is executed.
[0091] Based on the same concept, a software package security verification system is provided in the embodiment of the present application. The specific implementation of the system can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 3 As shown, the system mainly includes:
[0092] Electronic device 301 and software providing platform 302;
[0093] The electronic device 301 is used to obtain a first certificate and a second certificate in a software package of the software, wherein the first certificate is used to verify the software package public key of the software package, and the second certificate is used to verify the software package; decrypt the signature of the first certificate based on the pre-burned root public key to obtain the software package public key hash value; when it is determined based on the software package public key hash value that the software package public key in the first certificate is correct, use the software package public key to decrypt the signature of the second certificate to obtain the software package hash value; when it is determined that the software package hash value is the same as the software package hash value in the second certificate, execute the software package;
[0094] The software providing platform 302 is used to encrypt the software package public key hash value in the software package with a root private key to obtain a signature of a first certificate, and the root private key matches the root public key pre-burned into the electronic device 301; and to encrypt the software package hash value of the software package with a software package private key to obtain a signature of a second certificate, and the software package private key and the software package public key match; generate a first certificate based on the signature of the first certificate and the software package public key; generate a second certificate based on the signature of the second certificate and the software package hash value; and when the conditions for issuing the software package are met, issue the software package including the first certificate and the second certificate.
[0095] Based on the same concept, a software package security verification device is provided in the embodiment of the present application. The specific implementation of the device can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 4 As shown, the device mainly includes:
[0096] An acquisition unit 401 is used to acquire a first certificate and a second certificate in a software package of the software, wherein the first certificate is used to verify a software package public key of the software package, and the second certificate is used to verify the software package;
[0097] A first decryption unit 402, configured to decrypt the signature of the first certificate based on the pre-burned root public key to obtain a public key hash value of the software package;
[0098] A second decryption unit 403 is configured to, when it is determined based on the software package public key hash value that the software package public key in the first certificate is correct, decrypt the signature of the second certificate using the software package public key to obtain the software package hash value;
[0099] The execution unit 404 is configured to execute the software package when it is determined that the software package hash value is the same as the software package hash value in the second certificate.
[0100] Optionally, the device is also used for:
[0101] Before obtaining the first certificate and the second certificate in the software package, obtain the certificate authentication file and the encryption certificate file of the software, wherein the certificate authentication file includes the certificate authentication file public key;
[0102] When the public key of the certificate authentication file is determined to be valid based on the pre-burned root public key, the public key of the certificate authentication file is used to decrypt the encrypted certificate file to obtain the certificate file;
[0103] Download the software package based on the certificate file.
[0104] Optionally, the device is used to:
[0105] Decrypt the signature in the certificate authentication file based on the pre-burned root public key to obtain the public key for the decrypted certificate authentication file;
[0106] When the decrypted certificate authentication file public key is consistent with the certificate file public key, it is determined that the certificate authentication file public key is valid.
[0107] Optionally, the device is also used for:
[0108] Decrypt the signature in the certificate authentication file based on the pre-burned root public key, and obtain the root public key in the certificate authentication file before obtaining the public key for decrypting the certificate authentication file;
[0109] Calculate a first hash value of the root public key in the certificate authentication file and a second hash value of the pre-burned root public key;
[0110] It is determined that the first hash value is the same as the second hash value.
[0111] Optionally, the first decryption unit 402 is used to:
[0112] Obtain the root public key in the first certificate;
[0113] Calculate a third hash value of the root public key in the first certificate and a second hash value of the pre-burned root public key;
[0114] It is determined that the second hash value and the third hash value are the same.
[0115] Optionally, the second decryption unit 403 is used to:
[0116] Obtain the software package public key in the first certificate;
[0117] Calculate a hash value of the software package public key in the first certificate;
[0118] When it is determined that the software package public key hash value is the same as the hash value of the software package public key in the first certificate, it is determined that the software package public key in the first certificate is correct.
[0119] Optionally, the device is also used for:
[0120] After determining that the software package public key in the first certificate is correct based on the software package public key hash value, the software package public key is used to decrypt the signature of the second certificate, and before obtaining the software package hash value, the software package public key in the second certificate is obtained;
[0121] It is determined that the software package public key in the second certificate is the same as the software package public key in the first certificate.
[0122] Based on the same concept, a software package security verification device is provided in the embodiment of the present application. The specific implementation of the device can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 5 As shown, the device mainly includes:
[0123] The encryption unit 501 is used to encrypt the software package public key hash value in the software package with the root private key to obtain the signature of the first certificate, and the root private key matches the root public key pre-burned into the electronic device; and encrypt the software package hash value of the software package with the software package private key to obtain the signature of the second certificate, and the software package private key matches the software package public key;
[0124] A generating unit 502 is used to generate a first certificate based on the signature of the first certificate and the public key of the software package; and to generate a second certificate based on the signature of the second certificate and the hash value of the software package;
[0125] The issuing unit 503 is configured to issue a software package including the first certificate and the second certificate when a condition for issuing the software package is met.
[0126] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 6 As shown, the electronic device mainly includes: a processor 601, a memory 602 and a communication bus 603, wherein the processor 601 and the memory 602 communicate with each other through the communication bus 603. The memory 602 stores a program that can be executed by the processor 601, and the processor 601 executes the program stored in the memory 602 to implement the following steps:
[0127] Obtain a first certificate and a second certificate in a software package of the software, wherein the first certificate is used to verify the software package public key of the software package, and the second certificate is used to verify the software package; decrypt the signature of the first certificate based on the pre-burned root public key to obtain a software package public key hash value; when it is determined based on the software package public key hash value that the software package public key in the first certificate is correct, use the software package public key to decrypt the signature of the second certificate to obtain a software package hash value; when it is determined that the software package hash value is the same as the software package hash value in the second certificate, execute the software package;
[0128] or,
[0129] The root private key is used to encrypt the software package public key hash value in the software package to obtain the signature of the first certificate, and the root private key matches the root public key pre-burned into the electronic device; and the software package private key is used to encrypt the software package hash value of the software package to obtain the signature of the second certificate, and the software package private key and the software package public key match; based on the signature of the first certificate and the software package public key, a first certificate is generated; based on the signature of the second certificate and the software package hash value, a second certificate is generated; when the conditions for issuing the software package are met, the software package including the first certificate and the second certificate is issued.
[0130] The communication bus 603 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 603 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0131] The memory 602 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor 601.
[0132] The above-mentioned processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0133] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program runs on a computer, the computer executes the software security verification method, system, and device described in the above embodiments.
[0134] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape, etc.), an optical medium (e.g., a DVD) or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0135] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0136] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for verifying software security, characterized in that: include: Obtaining a first certificate and a second certificate in a software package, wherein the first certificate is used to verify a software package public key of the software package, and the second certificate is used to verify the software package; Decrypting the signature of the first certificate based on the pre-burned root public key to obtain a public key hash value of the software package; When it is determined based on the software package public key hash value that the software package public key in the first certificate is correct, decrypting the signature of the second certificate using the software package public key to obtain the software package hash value; When it is determined that the software package hash value is the same as the software package hash value in the second certificate, executing the software package; Before obtaining the first certificate and the second certificate in the software package, the method further includes: Obtaining a certificate authentication file and an encryption certificate file of the software, wherein the certificate authentication file includes a certificate authentication file public key; When it is determined that the certificate authentication file public key is valid based on the pre-burned root public key, the encrypted certificate file is decrypted using the certificate authentication file public key to obtain the certificate file; Download the software package according to the certificate file; Wherein, based on the pre-burned root public key, determining that the certificate authentication file public key is valid includes: Decrypting the signature in the certificate authentication file based on the pre-burned root public key to obtain a decrypted certificate authentication file public key; When the decrypted certificate authentication file public key is consistent with the certificate authentication file public key, determining that the certificate authentication file public key is valid; Wherein, before decrypting the signature in the certificate authentication file based on the pre-burned root public key to obtain the public key for decrypting the certificate authentication file, it also includes: Obtain the root public key in the certificate authentication file; Calculate a first hash value of the root public key in the certificate authentication file and a second hash value of the pre-burned root public key; It is determined that the first hash value is the same as the second hash value.
2. The method according to claim 1, characterized in that Before decrypting the signature of the first certificate based on the pre-burned root public key to obtain the hash value of the software package public key, the method further includes: Obtaining the root public key in the first certificate; Calculate a third hash value of the root public key in the first certificate and a second hash value of the pre-burned root public key; It is determined that the second Hash value is the same as the third Hash value.
3. The method according to claim 1, characterized in that Determining, based on the software package public key hash value, that the software package public key in the first certificate is correct includes: Obtaining the software package public key in the first certificate; Calculating a hash value of the software package public key in the first certificate; When it is determined that the software package public key hash value is the same as the software package public key hash value in the first certificate, it is determined that the software package public key in the first certificate is correct.
4. The method according to claim 1, characterized in that: After determining that the software package public key in the first certificate is correct based on the software package public key hash value, the signature of the second certificate is decrypted using the software package public key before obtaining the software package hash value, the method further includes: Obtaining the software package public key in the second certificate; It is determined that the software package public key in the second certificate is the same as the software package public key in the first certificate.
5. A method for verifying the security of a software package, characterized in that: include: Encrypting the software package public key hash value in the software package using a root private key to obtain a signature of the first certificate, wherein the root private key matches the root public key pre-burned into the electronic device; and, encrypting the software package hash value of the software package using the software package private key to obtain a signature of the second certificate, wherein the software package private key matches the software package public key of the software package; generating the first certificate based on the signature of the first certificate and the public key of the software package; generating the second certificate based on the signature of the second certificate and the hash value of the software package; When a condition for issuing the software package is met, issuing a software package including the first certificate and the second certificate; The distribution condition of the software package includes: obtaining a certificate file of an electronic device; wherein the certificate file is obtained by the electronic device in the following manner: obtaining a certificate authentication file and an encrypted certificate file of the software, wherein the certificate authentication file includes a certificate authentication file public key; when it is determined that the certificate authentication file public key is valid based on the pre-burned root public key, the encrypted certificate file is decrypted using the certificate authentication file public key to obtain the certificate file; wherein, determining that the certificate authentication file public key is valid based on the pre-burned root public key includes: decrypting the signature in the certificate authentication file based on the pre-burned root public key to obtain a decrypted certificate authentication file public key; when the decrypted certificate authentication file public key is consistent with the certificate authentication file public key, determining that the certificate authentication file public key is valid; wherein, before decrypting the signature in the certificate authentication file based on the pre-burned root public key to obtain the decrypted certificate authentication file public key, it also includes: obtaining the root public key in the certificate authentication file; calculating a first hash value of the root public key in the certificate authentication file and a second hash value of the pre-burned root public key; and determining that the first hash value is the same as the second hash value.
6. An electronic device, characterized in that: include: A processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the method described in any one of claims 1 to 4 or the method described in claim 5.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 or the method according to claim 5 is implemented.
Citation Information
Patent Citations
Safe application installation method based on encrypted storage hardware
CN113922966A