aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib/crypt.php
diff options
context:
space:
mode:
authorOwen Winkler <epithet@gmail.com>2013-08-19 06:36:19 -0400
committerringmaster <epithet@gmail.com>2013-09-02 09:59:00 -0400
commit9a263a500abb6e6eaf482fcb962fcd9d652e076c (patch)
tree2f318816e4d4e519e6478a9f57aef36dda9c3a46 /apps/files_encryption/lib/crypt.php
parentfb34f49913e55731031a2e5c1b8041259df5c5ef (diff)
downloadnextcloud-server-9a263a500abb6e6eaf482fcb962fcd9d652e076c.tar.gz
nextcloud-server-9a263a500abb6e6eaf482fcb962fcd9d652e076c.zip
Employ config option for OpenSSL config file, if provided.
This should help make OpenSSL configuration on Windows servers easier by allowing the openssl.cnf file to be set directly in the ownCloud config, rather than in SetEnv commands that don't exist and are hard to replicate in IIS.
Diffstat (limited to 'apps/files_encryption/lib/crypt.php')
-rwxr-xr-xapps/files_encryption/lib/crypt.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php
index 7eab620baa5..c009718160a 100755
--- a/apps/files_encryption/lib/crypt.php
+++ b/apps/files_encryption/lib/crypt.php
@@ -52,15 +52,14 @@ class Crypt {
$return = false;
- $res = \OCA\Encryption\Helper::getOpenSSLPkey();
- $res = openssl_pkey_new(array('private_key_bits' => 4096));
+ $res = Helper::getOpenSSLPkey();
if ($res === false) {
\OCP\Util::writeLog('Encryption library', 'couldn\'t generate users key-pair for ' . \OCP\User::getUser(), \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)) {
+ } elseif (openssl_pkey_export($res, $privateKey, null, Helper::getOpenSSLConfig())) {
// Get public key
$keyDetails = openssl_pkey_get_details($res);
$publicKey = $keyDetails['key'];
@@ -71,7 +70,9 @@ class Crypt {
);
} else {
\OCP\Util::writeLog('Encryption library', 'couldn\'t export users private key, please check your servers openSSL configuration.' . \OCP\User::getUser(), \OCP\Util::ERROR);
- \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR);
+ while($errMsg = openssl_error_string()) {
+ \OCP\Util::writeLog('Encryption library', $errMsg, \OCP\Util::ERROR);
+ }
}
return $return;