Panopticon Sample Program

Panopticon includes a sample program, written in C++, which demonstrates how to use Panopticon to decrypt RMS protected files. The sample program is called panopticon_test. It is intended to provide a starting point or reference for your own applications.

The source code and makefiles are provided in the samples/panopticon_test directory of your Panopticon installation directory.

Before you can compile the program, you must replace the parameter YOUR_KEYVIEW_LICENSE in the init() function call with your license key.

To compile the sample program, use the makefiles provided in the program directory. You must ensure that the Panopticon include directory is in the include path of the project.

After you compile and build the executable, you must place it in the same directory as the Panopticon library.

NOTE: A compiled executable is provided in the PLATFORM/bin directory. This sample has an embedded trial license, which expires approximately five months after release. If you set the environment variable KV_SAMPLE_PROGRAM_LICENSE_FROM_FILEPATH to a file path, the sample program reads your license from the specified file. This allows you to use the program after the embedded trial license has expired, and to test or troubleshoot with your own license.

The panopticon_test sample program gets the encryption information for a file. If decryption is supported, it then decrypts the file.

The sample program includes the following files: 

  • panopticon_test.cpp. Contains the command-line interface.
  • panopticon_interface.cpp. Contains a C++ class, which wraps the Panopticon C interface.
  • utils.cpp. Contains utility functions used by panopticon_interface.cpp.

To run panopticon_test

  1. Open a command prompt in the bin folder that contains the Panopticon library.

  2. Type the following command:

    panopticon_test [options] credentialsfile inputfile outputfile

    The following table describes these arguments.

    options Zero or more of the options listed in the table Options for the panopticon_test sample program.
    credentialsfile The full path and file name of a file that contains the RMS credentials to use. This file must contain just the tenant ID, client ID, and client secret, in that order, separated by new lines.
    inputfile The full path and file name of the file to decrypt.
    outputfile The full path and file name to use for the decrypted file.

The following table describes the optional command-line arguments for the panopticon_test sample program.

Options for the panopticon_test sample program
Option Description
-t tempdir A temporary directory where Panopticon stores the temporary files that it generates. By default, it uses the system default temporary directory.