【发布时间】:2014-05-30 14:44:01
【问题描述】:
我的密码在数据库中被 zend2 的 BlockCipher 加密:
public function cipher($incKey, $password) {
$cipher = BlockCipher::factory ( 'mcrypt', array (
'algorithm' => 'aes'
));
$cipher->setKey ( $incKey );
$text = $password;
$encrypted = $cipher->encrypt ( $text );
echo "Encrypted text: $encrypted \n";
return $encrypted;
}
现在我需要在登录时验证用户的密码:
$cipher = new Cipher();
$ciphered_password = $cipher->cipher($incKey, $data['usr_password']);
$authAdapter = new AuthAdapter($dbAdapter,
'users',
'email',
'password',
"CONCAT('$ciphered_password') AND state= 1"
);
但是没有通过认证;
使用代码:FAILURE_CREDENTIAL_INVALID
我在这里做错了吗?
任何帮助将不胜感激。
【问题讨论】:
标签: php authentication encryption passwords zend-framework2