OnixS SGX Derivatives Handler for C++
Getting Started

All Handler classes are located under the OnixS::Sgx namespace. Header files are assembled in the OnixS/Sgx.h header file.

The typical way of using the Handler is as follows:

Error Reporting

Exception handling is used as a fundamental error-reporting mechanism.

In the event of any errors during the method execution the exception derived from Exception is thrown.

Errors that are detected in broadcast listener thread are reported via ErrorListener event listener.


The logging activation is specified in Settings class that is served as a parameter of Handler constructor.

The log file name format is path/name.ext, path could be absolute or relative to to the current directory. Each time Handler object is created new log file will be introduced. Old log files format is path/name.ext.[1-5], i.e. log files are rotated, and the deep of history is five.

How to disable dump file creation?

To disable dump file creation please remove OnixS::Sgx::LogSwitches::DumpProtocolText and/or OnixS::Sgx::LogSwitches::DumpProtocolBin flag(s) from OnixS::Sgx::Settings::logSwitches.

For example:

1 namespace osgx = OnixS::Sgx;
2 osgx::Settings settings;
3 ...
4 settings.logSwitches = osgx::LogSwitches::TraceToFile;


Specifing License File

Handler needs a license for successfull execution. If the Handler is not able to find a valid license it will throw an exception at the initialization stage.

OnixS::Sgx::Settings structure exposes OnixS::Sgx::Settings::licenseDir parameter which allows to instruct the Handler where to look for a license. By default, the Handler looks for a license in the current directory for the application which uses the Handler. Handler also assumes that license file has "lic" extension.


Following example demostrates how supply license to the Handler:

1 using namespace OnixS::Sgx;
3 // Connectivity is the only parameter with no default value.
4 Settings settings;
6 // By default, license is stored in license folder of the distribute
7 // package. Instead of copying license, let's use original file.
8 settings.licenseDir = "../license";
10 // Constructs handler with custom license path.
11 Handler handler(settings);

Genium INET Password

This section describes how to deal with password expiration and set new password.

Password Requirements

The new password must comply with the following requirements:

The exchange may configure further restrictions on a password:

The restrictions above are only checked when the password is changed.

The password is currently not case sensitive. The OMex system converts the passwords to upper case before handling them. However in future releases, the password will be case sensitive.

The API Client Application should be programmed in a manner that may handle case sensitive passwords.

Expired Password

If the password has expired when logging in, the session will get restricted access to the Genium INET system until the password has been successfully changed.

In this scenario the OnixS::Sgx::Handler will notify client using OnixS::Sgx::ErrorListener::onError event callback OnixS::Sgx::ErrorCode::PasswordExpiredError.

If the password is close to expiration the OnixS::Sgx::Handler will call OnixS::Sgx::ErrorListener::onError with OnixS::Sgx::ErrorCode::PasswordWillExpireSoon.

changePassword Change Password

To change the password OnixS::Sgx::Handler::changePassword should be used.

For example:

1 void onError(const OnixS::Sgx::ErrorContext& errorContext)
2 {
3  if (errorContext.errorCode == OnixS::Sgx::ErrorCode::PasswordExpiredError)
4  {
5  std::string login = getLoginId();
6  std::string oldPassword = getOldPassword();
7  std::string newPassword = getNewPassword();
8  try
9  {
10  handler.changePassword(login, oldPassword, newPassword);
11  }
12  catch(const std::exception& ex)
13  {
14  std::cerr << ex.what() << std::endl;
15  }
16  }
17 }