\r
if ($res === false) {\r
\OCP\Util::writeLog('Encryption library', 'couldn\'t generate users key-pair for ' . \OCP\User::getUser(), \OCP\Util::ERROR);\r
+ \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR);\r
} elseif (openssl_pkey_export($res, $privateKey)) {\r
// Get public key\r
- $publicKey = openssl_pkey_get_details($res);\r
- $publicKey = $publicKey['key'];\r
+ $keyDetails = openssl_pkey_get_details($res);\r
+ $publicKey = $keyDetails['key'];\r
\r
$return = array(\r
'publicKey' => $publicKey,\r
);\r
} else {\r
\OCP\Util::writeLog('Encryption library', 'couldn\'t export users private key, please check your servers openSSL configuration.' . \OCP\User::getUser(), \OCP\Util::ERROR);\r
+ \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR);\r
}\r
\r
return $return;\r
public static function encrypt($plainContent, $iv, $passphrase = '') {\r
\r
if ($encryptedContent = openssl_encrypt($plainContent, 'AES-128-CFB', $passphrase, false, $iv)) {\r
-\r
return $encryptedContent;\r
-\r
} else {\r
-\r
\OCP\Util::writeLog('Encryption library', 'Encryption (symmetric) of content failed', \OCP\Util::ERROR);\r
-\r
+ \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR);\r
return false;\r
\r
}\r