10Duke Enterprise C++ SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
NCryptHandle.h
1
#ifndef TENDUKE_CRYPT_WIN_CNG_NCRYPTHANDLE_H
2
#define TENDUKE_CRYPT_WIN_CNG_NCRYPTHANDLE_H
3
4
#include "log/log.h"
5
#include "../WinCNG_utils.h"
6
#include <windows.h>
7
#include <ncrypt.h>
8
9
namespace
tenduke
{
namespace
crypto
{
namespace
win {
namespace
cng {
10
11
template
<
class
H>
12
class
NCryptHandle
13
{
14
public
:
15
explicit
NCryptHandle(
const
H handle)
16
: handle(handle)
17
{
18
}
19
20
virtual
~NCryptHandle()
21
{
22
if
(handle != 0) {
23
auto
status = ::NCryptFreeObject(handle);
24
25
if
(status != ERROR_SUCCESS) {
26
::tenduke::log::warning
(
27
std::string(
"NCryptFreeObject failed. Ignored. Error code: "
)
28
+ std::to_string(status)
29
+
", message: "
30
+ ::tenduke::crypto::win::cng::getNCryptErrorMessage(status)
31
);
32
}
33
}
34
}
35
36
virtual
H getHandle()
const
37
{
38
return
handle;
39
}
40
41
protected
:
42
H handle;
43
};
44
45
46
}}}}
47
48
#endif
//TENDUKE_CRYPT_WIN_CNG_NCRYPTHANDLE_H
tenduke::crypto
Cryptography services.
Definition
AbstractCiphers.h:12
tenduke::log::warning
void warning(const char *message)
Write message to global logger at WARNING-level.
Definition
log.cpp:94
tenduke
Root for classes, functions and globals of 10Duke C++ Client.
Definition
APIRequest.h:4
core
services
windows
src
crypto
ncrypt
NCryptHandle.h
Generated by
1.17.0