CN114629641B - Code downloading starting safety protection method and device based on safety chip - Google Patents

Code downloading starting safety protection method and device based on safety chip Download PDF

Info

Publication number
CN114629641B
CN114629641B CN202210263657.1A CN202210263657A CN114629641B CN 114629641 B CN114629641 B CN 114629641B CN 202210263657 A CN202210263657 A CN 202210263657A CN 114629641 B CN114629641 B CN 114629641B
Authority
CN
China
Prior art keywords
code
security chip
downloading
public key
configuration information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210263657.1A
Other languages
Chinese (zh)
Other versions
CN114629641A (en
Inventor
白锦龙
郏晖
汪海洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Xinzhi Information Technology Co ltd
Jiang Nan Information Security Beijing Technology Co ltd
Original Assignee
Jiangsu Xinzhi Information Technology Co ltd
Jiang Nan Information Security Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangsu Xinzhi Information Technology Co ltd, Jiang Nan Information Security Beijing Technology Co ltd filed Critical Jiangsu Xinzhi Information Technology Co ltd
Priority to CN202210263657.1A priority Critical patent/CN114629641B/en
Publication of CN114629641A publication Critical patent/CN114629641A/en
Application granted granted Critical
Publication of CN114629641B publication Critical patent/CN114629641B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/065Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
    • H04L9/0656Pseudorandom key sequence combined element-for-element with data sequence, e.g. one-time-pad [OTP] or Vernam's cipher
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/51Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0894Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage
    • H04L9/0897Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage involving additional devices, e.g. trusted platform module [TPM], smartcard or USB
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3234Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving additional secure or trusted devices, e.g. TPM, smartcard, USB or software token
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/12Details relating to cryptographic hardware or logic circuitry

Landscapes

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

Abstract

Before downloading the code to the security chip, the method needs to configure the security chip to judge the downloading authority, each chip is configured only once and can not be configured repeatedly; when downloading the code to the security chip, acquiring the downloading authority, and downloading the code after acquiring the downloading authority; after the download authority is obtained, when the code is downloaded, the configuration data of the start authority is downloaded to the security chip at the same time, and the configuration can be repeated; and when the code is started, the starting authority is obtained, and the code can be normally started after the starting authority is obtained. The invention adopts double authentication, and the download authority needs configuration information authentication (otherwise, the configuration is unsuccessful) and download authentication (otherwise, the download cannot be carried out); the starting authority needs configuration information authentication (preventing configuration information from being tampered) and starting authentication (preventing code from being tampered), the safety of chip codes is guaranteed, illegal code downloading is prevented, and code tampering is prevented.

Description

Code downloading starting safety protection method and device based on safety chip
Technical Field
The invention relates to the technical field of security chips, in particular to a code downloading starting security protection method and device based on a security chip.
Background
The safety chip is a trusted platform module, is a device capable of independently generating a secret key and encrypting and decrypting, is internally provided with an independent processor and a storage unit, can store the secret key and characteristic data, and provides encryption and safety authentication services for a computer. The security chip is used for encryption, the key is stored in hardware, and stolen data cannot be decrypted, so that business privacy and data security are protected.
When the security chip runs the code, the code needs to be downloaded to the code storage area of the security chip, and there are many methods for downloading the code, such as emulation downloading, security chip peripheral interface downloading, etc. It is important for product security that the code can be downloaded securely to the secure chip and be able to boot correctly. In the prior art, when a universal security chip starts a code from a code storage area, the legality of the code cannot be judged, and if the code is tampered, the universal security chip still runs the tampered illegal code, so that the product security is influenced. How to ensure the reliability of code downloading and starting of the security chip is a technical problem to be solved urgently.
Disclosure of Invention
Therefore, the invention provides a code downloading and starting safety protection method and device based on a safety chip, and aims to solve the problem that in the prior art, the safety chip lacks the processing of code downloading and starting, and the safety of a product is influenced due to the fact that a tampered illegal code is operated.
In order to achieve the above purpose, the invention provides the following technical scheme: the code downloading starting safety protection method based on the safety chip comprises the following steps:
configuring downloading authority: judging whether the security chip downloads the public key, and if the security chip downloads the public key, finishing configuration; if the public key is not downloaded by the security chip, configuring random number information, downloading the public key to an SRAM of the security chip, signing the random number by adopting a private key, and copying the public key to a storage area of the security chip according to a signature verification result of the random number;
acquiring downloading authority: acquiring the random number from the security chip, signing the random number by adopting a private key, issuing signature data to the security chip, verifying the signature data by the security chip according to the public key, and judging whether the security chip has a downloading right or not according to a verification result;
configuring a starting authority: after obtaining the download authority, downloading the code to the security chip; performing summary operation on the code to obtain a summary value, and encrypting the summary value by adopting a private key to obtain code encryption data; configuring the code encryption data into configuration information, and downloading the configuration information to the security chip;
acquiring a starting authority: when the code is started, verifying the configuration information; when the configuration information is verified successfully, performing abstract operation on codes in a code storage area of the security chip to obtain code abstract data; and decrypting the code encrypted data by adopting a public key, comparing the decrypted data with the code abstract data, and judging whether the code encrypted data has the starting authority or not according to a comparison result.
As a preferred scheme of a code downloading starting security protection method based on a security chip, in the process of configuring downloading authority, a private key is adopted to sign the random number, a signature value is issued to the security chip, the security chip adopts a public key in an SRAM to verify the signature value, and the public key is copied to a storage area of the security chip after verification is successful.
As a preferred scheme of a code downloading starting security protection method based on a security chip, in the process of configuring downloading permission, an OTP storage mode is adopted for one-time configuration:
storing a public key and a public key mark in an OTP storage area of the security chip subjected to downloading permission configuration, judging whether the public key is valid through the public key mark, and finishing downloading permission configuration if the public key mark is valid; and if the public key mark is invalid, carrying out downloading authority configuration on the security chip.
As a preferred scheme of a code downloading starting safety protection method based on a safety chip, in the process of obtaining downloading authority, the safety chip verifies signature data according to a public key, the signature verification is successful, the code downloading is allowed, the signature verification fails, and the code downloading is prevented.
As a preferred scheme of a code downloading starting security protection method based on a security chip, in the process of configuring the starting authority, the configuration information configured by the code encryption data is subjected to digest operation again, and a digest value obtained by performing digest operation again is added to the configuration information.
As a preferred scheme of a code downloading starting safety protection method based on a safety chip, in the process of obtaining starting authority, after summary data in configuration information is removed, summary operation is carried out on the configuration information with the summary data removed, the calculated summary value is compared with the removed summary value, if the comparison result is consistent, the configuration information is correct, the starting downloading is allowed, otherwise, the starting downloading is failed;
when the configuration information is verified to be correct, performing abstract operation on the codes downloaded in the security chip to obtain abstract values of the downloaded codes; and decrypting the code encrypted data in the configuration information by adopting a public key, comparing the decrypted abstract value with the abstract value of the downloaded code, if the comparison result is consistent, the code is correct, and allowing the security chip to be normally started, otherwise, the starting and downloading are failed.
The invention also provides a code downloading starting safety protection device based on the safety chip, which comprises:
the download authority configuration unit is used for judging whether the security chip downloads the public key or not, and finishing configuration if the security chip downloads the public key; if the public key is not downloaded by the security chip, configuring random number information, downloading the public key to an SRAM of the security chip, signing the random number by adopting a private key, and copying the public key to a storage area of the security chip according to a signature verification result of the random number;
the download authority acquisition unit is used for acquiring the random number from the security chip, signing the random number by adopting a private key, issuing signature data to the security chip, verifying the signature data by the security chip according to a public key and judging whether the download authority exists or not according to a verification result;
the starting authority configuration unit is used for downloading the code to the security chip after acquiring the downloading authority; performing summary operation on the code to obtain a summary value, and encrypting the summary value by adopting a private key to obtain code encrypted data; configuring the code encryption data into configuration information, and downloading the configuration information to the security chip;
the starting authority acquiring unit is used for verifying the configuration information when the code is started; after the configuration information is verified successfully, performing abstract operation on the codes of the code storage area of the security chip to obtain code abstract data; and decrypting the code encrypted data by adopting a public key, comparing the decrypted data with the code abstract data, and judging whether the starting authority is available or not according to a comparison result.
As a preferred scheme for starting a security protection device by downloading a code based on a security chip, in the downloading permission configuration unit, a private key is adopted to sign the random number, a signature value is issued to the security chip, the security chip adopts a public key in an SRAM to verify the signature value, and the public key is copied to a storage area of the security chip after the verification is successful;
in the download authority configuration unit, an OTP storage mode is adopted for one-time configuration:
storing a public key and a public key mark in an OTP (one time programmable) storage area of the security chip subjected to downloading permission configuration, judging whether the public key is valid through the public key mark, and finishing downloading permission configuration if the public key mark is valid; and if the public key mark is invalid, carrying out downloading authority configuration on the security chip.
As a preferred scheme for starting the security protection device by downloading the code based on the security chip, in the download permission acquisition unit, the security chip verifies the signature data according to the public key, the signature verification is successful, the code download is allowed, the signature verification fails, and the code download is prevented.
As a preferred scheme for starting the security protection device by downloading the code based on the security chip, the start authority configuration unit performs digest operation on the configuration information configured by the code encryption data again, and adds a digest value obtained by performing digest operation again to the configuration information.
As a preferred scheme for starting the security protection device by code downloading based on the security chip, in the starting authority acquiring unit, after removing the abstract data in the configuration information, performing abstract operation on the configuration information without the abstract data, comparing the operated abstract value with the removed abstract value, if the comparison result is consistent, the configuration information is correct, and the downloading is allowed to be started, otherwise, the downloading is failed to be started;
when the configuration information is verified to be correct, performing abstract operation on the codes downloaded in the security chip to obtain abstract values of the downloaded codes; and decrypting the code encrypted data in the configuration information by adopting a public key, comparing the decrypted abstract value with the abstract value of the downloaded code, if the comparison result is consistent, the code is correct, and allowing the security chip to be normally started, otherwise, the starting and downloading are failed.
The invention has the following advantages: judging whether the security chip downloads the public key, and finishing the configuration if the security chip downloads the public key; if the public key is not downloaded by the security chip, random number information is configured, the public key is downloaded to an SRAM of the security chip, the private key is adopted to sign the random number, and the public key is copied to a storage area of the security chip according to a signature verification result of the random number; acquiring a random number from a security chip, signing the random number by adopting a private key, sending signature data to the security chip, verifying the signature data by the security chip according to a public key, and judging whether the security chip has a downloading right or not according to a verification result; after obtaining the downloading authority, downloading the code to the security chip; performing summary operation on the code to obtain a summary value, and encrypting the summary value by adopting a private key to obtain code encrypted data; configuring the code encryption data into configuration information, and downloading the configuration information to a security chip; when the code is started, verifying the configuration information; when the configuration information is verified successfully, performing abstract operation on codes in a code storage area of the security chip to obtain code abstract data; and decrypting the code encrypted data by adopting the public key, comparing the decrypted data with the code abstract data, and judging whether the starting authority is available or not according to a comparison result. The invention can ensure the safety of the chip code, prevent illegal code downloading, ensure the starting safety of the safety chip and prevent code tampering; the invention adopts double authentication, the download authority needs configuration information authentication (otherwise, the configuration is unsuccessful) and download authentication (otherwise, the download cannot be carried out); the starting authority needs configuration information authentication (preventing configuration information from being tampered) and starting authentication (preventing code from being tampered), product safety is ensured, and economic loss of developers is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below. It should be apparent that the drawings in the following description are merely exemplary and that other implementation drawings may be derived from the drawings provided to one of ordinary skill in the art without inventive effort.
The structures, ratios, sizes, and the like shown in the present specification are only used for matching with the contents disclosed in the specification, so that those skilled in the art can understand and read the present invention, and do not limit the conditions for implementing the present invention, so that the present invention has no technical significance, and any structural modifications, changes in the ratio relationship, or adjustments of the sizes, without affecting the functions and purposes of the present invention, should still fall within the scope of the present invention.
Fig. 1 is a schematic diagram of an overall framework of a security protection method for starting code downloading based on a security chip according to embodiment 1 of the present invention;
fig. 2 is a schematic view illustrating configuration of download permission in a security protection method for starting code download based on a security chip according to embodiment 1 of the present invention;
fig. 3 is a schematic diagram illustrating acquisition of a download right in a security protection method for starting code download based on a security chip according to embodiment 1 of the present invention;
fig. 4 is a schematic view of configuration of a start permission in a security protection method for starting code downloading based on a security chip according to embodiment 1 of the present invention;
fig. 5 is a schematic diagram illustrating acquisition of a start permission in a security protection method for starting code downloading based on a security chip according to embodiment 1 of the present invention;
fig. 6 is a schematic diagram of a security protection device for starting code downloading based on a security chip according to embodiment 2 of the present invention.
Detailed Description
The present invention is described in terms of particular embodiments, other advantages and features of the invention will become apparent to those skilled in the art from the following disclosure, and it is to be understood that the described embodiments are merely exemplary of the invention and that it is not intended to limit the invention to the particular embodiments disclosed. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Example 1
Referring to fig. 1, embodiment 1 of the present invention provides a method for starting security protection of code download based on a security chip, including:
configuring downloading authority: judging whether the security chip downloads the public key or not, and finishing configuration if the security chip downloads the public key; if the public key is not downloaded by the security chip, configuring random number information, downloading the public key to an SRAM of the security chip, signing the random number by adopting a private key, and copying the public key to a storage area of the security chip according to a signature verification result of the random number;
acquiring downloading authority: acquiring the random number from the security chip, signing the random number by adopting a private key, issuing signature data to the security chip, verifying the signature data by the security chip according to the public key, and judging whether the security chip has a downloading right or not according to a verification result;
configuring a starting authority: after obtaining the downloading authority, downloading a code to the security chip; performing summary operation on the code to obtain a summary value, and encrypting the summary value by adopting a private key to obtain code encryption data; configuring the code encryption data into configuration information, and downloading the configuration information to the security chip;
acquiring a starting authority: when the code is started, verifying the configuration information; when the configuration information is verified successfully, performing abstract operation on codes in a code storage area of the security chip to obtain code abstract data; and decrypting the code encrypted data by adopting a public key, comparing the decrypted data with the code abstract data, and judging whether the starting authority is available or not according to a comparison result.
In the process of configuring the download permission, the present embodiment signs the random number with a private key, issues a signature value to the security chip, verifies the signature value with a public key in the SRAM, and copies the public key to a storage area of the security chip after the verification is successful.
Referring to fig. 2, the security chip may be configured to generate a random number and may verify a signature with a public key. Before downloading the code to the security chip, firstly, confirming whether the security chip downloads the public key, if the public key is not downloaded, downloading the public key to the storage area of the security chip, and if the public key is downloaded, directly running the next step. When the public key is downloaded to the storage area of the security chip, the public key is downloaded to an SRAM of the security chip, the random number is obtained from the security chip, the private key is used for signing the random number, the signature value is issued to the security chip, the security chip uses the public key in the SRAM to check the signature value, and after the signature is successfully checked, the security chip copies the public key to the storage area.
In this embodiment, in the process of configuring the download permission, an OTP storage mode is used for one-time configuration:
storing a public key and a public key mark in an OTP (one time programmable) storage area of the security chip subjected to downloading permission configuration, judging whether the public key is valid through the public key mark, and finishing downloading permission configuration if the public key mark is valid; and if the public key mark is invalid, carrying out downloading authority configuration on the security chip.
Specifically, before the secure chip is securely downloaded, it is first determined whether the secure chip has configured the download permission, and for the sake of security, the OTP memory mode is used for one-time configuration when configuring the download permission, that is, each secure chip can only perform one-time download permission configuration. The security chip which performs downloading authority configuration stores a public key and a public key mark in the OTP storage area, whether the public key is valid can be judged through the public key mark, if the public key is valid, the security chip performs downloading authority configuration, and the security chip finishes the downloading authority configuration. And if the public key mark is invalid, carrying out downloading authority configuration on the security chip.
Specifically, when the download authority configuration is performed on the security chip, it is further determined whether the chip is a security chip. The security chip has the functions of generating random numbers and verifying signatures of signatures, a section of random numbers are obtained from the chip after the random number initialization and other configurations are carried out on the chip through a downloading tool, the random numbers are signed at the downloading tool after the random numbers are obtained, and signature information and public key information are downloaded into the chip for verification after being prepared. Because the chip public key information is stored in the OTP storage area, in order to prevent the problem that the OTP area information cannot be recovered due to verification failure, the public key information is firstly downloaded into the chip SRAM, then the signature data is downloaded into the chip verification area, and finally the chip verifies the signature of the signature information. If the signature verification is successful, the public key information is stored in the OTP storage area, if the signature verification is failed, the downloading permission configuration is ended, and the public key information is automatically cleared after the chip is powered off.
In the embodiment, in the process of acquiring the downloading permission, the security chip verifies the signature data according to the public key, the signature verification is successful, the code downloading is allowed, the signature verification fails, and the code downloading is prevented.
Referring to fig. 3, specifically, the public key is itself public and can be obtained by anyone at will, but only the user who owns the private key corresponding to the public key in the security chip can obtain the download authority and download the code. The method comprises the steps that a random number is obtained from a security chip through a downloading tool, the random number is signed at the downloading tool, the downloading tool issues signature information to the security chip, the security chip uses a public key configured before to verify the signature of the signature information, if the signature verification is successful, codes can be downloaded, and if the signature verification fails, the codes cannot be downloaded.
In this embodiment, in the process of configuring the start permission, the digest operation is performed again on the configuration information configured by the code encrypted data, and the digest value obtained by performing the digest operation again is added to the configuration information.
Referring to fig. 4, specifically, the configuration of the start authority is to download configuration information into the storage area of the security chip, and the process and the code downloading process are performed synchronously. The configuration information comprises private key encryption data and digest values of the configuration information, the configuration information is generated in a downloading tool, the downloading tool firstly obtains downloading codes, the size of the downloading code data is possibly large, the downloading codes are operated through a hash algorithm to obtain a group of digest values, and the digest values are unique if the codes are unique. And encrypting the digest value by using a private key at the downloading tool end, wherein the code encrypted data can be decrypted only by using a corresponding public key. The length of the configuration information is equal to the length of the code encrypted data plus the length of the digest value of the configuration information, in order to ensure the integrity of the configuration information, the digest operation is carried out on the configuration information (the positions of the digest values are all zero), and then the digest values are added into the configuration information to form the complete configuration information. And finally, downloading the configuration information to the security chip when downloading the code.
Specifically, the protection of the configuration information adopts a method of changing the configuration information by hashing the configuration information per se to ensure the safety of the configuration information, and the specific method is that the length of the configuration information is fixed, 32 bytes (determined according to the hashing) are reserved as 0 to be used as a position for storing an abstract value, the configuration information is abstracted and then the abstract value is put at the position of the abstract value, and the data of the position of the abstract value is cleared and then hashed when being verified later.
In the embodiment, in the process of acquiring the starting authority, after the abstract data in the configuration information is removed, the configuration information with the abstract data removed is subjected to abstract operation, the operated abstract value is compared with the removed abstract value, if the comparison result is consistent, the configuration information is correct, the starting of downloading is allowed, otherwise, the starting of downloading fails;
after the configuration information is verified to be correct, carrying out abstract operation on the codes downloaded in the security chip to obtain abstract values of the downloaded codes; and decrypting the code encrypted data in the configuration information by adopting a public key, comparing the decrypted abstract value with the abstract value of the downloaded code, if the comparison result is consistent, the code is correct, and allowing the security chip to be normally started, otherwise, the starting and downloading are failed.
Referring to fig. 5, specifically, the obtaining of the start permission is automatically completed inside the security chip, and the security chip may automatically complete verification and start under the condition that the code security download and the security start configuration are correct.
When the safety chip is started, if the safety starting configuration information is detected in the safety chip, the safety chip automatically acquires the configuration information, after the abstract data in the configuration information is removed, the configuration information without the abstract information is subjected to abstract operation, the abstract value of the operation is compared with the removed abstract value, if the result is consistent, the configuration information is correct, and if not, the starting is failed. And after the configuration information is verified to be correct, verifying the code correctness. And performing summary operation on the code downloaded from the security chip to obtain a summary value of the downloaded code, decrypting the encrypted data in the configuration information by using a public key, comparing the decrypted summary value with the summary value of the downloaded code, and if the results are consistent, judging that the code is correct, and normally starting the security chip, otherwise, judging that the starting fails, and ensuring the legality of the code.
By combining the technical scheme of the invention, the code downloading of the chip can support common downloading and safe downloading, and the code is downloaded through a downloading tool. The common downloading is the same as the common MCU chip, the code can be directly downloaded to the storage area of the chip, and then the code can be directly operated; the safe downloading needs to configure the downloading authority of the chip at first, the chip with the configured downloading authority can download the code only after acquiring the downloading authority from the chip. The safe downloading comprises configuring the downloading authority and obtaining the downloading authority, and the legality of the user is guaranteed.
By combining the technical scheme of the invention, the chip code starting supports common starting and safe starting. The common start is the same as the general MCU chip, and the code stored in the chip can be directly started to run; the safe starting needs to be firstly carried out on the chip, the chip with the starting permission is configured, the operation can be started only after the code is verified by obtaining the starting permission, the safe starting comprises the steps of configuring the starting permission and obtaining the starting permission, and the legality of the code is guaranteed. After the chip is configured with the downloading authority and the starting authority, only the starting authority needs to be obtained and started every time the chip is started, and if the code is upgraded, the starting authority needs to be reconfigured.
In summary, the present invention determines whether the security chip downloads the public key, and if the security chip has downloaded the public key, the configuration is ended; if the public key is not downloaded by the security chip, configuring random number information, downloading the public key to an SRAM of the security chip, signing the random number by adopting a private key, and copying the public key to a storage area of the security chip according to a signature verification result of the random number; acquiring a random number from a security chip, signing the random number by adopting a private key, issuing signature data to the security chip, verifying the signature data by the security chip according to the public key, and judging whether the security chip has a downloading right or not according to a verification result; after obtaining the downloading authority, downloading the code to the security chip; performing summary operation on the code to obtain a summary value, and encrypting the summary value by adopting a private key to obtain code encrypted data; configuring the code encryption data into configuration information, and downloading the configuration information to a security chip; when the code is started, verifying the configuration information; when the configuration information is verified successfully, performing abstract operation on codes in a code storage area of the security chip to obtain code abstract data; and decrypting the code encrypted data by adopting the public key, comparing the decrypted data with the code abstract data, and judging whether the starting authority is available or not according to a comparison result. The invention can ensure the safety of the chip code, prevent illegal code downloading, ensure the starting safety of the safety chip and prevent code tampering; the invention adopts double authentication, the download authority needs configuration information authentication (otherwise, the configuration is unsuccessful) and download authentication (otherwise, the download cannot be carried out); the starting authority needs configuration information authentication (preventing configuration information from being tampered) and starting authentication (preventing code from being tampered), product safety is ensured, and economic loss of developers is avoided.
Example 2
Referring to fig. 6, embodiment 2 of the present invention provides a security chip-based code download start security protection apparatus, including:
the download authority configuration unit 1 is used for judging whether the security chip downloads the public key or not, and finishing configuration if the security chip downloads the public key; if the public key is not downloaded by the security chip, configuring random number information, downloading the public key to an SRAM of the security chip, signing the random number by adopting a private key, and copying the public key to a storage area of the security chip according to a signature verification result of the random number;
the download authority acquiring unit 2 is used for acquiring the random number from the security chip, signing the random number by adopting a private key, issuing the signature data to the security chip, verifying the signature data by the security chip according to the public key, and judging whether the download authority exists according to a verification result;
the starting authority configuration unit 3 is used for downloading codes to the security chip after acquiring downloading authority; performing summary operation on the code to obtain a summary value, and encrypting the summary value by adopting a private key to obtain code encryption data; configuring the code encryption data into configuration information, and downloading the configuration information to the security chip;
the starting authority acquiring unit 4 is used for verifying the configuration information when the code is started; after the configuration information is verified successfully, performing abstract operation on the codes of the code storage area of the security chip to obtain code abstract data; and decrypting the code encrypted data by adopting a public key, comparing the decrypted data with the code abstract data, and judging whether the code encrypted data has the starting authority or not according to a comparison result.
In this embodiment, in the download permission configuration unit 1, a private key is used to sign the random number, a signature value is issued to the security chip, the security chip verifies the signature value by using a public key in an SRAM, and the public key is copied to a storage area of the security chip after the verification is successful;
in the download authority configuration unit 1, an OTP storage mode is adopted for one-time configuration:
storing a public key and a public key mark in an OTP storage area of the security chip subjected to downloading permission configuration, judging whether the public key is valid through the public key mark, and finishing downloading permission configuration if the public key mark is valid; and if the public key mark is invalid, carrying out downloading authority configuration on the security chip.
In this embodiment, in the download permission obtaining unit 2, the security chip verifies the signature data according to the public key, and if the signature verification is successful, the code download is allowed, and if the signature verification fails, the code download is prevented.
In this embodiment, in the start authority configuration unit 3, the digest operation is performed again on the configuration information configured by the code encrypted data, and the digest value obtained by performing the digest operation again is added to the configuration information.
In this embodiment, in the starting permission obtaining unit 4, after the summary data in the configuration information is removed, the configuration information with the summary data removed is subjected to summary operation, the calculated summary value is compared with the removed summary value, if the comparison result is consistent, the configuration information is correct, the starting of downloading is allowed, otherwise, the starting of downloading fails;
after the configuration information is verified to be correct, carrying out abstract operation on the codes downloaded in the security chip to obtain abstract values of the downloaded codes; and decrypting the code encrypted data in the configuration information by adopting a public key, comparing the decrypted abstract value with the abstract value of the downloaded code, if the comparison result is consistent, the code is correct, and the security chip is allowed to be normally started, otherwise, the starting and downloading are failed.
It should be noted that, because the contents of information interaction, execution process, and the like between the modules/units of the apparatus are based on the same concept as the method embodiment in embodiment 1 of the present application, the technical effect brought by the contents is the same as the method embodiment of the present application, and specific contents may refer to the description in the foregoing method embodiment of the present application, and are not described herein again.
Example 3
Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, where a program code for downloading and starting a security protection method based on a code of a security chip is stored in the computer-readable storage medium, where the program code includes an instruction for executing the security chip-based code downloading and starting the security protection method according to embodiment 1 or any possible implementation manner of the embodiment.
Computer-readable storage media can be any available media that can be accessed by a computer or a data storage device, such as a server, data center, etc., that includes one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
Example 4
An embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;
the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the secure chip-based code download initiation security protection method of embodiment 1 or any possible implementation manner thereof.
Specifically, the processor may be implemented by hardware or software, and when implemented by hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated with the processor, located external to the processor, or stand-alone.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When implemented in software, may 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 loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to be performed in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may 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 instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized in a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a memory device and executed by a computing device, and in some cases, the steps shown or described may be executed out of order, or separately as individual integrated circuit modules, or multiple modules or steps thereof may be implemented as a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
Although the invention has been described in detail above with reference to a general description and specific examples, it will be apparent to one skilled in the art that modifications or improvements may be made thereto based on the invention. Accordingly, such modifications and improvements are intended to be within the scope of the invention as claimed.

Claims (8)

1. The code downloading starting safety protection method based on the safety chip is characterized by comprising the following steps:
configuring downloading authority: judging whether the security chip downloads the public key or not, and finishing configuration if the security chip downloads the public key; if the public key is not downloaded by the security chip, configuring random number information, downloading the public key to an SRAM of the security chip, signing the random number by adopting a private key, and copying the public key to a storage area of the security chip according to a signature verification result of the random number;
acquiring downloading authority: acquiring the random number from the security chip, signing the random number by adopting a private key, issuing signature data to the security chip, verifying the signature data by the security chip according to the public key, and judging whether the security chip has a downloading right or not according to a verification result;
configuring a starting authority: after obtaining the downloading authority, downloading a code to the security chip; performing summary operation on the code to obtain a summary value, and encrypting the summary value by adopting a private key to obtain code encryption data; configuring the code encryption data into configuration information, and downloading the configuration information to the security chip;
acquiring a starting authority: when the code is started, verifying the configuration information; after the configuration information is verified successfully, performing abstract operation on the codes of the code storage area of the security chip to obtain code abstract data; decrypting the code encrypted data by adopting a public key, comparing the decrypted data with the code abstract data, and judging whether the code encrypted data has a starting authority or not according to a comparison result;
when downloading the public key to the storage area of the security chip, firstly downloading the public key to an SRAM of the security chip, acquiring a random number from the security chip, signing the random number by using a private key, sending a signature value to the security chip, verifying the signature of the signature value by using the public key in the SRAM by the security chip, and copying the public key to the storage area by the security chip after the signature is successfully verified;
in the process of configuring the starting authority, performing summarization operation on the configuration information configured by the code encryption data again, and adding a summarized value obtained by performing summarization operation again into the configuration information; the configuration information comprises code encryption data and a digest value of the configuration information;
in the process of acquiring the starting authority, after removing the abstract data in the configuration information, performing abstract operation on the configuration information from which the abstract data is removed, comparing the operated abstract value with the removed abstract value, if the comparison result is consistent, the configuration information is correct, and starting downloading is allowed, otherwise, the starting downloading fails.
2. The method for starting the security protection after the code downloading based on the security chip of claim 1, wherein in the process of configuring the downloading authority, the OTP storage mode is adopted for one-time configuration:
storing a public key and a public key mark in an OTP (one time programmable) storage area of the security chip subjected to downloading permission configuration, judging whether the public key is valid through the public key mark, and finishing downloading permission configuration if the public key mark is valid; and if the public key mark is invalid, carrying out downloading authority configuration on the security chip.
3. The method for starting security protection after code downloading based on the security chip of claim 1, wherein in the process of obtaining the downloading authority, the security chip verifies the signature data according to the public key, the signature verification is successful, the code downloading is allowed, the signature verification fails, and the code downloading is prevented.
4. The security chip-based code download start security protection method of claim 1, wherein after verifying that the configuration information is correct, performing a digest operation on the code downloaded in the security chip to obtain a digest value of the downloaded code; and decrypting the code encrypted data in the configuration information by adopting a public key, comparing the decrypted abstract value with the abstract value of the downloaded code, if the comparison result is consistent, the code is correct, and allowing the security chip to be normally started, otherwise, the starting and downloading are failed.
5. The code based on safety chip downloads and starts the safety arrangement, characterized by that, including:
the download authority configuration unit is used for judging whether the security chip downloads the public key or not, and finishing configuration if the security chip downloads the public key; if the public key is not downloaded by the security chip, random number information is configured, the public key is downloaded to an SRAM of the security chip, a private key is adopted to sign the random number, and the public key is copied to a storage area of the security chip according to a signature verification result of the random number;
the download authority acquisition unit is used for acquiring the random number from the security chip, signing the random number by adopting a private key, issuing the signature data to the security chip, verifying the signature data by the security chip according to a public key, and judging whether the download authority exists according to a verification result;
the starting authority configuration unit is used for downloading codes to the security chip after acquiring downloading authority; performing summary operation on the code to obtain a summary value, and encrypting the summary value by adopting a private key to obtain code encrypted data; configuring the code encryption data into configuration information, and downloading the configuration information to the security chip;
the starting authority acquiring unit is used for verifying the configuration information when the code is started; after the configuration information is verified successfully, performing abstract operation on the codes of the code storage area of the security chip to obtain code abstract data; decrypting the code encrypted data by adopting a public key, comparing the decrypted data with the code abstract data, and judging whether the code encrypted data has a starting authority or not according to a comparison result;
when downloading the public key to the storage area of the security chip, firstly downloading the public key to an SRAM of the security chip, acquiring a random number from the security chip, signing the random number by using a private key, sending a signature value to the security chip, verifying the signature of the signature value by using the public key in the SRAM by the security chip, and copying the public key to the storage area by the security chip after the signature is successfully verified;
in the process of configuring the starting authority, performing summarization operation on the configuration information configured by the code encryption data again, and adding a summarized value obtained by performing summarization operation again into the configuration information; the configuration information comprises code encryption data and a digest value of the configuration information;
in the process of acquiring the starting authority, after the abstract data in the configuration information is removed, performing abstract operation on the configuration information with the abstract data removed, comparing the operated abstract value with the removed abstract value, if the comparison result is consistent, the configuration information is correct, and the starting of downloading is allowed, otherwise, the starting of downloading fails.
6. The device for protecting security chip-based code download initiation according to claim 5, wherein the download right configuration unit performs one-time configuration by using an OTP storage mode:
storing a public key and a public key mark in an OTP (one time programmable) storage area of the security chip subjected to downloading permission configuration, judging whether the public key is valid through the public key mark, and finishing downloading permission configuration if the public key mark is valid; and if the public key mark is invalid, carrying out downloading authority configuration on the security chip.
7. The security chip-based code download start security protection device of claim 5, wherein in the download right obtaining unit, the security chip verifies the signature data according to the public key, the signature verification is successful, the code download is allowed, the signature verification fails, and the code download is prevented.
8. The security chip-based code download start security protection device of claim 5, wherein after verifying that the configuration information is correct, performing a digest operation on the code downloaded in the security chip to obtain a digest value of the downloaded code; and decrypting the code encrypted data in the configuration information by adopting a public key, comparing the decrypted abstract value with the abstract value of the downloaded code, if the comparison result is consistent, the code is correct, and allowing the security chip to be normally started, otherwise, the starting and downloading are failed.
CN202210263657.1A 2022-03-17 2022-03-17 Code downloading starting safety protection method and device based on safety chip Active CN114629641B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210263657.1A CN114629641B (en) 2022-03-17 2022-03-17 Code downloading starting safety protection method and device based on safety chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210263657.1A CN114629641B (en) 2022-03-17 2022-03-17 Code downloading starting safety protection method and device based on safety chip

Publications (2)

Publication Number Publication Date
CN114629641A CN114629641A (en) 2022-06-14
CN114629641B true CN114629641B (en) 2022-10-25

Family

ID=81902399

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210263657.1A Active CN114629641B (en) 2022-03-17 2022-03-17 Code downloading starting safety protection method and device based on safety chip

Country Status (1)

Country Link
CN (1) CN114629641B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10200288A1 (en) * 2002-01-07 2003-07-17 Scm Microsystems Gmbh A device for executing applications that include secure transactions and / or access control to valuable content and / or services and methods for protecting such a device
CN106295318A (en) * 2015-06-05 2017-01-04 北京壹人壹本信息科技有限公司 A kind of system start-up bootstrap technique and device
CN109286599A (en) * 2017-07-20 2019-01-29 北京展讯高科通信技术有限公司 Data security protection method, smart machine, server and readable storage medium storing program for executing
CN112784280A (en) * 2021-01-12 2021-05-11 苏州浪潮智能科技有限公司 SoC chip security design method and hardware platform
CN112989356B (en) * 2021-03-08 2023-11-10 广州安凯微电子股份有限公司 Blank security chip burning method, system, blank security chip and storage medium

Also Published As

Publication number Publication date
CN114629641A (en) 2022-06-14

Similar Documents

Publication Publication Date Title
CN100454322C (en) Information processing device having activation verification function
CN102208000B (en) Method and system for providing security mechanisms for virtual machine images
KR101190479B1 (en) Ticket authorized secure installation and boot
JP6371919B2 (en) Secure software authentication and verification
CN110688660B (en) Method and device for safely starting terminal and storage medium
CN112699419B (en) Method for safely executing extensible firmware application program and calculator equipment
CN113039545A (en) Secure boot assistance for devices and related systems, methods, and devices
CN108229144B (en) Verification method of application program, terminal equipment and storage medium
WO2017045627A1 (en) Control board secure start method, and software package upgrade method and device
CN112148314B (en) Mirror image verification method, device and equipment of embedded system and storage medium
CN112257086A (en) User privacy data protection method and electronic equipment
CN116070217A (en) Safe starting system and method for chip module
CN112346759A (en) Firmware upgrading method and device and computer readable storage medium
CN111147259B (en) Authentication method and device
CN114003915A (en) Chip-based secure startup method and device
CN109508529B (en) Method for realizing safety starting verification of payment terminal
CN112613011B (en) USB flash disk system authentication method and device, electronic equipment and storage medium
CN114629641B (en) Code downloading starting safety protection method and device based on safety chip
CN112861137A (en) Secure firmware
CN111400771A (en) Target partition checking method and device, storage medium and computer equipment
CN116561734A (en) Verification method, verification device, computer and computer configuration system
CN114816549B (en) Method and system for protecting bootloader and environment variable thereof
CN115688120A (en) Secure chip firmware importing method, secure chip and computer readable storage medium
CN115563588A (en) Software offline authentication method and device, electronic equipment and storage medium
CN109840409B (en) Core board and core board starting method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information

Inventor after: Bai Hongxia

Inventor before: Bai Jinlong

Inventor before: Jia Hui

Inventor before: Wang Haiyang

CB03 Change of inventor or designer information
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Code Download and Start Security Protection Method and Device Based on Security Chip

Granted publication date: 20221025

Pledgee: Zhongguancun Beijing technology financing Company limited by guarantee

Pledgor: JIANG NAN INFORMATION SECURITY (BEIJING) TECHNOLOGY CO.,LTD.|JIANGSU XINZHI INFORMATION TECHNOLOGY Co.,Ltd.

Registration number: Y2024990000107

PE01 Entry into force of the registration of the contract for pledge of patent right