WPF密码箱到C#中的SecureString的 [英] wpf password box into a SecureString in C#

查看:423
本文介绍了WPF密码箱到C#中的SecureString的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从一个WPF密码框中的数据进入一个安全字符串。这是怎么一回事?
是我到目前为止有:

I am attempting to get the data from a wpf password box into a secure string. How is that done? what i have so far:

 SecureString pass = new SecureString();
        pass.AppendChar(pbox1.Password);

这当然是不行的,所以我将如何得到,而无需创建一个普通字符串密码数据?

this of course does not work, so how would I get the password data without creating a regular string?

推荐答案

你需要阅读

SecureString pass = new SecureString();

foreach (char c in pbox1.Password)
{
  pass.AppendChar(c);
}

或更安全地使用SecurePassword属性。

or more securely use the SecurePassword property

SecureString pass = pbox1.SecurePassword

这篇关于WPF密码箱到C#中的SecureString的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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