I'm creating a custom OpenSSL engine for an ARM board, to be used in applications that are already linking to libssl. However, I need to tell the application to load this custom engine and use it. I'm only able to find the command line for openssl. So the question is: how can I load an OpenSSL engine and use it in a C/C++ application?
Asked
Active
Viewed 781 times
1 Answers
1
Use ENGINE_by_id(...)
. You also might need to set OPENSSL_ENGINES
environment variable to specify the path to the directory where your custom engine is located.
const char *engine_id = "your_custom_engine_id";
// ...
engine = ENGINE_by_id(engine_id);
if (engine == NULL) {
// handle error
}
if (ENGINE_init(engine) == 0) {
// handle error
}
EVP_PKEY *evp_key = ENGINE_load_public_key(engine, key_uri, NULL, NULL);
if (evp_key == NULL) {
// handle error
}

Anton
- 351
- 3
- 3