简体   繁体   English

将密码存储到SQL Server 2008中的适当格式?

[英]Appropriate format to store password into SQL Server 2008?

I am creating an ASP.Net website for first time and I want to store the password of login page into the database in any encoded format not directly as it is. 我是第一次创建ASP.Net网站,我想以任何编码格式而不是直接将登录页面的密码存储到数据库中。 But encryption and decryption should occur automatically. 但是加密和解密应该自动进行。

Any suggestion for this ?? 有什么建议吗?

De cryption of the stored password should not be possible for security reasons. 存储密码的 cryption不应该出于安全原因,是不可能的。 If the user tries to authenticate, "encrypt" the entered password again and compare it to the value in the database. 如果用户尝试进行身份验证,请再次“加密”输入的密码,并将其与数据库中的值进行比较。

The mathematical method to do this is called a cryptographic hash function . 执行此操作的数学方法称为加密哈希函数 To protect against rainbow table attacks, the hash should also be salted . 为了防止彩虹表攻击,哈希值也应加盐


If you want to implement this yourself, there are lots of questions here on SO on how to do this with .NET. 如果您想自己实现这一点,那么在SO上有很多关于如何使用.NET执行此操作的问题。 Here are a few of them: 这里有几个:


On the other hand, since you are using ASP.NET, you could make your life easier and just use the built-in ASP.NET membership provider, which already does all the necessary security stuff . 另一方面,由于您使用的是ASP.NET,因此可以使生活更轻松,并且只需使用内置的ASP.NET成员资格提供程序即可,该程序已经完成了所有必要的安全工作 Here's an MSDN article to get you started: 这是MSDN文章,可帮助您入门:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM