CommonLibSSE (powerof3)
BCRYPT.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "REX/W32/BASE.h"
4 
5 namespace REX::W32
6 {
7  using BCRYPT_HANDLE = void*;
8  using BCRYPT_ALG_HANDLE = void*;
9  using BCRYPT_KEY_HANDLE = void*;
10  using BCRYPT_HASH_HANDLE = void*;
11  using BCRYPT_SECRET_HANDLE = void*;
12 
13  // algorithms
14  inline constexpr auto BCRYPT_RSA_ALGORITHM{ L"RSA" };
15  inline constexpr auto BCRYPT_RSA_SIGN_ALGORITHM{ L"RSA_SIGN" };
16  inline constexpr auto BCRYPT_DH_ALGORITHM{ L"DH" };
17  inline constexpr auto BCRYPT_DSA_ALGORITHM{ L"DSA" };
18  inline constexpr auto BCRYPT_RC2_ALGORITHM{ L"RC2" };
19  inline constexpr auto BCRYPT_RC4_ALGORITHM{ L"RC4" };
20  inline constexpr auto BCRYPT_AES_ALGORITHM{ L"AES" };
21  inline constexpr auto BCRYPT_DES_ALGORITHM{ L"DES" };
22  inline constexpr auto BCRYPT_DESX_ALGORITHM{ L"DESX" };
23  inline constexpr auto BCRYPT_3DES_ALGORITHM{ L"3DES" };
24  inline constexpr auto BCRYPT_3DES_112_ALGORITHM{ L"3DES_112" };
25  inline constexpr auto BCRYPT_MD2_ALGORITHM{ L"MD2" };
26  inline constexpr auto BCRYPT_MD4_ALGORITHM{ L"MD4" };
27  inline constexpr auto BCRYPT_MD5_ALGORITHM{ L"MD5" };
28  inline constexpr auto BCRYPT_SHA1_ALGORITHM{ L"SHA1" };
29  inline constexpr auto BCRYPT_SHA256_ALGORITHM{ L"SHA256" };
30  inline constexpr auto BCRYPT_SHA384_ALGORITHM{ L"SHA384" };
31  inline constexpr auto BCRYPT_SHA512_ALGORITHM{ L"SHA512" };
32  inline constexpr auto BCRYPT_AES_GMAC_ALGORITHM{ L"AES-GMAC" };
33  inline constexpr auto BCRYPT_AES_CMAC_ALGORITHM{ L"AES-CMAC" };
34  inline constexpr auto BCRYPT_ECDSA_P256_ALGORITHM{ L"ECDSA_P256" };
35  inline constexpr auto BCRYPT_ECDSA_P384_ALGORITHM{ L"ECDSA_P384" };
36  inline constexpr auto BCRYPT_ECDSA_P521_ALGORITHM{ L"ECDSA_P521" };
37  inline constexpr auto BCRYPT_ECDH_P256_ALGORITHM{ L"ECDH_P256" };
38  inline constexpr auto BCRYPT_ECDH_P384_ALGORITHM{ L"ECDH_P384" };
39  inline constexpr auto BCRYPT_ECDH_P521_ALGORITHM{ L"ECDH_P521" };
40  inline constexpr auto BCRYPT_RNG_ALGORITHM{ L"RNG" };
41  inline constexpr auto BCRYPT_RNG_FIPS186_DSA_ALGORITHM{ L"FIPS186DSARNG" };
42  inline constexpr auto BCRYPT_RNG_DUAL_EC_ALGORITHM{ L"DUALECRNG" };
43 
44  // properties
45  inline constexpr auto BCRYPT_OBJECT_LENGTH{ L"ObjectLength" };
46  inline constexpr auto BCRYPT_ALGORITHM_NAME{ L"AlgorithmName" };
47  inline constexpr auto BCRYPT_PROVIDER_HANDLE{ L"ProviderHandle" };
48  inline constexpr auto BCRYPT_CHAINING_MODE{ L"ChainingMode" };
49  inline constexpr auto BCRYPT_BLOCK_LENGTH{ L"BlockLength" };
50  inline constexpr auto BCRYPT_KEY_LENGTH{ L"KeyLength" };
51  inline constexpr auto BCRYPT_KEY_OBJECT_LENGTH{ L"KeyObjectLength" };
52  inline constexpr auto BCRYPT_KEY_STRENGTH{ L"KeyStrength" };
53  inline constexpr auto BCRYPT_KEY_LENGTHS{ L"KeyLengths" };
54  inline constexpr auto BCRYPT_BLOCK_SIZE_LIST{ L"BlockSizeList" };
55  inline constexpr auto BCRYPT_EFFECTIVE_KEY_LENGTH{ L"EffectiveKeyLength" };
56  inline constexpr auto BCRYPT_HASH_LENGTH{ L"HashDigestLength" };
57  inline constexpr auto BCRYPT_HASH_OID_LIST{ L"HashOIDList" };
58  inline constexpr auto BCRYPT_PADDING_SCHEMES{ L"PaddingSchemes" };
59  inline constexpr auto BCRYPT_SIGNATURE_LENGTH{ L"SignatureLength" };
60  inline constexpr auto BCRYPT_HASH_BLOCK_LENGTH{ L"HashBlockLength" };
61  inline constexpr auto BCRYPT_AUTH_TAG_LENGTH{ L"AuthTagLength" };
62 }
63 
64 namespace REX::W32
65 {
66  NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE* a_algorithm, const wchar_t* a_id, const wchar_t* a_impl = nullptr, std::uint32_t a_flags = 0);
67  NTSTATUS BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE a_algorithm, std::uint32_t a_flags = 0);
68  NTSTATUS BCryptCreateHash(BCRYPT_ALG_HANDLE a_algorithm, BCRYPT_HASH_HANDLE* a_hash, std::uint8_t* a_hashObject = nullptr, std::uint32_t a_hashObjectSize = 0, std::uint8_t* a_secret = nullptr, std::uint32_t a_secretSize = 0, std::uint32_t a_flags = 0);
70  NTSTATUS BCryptFinishHash(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t a_flags = 0);
71  NTSTATUS BCryptGetProperty(BCRYPT_HANDLE a_object, const wchar_t* a_property, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t* a_result, std::uint32_t a_flags = 0);
72  NTSTATUS BCryptHashData(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_input, std::uint32_t a_inputSize, std::uint32_t a_flags = 0);
73 }
Definition: BSDirectInputManager.h:8
constexpr auto BCRYPT_KEY_STRENGTH
Definition: BCRYPT.h:52
constexpr auto BCRYPT_SHA1_ALGORITHM
Definition: BCRYPT.h:28
NTSTATUS BCryptHashData(BCRYPT_HASH_HANDLE a_hash, std::uint8_t *a_input, std::uint32_t a_inputSize, std::uint32_t a_flags=0)
constexpr auto BCRYPT_KEY_OBJECT_LENGTH
Definition: BCRYPT.h:51
constexpr auto BCRYPT_CHAINING_MODE
Definition: BCRYPT.h:48
void * BCRYPT_HANDLE
Definition: BCRYPT.h:7
constexpr auto BCRYPT_HASH_LENGTH
Definition: BCRYPT.h:56
constexpr auto BCRYPT_HASH_OID_LIST
Definition: BCRYPT.h:57
std::int32_t NTSTATUS
Definition: BASE.h:31
constexpr auto BCRYPT_RNG_DUAL_EC_ALGORITHM
Definition: BCRYPT.h:42
constexpr auto BCRYPT_SHA512_ALGORITHM
Definition: BCRYPT.h:31
constexpr auto BCRYPT_AES_GMAC_ALGORITHM
Definition: BCRYPT.h:32
constexpr auto BCRYPT_RNG_ALGORITHM
Definition: BCRYPT.h:40
constexpr auto BCRYPT_RC4_ALGORITHM
Definition: BCRYPT.h:19
constexpr auto BCRYPT_RSA_SIGN_ALGORITHM
Definition: BCRYPT.h:15
constexpr auto BCRYPT_ECDH_P256_ALGORITHM
Definition: BCRYPT.h:37
constexpr auto BCRYPT_DH_ALGORITHM
Definition: BCRYPT.h:16
constexpr auto BCRYPT_ALGORITHM_NAME
Definition: BCRYPT.h:46
constexpr auto BCRYPT_ECDSA_P521_ALGORITHM
Definition: BCRYPT.h:36
constexpr auto BCRYPT_3DES_112_ALGORITHM
Definition: BCRYPT.h:24
constexpr auto BCRYPT_ECDSA_P384_ALGORITHM
Definition: BCRYPT.h:35
constexpr auto BCRYPT_AUTH_TAG_LENGTH
Definition: BCRYPT.h:61
constexpr auto BCRYPT_MD2_ALGORITHM
Definition: BCRYPT.h:25
constexpr auto BCRYPT_KEY_LENGTHS
Definition: BCRYPT.h:53
constexpr auto BCRYPT_SIGNATURE_LENGTH
Definition: BCRYPT.h:59
NTSTATUS BCryptCreateHash(BCRYPT_ALG_HANDLE a_algorithm, BCRYPT_HASH_HANDLE *a_hash, std::uint8_t *a_hashObject=nullptr, std::uint32_t a_hashObjectSize=0, std::uint8_t *a_secret=nullptr, std::uint32_t a_secretSize=0, std::uint32_t a_flags=0)
NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *a_algorithm, const wchar_t *a_id, const wchar_t *a_impl=nullptr, std::uint32_t a_flags=0)
constexpr auto BCRYPT_ECDSA_P256_ALGORITHM
Definition: BCRYPT.h:34
void * BCRYPT_ALG_HANDLE
Definition: BCRYPT.h:8
constexpr auto BCRYPT_AES_CMAC_ALGORITHM
Definition: BCRYPT.h:33
constexpr auto BCRYPT_ECDH_P521_ALGORITHM
Definition: BCRYPT.h:39
void * BCRYPT_SECRET_HANDLE
Definition: BCRYPT.h:11
constexpr auto BCRYPT_SHA256_ALGORITHM
Definition: BCRYPT.h:29
NTSTATUS BCryptFinishHash(BCRYPT_HASH_HANDLE a_hash, std::uint8_t *a_output, std::uint32_t a_outputSize, std::uint32_t a_flags=0)
constexpr auto BCRYPT_EFFECTIVE_KEY_LENGTH
Definition: BCRYPT.h:55
constexpr auto BCRYPT_BLOCK_SIZE_LIST
Definition: BCRYPT.h:54
NTSTATUS BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE a_algorithm, std::uint32_t a_flags=0)
constexpr auto BCRYPT_PADDING_SCHEMES
Definition: BCRYPT.h:58
void * BCRYPT_KEY_HANDLE
Definition: BCRYPT.h:9
constexpr auto BCRYPT_BLOCK_LENGTH
Definition: BCRYPT.h:49
constexpr auto BCRYPT_KEY_LENGTH
Definition: BCRYPT.h:50
constexpr auto BCRYPT_MD4_ALGORITHM
Definition: BCRYPT.h:26
constexpr auto BCRYPT_SHA384_ALGORITHM
Definition: BCRYPT.h:30
constexpr auto BCRYPT_ECDH_P384_ALGORITHM
Definition: BCRYPT.h:38
constexpr auto BCRYPT_HASH_BLOCK_LENGTH
Definition: BCRYPT.h:60
constexpr auto BCRYPT_DES_ALGORITHM
Definition: BCRYPT.h:21
NTSTATUS BCryptDestroyHash(BCRYPT_HASH_HANDLE a_hash)
constexpr auto BCRYPT_OBJECT_LENGTH
Definition: BCRYPT.h:45
constexpr auto BCRYPT_MD5_ALGORITHM
Definition: BCRYPT.h:27
NTSTATUS BCryptGetProperty(BCRYPT_HANDLE a_object, const wchar_t *a_property, std::uint8_t *a_output, std::uint32_t a_outputSize, std::uint32_t *a_result, std::uint32_t a_flags=0)
constexpr auto BCRYPT_DESX_ALGORITHM
Definition: BCRYPT.h:22
constexpr auto BCRYPT_RNG_FIPS186_DSA_ALGORITHM
Definition: BCRYPT.h:41
constexpr auto BCRYPT_DSA_ALGORITHM
Definition: BCRYPT.h:17
constexpr auto BCRYPT_PROVIDER_HANDLE
Definition: BCRYPT.h:47
constexpr auto BCRYPT_RC2_ALGORITHM
Definition: BCRYPT.h:18
constexpr auto BCRYPT_AES_ALGORITHM
Definition: BCRYPT.h:20
constexpr auto BCRYPT_3DES_ALGORITHM
Definition: BCRYPT.h:23
void * BCRYPT_HASH_HANDLE
Definition: BCRYPT.h:10
constexpr auto BCRYPT_RSA_ALGORITHM
Definition: BCRYPT.h:14