6 #ifndef _INC_cKeyWrap_H
7 #define _INC_cKeyWrap_H
18 #include "../File/cASNWriterRev.h"
19 #include "../Hash/cHashWrap.h"
20 #include "../SSL/SSLTypes.h"
49 : m_pKeyTypeDef(nullptr)
69 if (pHashType ==
nullptr)
86 if ( this->m_pKeyTypeDef ==
nullptr)
95 if ( this->m_pKeyBase ==
nullptr)
97 return this->m_pKeyBase->get_KeySize();
106 if (this->m_pKeyTypeDef ==
nullptr)
108 return this->m_pKeyTypeDef->
HasKeyType(eKeyType);
115 if ( this->m_pKeyTypeDef ==
nullptr)
125 if ( this->m_pKeyBase ==
nullptr)
127 return this->m_pKeyBase->GetKeyValues(items);
155 HRESULT ReadPublicKey(
const BYTE* pKey,
size_t nSizeKey);
165 HRESULT ReadPrivateKeyFile(
const FILECHAR_t* pszFilePath,
const char* pszPassword);
226 HRESULT VerifySignature(
SSL_Hash_TYPE eHashType,
const BYTE* pHash,
size_t nSizeHash,
const BYTE* pSig,
size_t nSizeSig)
const;
257 HRESULT DecryptWithKey(BYTE* pOut,
size_t nSizeOut,
const BYTE* pInp,
size_t nSizeIn,
IRandomNoise* pRandom);
268 HRESULT EncryptWithKey(BYTE* pOut,
size_t nSizeOut,
const BYTE* pInp,
size_t nSizeIn,
IRandomNoise* pRandom);
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cASNReader.h:22
Definition: cASNWriterRev.h:22
Definition: cHashTypeDef.h:21
size_t get_HashSize() const noexcept
Definition: cHashTypeDef.h:52
Definition: cKeyECPPair.h:24
Definition: cKeyTypeDef.h:22
SSL_Key_TYPE const m_eKeyType
Public key type.
Definition: cKeyTypeDef.h:27
const char *const m_pszName
Type name.
Definition: cKeyTypeDef.h:28
virtual bool HasKeyType(SSL_Key_TYPE eKeyType) const noexcept=0
Tell if the context implements this type (e.g. ECKEY can do ECDSA)
Definition: cKeyWrap.h:25
static const char * k_pszPEM_RSAPK
"RSA PRIVATE KEY"
Definition: cKeyWrap.h:34
cKeyWrap()
Definition: cKeyWrap.h:48
const char * get_KeyTypeName() const
Definition: cKeyWrap.h:82
static const char * k_pszPEM_EPK
"ENCRYPTED PRIVATE KEY"
Definition: cKeyWrap.h:37
~cKeyWrap()
Definition: cKeyWrap.h:52
static bool GetHashSize(SSL_Hash_TYPE eHashType, size_t *pnHashSize)
Definition: cKeyWrap.h:63
HRESULT GetKeyValues(cKeyBase::cValue *items) const
Definition: cKeyWrap.h:120
static const char * k_pszPEM_PK
"PRIVATE KEY"
Definition: cKeyWrap.h:36
static const char * k_pszPEM_Pub
"PUBLIC KEY"
Definition: cKeyWrap.h:38
const cKeyTypeDef * m_pKeyTypeDef
Metadata about key type.
Definition: cKeyWrap.h:31
static const char * k_pszPEM_EC
"EC PRIVATE KEY"
Definition: cKeyWrap.h:35
size_t get_KeySize() const
Definition: cKeyWrap.h:91
bool isZeroKey() const
Definition: cKeyWrap.h:57
cRefPtr< cKeyBase > m_pKeyBase
Underlying key instance.
Definition: cKeyWrap.h:32
SSL_Key_TYPE get_KeyType() const
Definition: cKeyWrap.h:111
bool HasKeyType(SSL_Key_TYPE eKeyType) const noexcept
Definition: cKeyWrap.h:100
Definition: cRefPtr.h:225
static cHashTypeMgr &__stdcall I()
Definition: cSingleton.h:199
SSL_SIG_TYPE
Definition: SSLTypes.h:132
SSL_Key_TYPE
Definition: cKeyBase.h:24
@ SSL_Key_NONE
Definition: cKeyBase.h:28
SSL_Hash_TYPE
Definition: cHashCode.h:23
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
Definition: cKeyBase.h:74
Definition: cKeyBase.h:40