write() 공개 메소드

Take a small piece of data and encrypt it with a key.
public write ( string $key, string $message ) : string
$key string The key to use for encryption.
$message string The plaintext message.
리턴 string The ciphertext message.
예제 #1
0
파일: Base.php 프로젝트: netcon-source/apps
 /**
  * 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;
 }
예제 #2
0
파일: Smtp.php 프로젝트: jubinpatel/horde
 /**
  * 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;
 }
예제 #3
0
파일: SecretTest.php 프로젝트: horde/horde
 public function testShortKeyWrite()
 {
     $secret = new Horde_Secret();
     $this->assertEquals('', $secret->write('', ""));
 }