Verify a passphrase for a given private key.
/** * 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; }
/** * 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; }