From 912831f589862c205d5b9837b710aa391460e08d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 4 Feb 2014 17:21:37 +0200 Subject: CI_Encryption: Fix some errors and add unit tests for hkdf() --- system/libraries/Encryption.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'system') diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php index 6e71d6ee1..4258aee53 100644 --- a/system/libraries/Encryption.php +++ b/system/libraries/Encryption.php @@ -125,15 +125,6 @@ class CI_Encryption { $this->initialize($params); - if (empty($this->_driver)) - { - $this->_driver = ($this->_drivers['mcrypt'] === TRUE) - ? 'mcrypt' - : 'openssl'; - - log_message('debug', "Encryption: Auto-configured driver '".$params['driver']."'."); - } - isset($this->_key) OR $this->_key = config_item('encryption_key'); if (empty($this->_key)) { @@ -172,6 +163,15 @@ class CI_Encryption { } } + if (empty($this->_driver)) + { + $this->_driver = ($this->_drivers['mcrypt'] === TRUE) + ? 'mcrypt' + : 'openssl'; + + log_message('debug', "Encryption: Auto-configured driver '".$this->_driver."'."); + } + empty($params['key']) OR $this->_key = $params['key']; $this->{'_'.$this->_driver.'_initialize'}($params); return $this; @@ -807,7 +807,7 @@ class CI_Encryption { */ public function __get($key) { - return in_array($key, array('cipher', 'mode', 'driver', 'drivers'), TRUE) + return in_array($key, array('cipher', 'mode', 'driver', 'drivers', 'digests'), TRUE) ? $this->{'_'.$key} : NULL; } -- cgit v1.2.3-24-g4f1b