在 Rust 中是否有等同于 win32crypt.CryptUnprotectData() 的 Rust

Is there a Rust equivalent to win32crypt.CryptUnprotectData() in Rust

在Python中,pywin32库提供了一个名为win32crypt的模块,它有一个名为CryptUnpotectData的方法来解密Windows加密数据,方法是使用Windows API.

这就是我在 Python 中应用它的方式:

import win32crypt
# ...
password = win32crypt.CryptUnprotectData(EncrytedPassword, None, None, None, 0)

我找到了 winapi but I can't find the CryptUnprotectData function, the closest I found to an equivalent is the CryptDecrypt function 的绑定。

这是我在 Rust 中的实现:

extern crate winapi;
let decrypted_password = winapi::um::wincrypt::CryptDecrypt(/* ???? */);

我不确定如何使用此功能以及它是否会解密我的加密密码字符串和 return。如果更有经验的 Rust 用户可以通过示例或解释为我阐明这一点,我会很高兴。

如果你去 documentation for winapi (linked from the crate page as well as the README),你会发现一个很大的搜索框:

如果您在该搜索框中键入 "CryptUnprotectData",您将收到 3 个结果:

点击第一个结果将引导您进入特定功能,CryptUnprotectData. As described in ,您需要使用适当的功能标志来启用该功能 (dpapi)。

正如自述文件所述:

Why is there no documentation on how to use anything?

This crate is nothing more than raw bindings to Windows API. If you wish to know how to use the various functionality in Windows API, you can look up the various items on MSDN which is full of detailed documentation.

这个函数的用法是described on MSDN