简体   繁体   English

在这种情况下,我需要对密码进行加密吗?

[英]Do I need encryption for the password in this case?

A Windows Desktop C# application will periodically send email from client to myEmail@gmail.com. Windows 桌面 C# 应用程序将定期将 email 从客户端发送到 myEmail@gmail.Z4D236D9A2D102C5ZFE6DAEC1C The password of the email(myPassword) I use is very explicit in the code as shown:我使用的电子邮件(myPassword)的密码在代码中非常明确,如下所示:

        SmtpClient smptp = new SmtpClient();
        smptp.Host = "smtp.gmail.com";
        smptp.Port = 587;
        smptp.DeliveryMethod = SmtpDeliveryMethod.Network;
        string myPassword = "123456789";
        System.Net.NetworkCredential nc = new NetworkCredential("myEmail@gmail.com", myPassword);
        smptp.EnableSsl = true;
        smptp.Credentials = nc;
        smptp.Send(mm);

I will only share the exe file or installer with the client not the source code.我只会与客户端共享 exe 文件或安装程序,而不是源代码。 Can myPassword be still hacked in that case?在这种情况下,myPassword 还能被黑客入侵吗? If so, how to encrypt it programmatically?如果是这样,如何以编程方式对其进行加密?

Yes, someone could read the password using some disassembler (eg ildasm), I think there is not much to do in this scenario, the best recommendation it is not to store the password, but network credential requires a plain text string.是的,有人可以使用一些反汇编程序(例如 ildasm)读取密码,我认为在这种情况下没什么可做的,最好的建议是不要存储密码,但网络凭据需要纯文本字符串。 You could try setting/getting the value in config file, then you could encrypt that config file.您可以尝试在配置文件中设置/获取值,然后您可以加密该配置文件。

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

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