gpt4 book ai didi

c# - wpf 密码框到 C# 中的 SecureString

转载 作者:太空狗 更新时间:2023-10-29 22:03:08 25 4
gpt4 key购买 nike

我正在尝试将 wpf 密码框中的数据转换为安全字符串。这是怎么做到的?到目前为止我所拥有的:

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

这当然行不通,那么我如何在不创建常规字符串的情况下获取密码数据呢?

最佳答案

Per MSDN :

When you get the Password property value, you expose the password as plain text in memory. To avoid this potential security risk, use the SecurePassword property to get the password as a SecureString.

您应该避免使用 Password 属性,除非您绝对需要该字符串的纯文本版本。在这种情况下,直接检索 SecureString。

关于c# - wpf 密码框到 C# 中的 SecureString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2978348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com