+ if (!name) {
+ print_error((gs_sp_t)"csv_replay_init::Filename must be defined for gshub interfaces");
+ exit(0);
+ }
+ }
+
+ pkey_fname=get_iface_properties(device,(gs_sp_t)"privatekey");
+ pwd_fname=get_iface_properties(device,(gs_sp_t)"password");
+
+ if ((encryptedtmp=get_iface_properties(device,(gs_sp_t)"encrypted"))!=0) {
+ if (strncmp(encryptedtmp,"TRUE",4)==0) {
+ #ifndef SSL_ENABLED
+ print_error((gs_sp_t)"csv_replay_init::runtime not built with SSL support to use encrypted interfaces");
+ exit(0);
+ #else
+ use_decryption=1;
+ if (verbose) {
+ fprintf(stderr,"CSV file is encrypted\n");
+ }
+ if (!pkey_fname || !pwd_fname) {
+ print_error((gs_sp_t)"csv_replay_init::privatekey and/or password filenames not specified for encrypted itnerface");
+ exit(0);
+ }
+
+ OpenSSL_add_all_algorithms();
+ ERR_load_crypto_strings();
+
+ // Read password file
+ FILE* in_fd = fopen(pwd_fname, "r");
+ if (!in_fd) {
+ fprintf(stderr, "Unable to open password file %s\n", pwd_fname);
+ exit(0);
+ }
+
+ if (!fgets(pwd, CSVMAXLINE, in_fd)) {
+ fprintf(stderr, "Error reading password from file %s\n", pwd_fname);
+ exit(0);
+ }
+ strtok(pwd, "\r\n\t ");
+ fclose(in_fd);
+
+ // Read the private key
+ in_fd = fopen(pkey_fname, "r");
+ if (!in_fd) {
+ fprintf(stderr, "Unable to open private key file %s\n", pkey_fname);
+ exit(0);
+ }
+
+ rkey = PEM_read_PrivateKey(in_fd, NULL, pass_cb, NULL);
+ if (!rkey) {
+ fprintf(stderr, "Unable to read private key file %s\n", pkey_fname);
+ exit(-1);
+ }
+
+ fclose(in_fd);
+ #endif
+ }