setProviderSearchPath method

void setProviderSearchPath(
  1. String path
)

Sets the directory where OpenSSL looks for provider modules (legacy.dll, legacy.so, ...).

Useful when libcrypto was loaded from a custom path and the modules are not in the directory compiled into it.

Implementation

void setProviderSearchPath(String path) {
  final pathPtr = path.toNativeUtf8(allocator: calloc).cast<Char>();
  try {
    final result =
        bindings.OSSL_PROVIDER_set_default_search_path(nullptr, pathPtr);
    if (result != 1) {
      throw OpenSslException(
        'Failed to set the provider search path "$path"',
        bindings.ERR_get_error(),
        'OSSL_PROVIDER_set_default_search_path',
      );
    }
  } finally {
    calloc.free(pathPtr);
  }
}