【问题标题】:Is there a way where i can get the decrypt password stored in the DB?有没有办法可以获取存储在数据库中的解密密码?
【发布时间】:2019-11-07 06:04:14
【问题描述】:

我正在尝试创建一个登录表单,其中密码在 oracle DB 中加密,我无法在 php 中的 select 语句中解密密码。当我输入正确的密码时,会弹出错误消息,当我尝试输入加密后的密码时,它会继续登录,

$strSQL = "SELECT USER_ID, PASS_WORD FROM VW_SMF_USERS WHERE USER_ID = 
           '".trim($_POST['txtUseremail'])."' 
           AND PASS_WORD = '".trim($_POST['txtUserpassword'])."'";

$objParse = oci_parse ($objConnect, $strSQL);
oci_execute ($objParse,OCI_DEFAULT);
$objResult = oci_fetch_array($objParse);

【问题讨论】:

  • 如果你是从零开始开发,最好使用digest、hash、salt的概念。 auth0.com/blog/…

标签: php oracle security encryption


【解决方案1】:

我可以理解您当前的情况,您已经在数据库中对密码进行了哈希处理,并且您正在直接向数据库查询 user_input 密码,这就是为什么应用程序使用哈希而不是纯文本密码登录的原因。 您需要先在所需的哈希 (md5,sha) 中加密 user_input 密码,
示例 md5:

"SELECT USER_ID, PASS_WORD FROM VW_SMF_USERS WHERE USER_ID = 
           '".trim($_POST['txtUseremail'])."' 
           AND PASS_WORD = '".md5($_POST['txtUserpassword'])."'";

【讨论】:

    猜你喜欢
    • 2013-08-20
    • 2013-12-07
    • 2021-01-10
    • 1970-01-01
    • 2020-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多