# 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.

The sample program passes license information to Panopticon by using `init()`. Before you can compile, you must replace the parameters `YOUR_LICENSE_ORGANIZATION` and `YOUR_LICENSE_KEY` in the `init()` function call with your license information.

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 the environment variables KV_SAMPLE_PROGRAM_LICENSE_ORGANIZATION and KV_SAMPLE_PROGRAM_LICENSE_KEY are set, their values are used instead of the trial license. This allows you to continue to use the program after the embedded trial license has expired, and also to test or troubleshoot with your actual 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.

_FT_HTML5_bannerTitle.htm