1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
// crypt.hpp --------------------------------------------------------------//
// Copyright 2014 Antony Polukhin
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_DETAIL_WINAPI_CRYPT_HPP
#define BOOST_DETAIL_WINAPI_CRYPT_HPP
#include <boost/detail/winapi/basic_types.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost
{
namespace detail
{
namespace winapi
{
#if defined( BOOST_USE_WINDOWS_H )
typedef HCRYPTPROV HCRYPTPROV_;
using ::CryptEnumProvidersA;
using ::CryptAcquireContextA;
using ::CryptGenRandom;
using ::CryptReleaseContext;
const DWORD_ PROV_RSA_FULL_ = PROV_RSA_FULL;
const DWORD_ CRYPT_VERIFYCONTEXT_ = CRYPT_VERIFYCONTEXT;
const DWORD_ CRYPT_NEWKEYSET_ = CRYPT_NEWKEYSET;
const DWORD_ CRYPT_DELETEKEYSET_ = CRYPT_DELETEKEYSET;
const DWORD_ CRYPT_MACHINE_KEYSET_ = CRYPT_MACHINE_KEYSET;
const DWORD_ CRYPT_SILENT_ = CRYPT_SILENT;
#else
extern "C" {
typedef ULONG_PTR_ HCRYPTPROV_;
__declspec(dllimport) BOOL_ __stdcall
CryptEnumProvidersA(
DWORD_ dwIndex,
DWORD_ *pdwReserved,
DWORD_ dwFlags,
DWORD_ *pdwProvType,
LPSTR_ szProvName,
DWORD_ *pcbProvName
);
__declspec(dllimport) BOOL_ __stdcall
CryptAcquireContextA(
HCRYPTPROV_ *phProv,
LPCSTR_ pszContainer,
LPCSTR_ pszProvider,
DWORD_ dwProvType,
DWORD_ dwFlags
);
__declspec(dllimport) BOOL_ __stdcall
CryptGenRandom(
HCRYPTPROV_ hProv,
DWORD_ dwLen,
BYTE_ *pbBuffer
);
__declspec(dllimport) BOOL_ __stdcall
CryptReleaseContext(
HCRYPTPROV_ hProv,
DWORD_ dwFlags
);
const DWORD_ PROV_RSA_FULL_ = 1;
const DWORD_ CRYPT_VERIFYCONTEXT_ = 0xF0000000;
const DWORD_ CRYPT_NEWKEYSET_ = 8;
const DWORD_ CRYPT_DELETEKEYSET_ = 16;
const DWORD_ CRYPT_MACHINE_KEYSET_ = 32;
const DWORD_ CRYPT_SILENT_ = 64;
}
#endif
}
}
}
#endif // BOOST_DETAIL_WINAPI_CRYPT_HPP
|