Key can't be empty when passing to Crypt_Blowfish
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 7 Apr 2010 16:26:56 +0000 (10:26 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 7 Apr 2010 16:35:05 +0000 (10:35 -0600)
framework/Secret/lib/Horde/Secret.php

index 72fcd16..104dd54 100644 (file)
@@ -72,7 +72,7 @@ class Horde_Secret
     {
         $val = strlen($key)
             ? $this->_getCipherOb($key)->encrypt($message)
-            : false;
+            : '';
 
         if ($val instanceof PEAR_Error) {
             throw new Horde_Secret_Exception($val);
@@ -92,7 +92,9 @@ class Horde_Secret
      */
     public function read($key, $ciphertext)
     {
-        $val = $this->_getCipherOb($key)->decrypt($ciphertext);
+        $val = strlen($key)
+            ? $this->_getCipherOb($key)->decrypt($ciphertext)
+            : '';
 
         if ($val instanceof PEAR_Error) {
             throw new Horde_Secret_Exception($val);