Browse Source

Generates a list of plaintext output fields, rather than a list containing lists of chars in output fields. (Tested, it works.)

dettanym 4 years ago
parent
commit
2ae445040c
1 changed files with 13 additions and 2 deletions
  1. 13 2
      MainLogic.cpp

+ 13 - 2
MainLogic.cpp

@@ -213,14 +213,25 @@ Php::Value MainLogic::php_decrypt_wrapper(Php::Parameters &params  ) {
         return ret_object;
     }
     ret_object["success"]="true";
-    ret_object["fields"]=Php::Array(plaintext_fields_list);
-    printf("Returning back to good old php.\n"); fflush(stdout);
+    no_of_fields = plaintext_fields_list.size();
+    std::vector<unsigned char> temp_vector;
+    Php::Array ret_php_array;
+    for(counter=0; counter<no_of_fields; counter++)
+    {
+        temp_vector = plaintext_fields_list[counter];
+        ret_php_array[counter] = std::string((char*) &temp_vector.front(), (ssize_t) temp_vector.size());
+    }
+    ret_object["fields"]=ret_php_array;
+
     for (auto binaryField : plaintext_fields_list)
     {
+
         for(auto myByte : binaryField)
             printf("%c", myByte);
         printf("\n");
     }
+    printf("Returning back to good old php.\n"); fflush(stdout);
+
     return ret_object;
 }