10Duke Enterprise C++ Client
Loading...
Searching...
No Matches
WinCNGMessageDigestFactory.h
1#ifndef TENDUKE_CRYPTO_WIN_CNG_WINCNGMESSAGEDIGESTFACTORY_H
2#define TENDUKE_CRYPTO_WIN_CNG_WINCNGMESSAGEDIGESTFACTORY_H
3
4#include "crypto/MessageDigestFactory.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::MessageDigest::Algorithm 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 WinCNGMessageDigestFactory : public ::tenduke::crypto::MessageDigestFactory
34{
35
36public:
37 WinCNGMessageDigestFactory();
38
39 // ::tenduke::crypt::MessageDigestFactory implementation
40public:
41 std::unique_ptr<::tenduke::crypto::MessageDigest> create(::tenduke::crypto::MessageDigest::Algorithm algorithm) const override;
42
43private:
44 const std::shared_ptr<WinCNGAlgorithms> algorithms;
45};
46
47}}}}
48
49#endif //TENDUKE_CRYPTO_WIN_CNG_WINCNGMESSAGEDIGESTFACTORY_H
Creates instances of tenduke::crypto::MessageDigest.
Definition MessageDigestFactory.h:12
Algorithm
Supported algorithms.
Definition MessageDigest.h:24
Cryptography services.
Definition CryptoException.h:7
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4