Don't encrypt/decrypt empty messages.
authorJan Schneider <jan@horde.org>
Tue, 6 Jul 2010 22:34:22 +0000 (00:34 +0200)
committerJan Schneider <jan@horde.org>
Tue, 6 Jul 2010 22:51:52 +0000 (00:51 +0200)
framework/Secret/lib/Horde/Secret.php

index 6675daf..41f400a 100644 (file)
@@ -70,7 +70,7 @@ class Horde_Secret
      */
     public function write($key, $message)
     {
-        $val = strlen($key)
+        $val = strlen($key) && strlen($message)
             ? $this->_getCipherOb($key)->encrypt($message)
             : '';
 
@@ -92,7 +92,7 @@ class Horde_Secret
      */
     public function read($key, $ciphertext)
     {
-        $val = strlen($key)
+        $val = strlen($key) && strlen($ciphertext)
             ? $this->_getCipherOb($key)->decrypt($ciphertext)
             : '';