gpt4 book ai didi

c# - DPAPI 会自动执行 Dynamic Salt 吗?

转载 作者:可可西里 更新时间:2023-11-01 10:02:28 25 4
gpt4 key购买 nike

我正在考虑使用 Windows 的数据保护 API (DPAPI) 来加密一些数据。我的一个要求是在加密值时使用动态盐。

我通过测试注意到,如果我多次加密同一个字符串,我会得到不同的结果。这是使用相同的字符串、空熵值和相同的范围。

这让我感觉好像已经包含了动态盐。我没有看到任何说明这一点的文档。

这是我调用的方法 https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.protecteddata.protect?view=netframework-4.7.2.

DPAPI 是否已经处理动态加盐?如果不是,是什么导致加密值每次都发生变化?

最佳答案

The MasterKey, however, is not used explicitly to protect the data. Instead, a symmetric session key is generated based on the MasterKey, some random data, and any additional entropy, if an application chooses to supply it. It is this session key that is used to protect the data.

[...]

The session key is never stored. Instead, DPAPI stores the random data it used to generate the key in the opaque data BLOB. When the data BLOB is passed back in to DPAPI, the random data is used to re-derive the key and unprotect the data.

https://msdn.microsoft.com/en-us/library/ms995355.aspx

加密数据中包含的随机数据充当盐。

optionalEntropy 参数的目的是允许各个应用程序保护自己免受同一用户帐户下运行的其他应用程序的影响,并且不需要提高已经执行的加盐的有效性。

关于c# - DPAPI 会自动执行 Dynamic Salt 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54714462/

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