Cannot call CryptDecrypt from the WinApi crate bec

2019-07-11 05:44发布

In the documentation it says that the function is in winapi::um::wincrypt::CryptDecrypt but when I install the crate and bring it in my project everything works fine until I try to call the function where I get the following error message:

error[E0433]: failed to resolve. Could not find `wincrypt` in `um`
  --> src\main.rs:68:39
   |
68 |  let decrypted_password = winapi::um::wincrypt::CryptDecrypt(password);
   |                                       ^^^^^^^^ Could not find `wincrypt` in `um`

My goal is to decrypt passwords from the "Local Data" file on my computer where Chrome stores passwords. I am using the Windows win32crypt API binding called winapi in Rust. I am trying to accomplish something similar to chromepass but in Rust.

1条回答
对你真心纯属浪费
2楼-- · 2019-07-11 06:12

From the crate-level documentation:

Frequently asked questions

Why am I getting errors about unresolved imports?

Each module is gated on a feature flag, so you must enable the appropriate feature to gain access to those items. For example, if you want to use something from winapi::um::winuser you must enable the winuser feature.

In this case, you need to add wincrypt:

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["wincrypt"] }
查看更多
登录 后发表回答