From e4c66080a8d7e3a329258498b35e8fc55eea5130 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 07 Sep 2015 03:47:16 -0400
Subject: [PATCH] Improved encrypt/decrypt methods with option to choose the cipher_method (#1489719)
---
program/lib/Roundcube/rcube_config.php | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index 3dd54e3..799552f 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -505,7 +505,7 @@
public function get_crypto_key($key)
{
// Bomb out if the requested key does not exist
- if (!array_key_exists($key, $this->prop)) {
+ if (!array_key_exists($key, $this->prop) || empty($this->prop[$key])) {
rcube::raise_error(array(
'code' => 500, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
@@ -513,18 +513,23 @@
), true, true);
}
- $key = $this->prop[$key];
+ return $this->prop[$key];
+ }
- // Bomb out if the configured key is not exactly 24 bytes long
- if (strlen($key) != 24) {
- rcube::raise_error(array(
- 'code' => 500, 'type' => 'php',
- 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Configured crypto key '$key' is not exactly 24 bytes long"
- ), true, true);
+ /**
+ * Return configured crypto method.
+ *
+ * @return string Crypto method
+ */
+ public function get_crypto_method()
+ {
+ $method = $this->get('cipher_method');
+
+ if (empty($method)) {
+ $method = 'DES-EDE3-CBC';
}
- return $key;
+ return $method;
}
/**
--
Gitblit v1.9.1