隐藏密码在C#源$ C ​​$ C [英] Hide password in c# source code

查看:157
本文介绍了隐藏密码在C#源$ C ​​$ C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的code在C#中从我的网站下载文件:

I am using the following code in c# to download a file from my website:

WebClient webClient = new WebClient();
webClient.Credentials = new System.Net.NetworkCredential("username", "password");
webClient.DownloadFile("http://example.com/file.txt", "file.txt");

在符合某些条件的文件只下载的,所以我不希望用户能够访问我的网站上的文件

The file is only downloaded when certain criteria are met, so I don't want the users to be able to access the files on my site

我corcern是,如果一个古玩用户反编译的code,他会找到密码,并能够访问我的网站上的所有文件。

My corcern is that if a curios users decompiles the code, he will find the password and be able to access all the files on my site.

我读过一个安全的方法来保存密码,以保存其哈希值,但我不知道如何在这个例子中实现它。

I've read that a secure way to save the password is to store its hash, but I don't know how to implement it in this example.

做什么选择我要保持我的密码的安全,并使其无法为用户找到它?

What options do I have to keep my password secure and make it impossible for a user to find it?

推荐答案

您根本就没有。用户给你密码做的东西,而不是其他的方式。

You simply don't. Users give you passwords to do stuff, not the other way around.

如果用户具有证明特定条件,然后传递这些特定条件的证明给服务器,并让它决定是否允许下载或不

If the user has to prove "certain conditions", then pass proof of those certain conditions to the server, and let it decide whether to allow the download or not.

这篇关于隐藏密码在C#源$ C ​​$ C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆