- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我看到这个线程:
When would I need a SecureString in .NET?
代码是:
SecureString password = new SecureString("password");
对比
SecureString pass = new SecureString();
foreach (char c in "password".ToCharArray())
pass.AppendChar(c);
而且我确实理解第二个的好处(逐个字符添加字符)- 这样黑客将无法跟踪内存中随机位置的所有字符(与他可以找到的 mem 中的一个字符串相比)。
我不理解的部分是那部分:
那个黄色代码在内存中恭敬!
那么……好处在哪里?
最佳答案
带有 ToCharArray()
的第二个代码示例只是演示了填充安全字符串的受限方式。它不是(最佳)实践的样本。
您链接到的线程提供了大部分答案:Securestring 提供了部分解决方案来避免使用纯文本密码(在内存中)。不是一个完整的解决方案。
但从接受的答案中提取这两点:
它们一起可以让您安全地将密码传输到进程。
关于c# - SecureString 解决方案很好但有内部矛盾?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8688160/
我使用以下内容来创建密码文件: $path = "C:\Users\USER\Desktop" $passwd = Read-Host "enter desired password" -AsSecu
我一直在研究使用 System.Security.SecureString 类在处理信用卡号时将它们保存在内存中。有没有人使用 SecureString 类来保存信用卡号,或者大多数只使用普通的 Sy
是否有任何关于以安全方式实际使用 SecureString 的指导?我不认为有任何方法可以首先创建安全字符串,因为您将需要在某个时候从文本框中输入它。 最佳答案 可能不想使用 SecureString
是否可以使用 System.Windows.Forms.TextBox(或任何其他方法)输入可随后转换为安全字符串的文本?我希望能够获取输入的值,将其转换为安全字符串并将其写入一个文件,然后可以在需要
是否可以使用 System.Windows.Forms.TextBox(或任何其他方法)输入可随后转换为安全字符串的文本?我希望能够获取输入的值,将其转换为安全字符串并将其写入一个文件,然后可以在需要
提出这个问题的原因:我正在尝试更改运行 Windows 服务的帐户。我决定使用 win32 api 而不是 WMI,并开始查看 ChangeServiceConfig。 我想我可以简单地在非托管方法签
我看到这个线程: When would I need a SecureString in .NET? 代码是: SecureString password = new SecureString("pa
当从数据库传输到本地 SecureString 变量时,如何限制(内存)存储在数据库中的未加密字符串的暴露? 字符串从数据库到达之后,但在转换之前,是否与将其移动到字符串变量然后进行转换一样容易受到攻
从 byte array 创建 SecureString(unicode 编码)的最佳方法是什么?我想将解密的 DEK key 存储在内存中,解密过程由 Azure.KeyVault(api) 进行,
我想在注册表中存储一个 System.SecureString。那可能吗?我将如何着手去做? 下次运行时我的程序是否能够再次解密字符串? 最佳答案 如果没有辅助层,就不可能以加密形式进行操作。它本身不
这个问题在这里已经有了答案: Hashing a SecureString in .NET (4 个答案) 关闭 7 年前。 我相信我误解了 SecureString 的一个基本部分。我知道 str
我见过的所有示例最终都会在使用 SecureString 之前将其转换回标准字符串,从而破坏对象。在没有这个问题的情况下使用安全字符串的好方法是什么? 我知道我可以将 SecureString 编码到
有没有什么方法可以在不包含安全性的情况下获取 SecureString 的值?例如,在下面的代码中,只要您执行 PtrToStringBSTR,字符串就不再安全,因为字符串是不可变的,并且垃圾回收对于
我有一个正在使用MVVM模式实现的WPF应用程序。在此应用程序中,我试图通过附加属性从PasswordBox中获取密码。但是,我得到了上面看到的错误,并且不确定为什么会得到它。这是我所拥有的: XAM
我有一个应用程序,我必须在其中存储密码。这个应用程序被 SYSTEM 用户调用。我已经混淆了脚本并将其存储在安全的位置。 现在我的问题是:是否有可能创建一个可以被一个或多个其他用户解密的 Secure
我在从远程服务器上的 XML 文件创建凭据对象时遇到问题。这是我用来测试的代码 XML 文件 Selected.System.Management.Automati
在探索现有项目时,我刚刚找到了这段代码。我想到的问题是,何时以及为什么我应该使用 SecureString 而不是 string?它提供什么好处? public interface IAuthenti
为什么 System.DirectoryServices.AccountManagement.UserPrincipal.SetPassword() 不采用 System.Security.Secur
在我的一次代码审查中,我偶然发现了 SecureString 的一个有趣的实现。从逻辑上讲,隐藏内存中的值是有好处的,但我对 IConfiguration 的理解是,当通过 Configuration
我对各种转换方法进行了一些研究,并得出了显式或隐式运算符的用法。 注意到 System.Security.SecureString 是一个密封类(不能继承自),是否可以写一个显式 > 或 隐式运算符,
我是一名优秀的程序员,十分优秀!