Thanks a lot for your help. I succeeded in running your example.
Unfortunately for me, using the CALG_SHA_256 the function return 0 and with CALG_SHA1 the programme run until the end but find as encrypted value:
I tried to understand why (I am really a beginner).
Edit: I succed to use both CALG_SHA1 and CALG_SHA_256 .
For inforation, to use CALG_SHA_256 it is necessary to replace PROV_Rsa_Full with PROV_RSA_AES in the CryptAcquireContextW function.
- Founder/Site Admin
- Posts: 472
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Some tips on getting info on Windows API, like constant values.
First, Always check the MSDN page on the function you want to use.
In some cases, constant values are listed with their actual values.
But mostly, they are just listed without the values and you need to search further.
Second, based on the info on MSDN (having a sample in c++, C# etc) you can use Visual Studio to get the constant values.
When you do not have a licensed VS installation, you can always use a free version.
Having an IDE which contains the Windows SDK (header files, libs etc) you can easily locate the needed constant value.
Also, most of the Windows API is described in Wine, a Windows OS emulator/lib for other operating systems like Linux.
As an example, Wine implements the wincrypt library and the header file (wincrypt.h) can be inspected online:
https://github.com/wine-mirror/wine/blo ... wincrypt.h
There you can search for the value you want:
Code: Select all
1878 /* Provider Types */ 1879 #define PROV_RSA_FULL 1 1880 #define PROV_RSA_SIG 2 1881 #define PROV_DSS 3 1882 #define PROV_FORTEZZA 4 1883 #define PROV_MS_EXCHANGE 5 1884 #define PROV_SSL 6 1885 #define PROV_RSA_SCHANNEL 12 1886 #define PROV_DSS_DH 13 1887 #define PROV_EC_ECDSA_SIG 14 1888 #define PROV_EC_ECNRA_SIG 15 1889 #define PROV_EC_ECDSA_FULL 16 1890 #define PROV_EC_ECNRA_FULL 17 1891 #define PROV_DH_SCHANNEL 18 1892 #define PROV_SPYRUS_LYNKS 20 1893 #define PROV_RNG 21 1894 #define PROV_INTEL_SEC 22 1895 #define PROV_REPLACE_OWF 23 1896 #define PROV_RSA_AES 24
There is also a Team Developer library, named WinApi32 declarations archive.
It contains not only API constants, but a lot of API declarations for the functions themselves.
But not everything is added to the library. The wincrypt constants seem not to be listed.
It is worth a try to look into the library to find the API declarations you need.
This library is described here:
Who is online
Users browsing this forum: No registered users and 0 guests