存储加密文本密钥的最佳方法是什么

编程入门 行业动态 更新时间:2024-10-28 12:18:46
本文介绍了存储加密文本密钥的最佳方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我有以下问题: 在我的ASP.NET MVC应用程序中,我想在我的数据库中存储一些键/值设置。 /> 这些键/值设置中的一些包含密码,我想加密以保护它们。 我无法对密码进行哈希,因为我需要一些密码才能在远程SMTP服务器上进行验证。 在MSDN上,我发现文章关于使用受保护的配置提供程序保护配置设置,但我不想将该设置存储在我的web.config文件中。 我考虑使用DpapiProtectedConfigurationProvider,它使用一些机器和用户特定的属性作为加密密钥,但是这个提供程序只能用于XML配置节点。 那么,在C#应用程序中存储密码的最佳方法是什么? greetings

解决方案

_-_ nox _-_ write:

我需要解密的密码才能在远程SMTP服务器上进行身份验证

不,你没有。 创建单个用户以允许通过您的应用程序访问SMTP服务器。为您的应用程序提供身份验证,并使用默认用户在SMTP服务器上运行。记录用户活动。 这就是全部! 正如谢尔盖所​​说,不要存储加密/解密的密码在您的应用程序中登录到SMTP服务器。

您不应该存储任何密码,即使是加密的,也不是绝对不需要验证。 感觉不同意?惊讶吗?然后继续阅读。请查看我过去的答案: 我已经加密了密码但是当我登录时给出了我错了。如何解密 [ ^ ] , 解密加密密码 [ ^ ], 存储密码值int sql server with secure方式 [ ^ ]。 你明白了吗?您需要存储密码的加密哈希函数,并始终将哈希与哈希进行比较。然后没有人能够学习原始密码,无论这个人有多少访问权限。
-SA

Hello folks, I have the following question: In my ASP.NET MVC application I want to store some key/value settings in my database. Some of this key/value settings contain passwords, that I want to encrypt to secure them. I can´t hash the passwords because I need some passwords to autheticate on a remote SMTP server. On MSDN I found an article about securing configuration settings with "Protected Configuration Providers", but I don´t want to store that settings in my web.config file. I considered to use the DpapiProtectedConfigurationProvider that uses some machine and user specific properties as encryption keys, but this provider is built to work only with XML configuration nodes. So, what is the best method to store passwords in an C# application? greetings

解决方案

_-_nox_-_ wrote:

I need the decrypted password to authenticate on the remote SMTP server

No, you don't. Create single user to allow access to SMTP server via your application. Provide authentication to your application and use default user to operate on SMTP server. Log user activity. That's all! As Sergey mentioned, do not store encrypted/decrypted passwords in your application to log in into SMTP server.

You should not store any passwords, even encrypted, this is not absolutely not needed for authentication. Feel disagree? Surprised? Then keep reading. Please see my past answers: i already encrypt my password but when i log in it gives me an error. how can decrypte it[^], Decryption of Encrypted Password[^], storing password value int sql server with secure way[^]. Are you getting the idea? You need to store cryptographic hash function of passwords, and always compare hash with hash. Then no one will be able to learn the original passwords, no matter how much access this person may have.
—SA

更多推荐

存储加密文本密钥的最佳方法是什么

本文发布于:2023-11-24 09:30:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1624660.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密钥   文本   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!