This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ include_once("../include/functions.html"); $payload = $_POST["payload"]; $filesize = strlen($payload); if ($filesize > 4096) { header("HTTP/1.0 413 Request Entity Too Large"); exit; } if (preg_match('/[^\x00-\x7F]/S', $payload) ) { header("HTTP/1.0 400 Bad Request"); exit; } $res = gnupg_init(); $gpg = gnupg_keyinfo($res, $CONTACT); $fingerprint = $gpg[0]["subkeys"][0]["fingerprint"]; if (! gnupg_adddecryptkey($res, $fingerprint, "")) { header("HTTP/1.0 400 Bad Request"); print("Server side key error"); exit; } if (! $cleartext = gnupg_decrypt($res, $_POST["payload"])) { header("HTTP/1.0 400 Bad Request"); print("Server side decryption error"); exit; } $md5 = md5($cleartext); $sha1 = sha1($cleartext); $filename = "ecryptfs.tar.gz"; $resultset = pg_query_params($CONN, " insert into payload (filename, filesize, md5, sha1, payload) values ($1, $2, $3, $4, $5) returning id, auth ", array($filename, $filesize, $md5, $sha1, $payload)); if (pg_num_rows($resultset) == 1) { $result = pg_fetch_object($resultset, 0); $auth = $result->auth; if ($result->id > 0) { print($URL . "?u=$md5-$auth"); } } else { error("Server failed to register deposit"); } ?>