summaryrefslogtreecommitdiffstats
path: root/etc/inc/crypt.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/crypt.inc')
-rw-r--r--etc/inc/crypt.inc15
1 files changed, 10 insertions, 5 deletions
diff --git a/etc/inc/crypt.inc b/etc/inc/crypt.inc
index 582a84c..8515c84 100644
--- a/etc/inc/crypt.inc
+++ b/etc/inc/crypt.inc
@@ -35,11 +35,16 @@
function crypt_data($val, $pass, $opt) {
$file = tempnam("/tmp", "php-encrypt");
file_put_contents("{$file}.dec", $val);
- exec("/usr/bin/openssl enc {$opt} -aes-256-cbc -in {$file}.dec -out {$file}.enc -k {$pass}");
- $result = file_get_contents("{$file}.enc");
- unlink($file);
- unlink("{$file}.dec");
- unlink("{$file}.enc");
+ exec("/usr/bin/openssl enc {$opt} -aes-256-cbc -in {$file}.dec -out {$file}.enc -k " . escapeshellarg($pass));
+ if (file_exists("{$file}.enc"))
+ $result = file_get_contents("{$file}.enc");
+ else {
+ $result = "";
+ log_error("Failed to encrypt/decrypt data!");
+ }
+ @unlink($file);
+ @unlink("{$file}.dec");
+ @unlink("{$file}.enc");
return $result;
}
OpenPOWER on IntegriCloud