10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
WinCNGHashFactory.h
1#ifndef TENDUKE_CRYPTO_WIN_CNG_WINCNGHASHFACTORY_H
2#define TENDUKE_CRYPTO_WIN_CNG_WINCNGHASHFACTORY_H
3
4#include "crypto/msgauthn/HashFactory.h"
5
6#include <mutex>
7
8#include <windows.h>
9#include <bcrypt.h>
10
11namespace tenduke { namespace crypto { namespace win { namespace cng {
12
13class WinCNGAlgorithms
14{
15
16public:
17 WinCNGAlgorithms();
18 ~WinCNGAlgorithms();
19
20public:
21 ::BCRYPT_ALG_HANDLE get(::tenduke::crypto::HashAlgorithm algorithm);
22
23private:
24 // Very simple, we only support one alg.
25 ::BCRYPT_ALG_HANDLE sha256Handle;
26 std::recursive_mutex mutex;
27};
28
29
33class WinCNGHashFactory : public ::tenduke::crypto::HashFactory
34{
35
36public:
37 WinCNGHashFactory();
38
39 // ::tenduke::crypto::HashFactory implementation
40public:
41 std::unique_ptr<::tenduke::crypto::CryptographicHash> create(::tenduke::crypto::HashAlgorithm algorithm) const override;
42
43private:
44 const std::shared_ptr<WinCNGAlgorithms> algorithms;
45};
46
47}}}}
48
49#endif //TENDUKE_CRYPTO_WIN_CNG_WINCNGHASHFACTORY_H
Creates cryptographic hash functions.
Definition HashFactory.h:13
std::unique_ptr<::tenduke::crypto::CryptographicHash > create(::tenduke::crypto::HashAlgorithm algorithm) const override
Creates a new message digest.
Definition WinCNGHashFactory.cpp:65
Cryptography services.
Definition AbstractCiphers.h:18
HashAlgorithm
Currently supported hash algorithms.
Definition HashAlgorithm.h:13
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4