【发布时间】:2025-11-26 10:35:02
【问题描述】:
我在我的 c# 项目中使用应用程序设置来保存 gmail 用户名和密码。在保存设置之前,我正在加密纯文本密码。当我重新启动应用程序时,检索它们当然没有任何问题,但检索到的密码是加密的。我想要的是在绑定回文本框之前解密它 设计器生成的代码如下:
this.tb_Gmail_Password.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::MyApp.Properties.Settings.Default, "GmailPassword", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
我不知道我能否正确地提出我的问题。如果我听起来像是在说外语,请随意踢我。我会根据你的建议给出更多的描述……
问候, N10i。
--编辑--
在保存配置时,我使用自定义函数来加密密码,即
Properties.Settings.Default.GmailPassword = MyApp.EncPass(tb_Gmail_Password.Text);
我可以使用类似的东西吗
this.tb_Gmail_Password.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::MyApp.Properties.Settings.Default, MyApp.DecPass("GmailPassword"), true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
即
MyApp.DecPass("GmailPassword")
【问题讨论】:
标签: c# .net visual-studio winforms