when you want to change the TLS level in the SDK and In order to set up TLS encryption with devices for device SDK.

->By calling PreferMethodHandle with the relevant TLS type parameter, you can set up the TLS level setting while you are using Secure Communication between BioStar 2 Device SDK and Suprema device’s network connection.


Declaration


int BS2_SetSSLHandler(void* context, PreferMethod ptrPreferMethod, GetRootCaFilePath ptrGetRootCaFilePath, GetServerCaFilePath ptrGetServerCaFilePath, GetServerPrivateKeyFilePath ptrGetServerPrivateKeyFilePath, GetPassword ptrGetPassword, OnErrorOccured ptrOnErrorOccured);


How to set it up:


BS2_SetSSLHandler
https://kb.supremainc.com/bs2sdk/doku.php?id=en:bs2_setsslhandler

  • [In] context : Context
  • [In] ptrPreferMethod : Callback function that is called when to retrieve the SSL Method Mask.
  • [In] ptrGetRootCaFilePath : Callback function that is called when to retrieve the root CA file directory.
  • [In] ptrGetServerCaFilePath : Callback function that is called when to retrieve the server CA file directory.
  • [In] ptrGetServerPrivateKeyFilePath : Callback function that is called when to retrieve the server private key file directory.
  • [In] ptrGetPassword : Callback function that is called when to retrieve the password.
  • [In] ptrOnErrorOccured : Callback function that is called when an error has occurred.

Before setting the TLS 1.2, you have to check the function below. the PreferMethod includes all of the settings about TLS.


UInt32 PreferMethodHandle(UInt32 deviceID)
{
return (UInt32)(BS2SslMethodMaskEnum.TLS1 | BS2SslMethodMaskEnum.TLS1_1 |BS2SslMethodMaskEnum.TLS1_2);
}