Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cCipherCCM.h
Go to the documentation of this file.
1 //
5 //
6 #ifndef _INC_cCipherCCM_H
7 #define _INC_cCipherCCM_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cCipherBase.h"
13 #include "cCipherTypeDef.h"
14 
15 namespace GrayLib
16 {
18  {
22 
23  private:
24  HRESULT AuthCrypt(BYTE* pOutput, const BYTE* pInput, size_t nSize, const BYTE* pIV, size_t nIVSize,
25  const BYTE* pAdd, size_t add_len, BYTE* pTag, size_t tag_len);
26 
27  public:
28  cCipherCCM(bool bEncodeMode, CipherAlgorithm_TYPE eCipherAlgorithm)
29  : cCipherBlockBase(bEncodeMode, eCipherAlgorithm)
30  {
31  }
32  virtual ~cCipherCCM()
33  {
34  }
35 
36  virtual HRESULT SetCipherKey(const void* pKeyData, size_t nKeySize) override;
37 
38  virtual HRESULT AuthEncrypt(BYTE* pOutput, const BYTE* pInput, size_t nSize,
39  const BYTE* pIV, size_t nSizeIV,
40  const BYTE* pAdd, size_t nSizeAdd,
41  BYTE* pTag, size_t nSizeTag) override;
42 
43  virtual HRESULT AuthDecrypt(BYTE* pOutput, const BYTE* pInput, size_t nSize,
44  const BYTE* pIV, size_t nSizeIV,
45  const BYTE* pAdd, size_t nSizeAdd,
46  const BYTE* pTag, size_t nSizeTag) override;
47 
49  };
50 
52  {
55  public:
57  {
58  }
59  virtual cCipherBase* AllocCipherAlg(bool bEncodeMode) const
60  {
61  return new cCipherCCM(bEncodeMode, CipherAlgorithm_AES);
62  }
63  };
64 
66  {
69  public:
71  {
72  }
73  virtual cCipherBase* AllocCipherAlg(bool bEncodeMode) const
74  {
75  return new cCipherCCM(bEncodeMode, CipherAlgorithm_Camellia);
76  }
77  };
78 }
79 
80 #endif // _INC_cCipherCCM_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cCipherCCM.h:52
cCipherAlgCCM_AES()
Definition: cCipherCCM.h:56
virtual cCipherBase * AllocCipherAlg(bool bEncodeMode) const
Definition: cCipherCCM.h:59
Definition: cCipherCCM.h:66
cCipherAlgCCM_Camellia()
Definition: cCipherCCM.h:70
virtual cCipherBase * AllocCipherAlg(bool bEncodeMode) const
Definition: cCipherCCM.h:73
Definition: cCipherTypeDef.h:67
Definition: cCipherBase.h:125
Definition: cCipherBase.h:234
Definition: cCipherCCM.h:18
virtual ~cCipherCCM()
Definition: cCipherCCM.h:32
cCipherCCM(bool bEncodeMode, CipherAlgorithm_TYPE eCipherAlgorithm)
Definition: cCipherCCM.h:28
UNITTEST_FRIEND(cCipherCCM)
Definition: cMesh.h:22
CipherAlgorithm_TYPE
Definition: cCipherBase.h:22
@ CipherAlgorithm_CCM_Camellia
Definition: cCipherBase.h:37
@ CipherAlgorithm_AES
Definition: cCipherBase.h:29
@ CipherAlgorithm_Camellia
Definition: cCipherBase.h:30
@ CipherAlgorithm_CCM_AES
Definition: cCipherBase.h:36