Skip to content
Snippets Groups Projects
Commit df7bfa4b authored by Owen Winkler's avatar Owen Winkler
Browse files

Don't cache the pkey, skip generation if the keyfile exists

parent 9a263a50
No related branches found
No related tags found
No related merge requests found
...@@ -36,14 +36,6 @@ class Hooks { ...@@ -36,14 +36,6 @@ class Hooks {
*/ */
public static function login($params) { public static function login($params) {
$l = new \OC_L10N('files_encryption'); $l = new \OC_L10N('files_encryption');
//check if all requirements are met
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 OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
\OC_App::disable('files_encryption');
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
\OCP\Template::printErrorPage($error_msg, $hint);
}
$view = new \OC_FilesystemView('/'); $view = new \OC_FilesystemView('/');
...@@ -54,6 +46,15 @@ class Hooks { ...@@ -54,6 +46,15 @@ class Hooks {
$util = new Util($view, $params['uid']); $util = new Util($view, $params['uid']);
//check if all requirements are met
if(!$util->ready() && (!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 OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
\OC_App::disable('files_encryption');
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
\OCP\Template::printErrorPage($error_msg, $hint);
}
// setup user, if user not ready force relogin // setup user, if user not ready force relogin
if (Helper::setupUser($util, $params['password']) === false) { if (Helper::setupUser($util, $params['password']) === false) {
return false; return false;
......
...@@ -277,14 +277,11 @@ class Helper { ...@@ -277,14 +277,11 @@ class Helper {
/** /**
* Create an openssl pkey with config-supplied settings * Create an openssl pkey with config-supplied settings
* WARNING: This initializes and caches a new private keypair, which is computationally expensive
* @return resource The pkey resource created * @return resource The pkey resource created
*/ */
public static function getOpenSSLPkey() { public static function getOpenSSLPkey() {
static $res = null; return openssl_pkey_new(self::getOpenSSLConfig());
if (is_null($res)) {
$res = openssl_pkey_new(self::getOpenSSLConfig());
}
return $res;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment