|
@@ -0,0 +1,38 @@
|
|
|
+<html><body>
|
|
|
+<?php
|
|
|
+
|
|
|
+ $client_pub_key_b64=""; // Invalid base64
|
|
|
+ $client_pub_key_header="Mitigator-Client-Public-Key";
|
|
|
+ $headers=getallheaders(); // TODO: Error-checking: could be null - treat same way as if header n$
|
|
|
+ if(array_key_exists($client_pub_key_header, $headers))
|
|
|
+ {
|
|
|
+ $client_pub_key_b64=$headers[$client_pub_key_header];
|
|
|
+ }
|
|
|
+ else if(array_key_exists(strtolower( $client_pub_key_header), $headers)) // TODO: NASTY BUG HERE$
|
|
|
+ {
|
|
|
+ $client_pub_key_b64=$headers[ strtolower( $client_pub_key_header ) ];
|
|
|
+ }
|
|
|
+ // echo $client_pub_key_b64;
|
|
|
+ $ip_args = array($client_pub_key_b64);
|
|
|
+ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|
|
+ foreach ($_POST as $key => $value) {
|
|
|
+ array_push($ip_args, $value);
|
|
|
+ // print_r( $ip_args );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $ret_obj = php_decrypt_wrapper($ip_args);
|
|
|
+ $is_success = $ret_obj->success;
|
|
|
+ if($is_success === "true")
|
|
|
+ {
|
|
|
+ $fields = $ret_obj->fields;
|
|
|
+ $no_of_fields=count($fields);
|
|
|
+ foreach ($fields as $key => $value) {
|
|
|
+ echo $value . " ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ echo "Could not decrypt.";
|
|
|
+
|
|
|
+?>
|
|
|
+</body></html>
|
|
|
+
|