我问这个问题是因为我花了一天的大部分时间来浏览 msdn 文档和其他不透明的来源,以获取有关如何开始使用 Windows C/C++ Crypto API 的简单直接指南。
我想看到的是一些示例代码,典型的包含路径,链接指南等,任何真正有用的东西。我知道这是一个不精确的问题,但我认为不精确的答案更好。
我会用我自己微薄的发现开始行动......
I'm asking this question because I've spent the best part of a day trawling through msdn docs and other opaque sources for simple straightforward guidelines on how to get started with the Windows C/C++ Crypto API.
What I'd like to see is some example code, typical include paths, linking guidelines, etc, anything useful really. I know this is an imprecise question but I reckon imprecise answers are better none at all.
I'll get the ball rolling with my own meager findings...
发布评论
评论(4)
这是我发现的一堆例子......
MSDN 将这些示例分散在 文档
此网站 提供了概念的良好概述以及跨平台示例
Here's a bunch of examples I've found....
MSDN has these examples scattered around the docs
This website provides a good overview of the concepts along with cross-platform examples
msdn 文档位于:http://msdn.microsoft.com/en-us/library/aa380252。 aspx
这是主要包含文件:
#include
加密位作为 Windows SDK,通常安装在
%PROGRAMFILES(x86)%\Microsoft SDKs\Windows\SDKVERSION
中(例如C: \Program Files\Microsoft SDKs\Windows\v6.0A
)。标头通常位于%WINDOWSSDK%\Include
中,相关库位于%WINDOWSSDK%\Lib
中。您必须显式链接到加密库。假设您在 Visual Studio 中,您可以通过右键单击 C++ 项目、选择属性并选择“配置属性”->“添加引用”。左侧树视图上的链接器。然后,您可以在右侧的输入字段中指定
crypt32.lib
。或者,(假设您使用的是 msvc++)添加
到您的源代码中。
The msdn docs are here: http://msdn.microsoft.com/en-us/library/aa380252.aspx
This is the main include file:
#include <wincrypt.h>
The cryptography bits are included as part of the Windows SDK, which is typically installed in
%PROGRAMFILES(x86)%\Microsoft SDKs\Windows\SDKVERSION
(e.g.,C:\Program Files\Microsoft SDKs\Windows\v6.0A
). The headers are typically in%WINDOWSSDK%\Include
, and the related libraries are in%WINDOWSSDK%\Lib
.You must link to the cryptography libraries explicitly. Assuming you're in Visual Studio, you can add the reference by right clicking on the C++ project, choosing properties, and selecting Configuration Properties -> Linker on the treeview at left. You can then specify
crypt32.lib
in the input field on the right.Alternately, (assuming you're using msvc++) add
to your source.
还有一个冗长的示例 "使用Win32 Crypto API”位于代码项目。
There is also a lengthy example "Encryption using the Win32 Crypto API" over at the Code Project.
搜索了几个小时后,我在这里找到了这个: https://learn.microsoft.com/en-us/troubleshoot/windows/win32/get-information-authenticode-signed-executables
很详细,而且很有效。
After searching for several hours, I found this one here: https://learn.microsoft.com/en-us/troubleshoot/windows/win32/get-information-authenticode-signed-executables
It's detailed, and it works.