verifyPassphrase() public method

Verify a passphrase for a given private key.
public verifyPassphrase ( string $private_key, string $passphrase ) : boolean
$private_key string The user's private key.
$passphrase string The user's passphrase.
return boolean Returns true on valid passphrase, false on invalid passphrase.
コード例 #1
0
ファイル: Smime.php プロジェクト: GenerationLabs/horde
 /**
  * Store's the user's passphrase in the session cache.
  *
  * @param string $passphrase  The user's passphrase.
  *
  * @return boolean  Returns true if correct passphrase, false if incorrect.
  */
 public function storePassphrase($passphrase)
 {
     global $session;
     if ($this->_smime->verifyPassphrase($this->getPersonalPrivateKey(), $passphrase) !== false) {
         $session->set('imp', 'smime_passphrase', $passphrase, $session::ENCRYPT);
         return true;
     }
     return false;
 }
コード例 #2
0
ファイル: Smime.php プロジェクト: horde/horde
 /**
  * Stores the user's passphrase in the session cache.
  *
  * @param string $passphrase  The user's passphrase.
  * @param integer $signkey    One of the IMP_Sime::KEY_* constants.
  *
  * @return boolean  Returns true if correct passphrase, false if incorrect.
  */
 public function storePassphrase($passphrase, $signkey = self::KEY_PRIMARY)
 {
     global $session;
     if ($signkey == self::KEY_SECONDARY_OR_PRIMARY) {
         if ($key = $this->getPersonalPrivateKey(self::KEY_SECONDARY)) {
             $signkey = self::KEY_SECONDARY;
         } else {
             $key = $this->getPersonalPrivateKey();
             $signkey = self::KEY_PRIMARY;
         }
     } else {
         $key = $this->getPersonalPrivateKey($signkey);
     }
     if ($this->_smime->verifyPassphrase($key, $passphrase) !== false) {
         $session->set('imp', $signkey ? 'smime_passphrase_sign' : 'smime_passphrase', $passphrase, $session::ENCRYPT);
         return true;
     }
     return false;
 }