diff --git a/decryptFunc.php b/decryptFunc.php index 725da5b..9925c88 100644 --- a/decryptFunc.php +++ b/decryptFunc.php @@ -1,30 +1,21 @@ ".$_POST["words"].""; + $data = simplexml_load_string($words) or die("Couldn't make object"); //Get the key $key = $_POST["key"]; - echo "key is $key
"; //Get the IV - preg_match('#(?<=())(.*?)(<\/iv>)#', $data, $ivArr); - $iv = $ivArr[0]; - $iv = substr($iv, 0, strlen("")); - echo "iv is $iv
"; + $iv = hex2bin($data->iv); //Get the tag - preg_match('#(?<=())(.*?)(<\/tag>)#', $data, $tagArr); - $tag = bin2hex($tagArr[0]); - $tag = substr($tag, 0, strlen("")); - echo "tag is $tag
"; + $tag = hex2bin($data->tag); //Get the ciphertext - preg_match('#(?<=())(.*?)(<\/content>)#', $data, $ctArr); - $ciphertext = $ctArr[0]; - $ciphertext = substr($ciphertext, 0, strlen("")); - echo "text is $ciphertext
"; + $ciphertext = $data->content; - $content = decrypt($ciphertext, $key, $iv, $tag); - echo "content is:
"; var_dump($content); + echo "
Your decrypted content:
"; + echo decrypt($ciphertext, $key, $iv, $tag);; ?> \ No newline at end of file diff --git a/error_log b/error_log index 2168f5d..f73fc57 100644 --- a/error_log +++ b/error_log @@ -1,59 +1,27 @@ -[08-Apr-2019 22:38:51 America/New_York] PHP Notice: Undefined variable: current_key in /home/lukeuxao/public_html/cs/submit.php on line 3 -[08-Apr-2019 22:38:51 America/New_York] PHP Notice: Undefined offset: 3 in /home/lukeuxao/public_html/cs/submit.php on line 4 -[08-Apr-2019 22:41:11 America/New_York] PHP Notice: Undefined offset: 3 in /home/lukeuxao/public_html/cs/submit.php on line 4 -[08-Apr-2019 22:41:25 America/New_York] PHP Notice: Undefined index: doc in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:41:25 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:42:00 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:42:00 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:42:28 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:42:28 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:42:53 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:42:53 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:43:33 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:43:33 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:43:33 America/New_York] PHP Notice: Undefined index: file in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:44:04 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:44:04 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:44:04 America/New_York] PHP Notice: Undefined index: encrypted.txt in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:44:13 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:44:13 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:44:13 America/New_York] PHP Notice: Undefined index: encrypted in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:45:21 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:45:21 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:45:21 America/New_York] PHP Notice: Undefined index: upload_file in /home/lukeuxao/public_html/cs/decryptFunc.php on line 5 -[08-Apr-2019 22:45:21 America/New_York] PHP Warning: file_get_contents(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 5 -[08-Apr-2019 22:47:24 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:47:24 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:47:24 America/New_York] PHP Notice: Undefined index: upload_file in /home/lukeuxao/public_html/cs/decryptFunc.php on line 5 -[08-Apr-2019 22:47:24 America/New_York] PHP Warning: file_get_contents(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 5 -[08-Apr-2019 22:47:43 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:47:43 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:48:15 America/New_York] PHP Notice: Undefined index: uploadFile in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:48:15 America/New_York] PHP Warning: fopen(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 22:48:15 America/New_York] PHP Notice: Undefined index: doc in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:48:15 America/New_York] PHP Warning: file_get_contents(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:51:00 America/New_York] PHP Notice: Undefined index: doc in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:51:00 America/New_York] PHP Warning: file_get_contents(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:51:03 America/New_York] PHP Notice: Undefined index: doc in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:51:03 America/New_York] PHP Warning: file_get_contents(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:51:07 America/New_York] PHP Notice: Undefined index: doc in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:51:07 America/New_York] PHP Warning: file_get_contents(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:53:04 America/New_York] PHP Notice: Undefined index: doc in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:53:04 America/New_York] PHP Warning: file_get_contents(): Filename cannot be empty in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 22:55:21 America/New_York] PHP Notice: Undefined index: doc in /home/lukeuxao/public_html/cs/decryptFunc.php on line 4 -[08-Apr-2019 23:01:42 America/New_York] PHP Notice: Undefined offset: 3 in /home/lukeuxao/public_html/cs/submit.php on line 4 -[08-Apr-2019 23:01:50 America/New_York] PHP Notice: Undefined offset: 3 in /home/lukeuxao/public_html/cs/submit.php on line 4 -[08-Apr-2019 23:04:28 America/New_York] PHP Warning: openssl_decrypt(): Setting tag for AEAD cipher decryption failed in /home/lukeuxao/public_html/cs/enc.php on line 14 -[08-Apr-2019 23:04:33 America/New_York] PHP Warning: openssl_decrypt(): Setting tag for AEAD cipher decryption failed in /home/lukeuxao/public_html/cs/enc.php on line 14 -[08-Apr-2019 23:04:42 America/New_York] PHP Warning: openssl_decrypt(): Setting tag for AEAD cipher decryption failed in /home/lukeuxao/public_html/cs/enc.php on line 14 -[08-Apr-2019 23:05:07 America/New_York] PHP Warning: openssl_decrypt(): Setting tag for AEAD cipher decryption failed in /home/lukeuxao/public_html/cs/enc.php on line 14 -[08-Apr-2019 23:05:23 America/New_York] PHP Warning: openssl_decrypt(): Setting tag for AEAD cipher decryption failed in /home/lukeuxao/public_html/cs/enc.php on line 14 -[08-Apr-2019 23:13:43 America/New_York] PHP Notice: Undefined variable: iv in /home/lukeuxao/public_html/cs/decryptFunc.php on line 13 -[08-Apr-2019 23:13:43 America/New_York] PHP Notice: Undefined variable: iv in /home/lukeuxao/public_html/cs/decryptFunc.php on line 25 -[08-Apr-2019 23:13:43 America/New_York] PHP Warning: openssl_decrypt(): Setting of IV length for AEAD mode failed in /home/lukeuxao/public_html/cs/enc.php on line 14 -[08-Apr-2019 23:14:25 America/New_York] PHP Notice: Undefined index: words in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 -[08-Apr-2019 23:14:25 America/New_York] PHP Notice: Undefined index: key in /home/lukeuxao/public_html/cs/decryptFunc.php on line 6 -[08-Apr-2019 23:14:25 America/New_York] PHP Notice: Undefined offset: 0 in /home/lukeuxao/public_html/cs/decryptFunc.php on line 11 -[08-Apr-2019 23:14:25 America/New_York] PHP Notice: Undefined offset: 0 in /home/lukeuxao/public_html/cs/decryptFunc.php on line 16 -[08-Apr-2019 23:14:25 America/New_York] PHP Notice: Undefined offset: 0 in /home/lukeuxao/public_html/cs/decryptFunc.php on line 21 -[08-Apr-2019 23:14:25 America/New_York] PHP Warning: openssl_decrypt(): Setting of IV length for AEAD mode failed in /home/lukeuxao/public_html/cs/enc.php on line 14 +[08-Apr-2019 23:39:18 America/New_York] PHP Notice: Undefined variable: tag in /home/lukeuxao/public_html/cs/decryptFunc.php on line 18 +[08-Apr-2019 23:40:03 America/New_York] PHP Warning: substr() expects parameter 1 to be string, array given in /home/lukeuxao/public_html/cs/decryptFunc.php on line 18 +[08-Apr-2019 23:43:45 America/New_York] PHP Warning: simplexml_load_string(): Entity: line 1: parser error : Extra content at the end of the document in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:43:45 America/New_York] PHP Warning: simplexml_load_string(): <iv>7b2db79604ebdc87ecacc527</iv><tag>c5b396d20a22bb418ba238d6563b0df3</tag><con in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:43:45 America/New_York] PHP Warning: simplexml_load_string(): ^ in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:43:45 America/New_York] PHP Notice: Trying to get property 'iv' of non-object in /home/lukeuxao/public_html/cs/decryptFunc.php on line 11 +[08-Apr-2019 23:43:45 America/New_York] PHP Notice: Trying to get property 'tag' of non-object in /home/lukeuxao/public_html/cs/decryptFunc.php on line 15 +[08-Apr-2019 23:43:45 America/New_York] PHP Notice: Undefined variable: tag in /home/lukeuxao/public_html/cs/decryptFunc.php on line 16 +[08-Apr-2019 23:43:45 America/New_York] PHP Notice: Trying to get property 'content' of non-object in /home/lukeuxao/public_html/cs/decryptFunc.php on line 19 +[08-Apr-2019 23:43:45 America/New_York] PHP Notice: Undefined variable: ciphertext in /home/lukeuxao/public_html/cs/decryptFunc.php on line 20 +[08-Apr-2019 23:43:45 America/New_York] PHP Notice: Undefined variable: ciphertext in /home/lukeuxao/public_html/cs/decryptFunc.php on line 22 +[08-Apr-2019 23:43:45 America/New_York] PHP Notice: Undefined variable: tag in /home/lukeuxao/public_html/cs/decryptFunc.php on line 22 +[08-Apr-2019 23:43:45 America/New_York] PHP Warning: openssl_decrypt(): Setting of IV length for AEAD mode failed in /home/lukeuxao/public_html/cs/enc.php on line 14 +[08-Apr-2019 23:44:04 America/New_York] PHP Warning: simplexml_load_string(): Entity: line 1: parser error : Extra content at the end of the document in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:44:04 America/New_York] PHP Warning: simplexml_load_string(): <iv>7b2db79604ebdc87ecacc527</iv><tag>c5b396d20a22bb418ba238d6563b0df3</tag><con in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:44:04 America/New_York] PHP Warning: simplexml_load_string(): ^ in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:44:15 America/New_York] PHP Warning: simplexml_load_string(): Entity: line 1: parser error : Extra content at the end of the document in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:44:15 America/New_York] PHP Warning: simplexml_load_string(): <iv>7b2db79604ebdc87ecacc527</iv><tag>c5b396d20a22bb418ba238d6563b0df3</tag><con in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:44:15 America/New_York] PHP Warning: simplexml_load_string(): ^ in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:44:40 America/New_York] PHP Warning: simplexml_load_string(): Entity: line 1: parser error : Extra content at the end of the document in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:44:40 America/New_York] PHP Warning: simplexml_load_string(): <iv>7b2db79604ebdc87ecacc527</iv><tag>c5b396d20a22bb418ba238d6563b0df3</tag><con in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:44:40 America/New_York] PHP Warning: simplexml_load_string(): ^ in /home/lukeuxao/public_html/cs/decryptFunc.php on line 3 +[08-Apr-2019 23:47:44 America/New_York] PHP Notice: Undefined variable: tag in /home/lukeuxao/public_html/cs/decryptFunc.php on line 17 +[08-Apr-2019 23:47:44 America/New_York] PHP Notice: Undefined variable: ciphertext in /home/lukeuxao/public_html/cs/decryptFunc.php on line 21 +[08-Apr-2019 23:47:44 America/New_York] PHP Notice: Undefined variable: ciphertext in /home/lukeuxao/public_html/cs/decryptFunc.php on line 23 +[08-Apr-2019 23:47:44 America/New_York] PHP Notice: Undefined variable: tag in /home/lukeuxao/public_html/cs/decryptFunc.php on line 23 +[08-Apr-2019 23:48:21 America/New_York] PHP Warning: openssl_decrypt(): Setting tag for AEAD cipher decryption failed in /home/lukeuxao/public_html/cs/enc.php on line 14 diff --git a/submit.php b/submit.php index 973fe77..500f36f 100644 --- a/submit.php +++ b/submit.php @@ -1,7 +1,7 @@ '.$enc[1].''.''.$enc[2].''.''.$enc[0].""; + $content = ''.bin2hex($enc[1]).''.''.bin2hex($enc[2]).''.''.$enc[0].""; header('Content-type: text/plain'); header('Content-Disposition: attachment; filename="encrypted.txt"');