summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-08-01 11:50:56 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-08-01 11:50:56 +0200
commitc62f1ab0ac127d3cca8fddcda52a6b38b9e27b69 (patch)
tree9e12ff2b5d09a5303b4ae84b692ec558ce82228b /apps/files_encryption
parent3b30bb23d7176c41d19fc96716cdd17446da066b (diff)
downloadnextcloud-server-c62f1ab0ac127d3cca8fddcda52a6b38b9e27b69.tar.gz
nextcloud-server-c62f1ab0ac127d3cca8fddcda52a6b38b9e27b69.zip
catch broken server config and disable encryption app.
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/hooks/hooks.php2
-rwxr-xr-xapps/files_encryption/lib/helper.php12
2 files changed, 13 insertions, 1 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index b2a17f6bca5..264dc2fd719 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -40,7 +40,7 @@ class Hooks {
public static function login($params) {
$l = new \OC_L10N('files_encryption');
//check if all requirements are met
- if(!Helper::checkRequirements() ) {
+ if(!Helper::checkRequirements() || !Helper::checkConfiguration() ) {
$error_msg = $l->t("Missing requirements.");
$hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that the OpenSSL PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
\OC_App::disable('files_encryption');
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index 6eee8fed6a6..d3d4afff912 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -232,6 +232,18 @@ 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 {
+ return false;
+ }
+ }
/**
* @brief glob uses different pattern than regular expressions, escape glob pattern only