/** * Sets a configuration parameter value. * * @param string $key The param key. * @param mixed $value The param value. */ public function setParam($key, $val) { switch ($key) { case 'password': // Encrypt password. try { $encrypt_key = $this->_getEncryptKey(); if (strlen($encrypt_key)) { $secret = new Horde_Secret(); $val = $secret->write($encrypt_key, $val); $this->_params['_passencrypt'] = true; } } catch (Exception $e) { $this->_params['_passencrypt'] = false; } break; } $this->_params[$key] = $val; $this->changed = true; }
/** * Sets a configuration parameter value. * * @param string $key The param key. * @param mixed $val The param value. */ public function setParam($key, $val) { switch ($key) { case 'password': if ($val instanceof Horde_Smtp_Password) { break; } // Encrypt password. DEPRECATED try { $encrypt_key = $this->_getEncryptKey(); if (strlen($encrypt_key)) { $secret = new Horde_Secret(); $val = $secret->write($encrypt_key, $val); $this->_params['_passencrypt'] = true; } } catch (Exception $e) { } break; } $this->_params[$key] = $val; }
public function testShortKeyWrite() { $secret = new Horde_Secret(); $this->assertEquals('', $secret->write('', "")); }