Abstract:
A method includes: pre-generating a key pair including a first public key and a first private key; acquiring identification information about a mobile terminal; encrypting the key pair including the first public key and the first private key using the identification information to obtain a first encrypted public key and a first encrypted private key and saving same; when a service key is encrypted, encrypting the service key using the first private key to obtain an encrypted service key; when the service key is decrypted, decrypting the encrypted service key using the first public key to obtain the service key; acquiring data needing to be encrypted/decrypted of the mobile terminal; and encrypting/decrypting the data using the service key. The security of the data can be protected off-line with low cost and without hardware protection, so that the data cannot be intercepted and tampered with.

Description:
CROSS REFERENCE TO RELATED PATENT APPLICATIONS 
       [0001]    This application claims priority to and is a continuation of PCT Patent Application No. PCT/CN2015/095588, filed on 26 Nov. 2015, which claims priority to Chinese Patent Application No. 201410721298.5, filed on 2 Dec. 2014, entitled “METHOD AND APPARATUS FOR ENCRYPTING/DECRYPTING DATA ON MOBILE TERMINAL,” which are hereby incorporated by reference in their entirety. 
     
    
     TECHNICAL FIELD 
       [0002]    The present disclosure relates to the field of data processing, and in particular, to a method and an apparatus for encrypting/decrypting data on a mobile terminal. 
       BACKGROUND 
       [0003]    With the development of mobile communications and network technologies, people gradually develop a habit of accessing the Internet by using mobile terminals (such as mobile phones and tablet computers). Therefore, a lot of private data, including a unique identifier of a mobile phone device and some key service data, needs to be saved on a mobile terminal. Such data needs to be securely stored on the mobile terminal, and therefore, a secure data encryption method is needed to ensure that the private data will not be stolen or tampered with. 
         [0004]    In the conventional techniques, data on a mobile terminal is protected by means of hardware protection or public and private key protection. The hardware protection is generally a method of using an encryption card or a mobile phone shield as a carrier for protecting private data on the mobile terminal, to store the private data in plain text. For example, key seeds are integrated in a central processor by using a certificate shield of a bank, to encrypt and decrypt data. To protect data on the mobile terminal by using public and private keys, the data needs to be encrypted by using keys exchanged on a network. 
         [0005]    The method of protecting data on a mobile terminal by using hardware protection is expensive, and is not suitable for promotion and popularization among the public. When data on a mobile terminal is protected by using public and private keys, data needs to be decrypted on a server, which can be implemented only in the case of a network connection, and cannot be used in an offline state. 
       SUMMARY 
       [0006]    This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify all key features or essential features of the claimed subject matter, nor is it intended to be used alone as an aid in determining the scope of the claimed subject matter. The term “technique(s) or technical solution(s)” for instance, may refer to apparatus(s), system(s), method(s) and/or computer-readable instructions as permitted by the context above and throughout the present disclosure. 
         [0007]    An objective of the present disclosure is to provide a method and an apparatus for encrypting/decrypting data on a mobile terminal, which can protect the data in an offline state without hardware protection, so that the data will not be stolen or tampered with. 
         [0008]    According to an aspect, the present disclosure provides a method for encrypting/decrypting data on a mobile terminal, including generating a service key, and encrypting/decrypting the service key, which includes: 
         [0009]    generating a key pair including a first public key and a first private key in advance; 
         [0010]    acquiring identification information of the mobile terminal; 
         [0011]    encrypting the key pair including the first public key and the first private key by using the identification information, to obtain a first encrypted public key and a first encrypted private key and save them; 
         [0012]    acquiring the identification information of the mobile terminal during encryption of the service key; 
         [0013]    decrypting the first encrypted private key by using the identification information, to obtain the first private key; 
         [0014]    encrypting the service key by using the first private key, to obtain an encrypted service key; 
         [0015]    acquiring the identification information of the mobile terminal during decryption of the service key; 
         [0016]    decrypting the first encrypted public key by using the identification information, to obtain the first public key; 
         [0017]    decrypting the encrypted service key by using the first public key, to obtain the service key; 
         [0018]    acquiring data that needs to be encrypted/decrypted on the mobile terminal; and 
         [0019]    encrypting/decrypting the data by using the service key. 
         [0020]    According to an aspect, the present disclosure provides an apparatus for encrypting/decrypting data on a mobile terminal, including: 
         [0021]    a first generation unit configured to generate a service key; 
         [0022]    a second generation unit configured to generate a key pair including a first public key and a first private key in advance; 
         [0023]    a first acquisition unit configured to acquire identification information of the mobile terminal; 
         [0024]    a first encryption unit configured to encrypt the key pair including the first public key and the first private key by using the identification information, to obtain a first encrypted public key and a first encrypted private key and save them; 
         [0025]    a first decryption unit configured to decrypt the first encrypted private key by using the identification information, to obtain the first private key; 
         [0026]    a second encryption unit configured to encrypt the service key by using the first private key, to obtain an encrypted service key; 
         [0027]    a second decryption unit configured to decrypt the first encrypted public key by using the identification information, to obtain the first public key; 
         [0028]    a third decryption unit configured to decrypt the encrypted service key by using the first public key, to obtain the service key; 
         [0029]    a second acquisition unit configured to acquire data that needs to be encrypted/decrypted on the mobile terminal; 
         [0030]    a third encryption unit configured to encrypt the data by using the service key; and 
         [0031]    a fourth decryption unit configured to decrypt the data by using the service key. 
         [0032]    For example, the first decryption unit is further configured to: 
         [0033]    generate a character string according to the identification information; and 
         [0034]    decrypt the first encrypted private key by using the character string. 
         [0035]    For example, the second decryption unit is configured to: 
         [0036]    generate a character string according to the identification information; and 
         [0037]    decrypt the first encrypted public key by using the character string. 
         [0038]    For example, the generating the character string according to the identification information includes performing a hash algorithm processing on the identification information, to obtain the character string. 
         [0039]    For example, the identification information comprises one or more of the following types: 
         [0040]    an international mobile equipment identity; 
         [0041]    an international mobile subscriber identification number, 
         [0042]    a media access control address; and 
         [0043]    a universally unique identifier of the mobile terminal. 
         [0044]    The present disclosure also provides a method comprising: 
         [0045]    generating a key pair including a first public key and a first private key in advance; 
         [0046]    acquiring identification information of a mobile terminal; and 
         [0047]    encrypting the key pair including the first public key and the first private key by using the identification information to obtain a first encrypted public key and a first encrypted private key. 
         [0048]    For example, the encrypting the key pair including the first public key and the first private key by using the identification information to obtain the first encrypted public key and the first encrypted private key includes: 
         [0049]    generating a character string according to the identification information; and 
         [0050]    encrypting the key pair including the first public key and the first private key by using the character string to obtain the first encrypted public key and the first encrypted private key. 
         [0051]    For example, the method further comprises saving the first encrypted public key and the first encrypted private key. 
         [0052]    For example, the method further comprises: 
         [0053]    generating a service key; 
         [0054]    using the service key to encrypt data to obtain encrypted data 
         [0055]    For example, the method further comprises decrypting the first encrypted private key by using the identification information to obtain the first private key. 
         [0056]    For example, the decrypting the first encrypted private key by using the identification information to obtain the first private key includes: 
         [0057]    generating a character string according to the identification information; and 
         [0058]    decrypting the first encrypted private key by using the character string. 
         [0059]    For example, the method further comprises encrypting the service key by using the first private key, to obtain an encrypted service key. 
         [0060]    For example, the method further comprises decrypting the first encrypted public key by using the identification information to obtain the first public key. 
         [0061]    For example, the decrypting the first encrypted public key by using the identification information includes: 
         [0062]    generating a character string according to the identification information; and 
         [0063]    decrypting the first encrypted public key by using the character string. 
         [0064]    For example, the method further comprises decrypting an encrypted service key by using the first public key to obtain a service key. 
         [0065]    For example, the method further comprises using the service key to decrypt encrypted data to obtain data. 
         [0066]    For example, the generating the character string according to the identification information includes performing a hash algorithm processing on the identification information to obtain the character string. 
         [0067]    For example, the identification information includes one or more of following types: 
         [0068]    an international mobile equipment identity; 
         [0069]    an international mobile subscriber identification number, 
         [0070]    a media access control address; and 
         [0071]    a universally unique identifier of the mobile terminal. 
         [0072]    The present disclosure also provides an apparatus comprising: 
         [0073]    one or more processors; and 
         [0074]    one or more memories stored thereon computer-readable instructions that, when executed by the one or more processors, cause the one or more processors to perform acts comprising:
       generating a service key; and   encrypting the service key, the encrypting the service key including:
           generating a key pair including a first public key and a first private key in advance;   acquiring identification information of a mobile terminal;   encrypting the key pair including the first public key and the first private key by using the identification information to obtain a first encrypted public key and a first encrypted private key;   acquiring the identification information of the mobile terminal during encryption of the service key;   decrypting the first encrypted private key by using the identification information to obtain the first private key; and   encrypting the service key by using the first private key, to obtain an encrypted service key.   
               
 
         [0083]    For example, the acts further comprise: 
         [0084]    acquiring data that needs to be encrypted on the mobile terminal; and 
         [0085]    encrypting the data by using the service key. 
         [0086]    For example, the acts further comprising decrypting the service key, the decrypting the service key including: 
         [0087]    decrypting the first encrypted public key by using the identification information to obtain the first public key; and 
         [0088]    decrypting the encrypted service key by using the first public key to obtain the service key. 
         [0089]    For example, the acts further comprise decrypting the encrypted data by using the service key. 
         [0090]    For example, the encrypting the key pair including the first public key and the first private key by using the identification information to obtain the first encrypted public key and the first encrypted private key includes: 
         [0091]    generating a character string according to the identification information; and 
         [0092]    encrypting the first public key and the first private key separately by using the character string. 
         [0093]    The present disclosure also provides one or more memories stored thereon computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform acts comprising: 
         [0094]    generating a service key; and 
         [0095]    generating a key pair including a first public key and a first private key in advance; 
         [0096]    acquiring identification information of the mobile terminal; 
         [0097]    encrypting the key pair including the first public key and the first private key by using the identification information to obtain a first encrypted public key and a first encrypted private key and save them; 
         [0098]    decrypting the first encrypted private key by using the identification information, to obtain the first private key; 
         [0099]    encrypting the service key by using the first private key, to obtain an encrypted service key; 
         [0100]    acquiring data that needs to be encrypted on the mobile terminal; and 
         [0101]    encrypting the data by using the service key 
         [0102]    For example, the acts further comprise: 
         [0103]    decrypting the first encrypted public key by using the identification information, to obtain the first public key; 
         [0104]    decrypting the encrypted service key by using the first public key, to obtain the service key; and 
         [0105]    decrypting the encrypted data by using the service key. 
         [0106]    The method and apparatus for encrypting/decrypting data on a mobile terminal provided in the example embodiments of the present disclosure implements protection for private data on a mobile terminal by using processes of initialization, encryption, and decryption. Moreover, there is no need for hardware protection, data protection costs are low, and the data can be protected in an offline state, so that the data will not be stolen or tampered with. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0107]      FIG. 1  is a flowchart of a method for encrypting/decrypting data on a mobile terminal according to an example embodiment of the present disclosure; and 
           [0108]      FIG. 2  is a schematic diagram of an apparatus for encrypting/decrypting data on a mobile terminal according to an example embodiment of the present disclosure. 
       
    
    
     DETAILED DESCRIPTION 
       [0109]    To make the objectives, technical solutions, and advantages of the example embodiments of the present disclosure clearer, the technical solutions in the example embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the present disclosure. Apparently, the described example embodiments are merely some but not all of the example embodiments of the present disclosure. All other example embodiments obtained by those of ordinary skill in the art based on the example embodiments in the present disclosure without creative efforts fall in the protection scope of the present disclosure. 
         [0110]    To facilitate comprehension of the example embodiments of the present disclosure, the following provides further detailed descriptions with reference to the accompanying drawings and specific example embodiments, and the example embodiments do not constitute a limit to the example embodiments of the present disclosure. 
         [0111]    A method and an apparatus for encrypting/decrypting data on a mobile terminal provided in the example embodiments of the present disclosure are applicable to mobile terminals, such as a mobile phone and a tablet computer. 
         [0112]      FIG. 1  is a flowchart of a method for encrypting/decrypting data on a mobile terminal according to anxample embodiment of the present disclosure. Steps of the method are performed by a mobile terminal. As shown in  FIG. 1 , the method specifically includes: 
         [0113]    S 102 : generating a key pair including a first public key and a first private key. 
         [0114]    For example, the mobile terminal generates a key pair including a first public key and a first private key; a generation method belongs to the conventional techniques, and is not described in detail herein. The first public key and the first private key are generated simultaneously. Information encrypted with the first public key can only be decrypted with the first private key, and information encrypted with the first private key can only be decrypted with the first public key. 
         [0115]    S 104 : acquiring identification information of the mobile terminal. 
         [0116]    For example, the identification information of the mobile terminal is acquired by using a code. 
         [0117]    The identification information includes one or more of the following types: 
         [0118]    an International Mobile Equipment Identity (IMEI), an International Mobile Subscriber Identification Number (IMSI), a Media Access Control (MAC) address, and a Universally Unique Identifier (UUID) of the mobile terminal. 
         [0119]    S 106 : generating a character string by using the identification information. 
         [0120]    For example, hash algorithm processing is performed on the identification information, to obtain the character string. 
         [0121]    A hash algorithm maps a binary value of any length into a shorter binary value with a fixed length, and this shorter binary value is referred to as a hash value. The hash value is a unique and extremely compact numeral expression form of a data segment. In hashing of a plain text, if only one letter of the paragraph is changed, a different hash value will be generated subsequently. It is impossible in calculation to find two different inputs that are hashed to a same value. Therefore, a hash value of data may be used to check the integrity of the data, and is generally used in quick search and encryption algorithms. 
         [0122]    S 108 : encrypting the first public key and the first private key by using the character string, to obtain a first encrypted public key and a first encrypted private key. 
         [0123]    For example, the first public key and the first private key are encrypted by using the character string and a symmetric encryption algorithm, to obtain the first encrypted public key and the first encrypted private key. 
         [0124]    The encryption algorithm may be: an Advanced Encryption Standard (AES), a Data Encryption Standard (DES), a triple data encryption algorithm, and the like. 
         [0125]    It should be noted that, the character string is a root key, and after being generated, is used for encrypting the first public key and the first private key. The root key is not saved, and is generated by using the identification information of the mobile terminal when needed. 
         [0126]    The above is an initialization process. Each mobile terminal needs to be initialized once. Initialization is a prerequisite for encryption and decryption. The purpose of the initialization process is to obtain the first encrypted public key and the first encrypted private key. 
         [0127]    S 110 : generating a service key. 
         [0128]    For example, the service key is a service key randomly generated by the mobile terminal, and each service uses one service key. A method for generating the service key is the same as that for generating the key pair including the first public key and the first private key, and is not described in detail herein. 
         [0129]    S 112 : encrypting data by using the service key, to obtain encrypted data. 
         [0130]    For example, to-be-encrypted data on the mobile terminal is acquired, and the data is encrypted by using the service key and a symmetric encryption algorithm, to obtain the encrypted data, thus ensuring the security of the data. The data includes private data, such as a biological feature of a user. 
         [0131]    S 114 : decrypting the first encrypted private key by using the character string, to obtain the first private key. 
         [0132]    Before step S 114 , the root key is not saved; therefore, steps S 104  and S 106  need to be performed again, to obtain the character string. 
         [0133]    The first encrypted private key is decrypted by using the character string and a symmetric decryption algorithm, to obtain the first private key. 
         [0134]    S 116 : encrypting the service key by using the first private key, to obtain an encrypted service key. 
         [0135]    For example, the service key is encrypted by using the first private key and an asymmetric algorithm, to obtain an encrypted service key. 
         [0136]    The asymmetric algorithm may be: a public-key encryption algorithm (RSA), a Digital Signature Algorithm (DSA), and the like. 
         [0137]    It should be noted that, steps S 110  to S 116  are an encryption process, which implements encryption of the private data, to prevent the private data from being stolen or tampered with. Moreover, the encrypted service key obtained in step S 116  can be used for decrypting encrypted private data when private data is used. 
         [0138]    S 118 : decrypting the first encrypted public key by using the character string, to obtain the first public key. 
         [0139]    Before step S 118 , the root key is not saved; therefore, steps S 104  and S 106  need to be performed again, to obtain the character string. 
         [0140]    The first encrypted public key is decrypted by using the character string and a symmetric decryption algorithm, to obtain the first public key. 
         [0141]    S 120 : decrypting the encrypted service key by using the first public key, to obtain the service key. 
         [0142]    For example, the encrypted service key is decrypted by using the first public key and an asymmetric decryption algorithm, to obtain the service key. 
         [0143]    S 122 : decrypting the encrypted data by using the service key, to obtain the data. 
         [0144]    For example, the encrypted private data is decrypted by using the service key and a symmetric decryption algorithm, to obtain the private data. 
         [0145]    It should be noted that, steps S 118  to S 122  are a process of decrypting the encrypted data. The character string is generated according to the identifier of the device, and during decryption, the character string may be generated at any time according to the mobile phone device for decryption. Therefore, the encrypted private data can be decrypted in an offline state without accessing a server. Meanwhile, the character string is generated according to a local device for decryption, even if data leakage occurs, the data cannot be decrypted by others using other devices. Therefore, user privacy can be effectively protected from leakage. 
         [0146]    The method for encrypting/decrypting data on a mobile terminal provided in the example embodiment of the present disclosure implements protection for private data on a mobile terminal by using processes of initialization, encryption, and decryption, wherein a root key is not saved; through information calculation by the mobile terminal, a public-private key pair ensures the security of a service key, and the service key protects the data. Hardware protection is not needed, data protection costs are low, and security of data can be ensured in an offline state, so that the data will not be stolen or tampered with. 
         [0147]    Corresponding to the foregoing method for encrypting/decrypting data on a mobile terminal, an nd example embodiment of the present disclosure provides an apparatus for encrypting/decrypting data on a mobile terminal.  FIG. 2  is a schematic diagram of an apparatus  200  for encrypting/decrypting data on a mobile terminal according to the example embodiment of the present disclosure. As shown in  FIG. 2 , the apparatus  200  includes one or more processor(s)  202  or data processing unit(s) and memory  204 . The apparatus  200  may further include one or more input/output interface(s)  206 , and network interface(s)  208 . 
         [0148]    The memory  204  may include computer readable media such as a volatile memory, a Random Access Memory (RAM), and/or a non-volatile memory, e.g., Read-Only Memory (ROM) or flash RAM, and so on. Computer readable media include permanent, non-permanent, mobile and non-mobile media, which can implement information storage through any method or technology. The information may be computer-readable instructions, data structures, program modules or other data. Examples of storage media of computers include, but are not limited to, a Phase-change RAM (PRAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), other types of Random Access Memories (RAMs), a Read-Only Memory (ROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a flash memory or other memory technologies, a Compact Disk Read-Only Memory (CD-ROM), a Digital Versatile Disc (DVD) or other optical memories, a cassette, a cassette and disk memory or other magnetic memory devices or any other non-transmission media, which can be used for storing information accessible to the computation device. According to the definitions herein, the computer readable media exclude transitory computer readable medium (transitory media), such as modulated data signals and carriers. 
         [0149]    The memory  204  may store therein a plurality of modules or units including a first generation unit  210 , a second generation unit  212 , a first acquisition unit  214 , a first encryption unit  216 , a first decryption unit  218 , a second encryption unit  220 , a second decryption unit  222 , a third decryption unit  224 , a second acquisition unit  226 , a third encryption unit  228 , and a fourth decryption unit  230 . 
         [0150]    The first generation unit  210  is configured to generate a service key. 
         [0151]    The second generation unit  212  is configured to generate a key pair including a first public key and a first private key in advance. 
         [0152]    The first acquisition unit  214  is configured to acquire identification information of the mobile terminal. 
         [0153]    The first encryption unit  216  is configured to encrypt the key pair including the first public key and the first private key by using the identification information, to obtain a first encrypted public key and a first encrypted private key and save them. 
         [0154]    The first decryption unit  218  is configured to decrypt the first encrypted private key by using the identification information, to obtain the first private key. 
         [0155]    The second encryption unit  220  is configured to encrypt the service key by using the first private key, to obtain an encrypted service key. 
         [0156]    The second decryption unit  222  is configured to decrypt the first encrypted public key by using the identification information, to obtain the first public key. 
         [0157]    The third decryption unit  224  is configured to decrypt the encrypted service key by using the first public key, to obtain the service key. 
         [0158]    The second acquisition unit  226  is configured to acquire data that needs to be encrypted/decrypted on the mobile terminal. 
         [0159]    The third encryption unit  228  is configured to encrypt the data by using the service key. 
         [0160]    The fourth decryption unit  230  is configured to decrypt the data by using the service key. 
         [0161]    Optionally, the first encryption unit  216  is specifically configured to: 
         [0162]    generate a character string according to the identification information; and 
         [0163]    encrypt the first public key and the first private key separately by using the character string. 
         [0164]    Optionally, the first decryption unit  218  is specifically configured to: 
         [0165]    generate a character string according to the identification information; and 
         [0166]    decrypt the first encrypted private key by using the character string. 
         [0167]    Optionally, the second decryption unit  222  is specifically configured to: 
         [0168]    generate a character string according to the identification information; and 
         [0169]    decrypt the first encrypted public key by using the character string. 
         [0170]    Optionally, the generating a character string according to the identification information includes: 
         [0171]    performing hash algorithm processing on the identification information, to obtain the character string. 
         [0172]    Optionally, the identification information includes one or more of the following types: 
         [0173]    an International Mobile Equipment Identity (IMEI), an International Mobile Subscriber Identification Number (IMSI), a Media Access Control (MAC) address, and a Universally Unique Identifier (UUID) of the mobile terminal. 
         [0174]    The method provided in the first example embodiment of the present disclosure is implanted in the apparatus provided in the example embodiment of the present disclosure. Therefore, a specific working process of the apparatus provided in the present disclosure is not described in detail herein again. 
         [0175]    The apparatus for encrypting/decrypting data on a mobile terminal provided in the example embodiment of the present disclosure implements protection for private data on a mobile terminal by using processes of initialization, encryption, and decryption, wherein a root key is not saved; through information calculation by the mobile terminal, a public-private key pair ensures the security of a service key, and the service key protects the data. Hardware protection is not needed, data protection costs are low, and security of data can be ensured in an offline state, so that the data will not be stolen or tampered with. 
         [0176]    Those of ordinary skill in the art should also be aware that objects and algorithm steps in examples described with reference to the example embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination thereof. To clearly illustrate the interchangeability between hardware and software, the composition and steps of each example have been described in general according to functions in the foregoing description. Whether these functions are executed by using hardware or software depends on a specific application and design constraint conditions of the technical solution. For each specific application, professionals may use a different method to implement the described functions. However, such implementation should not be considered as exceeding the scope of the present disclosure. 
         [0177]    Steps of the method or algorithm described with reference to the example embodiments disclosed herein may be implemented by hardware, a software module executed by a processor, or a combination thereof. The software module may be disposed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard drive, a removable disk, a CD-ROM, or any other form of storage medium commonly known in the technical field. 
         [0178]    The foregoing specific implementations provide further detailed description of the objectives, technical solutions, and beneficial effects of the present disclosure. It should be understood that, described above are merely specific implementations of the present disclosure, which are not intended to limit the protection scope of the present disclosure. Any modification, equivalent replacement, improvement, and the like made within the spirit and principle of the present disclosure shall all be included in the protection scope of the present disclosure.