Easy to use

Using the Secure Logger APIs in your software program

The Secure Logger API functions included in the libLogger.a library are:

  1. The LoggerStartUp() initializes the logger internal storage area structure and starts the logger.
  2. The LoggerLogMsg() stores a software program log message to the logger internal encoded storage area structure.
  3. The LoggerSaveStorageAreaToFile() saves the current internal storage area structure to an encrypted disk file.
  4. The LoggerShutDown() stops the logger and save any log messages in the internal storage area structure to an encrypted disk file.

The following sample C program my_sample.c shows how to use the above Secure Logger APIs. Note that the third argument to LoggerLogMsg() on line 10 is an integer value of “2”. This integer value is a replacement for the actual message text string. With this approach the string text in not included in the executable, and therefore cannot be reverse engineered and extracted from the application executable file. Note: There are no header files needed. Just compile the my_sample.c with the library.

1. #include <stdio.h>
2. enum components { UI=1, LG=2, DB=3 };
3. enum severity { FATAL=1, INFO=2 };
4. main()
5. {
6.    LoggerStartUp(1);
7.       …other application code…
8.    LoggerLogMsg(DB,FATAL,1, 102, 103, 104, 105, 106);
9.       …other application code…
10.    LoggerLogMsg(LG,INFO,2, “Four”);
11.       …other application code…
12.    LoggerShutDown();
13. }

The following commands show how to compile the Secure Logger library (libLogger.a) with the software program (i.e., my_sample.c) and execute the my_sample compiled program to produce an encoded/encrypted audit/log file 03032020_16:55:49_001.efl:

$ gcc my_sample.c -o my_sample -L. -lLogger -L. -lssl -lcrypto
$ my_sample
$ ls

Using the Secure Browser to view audit/log messages:

To view the encoded/encrypted audit/log message, use the Secure Browser (i.e., browser) to decode/unencrypt the 03032020_16:55:49_001.efl file to produce an unencoded/decrypted plain text file 03032020_16:55:49_001.log.

$ browse -i 03032020_16:55:49_001.efl
$ ls
$ cat 03032020_16:55:49_001.log
02/21/2020 11:09:16 [22237] [DB] [INFO] This message contains five integers=[102, 103, 104, 105, 106]
02/21/2020 11:09:16 [22237] [LG] [INFO] This message contains one string=[Four]

Copyright 2013-2021 ISTECH.COM. All rights reserved. Patent Pending.