Programming practitioners, skilled in the art, will appreciate that a C programming language compiler traditionally provides a header file named “stdio.h”. This header file describes several C programming functions and values an application program respectively invokes or needs but does not otherwise respectively implement or define in its source code. The execution logic for these invoked functions resides elsewhere, usually in a shared system library.
Example stdio.h referenced functions include, but not are necessarily limited to the following:
File Access
Direct Input/Output
Unformatted Input/Output
Formatted Input/Output
File Positioning
Error Handling
Operations on Files
Among other services, these functions, and others like them, provide application programs with on-demand capability to read, write, and update data stored in existing data files, as well as on-demand ability to create new files.
Traditionally, the actual executable logic for these library functions does not exist within a compiled application program module the operating system loads into memory for execution. Rather, the actual executable logic for these library functions traditionally resides in a “standard C library” commonly referred to as “libc”. This library is a library of standard C library functions that the operating system's application loader dynamically loads, and links the application module to, when the operating system loads an application program module that requires them for execution.
As an example, an operating system can be an operating system such as a Linux variant operating system, though other operating systems have similar provisions that provide applications dynamically-linked library support.
Aspects of the disclosure may operate on particularly created hardware, firmware, digital signal processors, or on a specially programmed computer including a processor operating according to programmed instructions. The terms controller or processor as used herein are intended to include microprocessors, microcomputers, Application Specific Integrated Circuits (ASICs), and dedicated hardware controllers.
One or more aspects of the disclosure may be embodied in computer-usable data and computer-executable instructions, such as in one or more program modules, executed by one or more computers (including monitoring modules), or other devices. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types when executed by a processor in a computer or other device.
The computer executable instructions may be stored on a computer readable storage medium such as a hard disk, optical disk, removable storage media, solid state memory, Random Access Memory (RAM), etc. As will be appreciated by one of skill in the art, the functionality of the program modules may be combined or distributed as desired in various aspects. In addition, the functionality may be embodied in whole or in part in firmware or hardware equivalents such as integrated circuits, FPGA, and the like.
Particular data structures may be used to more effectively implement one or more aspects of the disclosure, and such data structures are contemplated within the scope of computer executable instructions and computer-usable data described herein.
The disclosed aspects may be implemented, in some cases, in hardware, firmware, software, or any combination thereof. The disclosed aspects may also be implemented as instructions carried by or stored on one or more or computer-readable storage media, which may be read and executed by one or more processors. Such instructions may be referred to as a computer program product. Computer-readable media, as discussed herein, means any media that may be accessed by a computing device. By way of example, and not limitation, computer-readable media may comprise computer storage media and communication media.
For discussion simplicity, the following invention description only discusses a Linux C programming GNU C compiler environment as an embodiment example. One having skill in the art will readily recognize that this is not intended to limit the invention's scope or applicability.
Programmers skilled in the art will appreciate that the example illustrated by
Demo.c opens a file named “ReadFileName” for input, opens a file named “WriteFileName” for output, reads 100 bytes from the input file, processes it in some undescribed manner, writes 256 bytes of output data to the output file, closes both files, and exits.
Compiling Demo.c using the terminal command line command “gcc Demo.c-o Demo” provides an executable module named “Demo” which, when executed, and when a file named “ReadFileName” exists, produces an output file named “WriteFileName”.
Executing the Demo program is possible by entering “./Demo” at a terminal command line when the compiled application file resides in the the same Linux current working directory.
Suppose it subsequently becomes necessary to ensure that all the application data that the Demo application module reads and writes is always encrypted when it resides on a storage device or is in transit to or from such a storage device.
Unfortunately, and for many reasons, it is not always easy or even possible to retrofit encryption and decryption programming logic into an existing program's source code. For example, perhaps the Demo.c source code has been lost or is otherwise unavailable due to a network server outage or source code licensing restriction.
This disclosure generally provides a mechanism to provide encryption and decryption support in many such instances.
A first step is to select a suitable encryption/decryption technology from the many that are available. Suppose the widely-used, internationally-standardized, AES-256 method is selected as an example embodiment implementation. In this example, the next step is to select a symmetric encryption/decryption key for the encryption process.
Practitioners, skilled in the art, will appreciate that AES-256 is a symmetric block cipher that operates on 16-byte blocks. Several other encryption methods use block encryption concepts similar to AES-256. Practitioners, skilled in the art, will also appreciate that many file encryption operations encrypt an entire file in one continuous encryption operation, using a selected key and associated key scheduling algorithm particular to the selected encryption means.
In contrast, this disclosure teaches that there can be significant benefit in encrypting the data file as a multiplicity of independent segments that are each a multiple of a block encryption's block size. Such an approach minimizes ciphertext expansion due to encryption padding and accelerates decryption operations. An additional performance improvement is possible by having the segments be a uniform size, except perhaps for the last segment. This convenience also reduces the amount of encryption information that must be stored and available for subsequent decryption operations.
The segmentation strategy, encryption method for each segment, value of the encrypting key for each segment, and the key scheduling information for each segment comprise a multiplicity of shared secrets that must be obfuscated or otherwise sequestered from unauthorized access. It must also be available for decryption operations. Suppose it is stored in a file named “DemoEnc.txt” as an embodiment example.
Next, the application data is encrypted on a segment-by-segment basis using the multiplicity of selected encryption methods and associated information. Since each segment is independently encrypted, each segment number optionally can be algorithmically combined with the designated encryption key, perhaps by concatenation means or hashing. This can optionally produce a unique encryption key for each segment with each segment optionally encrypted using a different encryption method means.
One having ordinary skill in the art will recognize that an application module can contemporaneously access multiple files and that this invention allows each file to be encrypted completely differently.
Next, it is necessary to create a programming shared object “shim” Interposer module for the Demo executable module. With appropriate planning, this interposer module can be shared with other applications accessing data that is encrypted in the same manner as the Demo application. The shared object shim Interposer module will intercept Demo application module calls to “fopen”, “fread”, “fwrite”, “fclose”, and any other functions required to support Input/Output encryption and decryption activities. It will reflect the calls to traditional libc function modules for actual Input/Output operations, capture file access state change, encrypt/decrypt application data, and pass the results to the calling application module transparently.
Suppose the shared object shim Interposer module source code is named “DemoShim.c”. Attentive readers will note that the function names “fopen”, “fread”, “fwrite”, and “fclose” are highlighted in
For discussion simplicity, the following discussion only discusses those functions. It is to be understood that several other file Input/Output functions, such as the fscanf( ) function, may require similar considerations but are intentionally omitted from this description for discussion simplicity.
In
Saving the generated file pointer with associated encryption information is necessary since each accessed file may have different encryption methods or encryption parameters. Subsequent read and write requests will reference the file pointer, allowing the Interposer module to identify its encryption method and parameters.
Following this command, the Demo.out application module now operates with the DemoShim.so shared object shim Interposer Module as depicted in
Practitioners, skilled in the art, will appreciate that there are many environments that support analogous Interposer Module strategies that this discussion does not mention. For example, an interposer module can access an augmented DemoEnc.txt file which contains CRC values an application can reference to perform a data integrity verification for each segment. Such environments may use different terminology and implementation details.
It to be understood, the forgoing discussion limits discussion for explanation simplicity and the scope of this disclosure includes such environments.
It will be appreciated that variants of the above-disclosed and other features and functions, or alternatives thereof, may be combined into many other different systems or applications.
Various presently unforeseen or unanticipated alternatives, modifications, variations, or improvements therein may be subsequently made by those skilled in the art which are also intended to be encompassed by the following claims.
The present application claims priority to U.S. Provisional Application No. 63/368,446, entitled “DYNAMICALLY ENCRYPTING AND DECRYPTING APPLICATION DATA USING DYNAMICALLY LINKED INTERPOSER MODULES”, and filed on Jul. 14, 2022. The entire contents of the above-listed application are hereby incorporated by reference for all purposes.
Number | Date | Country | |
---|---|---|---|
63368446 | Jul 2022 | US |