read() 공개 메소드

Decrypt a message encrypted with write().
public read ( string $key, $ciphertext ) : string
$key string The key to use for decryption.
리턴 string The plaintext message.
예제 #1
0
파일: Base.php 프로젝트: netcon-source/apps
 /**
  * Returns a value from the internal params array.
  *
  * @param string $key  The param key.
  *
  * @return mixed  The param value, or null if not found.
  */
 public function getParam($key)
 {
     /* Passwords may be stored encrypted. */
     if ($key == 'password' && !empty($this->_params['_passencrypt'])) {
         try {
             $secret = new Horde_Secret();
             return $secret->read($this->_getEncryptKey(), $this->_params['password']);
         } catch (Exception $e) {
             return null;
         }
     }
     return isset($this->_params[$key]) ? $this->_params[$key] : null;
 }
예제 #2
0
파일: Smtp.php 프로젝트: jubinpatel/horde
 /**
  * Returns a value from the internal params array.
  *
  * @param string $key  The param key.
  *
  * @return mixed  The param value, or null if not found.
  */
 public function getParam($key)
 {
     /* Passwords may be stored encrypted. */
     switch ($key) {
         case 'password':
         case 'xoauth2_token':
             if (isset($this->_params[$key]) && $this->_params[$key] instanceof Horde_Smtp_Password) {
                 return $this->_params[$key]->getPassword();
             }
             // DEPRECATED
             if ($key == 'password' && !empty($this->_params['_passencrypt'])) {
                 try {
                     $secret = new Horde_Secret();
                     return $secret->read($this->_getEncryptKey(), $this->_params['password']);
                 } catch (Exception $e) {
                     return null;
                 }
             }
             break;
     }
     return isset($this->_params[$key]) ? $this->_params[$key] : null;
 }
예제 #3
0
파일: SecretTest.php 프로젝트: horde/horde
 public function testShortKeyRead()
 {
     $secret = new Horde_Secret();
     $this->assertEquals('', $secret->read('', ""));
 }