Start a branch for easier OpenSSL configuration.

This commit is contained in:
Owen Winkler 2013-08-18 13:11:48 -04:00 committed by ringmaster
parent 06870a6e39
commit fb34f49913
3 changed files with 17 additions and 1 deletions

View File

@ -52,6 +52,7 @@ class Crypt {
$return = false; $return = false;
$res = \OCA\Encryption\Helper::getOpenSSLPkey();
$res = openssl_pkey_new(array('private_key_bits' => 4096)); $res = openssl_pkey_new(array('private_key_bits' => 4096));
if ($res === false) { if ($res === false) {

View File

@ -265,7 +265,7 @@ class Helper {
* @return bool true if configuration seems to be OK * @return bool true if configuration seems to be OK
*/ */
public static function checkConfiguration() { public static function checkConfiguration() {
if(openssl_pkey_new(array('private_key_bits' => 4096))) { if(self::getOpenSSLPkey()) {
return true; return true;
} else { } else {
while ($msg = openssl_error_string()) { while ($msg = openssl_error_string()) {
@ -275,6 +275,16 @@ class Helper {
} }
} }
/**
* Create an openssl pkey with config-supplied settings
* @return resource The pkey resource created
*/
public static function getOpenSSLPkey() {
$config = array('private_key_bits' => 4096);
$config = array_merge(\OCP\Config::getSystemValue('openssl'), $config);
return openssl_pkey_new($config);
}
/** /**
* @brief glob uses different pattern than regular expressions, escape glob pattern only * @brief glob uses different pattern than regular expressions, escape glob pattern only
* @param unescaped path * @param unescaped path

View File

@ -214,4 +214,9 @@ $CONFIG = array(
'preview_libreoffice_path' => '/usr/bin/libreoffice', 'preview_libreoffice_path' => '/usr/bin/libreoffice',
/* cl parameters for libreoffice / openoffice */ /* cl parameters for libreoffice / openoffice */
'preview_office_cl_parameters' => '', 'preview_office_cl_parameters' => '',
// Extra SSL options to be used for configuration
'openssl' => array(
//'config' => '/path/to/openssl.cnf',
),
); );