2 #include <openssl/engine.h>
3 #include <openssl/evp.h>
4 #include <openssl/pem.h>
7 static char *
engine_name =
"Engine for testing openvpn engine key support";
15 fprintf(stderr,
"ENGINE: engine_init called\n");
22 fprintf(stderr,
"ENGINE: engine_finsh called\n");
29 UI_METHOD *ui_method,
void *cb_data)
33 PKCS8_PRIV_KEY_INFO *p8inf;
37 fprintf(stderr,
"ENGINE: engine_load_key called\n");
41 fprintf(stderr,
"Load Key called without correct initialization\n");
44 b = BIO_new_file(key_id,
"r");
47 fprintf(stderr,
"File %s does not exist or cannot be read\n", key_id);
52 p8inf = PEM_ASN1_read_bio((d2i_of_void *)d2i_PKCS8_PRIV_KEY_INFO,
58 fprintf(stderr,
"Failed to read engine private key\n");
61 pkey = EVP_PKCS82PKEY(p8inf);
69 UI_set_method(ui, ui_method);
72 UI_add_user_data(ui, cb_data);
74 if (UI_add_input_string(ui,
"enter test engine key",
75 UI_INPUT_FLAG_DEFAULT_PWD,
76 auth, 0,
sizeof(auth)) == 0)
78 fprintf(stderr,
"UI_add_input_string failed\n");
84 fprintf(stderr,
"UI_process failed\n");
88 fprintf(stderr,
"ENGINE: engine_load_key got password %s\n", auth);
115 IMPLEMENT_DYNAMIC_CHECK_FN()