Abstract:
A non-transitory computer-readable recording medium includes a shared library that is executed by a processor. The shared library includes a preprocessing function and a function. The function causes the processor to execute a process if a value, as an execution result of the preprocessing function, is valid, and not to execute the process if the value is invalid. The preprocessing function causes the processor to acquire encrypted unique information from the storage device, to decrypt the unique information, to acquire, from the storage device, specific information that specifies an application using the shared library, and to return the value that is valid or invalid based on a comparison between the specific information and the decrypted unique information.

Description:
INCORPORATION BY REFERENCE 
       [0001]    This application is based upon, and claims the benefit of priority from, corresponding Japanese Patent Application No. 2013-039366, filed in the Japan Patent Office on Feb. 28, 2013, the entire contents of which are incorporated herein by reference. 
       FIELD 
       [0002]    Unless otherwise indicated herein, the description in this field section or the background section is not prior art to the claims in this application and is not admitted to be prior art by inclusion in this section. The present disclosure relates to a non-transitory computer-readable recording medium and an information processing apparatus including a shared library that prevents unauthorized use of it. 
       BACKGROUND 
       [0003]    In a typical configuration wherein functions commonly used among a plurality of applications are provided as a shared library that is dynamically linked to the applications during application execution, if a function in the shared library is corrected, for example, each application that uses the function is also modified. This improves the maintainability of the applications. For example, in Windows (registered trademark), a dynamic link library with an extension of “dll” is a shared library. 
         [0004]    If functions used in common by the plurality of applications are provided as a shared library, however, applications from, for example, a competing company can also use the functions. Accordingly, it is necessary to prevent unauthorized use of the shared library. 
         [0005]    In the typical system to prevent unauthorized use of a shared library, if there is no specific software development tool at a stage at which an executable program file in which an object in a library is embedded is developed, control is performed so that protect codes that are appropriately associated cannot be embedded in the library and executable program file. Furthermore, in the above system, upon execution of the object, a protect code check function is executed and, if the protect code in the library and the protect code in the executable program file are not appropriately associated, control is performed so that execution of the program is terminated. 
         [0006]    In a typical information processing apparatus, an object in a library is retrieved for each application to generate an executable program file. Therefore, the library in the typical information processing apparatus is not an ordinary shared library; when an object in the library is corrected, the corrected object needs to be embedded in each application. Another problem with the typical information processing apparatus is that the configuration to protect the shared library is complex. 
       SUMMARY 
       [0007]    The present disclosure relates to a non-transitory computer-readable recording medium and an information processing apparatus having a shared library that prevents unauthorized use of it using a simple configuration. 
         [0008]    According to an embodiment of the present disclosure, a non-transitory computer-readable recording medium includes a shared library that is executed by a processor. The shared library includes a preprocessing function and a function. The function causes the processor to execute the process if a value, as an execution result of the preprocessing function, is valid, and not to execute the process if the value is invalid. The preprocessing function causes the processor to acquire encrypted unique information from the storage device, to decrypt the unique information, to acquire, from the storage device, specific information that specifies an application using the shared library, and to return the value that is valid or invalid based on a comparison between the specific information and the decrypted unique information. 
         [0009]    According to an embodiment of the present disclosure, an information processing apparatus includes a processor, a storage device, and a shared library that is stored in the storage device and executed by the processor. The shared library includes a preprocessing function and a function. The function causes the processor to execute the process if a value, as an execution result of the preprocessing function, is valid, and not to execute the process if the value is invalid. The preprocessing function causes the processor to acquire encrypted unique information from the storage device, to decrypt the unique information, to acquire, from the storage device, specific information that specifies an application using the shared library, and to return the value that is valid or invalid based on a comparison between the specific information and the decrypted unique information. 
         [0010]    Additional features and advantages are described herein, and will be apparent from the following Detailed Description and the figures. 
     
    
     
       BRIEF DESCRIPTION OF THE FIGURES 
         [0011]    All drawings are intended to illustrate aspects and examples of the present disclosure. The drawings described are only schematic and are non-limiting, and are not necessarily drawn to scale. 
           [0012]      FIG. 1  is a schematic diagram illustrating generation of a license file for a shared library in an embodiment of the present disclosure; 
           [0013]      FIG. 2  is a block diagram illustrating the hardware configuration of the information processing apparatus in  FIG. 1 ; 
           [0014]      FIG. 3  is a flowchart illustrating a method of encrypting the unique information in  FIG. 1 ; 
           [0015]      FIG. 4  is a schematic diagram illustrating an operation performed after the shard library has been dynamically linked to an application; 
           [0016]      FIG. 5  is a schematic diagram illustrating the configuration of the shared library in  FIG. 4 ; 
           [0017]      FIG. 6  is a flowchart illustrating the operation of each of the functions in  FIG. 5 ; 
           [0018]      FIG. 7  is a flowchart illustrating the operation of the preprocessing function in  FIG. 5 ; and 
           [0019]      FIG. 8  is a flowchart illustrating process performed by the main function in  FIG. 4 . 
       
    
    
     DETAILED DESCRIPTION 
       [0020]    Various embodiments are described below with reference to the figures. It should be understood, however, that numerous variations from the depicted arrangements and functions are possible while remaining within the scope and spirit of the claims. For instance, one or more elements may be added, removed, combined, distributed, substituted, re-positioned, re-ordered, and/or otherwise changed. Further, where this description refers to one or more functions being implemented on and/or by one or more devices, one or more machines, and/or one or more networks, it should be understood that one or more of such entities could carry out one or more of such functions by themselves or in cooperation, and may do so by application of any suitable combination of hardware, firmware, and/or software. For instance, one or more processors may execute one or more sets of programming instructions as at least part of carrying out one or more of the functions described herein. 
         [0021]      FIG. 1  is a schematic diagram illustrating generation of a license file for a shared library, in an embodiment of the present disclosure, that has the capability of preventing unauthorized use of the shared library. This license file is generated by a developer M on a personal computer (PC)  10 , which is used as an information processing apparatus. 
         [0022]      FIG. 2  is a block diagram illustrating the hardware configuration of the PC  10 . 
         [0023]    In the hardware configuration of the PC  10 , a central processing unit (CPU)  11  is connected to a programmable read-only memory (PROM)  13 , a dynamic random-access memory (DRAM)  14 , an auxiliary storage device  15 , a network interface  16 , an input device  17 , and a display device  18  via an interface  12 . In  FIG. 2 , a plurality of interfaces are represented as a single block  12 . 
         [0024]    The PROM  13  is, for example, a flash memory; it stores basic input/output system (BIOS). The DRAM  14  is used as a main storage unit in a virtual storage system. The auxiliary storage device  15  stores an operating system (OS), various types of drivers, an integrated software development environment, applications developed in this environment, source code of a library, and the like. The input device  17  includes, for example, a keyboard and a pointing device. 
         [0025]    Referring again to  FIG. 1 , functions used in common by a plurality of applications  20  to  24  are handled as a shared library  25 . When an application is executed, a capability of the OS dynamically links the shared library  25  to the application. 
         [0026]    In the configuration illustrated in  FIG. 1 , when one of the functions in the shared library  25  is corrected, the applications  20  to  24  that use the corrected function have the same effect as being corrected. This improves the maintainability of the applications. 
         [0027]    Since, however, the shared library  25  can also be used by other applications, it is necessary to prevent unauthorized use of the shared library  25 . 
         [0028]    Thus, the developer M operates the input device  17  of the PC  10  to obtain, as unique information  30 , a set of specific information items about the applications  20  to  24  that use the shared library  25 . The developer M also generates a license file  31  in which the unique information  30  has been encrypted. 
         [0029]      FIG. 3  is a flowchart illustrating a method of encrypting the unique information  30 . 
         [0030]    In step S 0 , the developer M operates the input device  17  to copy specific information items about the applications  20  to  24  from their source code to a text file via a copy-and-paste operation, and store a set of the specific information items as the unique information  30 . 
         [0031]    The specific information indicates that the application has a valid right to use the shared library  25 . The specific information includes application identification information that identifies the relevant application of the applications  20  to  24 . The application identification information includes at least one of a name of a class, the name of function included in the application, a specific code included in the application, the name of a package of the application, the name of a main program of the application, and the codes obtained after the application has been compiled to binary format. 
         [0032]    Even if applications have the same application name, when their versions differ, the contents of the shared library  25  that these applications use may differ. To allow for this situation, the specific information also includes application version identification information. The applications  20  to  24  are identified by the logical conjunction of the application version identification information and application identification information. 
         [0033]    In step S 1 , to generate the license file  31 , the developer M activates an encryption program, specifies the unique information  30  as a target to be encrypted, enters a password used as an encryption key, and performs encryption. In step S 2 , the developer M outputs the license file  31 . 
         [0034]      FIG. 4  is a schematic diagram illustrating an operation performed after the application  20  has been activated and the shared library  25  has been dynamically linked to the application  20  by the dynamic linking capability of the OS. 
         [0035]    The application  20  includes a main function  201  and a class  202 . The main function  201  directly uses the shared library  25  or uses it via a function in the class  202 . 
         [0036]      FIG. 5  is a schematic diagram illustrating the configuration of the shared library  25 . 
         [0037]    The shared library  25  includes functions (methods in the class)  250 , which are used in common by a plurality of applications, a preprocessing function  251  (preprocess), which enables the functions  250  to be used, and a variable  252  (Valid), which indicates a processing result of the preprocessing function  251 . 
         [0038]      FIG. 6  is a flowchart illustrating the operation of each of the functions  250 . 
         [0039]    If variable Valid is true in step S 10 , the sequence proceeds to step S 11 . If the variable Valid is not true, the sequence proceeds to step S 12 . 
         [0040]    In step S 11 , the original process by the function is executed, after which the sequence returns. Thus, the capability of the function is implemented. 
         [0041]    In step S 12 , an exception is entered. That is, an embedded throw function is executed to abnormally terminate the function. 
         [0042]    Therefore, to have the process in step S 11  executed, variable Valid, the initial value of which is false, needs to become true. The variable Valid can be made true by the preprocessing function  251  illustrated in  FIG. 5 . 
         [0043]      FIG. 7  is a flowchart illustrating the operation of the preprocessing function  251 . 
         [0044]    In step S 20 , files names in a specific directory such as, for example, a directory including the shared library  25  are sequentially read. While the file names are read, the license file  31  with a specific file name assigned by the developer M is searched for. 
         [0045]    If the license file  31  is found in step S 21 , the sequence proceeds to step S 22 . If the license file  31  is not found, the sequence returns. That is, if the license file  31  is not found, variable Valid remains to be false. 
         [0046]    In step S 22 , the contents of the license file  31 , that is, unique information, are decrypted to “U”. In this decryption, the password that has been entered in step S 1  (encryption of unique information) is used as a decryption key. Therefore, the password is directly embedded in the preprocessing function  251  or is transferred to the preprocessing function  251 . Alternatively, the place at which the password is stored is embedded in the preprocessing function  251  or is transferred to the preprocessing function  251 . 
         [0047]    In step S 23 , a caller of the shared library  25  searches for specific information “u”, which is an element of the unique information U, and acquires the specific information u. That is, the application  20  is regarded as binary data, and whether the binary data includes the specific information u is checked. If the specific information u is included, the binary data is retained. 
         [0048]    If the specific information u is determined to be an element of the unique information U in step S 24 , the sequence proceeds to step S 25 . If the specific information u is not determined to be an element of the unique information U, the sequence returns. Before this determination, the formats of the specific information u and unique information U are unified. If, for example, the unique information U is text and the specific information u is binary code corresponding to text, the unique information U is converted to binary code corresponding to text. Alternatively, the specific information u is converted to text corresponding to binary code. 
         [0049]    In step S 25 , true is assigned to variable Valid, and the sequence returns. 
         [0050]    Referring again to  FIG. 4 , the main function  201  first calls the preprocessing function  251  and determines the value of variable Valid. When the main function  201  calls a function in the shared library  25  after that, only if variable Valid is found to be true in the process illustrated in  FIG. 6 , the process by the function is executed. 
         [0051]      FIG. 8  is a flowchart illustrating the process performed by the main function  201 . 
         [0052]    In step S 30 , the preprocessing function  251  is called and the value of variable Valid is determined. 
         [0053]    In step S 31 , one of the functions  250  in the shared library  25  is called. If variable Valid is true, the main body of the called function is executed. If the variable Valid is not true, an exception is entered and the function is abnormally terminated. 
         [0054]    In step S 32  as well, the process is performed as in step S 31 . 
         [0055]    Thus, the license file  31  enables the shared library  25  to be used only by the applications  20  to  24  permitted by the developer M, preventing unauthorized use of the shared library  25 . 
         [0056]    While various aspects and embodiments have been disclosed herein, other aspects and embodiments are possible. Other designs may be used in which the above-described components are each present. 
         [0057]    A combination of a plurality of data items included in each application, for example, may be used as the specific information. 
         [0058]    Alternatively, a random number that the developer has embedded in the application, for example, may be used as the specific information. 
         [0059]    Alternatively, part of data extracted from image data included in the application, for example, may be used as the specific information. 
         [0060]    Alternatively, a set of specific information items in a plurality of applications, for example, may be used as the unique information. 
         [0061]    Alternatively, the specific information may include, for example, specific information about an application that is planned to be developed in the future. 
         [0062]    It should be understood that various changes and modifications to the embodiments described herein will be apparent to those skilled in the art. Such changes and modifications may be made without departing from the spirit and scope of the present subject matter and without diminishing its intended advantages. It is therefore intended that such changes and modifications be covered by the appended claims.