Abstract:
The present invention discloses a terminal, a network locking and network unlocking method for same, and a storage medium, said network locking method comprising: writing network-locking parameters in a first memory unit of the terminal; obtaining, in accordance with terminal hardware unique identification information and the network-locking parameters, network-locking parameter authentication information and an unlock code; storing the obtained network-locking parameter authentication information in a second memory unit of the terminal, and saving the unlock code.

Description:
TECHNICAL FIELD 
       [0001]    The disclosure relates to the field of communication, and in particular to a terminal, network locking and network unlocking methods thereof, and a storage medium. 
       BACKGROUND 
       [0002]    Along with rapid popularization of mobile networks on a global scale, in particular rapid growth of 3-Generation (3G) networks, each operator attracts users in manners of communication fee subsidy or mobile terminal bundling in terms of selling modes of mobile terminals such as mobile phones, tablets and data cards to increase and consolidate the number of users. In order to prevent user loss and reward early subsidy investment of operators, the operators usually protect own customer resources and expect their own customers to use their own specified network resources only by network locking. In a prior art, a network locking on a mobile terminal is implemented by limiting the mobile terminal to use only a specified data card such as a Subscriber Identity Module (SIM) card. An existing network locking solution mainly includes the following steps: 
         [0003]    Step 1, when producing a terminal, a mobile terminal manufacturer writes a legal Public Land Mobile Network (PLMN) number segment, a locking identifier and an unlocking code value into a flash of the terminal; 
         [0004]    Step 2, when a terminal user inserts a card into the terminal, the terminal reads a PLMN number segment from the SIM card or acquires the PLMN number segment from a network where the SIM card gets successfully registered, and then compares the read or acquired PLMN number segment with the preset PLMN number segment of the terminal, all functions of the terminal are enabled if they are consistent, and if they are inconsistent, all the functions of the terminal are disabled; and 
         [0005]    Step 3, when the terminal user sends an unlocking code to the terminal, the terminal compares the sent unlocking code with a preset unlocking code of the terminal by virtue of a certain algorithm and the like, clears a network locking identifier if they are consistent, and determines that unlocking fails if they are inconsistent. 
         [0006]    In the existing network locking solution, the unlocking code value is directly obtained merely according to a set network locking parameter, and is easy to be tampered and cracked illegally, which may make the terminal easy to be unlocked illegally and lower security of network locking of the terminal. 
       SUMMARY 
       [0007]    In order to solve the problem of the prior art, the embodiment of the disclosure provides a terminal, network locking and network unlocking methods thereof, and a storage medium, which may solve the problems of easily illegal unlocking and poor security of network locking of an existing terminal. 
         [0008]    In order to solve the technical problem, the embodiment of the disclosure provides a network locking method for a terminal, which may include that: 
         [0009]    a network locking parameter is written into a first storage unit of the terminal; 
         [0010]    network locking parameter verification information and an unlocking code are obtained according to unique identification information of hardware of the terminal and the network locking parameter; and 
         [0011]    the obtained network locking parameter verification information is stored into a second storage unit of the terminal, and the unlocking code is stored. 
         [0012]    In an embodiment of the disclosure, the step that the network locking parameter verification information is obtained according to the unique identification information of the hardware of the terminal and the network locking parameter may include that: 
         [0013]    a first digest value for the unique identification information of the hardware of the terminal and the network locking parameter is calculated; and 
         [0014]    the first digest value is encrypted using a private key in a preset asymmetric encryption key pair to obtain first network locking parameter verification information. 
         [0015]    In an embodiment of the disclosure, the step that the network locking parameter verification information is obtained according to the unique identification information of the hardware of the terminal and the network locking parameter may further include that: 
         [0016]    a second digest value for the unique identification information of the hardware of the terminal and a public key in the asymmetric encryption key pair is calculated; and the second digest value is encrypted using the private key in the asymmetric encryption key pair to obtain second network locking parameter verification information. 
         [0017]    In an embodiment of the disclosure, the unique identification information of the hardware of the terminal may be unique identification information, which can be acquired only through an internal program of the terminal, of the hardware. 
         [0018]    In an embodiment of the disclosure, the unique identification information of the hardware of the terminal may be unique identification information of a baseband chip of the terminal. 
         [0019]    In order to solve the problem, the embodiment of the disclosure also provides a network unlocking method for a terminal, which may include that: 
         [0020]    a first unlocking code input by a user is received; 
         [0021]    a local unlocking code of the terminal is calculated according to a network locking parameter stored in the terminal and unique identification information, adopted for network locking, of hardware of the terminal; and 
         [0022]    comparison is performed to determine whether the first unlocking code is consistent with the local unlocking code, and if YES, it is determined that network unlocking succeeds. 
         [0023]    In an embodiment of the disclosure, the method may further include: before the step that comparison is performed to determine whether the first unlocking code is consistent with the local unlocking code, the first unlocking code and a first unlocking code ciphertext are received, wherein 
         [0024]    the first unlocking code ciphertext is a ciphertext obtained by encrypting the first unlocking code input by the user using a private key in an asymmetric encryption key pair adopted for network locking of the terminal; 
         [0025]    the first unlocking code ciphertext is unlocked according to a public key in the asymmetric encryption key pair adopted for the network locking of the terminal to obtain a first check unlocking code; and 
         [0026]    comparison is performed to determine whether the first unlocking code is consistent with the first check unlocking code, and if YES, comparison is performed to determine whether the first unlocking code is consistent with the local unlocking code. 
         [0027]    In an embodiment of the disclosure, the method may further include: before the step that the first unlocking code input by the user is received and when the terminal is started, 
         [0028]    integrity check is performed on the network locking parameter stored in a first storage unit of the terminal; or 
         [0029]    integrity check is performed on the public key in the asymmetric encryption key pair adopted for the network locking of the terminal. 
         [0030]    In an embodiment of the disclosure, the step that integrity check is performed on the network locking parameter stored in the first storage unit of the terminal may include: 
         [0031]    first network locking parameter verification information stored during the network locking is read from a second storage unit of the terminal, decryption processing is performed on the first network locking parameter verification information according to the public key in the asymmetric encryption key pair adopted for the network locking of the terminal to obtain a first check digest value, and a check network locking parameter is acquired from the first check digest value; and 
         [0032]    the check network locking parameter and the network locking parameter stored in the first storage unit are compared to determine whether the two parameters are consistent, and if YES, it is determined that the network locking parameter is complete; 
         [0033]    the step that integrity check is performed on the public key in the asymmetric encryption key pair adopted for the network locking of the terminal may include: 
         [0034]    second network locking parameter verification information stored during the network locking is read from the second storage unit of the terminal, decryption processing is performed on the second network locking parameter verification information according to the public key in the asymmetric encryption key pair adopted for the network locking of the terminal to obtain a second check digest value, and a check public key is acquired from the second check digest value; and 
         [0035]    the check public key and the public key stored in the second storage unit are compared to determine whether the two keys are consistent, and if YES, it is determined that the public key is complete. 
         [0036]    In an embodiment of the disclosure, the method may further include that: after network unlocking of the terminal is successfully performed, 
         [0037]    the network locking parameter stored in a first storage unit of the terminal is updated into an unlocking parameter; 
         [0038]    a third digest value for the unique identification information of the hardware of the terminal and the unlocking parameter is calculated; and 
         [0039]    the third digest value is encrypted using the private key in the asymmetric encryption key pair adopted for the network locking to obtain third network locking parameter verification information, and the third network locking parameter verification information is stored into a second storage unit of the terminal. 
         [0040]    In an embodiment of the disclosure, the method may further include: 
         [0041]    when the terminal is started after successful unlocking, the third network locking parameter verification information is read from the second storage unit of the terminal, decryption processing is performed on the third network locking parameter verification information according to the public key in the asymmetric encryption key pair adopted for the network locking of the terminal to obtain a third check digest value, and a check unlocking parameter is acquired from the third check digest value; and 
         [0042]    the check unlocking parameter and the unlocking parameter stored in the first storage unit are compared to determine whether the two parameters are consistent, and if YES, it is determined that the unlocking parameter is complete. 
         [0043]    In order to solve the problem, the embodiment of the disclosure further provides a terminal including a first storage unit, a second storage unit, a sending unit, a receiving unit and a processing unit, in which: 
         [0044]    the receiving unit may be configured to receive a network locking parameter and store the network locking parameter in the first storage unit; 
         [0045]    the processing unit may be configured to obtain network locking parameter verification information and an unlocking code according to unique identification information of hardware of the terminal and the network locking parameter, and store the obtained network locking parameter verification information into the second storage unit of the terminal; and 
         [0046]    the sending unit may be configured to send out the unlocking code for storage. 
         [0047]    In an embodiment of the disclosure, the second storage unit may be a One Time Programmable (OTP) storage unit. 
         [0048]    In an embodiment of the disclosure, the operation that the processing unit obtains the network locking parameter verification information according to the unique identification information of the hardware of the terminal and the network locking parameter may include that: 
         [0049]    a first digest value for the unique identification information of the hardware of the terminal and the network locking parameter is calculated; and 
         [0050]    the first digest value is encrypted using a private key in a preset asymmetric encryption key pair to obtain first network locking parameter verification information. 
         [0051]    In an embodiment of the disclosure, the operation that the processing unit obtains the network locking parameter verification information according to the unique identification information of the hardware of the terminal and the network locking parameter may further include: 
         [0052]    a second digest value for the unique identification information of the hardware of the terminal and a public key in the asymmetric encryption key pair is calculated; and 
         [0053]    the second digest value is encrypted to using the private key in the asymmetric encryption key pair obtain second network locking parameter verification information. 
         [0054]    In an embodiment of the disclosure, the unique identification information of the hardware of the terminal may be unique identification information, which can be acquired only through an internal program of the terminal, of the hardware. 
         [0055]    In an embodiment of the disclosure, the receiving unit may further be configured to receive a first unlocking code input by a user; and 
         [0056]    the processing unit may further be configured to calculate a local unlocking code according to the network locking parameter stored in the terminal and the unique identification information, adopted for network locking, of the hardware of the terminal, perform comparison to determine whether the first unlocking code is consistent with the local unlocking code, and if YES, determine that network unlocking succeeds. 
         [0057]    In order to solve the problem, the embodiment of the disclosure further provides a computer storage medium having stored therein a computer-executable instruction configured to execute the abovementioned network locking method for a terminal and/or the network unlocking method for a terminal. 
         [0058]    The embodiment of the disclosure achieves the following beneficial effects: during network locking of the terminal, the network locking parameter is written into the first storage unit of the terminal, and the network locking parameter verification information and the unlocking code are obtained on the basis of the unique identification information of the hardware of the terminal and the network locking parameter; and when network unlocking of the terminal is performed, the unlocking code is obtained according to the network locking parameter stored in the terminal and the unique identification information of the hardware of the terminal; and comparison is performed to determine whether the unlocking code is consistent with the unlocking code input by the user, and when the two codes are consistent, it is determined that network unlocking is successfully performed. It is clear that the technical solutions provided by the disclosure may implement unique binding of the network locking parameter of the terminal and the unique identification information of the hardware of the terminal, and network unlocking can be smoothly performed only according to the unique identification information of the hardware of the terminal, so that difficulty in illegal cracking of the unlocking code can be increased to a greater extent and thus security of network locking of the terminal can be improved. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0059]      FIG. 1-1  is a flowchart of network locking of a terminal according to embodiment 1 of the disclosure; 
           [0060]      FIG. 1-2  is a flowchart of obtaining network locking parameter verification information by adopting an asymmetric encryption algorithm according to embodiment 1 of the disclosure; 
           [0061]      FIG. 2-1  is a flowchart of releasing network locking of a terminal according to embodiment 1 of the disclosure; 
           [0062]      FIG. 2-2  is a flowchart of performing integrity check on a first unlocking code input by a user according to embodiment 1 of the disclosure; 
           [0063]      FIG. 3  is a flowchart of performing integrity check on a network locking parameter according to embodiment 1 of the disclosure; 
           [0064]      FIG. 4  is a flowchart of performing integrity check on a public key according to embodiment 1 of the disclosure; 
           [0065]      FIG. 5  is a flowchart of updating an unlocking parameter after network unlocking is successfully performed according to embodiment 1 of the disclosure; 
           [0066]      FIG. 6  is a flowchart of performing integrity check on an unlocking parameter according to embodiment 1 of the disclosure; 
           [0067]      FIG. 7  is a structure diagram of a terminal according to embodiment 1 of the disclosure; 
           [0068]      FIG. 8  is a flowchart of network locking of a terminal according to embodiment 2 of the disclosure; and 
           [0069]      FIG. 9  is a flowchart of releasing network locking of a terminal according to embodiment 2 of the disclosure. 
       
    
    
     DETAILED DESCRIPTION 
       [0070]    The embodiment of the disclosure is intended to solve the problem of poor security of network locking of an existing terminal caused by easily illegal cracking of network locking of the terminal; during network locking of the terminal, an unlocking code is obtained by virtue of unique identification information of hardware of the terminal and a network locking parameter, that is, the unlocking code is uniquely bound with the hardware of the terminal during network locking, the unique identification information of the hardware of the terminal in the embodiment of the disclosure may only be obtained through an internal application program of the terminal, and the unique identification information of the hardware may not be obtained through an external program or tool, so that security of the unlocking code may further be improved, and may be prevented from being illegally cracked, and network locking of the terminal is further prevented from being illegally cracked. The technical solutions of the disclosure will be further described below with reference to specific implementation modes and the drawings in detail. 
       Embodiment 1 
       [0071]    Referring to  FIG. 1-1 , a network locking method for a terminal provided by the embodiment includes the following steps: 
         [0072]    Step S 101 , a network locking parameter is written into a first storage unit of the terminal. 
         [0073]    The network locking parameter written in Step S 101  may be a PLMN number segment, and may also be selected according to a specific application scenario. 
         [0074]    In the embodiment, before Step S 101 , the method may further include: a step of determining whether the terminal supports a network locking function, and subsequent Step S 101  is executed only when the terminal supports the network locking function; and an existing terminal, such as a mobile phone terminal, usually supports the network locking function. 
         [0075]    Step S 102 , network locking parameter verification information and an unlocking code are obtained according to unique identification information of hardware of the terminal and the network locking parameter. 
         [0076]    In Step S 102 , the network locking parameter verification information may include one or more pieces of network locking parameter verification information according to a specific encryption algorithm and a specific application scenario; for example, an asymmetric encryption algorithm such as an asymmetric Rivest-Shamir-Adleman (RSA) public key encryption algorithm may be adopted in the embodiment; then, the network locking parameter verification information in Step S 102  includes first network locking parameter verification information and second network locking parameter verification information, and as shown in  FIG. 1-2 , the step that the network locking parameter verification information is obtained according to the unique identification information of the hardware of the terminal and the network locking parameter includes: 
         [0077]    Step S 1021 , a first digest value for the unique identification information of the hardware of the terminal and the network locking parameter is calculated, 
         [0078]    wherein the digest value may be represented by a Message Digest (MD) value, and the first digest value is represented by MD 1 ; 
         [0079]    Step S 1022 , the first digest value is encrypted using a private key in a preset asymmetric encryption key pair to obtain the first network locking parameter verification information; 
         [0080]    Step S 1023 , a second digest value for the unique identification information of the hardware of the terminal and a public key in the asymmetric encryption key pair is calculated; and 
         [0081]    Step S 1024 , the second digest value is encrypted using the private key in the asymmetric encryption key pair to obtain the second network locking parameter verification information. 
         [0082]    It should be understood that the network locking parameter verification information may not include the second network locking parameter verification information obtained by Step S 1023  and Step S 1024  when the adopted encryption algorithm does not include the public key; the asymmetric encryption algorithm in the embodiment may specifically be provided by a Universal Serial Bus (USB) key, and the private key in the asymmetric encryption key pair may be stored in the USB key, so that security of network locking is further improved; and 
         [0083]    in the embodiment, the unlocking code may specifically be calculated according to keyword information of the network locking parameter and the unique identification information of the hardware of the terminal, and a specific algorithm may adopt the asymmetric RSA algorithm. 
         [0084]    In the embodiment, the unique identification information of the hardware of the terminal may be unique identification information, which may only be obtained through an internal application program of the terminal and may not be obtained by an external program or tool, so that security of the unlocking code is further improved. For example, the unique identification information may be unique identification information of a baseband chip of the terminal, and may specifically be a unique hardware key of the baseband chip; and of course, the unique identification information of the hardware of the terminal may also be information, which may be obtained through the external application program or tool, with lower security, and for example, may be an International Mobile Equipment Identity (IMEI) of the terminal. 
         [0085]    Step S 103 , the obtained network locking parameter verification information is stored into a second storage unit of the terminal, and the obtained unlocking code is stored. 
         [0086]    In Step S 103 , the obtained unlocking code may be stored in the terminal; and however, for improving security, the obtained unlocking code is preferably sent to a Personal Computer (PC) side to be stored with identification information of the terminal, such as the IMEI of the terminal, as an index in the embodiment, which may specifically be implemented by establishing a mapping table of identification information of a terminal and its unlocking code. 
         [0087]    The first storage unit and second storage unit in the embodiment may adopt the same storage unit, and may also adopt different storage units. In order to further improve security, the first storage unit is preferably a Random-Access Memory (RAM) storage unit of the terminal, and for example, may be a Non-Volatile Random Access Memory (NVRAM); the second storage unit may be a One Time Programmable (OTP) storage unit, and a written content may not be modified once the content is written into the OTP storage unit, so that the network locking parameter verification information written into the OTP storage unit may be prevented from being illegally tampered. 
         [0088]    Step S 103  further includes the operation that the public key in the asymmetric encryption key pair adopted for network locking is also stored into the second storage unit. 
         [0089]    Network locking of the terminal may be implemented by Step S 101  to Step S 103 , the unlocking code is bound with the unique identification information of the hardware of the terminal in a network locking process, and network unlocking may be correctly performed only after the unique identification information of the hardware is acquired; and data cloning may also be prevented to avoid an unlocked network locking parameter being copied from terminal A to network-locked terminal B for unlocking, so that security of network locking of the terminal may further be improved, and may be prevented from being illegally cracked. 
         [0090]    In addition, after the network locking parameter verification information and the public key in the asymmetric encryption pair key adopted for network locking are stored into the OTP storage unit in the embodiment, these data may not be illegally tampered and erased; and therefore, security of network locking may further be improved. 
         [0091]    Moreover, the asymmetric RSA algorithm is adopted for encryption calculation in the embodiment. Different operating companies may adopt different RSA key pairs for network locking parameter signing and subsequent authentication, and the private key of the key pair may be stored into the USB key; and the operating companies and hackers may smoothly implement unlocking only with the correct unlocking code and the corresponding private key, both of the two being indispensible, so that difficulty in illegal cracking is further increased. 
         [0092]    Correspondingly, a network unlocking method for a terminal provided by the embodiment, as shown in  FIG. 2-1 , includes the following steps: 
         [0093]    Step S 201 , a first unlocking code input by a user is received; 
         [0094]    Step S 202 , a local unlocking code is calculated according to a network locking parameter stored in the terminal and unique identification information, adopted for network locking, of hardware of the terminal; 
         [0095]    Step S 203 , comparison is performed to determine whether the first unlocking code is consistent with the local unlocking code, Step  204  is executed if YES, otherwise Step  205  is executed; 
         [0096]    Step S 204 , it is determined that unlocking succeeds; and 
         [0097]    Step S 205 , it is determined that unlocking fails. 
         [0098]    In step S 201 , the user may specifically input the first unlocking code through a PC side; in addition, for ensuring reliability, integrity check may also be performed on the first unlocking code input by the user in the embodiment; then, before Step S 203 , the method may, as shown in  FIG. 2-2 , further include the following steps: 
         [0099]    Step S 2021 , the first unlocking code input by the user is encrypted using a private key in an asymmetric encryption key pair adopted for network locking of the terminal to obtain a first unlocking code ciphertext; 
         [0100]    Step S 2022 , the first unlocking code and the first unlocking code ciphertext are sent to the terminal; 
         [0101]    Step S 2023 , the terminal unlocks the first unlocking code ciphertext to obtain a first check unlocking code according to a public key in the asymmetric encryption key pair in a network locking process; and 
         [0102]    Step S 2024 , comparison is performed to determine whether the first unlocking code is consistent with the first check unlocking code, and if YES, Step S 203  is executed. 
         [0103]    In the embodiment, before the terminal is unlocked, that is, before Step S 201  is executed, when the terminal is started, the method may further include a step that integrity check is performed on the network locking parameter in a first storage unit of the terminal; 
         [0104]    or the method may further include a step that integrity check is performed on the public key in the asymmetric encryption key pair adopted for the network locking process of the terminal. 
         [0105]    Specifically, the step that integrity check is performed on the network locking parameter stored in the first storage unit of the terminal, as shown in  FIG. 3 , includes: 
         [0106]    Step S 301 , first network locking parameter verification information stored during network locking is read from a second storage unit of the terminal; 
         [0107]    Step S 302 , decryption processing is performed on the first network locking parameter verification information to obtain a first check digest value according to the public key in the asymmetric encryption key pair adopted for the network locking process of the terminal, and a check network locking parameter is acquired from the first check digest value; 
         [0108]    Step S 303 , the check network locking parameter and the network locking parameter stored in the first storage unit are compared to determine whether the two are consistent, Step S 304  is executed if YES, otherwise Step S 305  is executed; 
         [0109]    Step S 304 , it is determined that the network locking parameter is complete, and the terminal normally runs; and 
         [0110]    Step S 305 , it is determined that the network locking parameter is incomplete and may be tampered or damaged, and then the terminal may enter an offline state and disable functions such as a voice function and a network access function. 
         [0111]    Specifically, the step that integrity check is also performed on the public key in the asymmetric encryption key pair adopted for the network locking process of the terminal, as shown in  FIG. 4 , includes: 
         [0112]    Step S 401 , second network locking parameter verification information stored during network locking is read from the second storage unit of the terminal; 
         [0113]    Step S 402 , decryption processing is performed on the second network locking parameter verification information to obtain a second check digest value according to the public key in the asymmetric encryption key pair adopted for the network locking process of the terminal, and a check public key is acquired from the second check digest value; 
         [0114]    Step  403 , the check public key and the public key stored in the second storage unit during network locking are compared to determine whether the two are consistent, Step S 404  is executed if YES, otherwise Step S 405  is executed; 
         [0115]    Step S 404 , it is determined that the public key is complete, that is, the terminal normally runs; and 
         [0116]    Step S 405 , it is determined that the public key is incomplete and namely may be tampered or damaged, and then the terminal may enter the offline state and disable the functions such as the voice function and the network access function. 
         [0117]    In the embodiment, after Step S 204 , a step that the network locking parameter into an unlocking parameter may further be executed, and is, as shown in  FIG. 5 , specifically implemented as follows: 
         [0118]    Step S 501 , the network locking parameter stored in the first storage unit of the terminal is updated into the unlocking parameter; 
         [0119]    Step S 502 , a third digest value for the unique identification information of the hardware of the terminal and the unlocking parameter is calculated; 
         [0120]    Step S 503 , the third digest value is encrypted using the private key in the asymmetric encryption key pair adopted for network locking to obtain third network locking parameter verification information; and 
         [0121]    Step S 504 , the obtained third network locking parameter verification information is stored into the second storage unit of the terminal. 
         [0122]    At this moment, network unlocking of the terminal has been successfully performed, and when the terminal is restarted, integrity detection may be performed on the third network locking parameter verification information stored in the first storage unit of the terminal, as shown in  FIG. 6 , specifically including the following steps: 
         [0123]    Step S 601 , when the terminal is started after successful unlocking, the third network locking parameter verification information is read from the second storage unit of the terminal; 
         [0124]    Step S 602 , decryption processing is performed on the third network locking parameter verification information to obtain a third check digest value according to the public key in the asymmetric encryption key pair adopted for the network locking process of the terminal, and a check unlocking parameter is acquired from the third check digest value; 
         [0125]    Step S 603 , the check unlocking parameter and the unlocking parameter stored in the first storage unit are compared to determine whether the two are consistent, Step S 604  is executed if YES, otherwise Step S 605  is executed; 
         [0126]    Step S 604 , it is determined that the unlocking parameter is complete, that is, the terminal normally runs; and 
         [0127]    Step S 605 , it is determined that the unlocking parameter is incomplete and namely may be tampered or damaged, then the terminal may enter the offline state and disable the functions such as the voice function and the network access function, and the current number of failed unlocking tries may further be updated to provide a basis for subsequently determining whether to perform unlocking. 
         [0128]    Referring to  FIG. 7 , the embodiment further provides a terminal, which supports a network locking function and includes a first storage unit  701 , a second storage unit  702 , a sending unit  703 , a receiving unit  704  and a processing unit  705 , wherein 
         [0129]    the receiving unit  704  is configured to receive a network locking parameter and store the network locking parameter in the first storage unit  701 ; 
         [0130]    the processing unit  705  is configured to obtain network locking parameter verification information and an unlocking code according to unique identification information of hardware of the terminal and the network locking parameter, and store the obtained network locking parameter verification information into the second storage unit of the terminal; and 
         [0131]    the sending unit  703  is configured to externally send the unlocking code for storage, and a specific storage manner may adopt the abovementioned storage manner. 
         [0132]    From the above analysis, it can further be seen that the first storage unit  701  and second storage unit  702  in the embodiment may be the same storage unit, and may also be different storage units; and the second storage unit may preferably be an OTP storage unit. 
         [0133]    In the embodiment, the operation that the processing unit  705  obtains the network locking parameter verification information according to the unique identification information of the hardware of the terminal and the network locking parameter includes that: 
         [0134]    a first digest value for the unique identification information of the hardware of the terminal and the network locking parameter is calculated; 
         [0135]    the first digest value is encrypted using a private key in a preset asymmetric encryption key pair to obtain first network locking parameter verification information; 
         [0136]    the operation further includes that: 
         [0137]    a second digest value for the unique identification information of the hardware of the terminal and a public key in the asymmetric encryption key pair is calculated; and 
         [0138]    the second digest value is encrypted using the private key in the asymmetric encryption key pair to obtain second network locking parameter verification information. 
         [0139]    In the embodiment, the unique identification information of the hardware of the terminal may be unique identification information, which may only be acquired through an internal program of the terminal, of the hardware, so that security of network locking is further improved; and for example, the unique identification information may be unique identification information of a baseband chip of the terminal. 
         [0140]    In the embodiment, the receiving unit  704  is further configured to receive a first unlocking code input by a user; and 
         [0141]    the processing unit  705  is further configured to calculate a local unlocking code according to the network locking parameter stored in the terminal and the unique identification information, adopted for network locking, of the hardware of the terminal, perform comparison to determine whether the first unlocking code input by the user is consistent with the local unlocking code, determine that network unlocking succeeds if YES, otherwise determine current unlocking fails. After determining that unlocking succeeds, the processing unit  705  may update the unlocking parameter according to the methods shown in  FIG. 5  to  FIG. 6 , and verify the unlocking parameter when the terminal is started; and when determining that current unlocking fails, the current number of unlocking failures may be updated to provide a determination basis for subsequent unlocking. 
         [0142]    In the embodiment, before the receiving unit  704  receives the first unlocking code input by the user, the processing unit  705  may further perform integrity verification on the network locking parameter and the public key in the asymmetric encryption key pair adopted for a network locking process of the terminal in advance by virtue of the methods shown in  FIG. 3  to  FIG. 4 , which will not be elaborated herein. 
       Embodiment 2 
       [0143]    In order to better understand the technical solutions of the disclosure, the technical solutions of the disclosure will be further described below with reference to a network locking flow and network unlocking flow of a mobile terminal (which may not, of course, be limited to a mobile terminal, and may also be a non-mobile terminal). 
         [0144]    Referring to  FIG. 8 , the network locking flow of the mobile terminal includes: 
         [0145]    Step S 801 , a PC side tool sends a network locking security handshake instruction to the mobile terminal; 
         [0146]    Step S 802 , the mobile terminal determines whether a network locking function is supported, 
         [0147]    wherein the mobile terminal specifically determines whether the network locking function is supported, Step S 803  is executed if the mobile terminal does not support the network locking function, otherwise Step S 804  is executed; 
         [0148]    Step S 803 , a handshake failure is returned; 
         [0149]    Step S 804 , a handshake success is returned; 
         [0150]    Step S 805 , the PC side tool sends a network locking parameter PLMN to the mobile terminal, 
         [0151]    wherein the PC side tool specifically sends the network locking parameter PLMN to the mobile terminal, and then the mobile terminal writes it into a first storage unit such as an NVRAM; 
         [0152]    Step S 806 , the PC side tool sends an instruction to the mobile terminal, 
         [0153]    wherein the instruction sent to the mobile terminal by the PC side tool is configured to request for network locking parameter verification information and public key parameter verification information, i.e. first network locking parameter verification information and second network locking parameter verification information respectively; 
         [0154]    Step S 807 , the mobile terminal determines whether the number of remaining pages of an OTP storage unit is more than 2, 
         [0155]    wherein the mobile terminal specifically determines whether the number of the remaining pages of the OTP storage unit (i.e. a second storage unit) of a flash is more than 2, namely determines whether a storage space is sufficient, Step S 808  is executed if the number of the remaining pages is less than 2, otherwise Step S 809  is executed; 
         [0156]    Step S 808 , a failure is returned; 
         [0157]    Step S 809 , a unique identifier of a baseband chip of the terminal is read, 
         [0158]    wherein the terminal specifically reads the unique identifier, such as an HW key, of the baseband chip of the terminal through an internal upper-layer application program; 
         [0159]    Step S 810 , the mobile terminal calculates a first digest value MD 1  of the network locking parameter and the unique identifier, 
         [0160]    wherein the mobile terminal specifically calculates MD 1  of the network locking parameter and the unique identifier, i.e. MD 1  of the HW key; 
         [0161]    Step S 811 , the mobile terminal calculates a second digest value MD 2  of an unlocking public key and the unique identifier, 
         [0162]    wherein the mobile terminal specifically calculates MD 2  of the network locking parameter and the unique identifier, i.e. MD 2  of the HW key; 
         [0163]    Step S 812 , the mobile terminal calculates an unlocking code according to a keyword of the network locking parameter and the unique identifier of the baseband chip, 
         [0164]    wherein the mobile terminal specifically calculates the unlocking code according to the keyword of the network locking parameter and the HW key; 
         [0165]    Step S 813 , the mobile terminal returns MD 1 , MD 2  and the unlocking code to the PC side tool; 
         [0166]    Step S 814 , the PC side tool locally stores the unlocking code and an IMEI of the terminal, 
         [0167]    wherein the PC side tool stores the IMEI of the terminal in a local database as an index of the unlocking code; 
         [0168]    Step S 815 , the PC side tool returns MD 1  and MD 2  to a USB key; 
         [0169]    Step S 816 , the USB key encrypts MD 1  and MD 2  using a private key to obtain DSP 1  and DSP 2 ; 
         [0170]    wherein the USB key performs digital signing on MD 1  and MD 2  using the RSA private key to generate the first network locking parameter verification information (DSP 1 ) and the second network locking parameter verification information (DSP 2 ); 
         [0171]    Step S 817 , the USB key returns DSP 1  and DSP 2  to the PC side tool; 
         [0172]    Step S 818 , the PC side tool sends DSP 1  and DSP 2  to the mobile terminal; 
         [0173]    Step S 819 , DSP 1  and DSP 2  are stored in the OTP storage unit, 
         [0174]    Wherein the mobile terminal writes DSP 1  and DSP 2  into the OTP storage unit of the flash respectively; and 
         [0175]    Step S 820 , the mobile terminal returns the network locking parameter and a network locking success. 
         [0176]    Integrity detection on the network locking parameter and the public key will not be elaborated herein, the technical solutions of the disclosure are further described herein directly with the unlocking flow of the mobile terminal as an example, and referring to  FIG. 9 , the flow includes: 
         [0177]    Step S 901 , a user inputs a first unlocking code K 1  into the PC side tool; 
         [0178]    Step S 902 , the USB key encrypts the unlocking code K 1  using the private key to generate a first unlocking code ciphertext KC; 
         [0179]    Step S 903 , the PC side tool sends an unlocking request containing K 1  and KC to the mobile terminal; 
         [0180]    Step S 904 , whether an unlocking failure flag bit in the OTP storage unit is reset, 
         [0181]    wherein the mobile terminal specifically detects whether the unlocking failure flag bit in the OTP storage unit of the flash is reset, Step S 905  is executed if YES, otherwise Step S 906  is executed; 
         [0182]    Step S 905 , an unlocking failure message is returned to the PC side tool; 
         [0183]    Step S 906 , the mobile terminal determines whether the number of remaining unlocking times is more than 0, Step S 907  is executed if NO, otherwise Step S 908  is executed; 
         [0184]    Step S 907 , a failure is returned, that is, if the number of the remaining unlocking times is not more than 0, the terminal returns the unlocking failure message to the PC side tool; 
         [0185]    Step S 908 , K 2  is decrypted from KC using the public key, 
         [0186]    wherein the terminal decrypts a first check unlocking code K 2  from the ciphertext KC using the public key adopted for network locking; 
         [0187]    Step S 909 , comparison is performed to determine whether K 1  and K 2  are the same, Step S 910  is executed if NO, otherwise Step S 911  is executed; 
         [0188]    Step S 910 , the failure is returned, that is, the terminal returns the unlocking failure message to the PC side tool; 
         [0189]    Step S 911 , a local unlocking code is calculated according to the keyword of the network locking parameter and the unique identifier of the baseband chip of the terminal, 
         [0190]    wherein the terminal calculates the local unlocking code according to the keyword of the network locking parameter and the unique identifier, such as the HW key, of the baseband chip of the terminal; 
         [0191]    Step S 912 , comparison is performed to determine whether K 1  and the local unlocking code are the same, Step S 913  is executed if NO, otherwise Step S 914  is executed; 
         [0192]    Step S 913 , the failure is returned, and 1 is subtracted from the number of the remaining unlocking times, 
         [0193]    wherein the terminal returns the unlocking failure message to the PC side tool, simultaneously subtracts 1 from the number of the remaining unlocking times, and writes a result into the OTP storage unit of the flash; 
         [0194]    Step S 914 , the terminal modifies the network locking parameter into an unlocking parameter; 
         [0195]    Step S 915 , a third digest value MD 3  of the network locking parameter and the unique identifier is recalculated, 
         [0196]    wherein the terminal recalculates the third digest value MD 3  of the unlocking parameter and the unique identifier such as the HW key; 
         [0197]    Step S 916 , the terminal returns MD 3  to the PC side tool; 
         [0198]    Step S 917 , the PC side tool returns MD 3  to the USB key; 
         [0199]    Step S 918 , MD 3  is encrypted using the private key to obtain DSP 3 , 
         [0200]    wherein the USB key encrypts MD 3  using the private key to generate the first network locking parameter verification information DSP 3 ; 
         [0201]    Step S 919 , the USB key returns DSP 3  to the PC side tool; 
         [0202]    Step S 920 , the PC side tool sends DSP 3  to the mobile terminal; 
         [0203]    Step S 921 , the terminal writes DSP 3  into the OTP storage unit of the flash; and 
         [0204]    Step S 922 , an unlocking success is returned, that is, the terminal returns an unlocking success message. 
         [0205]    At this point, introduction about the specific implementation steps involved in the terminal hardware identifier-based security network locking and unlocking methods for a terminal have been finished. It can be seen that security of network locking of the terminal may be improved by the network locking method and corresponding network unlocking method provided by the embodiment of the disclosure. 
         [0206]    The sending unit, receiving unit and processing unit in the terminal provided by the embodiment of the disclosure may all be implemented by a processor in the mobile terminal, and may, of course, also be implemented by a specific logic circuit; and in a specific implementation process, the processor may be a Central Processing Unit (CPU), a Micro Processing Unit (MPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA) or the like. 
         [0207]    The network locking method for a terminal and/or the network unlocking method for a terminal in the embodiment of the disclosure may also be stored in a computer-readable storage medium if being implemented in form of software function module and sold or used as independent products. Based on such understanding, the technical solutions of the embodiment of the disclosure or the parts contributing to the prior art may be embodied in form of software product, and the computer software product is stored in a storage medium, and includes a plurality of instructions to enable a piece of computer equipment (which may be a PC, a server, network equipment or the like) to execute all or part of the methods of each embodiment of the disclosure. The storage medium includes: various media capable of storing program codes, such as a U disk, a mobile hard disk, a Read-Only Memory (ROM), a disk or a compact disc. Therefore, the embodiment of the disclosure is not limited to any specific hardware and software combination. 
         [0208]    Correspondingly, the embodiment of the disclosure further provides a computer storage medium having stored therein a computer-executable instruction configured to execute a network locking method for a terminal and/or a network unlocking method for a terminal in the embodiment of the disclosure. 
         [0209]    The above is only further detailed description made about the technical solutions of the disclosure with reference to specific implementation modes, and specific implementation of the disclosure may not be considered to be limited to the description. Those skilled in the art may further make a plurality of simple deductions or replacements without departing from the concept of the disclosure, and these deductions or replacements shall fall within the scope of protection of the disclosure. 
       INDUSTRIAL APPLICABILITY 
       [0210]    In the embodiment of the disclosure, during network locking of the terminal, the network locking parameter is written into the first storage unit of the terminal, and the network locking parameter verification information and the unlocking code are obtained on the basis of the unique identification information of the hardware of the terminal and the network locking parameter; and when network unlocking of the terminal is performed, the unlocking code is obtained according to the network locking parameter stored in the terminal and the unique identification information of the hardware of the terminal; and comparison is performed to determine whether the unlocking code is consistent with the unlocking code input by the user, and when the two codes are consistent, it is determined that network unlocking is successfully performed. It is clear that the embodiment of the disclosure may implement unique binding of the network locking parameter of the terminal and the unique identification information of the hardware of the terminal, and network unlocking may be smoothly performed only according to the unique identification information of the hardware of the terminal, so that difficulty in illegal cracking of the unlocking code can be increased to a greater extent, and thus security of network locking of the terminal can be improved.