问题标签 [dpapi]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
windows - Is it possible for one process to inject code into another without administrative privileges?
The CryptProtectMemory
API in the DPAPI allows you to pass the CRYPTPROTECTMEMORY_SAME_PROCESS
flag, which prevents other processes from decrypting the memory. One way around this would be to use OpenProcess
, WriteProcessMemory
, and CreateRemoteThread
to inject code into the target process and have it call CryptUnprotectMemory
, thus decrypting the memory and leaking it to the other process.
Assuming both processes are running under the context of the same limited privilege user (i.e. not an administrator) on Windows Vista or later, is this still possible? I was under the impression that process memory write operations were denied to limited users, regardless of the process ACL, but I may be wrong.
encryption - 如何保护 AesCryptoServiceProvider 的 rgbKey?
我们有一个表格,我们保存用户/密码和其他一些数据。每条记录的密码字段都必须加密。我们决定使用 AesCryptoServiceProvider 进行加密,并手动创建了一次 rgbKey。然后加密所有用户密码并将记录插入到我们的表中,其中密码字段使用我们的 rgbKey 加密。
我们在负载均衡器后面有几台服务器,每台服务器都应该读取这些记录并可以解密密码字段值。一开始我们将base64StringFormat中的rgbKey放入我们的dll(API)中,同样所有的服务器都将使用这个API并且可以解密加密的值。
但是,将 rgbKey 保存在 dll 文件中是非常不安全的。我们讨论了是否将密钥保留在 DPAPI 中。在解密时,在我们的任何服务器上,我们将从 DPAPI 获取我们的密钥并成功解密加密值。
我认为我可以在具有当前用户模式的任何服务器中生成一次受保护的密钥,然后将其保存在我们的通用 dll 中。每个使用公共 dll 的服务器,将这个受保护的密钥(字节 [])提供给具有相同用户的 DPAPI,可以获得不受保护的密钥值。但是它只在受保护的机器上工作,在其他机器上它给出错误:“密钥在指定状态下无效。”
我的问题是如何保护我的永久 rgbKey 以便我可以从所有机器访问它?看看下面类似的测试控制台应用程序,我的方法有什么问题?
我为我的测试控制台应用程序提供了一个示例代码:
首先,我在本地机器上运行我的 PDPAPI() 函数:
然后硬编码添加到我的 UDPAPI() 函数 base64ProtectedData 从上述执行中获得的值,重建解决方案:
现在,如果我在本地机器上运行 UDPAPI() 函数,它会成功取消保护数据,但是如果我将控制台应用程序迁移到任何其他服务器,并使用我的网络用户登录该服务器,控制台应用程序会给出错误“密钥无效在指定状态下使用。”。
c# - 在每个 C# 应用程序中可以找到哪些信息用作加密的唯一盐?
在每个 C# 应用程序中可以找到哪些信息可以用作加密的唯一盐,包括 Web 应用程序、Windows 服务和 wcf 层?
我想创建一个库,允许使用(DPAPI)System.Security.Cryptography.ProtectedData.Protect()
和System.Security.Cryptography.ProtectedData.Unprotect()
方法轻松加密存储在配置文件中的敏感数据。
该库还将由我正在制作的一个单独的应用程序使用,该应用程序可以在使用这些值的应用程序之外加密和解密配置值,允许更新配置文件而无需重新编译所有内容或需要访问原始源,尽管访问源应始终可用。
盐必须足够简单,以便在单独的应用程序中手动输入(例如,很难识别 GUID)。
System.Reflection.Assembly.GetEntryAssembly()
看起来很有希望,如果这是调用我正在制作的这个库的应用程序/服务的程序集,我可以在那里使用一些东西。第一个想法是“将 salt 设置为存储加密数据的配置文件名......”,但对于网站来说,配置文件始终是 'web.config'。
欢迎任何其他想法。
更新...
'GetExecutingAssembly()'...与'GetEntryAssembly()' 有何不同?
c# - ProtectedData 使用哪种加密算法?
对于我想使用的密码加密ProtectedData
。
据我所知,这是CryptProtectData
.
MSDN 仅对基于用户凭据的加密进行了模糊说明,并且如果用户没有漫游配置文件,通常必须在同一台机器上进行解密。
它使用哪种加密算法?
是否有任何分析表明这种加密是否适合密码存储?
如何实现本地密码存储?
rpc - 受隐私保护的 RPC 通道
正如标题所说,我想知道这些是什么。我知道 RPC,但前缀形容词是什么意思?
PS:我在阅读 DPAPI @ MSDN 时遇到了这个术语:http: //msdn.microsoft.com/en-IN/library/ms995355.aspx#windataprotection-dpapi_topic04(在第 6 点中)
windows - DPAPI:在用户登录之前使用 CryptUnprotect
我正在使用 DPAPI 来存储 XML 数据。CryptProtectData 之后的数据存储在一个文件中。在我的一个用例中,需要在任何用户登录工作站之前解密此数据。因为,我不能在其中使用用户特定的密钥,所以我在加密时设置了标志“CRYPTPROTECT_LOCAL_MACHINE”。熵键是静态文本。
Unprotect 在所有情况下都有效,除非我在登录前调用它(没有用户登录)。其返回错误 87(参数不正确)。
我重新阅读了整个 DPAPI 文档以查看密钥是如何生成的。但是,不幸的是,对于这个特定的标志没有足够的信息。
CryptUnprotectData 会在这种情况下工作吗?它可以被在某个用户会话下运行的应用程序调用吗?任何帮助表示赞赏。
感谢:D
windows - DPAPI 在 C++ 应用程序中加密,在 C# 应用程序中解密
我想在基于 C++ 的应用程序中加密数据,将其存储在文件中,然后在其他 C# 应用程序中解密。我可以使用相应的 DPAPI 部件吗?
是否可以使用 保护 C++ 应用程序中的数据CryptProtectData()
,将其写入文件,然后从其他基于 C# 的应用程序读取此文件并使用ProtectedData
Unprotect()
方法解密?
是否有更好的方法在 C++ 和 C# 应用程序之间以安全的方式共享数据,以确保普通用户(不是绝对安全)的方式。
windows - 从 Windows 登录使用 DPAPI
我想在 Windows 登录阶段读取和取消保护一些数据,这些数据在某些用户下使用CryptProtectData()
带有CRYPTPROTECT_LOCAL_MACHINE
标志的 DPAPI 进行保护。或者只有在真实操作系统的用户下登录后才有可能?
c# - 数据保护 API 范围:LocalMachine 和 CurrentUser
我们有一个应用程序将数据加密/解密为DataProtectionScope.LocalMachine
. 我们现在必须将范围更改为DataProtectionScope.CurrentUser
.
LocalMachine
当范围更改为时,在范围下加密的现有字符串是否仍然可读CurrentUser
,当然假设用户登录到同一台机器?
编辑:我写了一个非常快速和肮脏的测试应用程序。奇怪的是,在同一台计算机上,我可以解密在 LocalMachine 或 CurrentUser 范围下由 LocalMachine 和 CurrentUser 范围加密的字符串。这听起来不像是正确的行为,求助!
c# - CryptographicException - Unable to update the password
I have some data I wish to protect, so I am using ProtectedData
to encrypt it onto a file.
When I am attempting to read and decrypt the data I am getting the strangest exception:
CryptographicException - Unable to update the password. The value provided for the new password does not not meet the length, complexity, or history requirements of the domain.
This is where it is thrown:
It also happens when using DataProtectionScope.CurrentUser
.
I haven't found any information about this exception online so I'm pretty much clueless.