douzhao7014 2012-07-17 17:17
浏览 33
已采纳

显示SQL DB的加密数据

So I followed this guide here http://www.kodyaz.com/articles/sql-server-2005-database-encryption-step-by-step.aspx on how to setup encryption for my DB. All went fine on that side.

I'm trying to get some of the data that has been encrypted to be displayed now. I'm able to call data that is un-encrypted fine but I cannot seem to work out how to use the symmetric key to decrypt the encrypted data and display on the page.

Originally I thought I should use a stored procedure and let that catch the values but not entirely sure how to implement it.

echo "This is the database userId field: " . $row->userId . "<p>";
echo "This is the database email field: " . $row->email . "<p>";
echo "This is the database encryptedpassword2 field: " . $row->encrypteddata . "<p>";

This is how I am calling data but unsure on how to get the encrypteddata field to be passed through my key and then be displayed. At the moment it just shows random characters.

I'm somewhat new to SQL encryption so I hope I've managed to explain myself somewhat okay.

Thanks

  • 写回答

1条回答 默认 最新

  • dongshang1979 2012-07-17 17:46
    关注

    Generally speaking, you should not have a need to decrypt a password field. You only need to hash the user's input and compare that to the previously hashed password to see if the hashes match. Please take a minute to understand the difference between hashing and encryption.

    If you really want to get encrypted info out of the DB (hopefully not passwords), you should call DecryptByKey in your SQL statement (as is mentioned in your linked article) before they are returned to PHP.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答