aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2013-08-14 20:56:44 +0200
committerGeorg Ehrke <developer@georgehrke.com>2013-08-14 20:56:44 +0200
commit4b5fb08c2cda4a13a1b81699f308d21b89f1723b (patch)
treea1f40bb6c6bcaf4e9093c2153d0a32fefecf2b79 /apps/files_encryption/lib
parente5761d90ef223a04205ad93eea7706439ef0b60e (diff)
parent994537a5b94826294e61231768f27964bc736ced (diff)
downloadnextcloud-server-4b5fb08c2cda4a13a1b81699f308d21b89f1723b.tar.gz
nextcloud-server-4b5fb08c2cda4a13a1b81699f308d21b89f1723b.zip
Merge master into oc_preview
Diffstat (limited to 'apps/files_encryption/lib')
-rwxr-xr-xapps/files_encryption/lib/crypt.php4
-rwxr-xr-xapps/files_encryption/lib/helper.php15
2 files changed, 18 insertions, 1 deletions
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php
index 6543a0de5f3..c3e88e5944e 100755
--- a/apps/files_encryption/lib/crypt.php
+++ b/apps/files_encryption/lib/crypt.php
@@ -57,7 +57,9 @@ class Crypt {
if ($res === false) {
\OCP\Util::writeLog('Encryption library', 'couldn\'t generate users key-pair for ' . \OCP\User::getUser(), \OCP\Util::ERROR);
- \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR);
+ while ($msg = openssl_error_string()) {
+ \OCP\Util::writeLog('Encryption library', 'openssl_pkey_new() fails: ' . $msg, \OCP\Util::ERROR);
+ }
} elseif (openssl_pkey_export($res, $privateKey)) {
// Get public key
$keyDetails = openssl_pkey_get_details($res);
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index 6eee8fed6a6..b09c584c0b8 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -232,6 +232,21 @@ class Helper {
return (bool) $result;
}
+
+ /**
+ * check some common errors if the server isn't configured properly for encryption
+ * @return bool true if configuration seems to be OK
+ */
+ public static function checkConfiguration() {
+ if(openssl_pkey_new(array('private_key_bits' => 4096))) {
+ return true;
+ } else {
+ while ($msg = openssl_error_string()) {
+ \OCP\Util::writeLog('Encryption library', 'openssl_pkey_new() fails: ' . $msg, \OCP\Util::ERROR);
+ }
+ return false;
+ }
+ }
/**
* @brief glob uses different pattern than regular expressions, escape glob pattern only