Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GrayLib::cCipherRotary Class Reference

#include <cCipherRotary.h>

Inheritance diagram for GrayLib::cCipherRotary:
GrayLib::cCipherBase Gray::CObject ICipherBase

Public Member Functions

 cCipherRotary (bool bEncodeMode=true)
 
virtual ~cCipherRotary ()
 
virtual HRESULT SetCipherKey (const void *pKeyData=nullptr, size_t nKeySize=0) override
 
virtual HRESULT Cipher (BYTE *pOutput, const BYTE *pInput, size_t nSizeBytes) override
 
 UNITTEST_FRIEND (cCipherRotary)
 
- Public Member Functions inherited from GrayLib::cCipherBase
 cCipherBase (bool bEncodeMode=true, CIPHER_BLOCK_TYPE eBlockMode=CIPHER_BLOCK_UNK) noexcept
 
virtual ~cCipherBase ()
 
void put_EncodeMode (bool bEncodeMode) noexcept
 
bool get_EncodeMode () const noexcept
 
void put_BlockMode (CIPHER_BLOCK_TYPE eBlockMode) noexcept
 
virtual size_t get_BlockAlignSize () const override
 
virtual HRESULT CipherModeECB (BYTE *pOutput, const BYTE *pInput)
 
virtual HRESULT CipherModeCBC (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pIV)
 
virtual HRESULT CipherModeCFB (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pIV, size_t *pIVOffset)
 
virtual HRESULT CipherModeCTR (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pNonceCounter, size_t *pNCOffset, BYTE *pStreamBlock)
 
- Public Member Functions inherited from Gray::CObject
virtual ~CObject ()
 
virtual bool isValidCheck () const noexcept
 < memory allocation and structure definitions are valid. More...
 
virtual void AssertValid () const
 < memory allocation and structure definitions are valid. More...
 
virtual void Serialize (cArchive &a)
 

Protected Member Functions

bool isMasterKeySet () const
 
bool InitCryptMasterKey (UINT32 dwVersion, UINT32 dwKeyHi, UINT32 dwKeyLo)
 
HRESULT put_CipherKey (UINT32 uSeed)
 

Additional Inherited Members

- Static Public Member Functions inherited from GrayLib::cCipherBase
static size_t GRAYCALL CopyFillX (void *pOutput, size_t nOutSize, const void *pInput, size_t nInputSize)
 
- Protected Attributes inherited from GrayLib::cCipherBase
bool m_bEncodeMode
 We are in encode/encrypt mode vs decode/decrypt mode. More...
 
CIPHER_BLOCK_TYPE m_eBlockMode
 Cipher block mode. How are sequences of blocks treated? More...
 

Detailed Description

Simple rotary encrypt/decrypt interface. Fast and cheap. no BlockAlignSize.

Constructor & Destructor Documentation

◆ cCipherRotary()

GrayLib::cCipherRotary::cCipherRotary ( bool  bEncodeMode = true)

◆ ~cCipherRotary()

GrayLib::cCipherRotary::~cCipherRotary ( )
virtual

Member Function Documentation

◆ Cipher()

HRESULT GrayLib::cCipherRotary::Cipher ( BYTE *  pOutput,
const BYTE *  pInput,
size_t  nSizeBytes 
)
overridevirtual

Symmetric cipher.

Note
pOutput == pInput is OK.
Returns
<0 = error. Amount of data i could actually process (some may be dropped for alignment)

Reimplemented from GrayLib::cCipherBase.

◆ InitCryptMasterKey()

bool GrayLib::cCipherRotary::InitCryptMasterKey ( UINT32  dwVersion,
UINT32  dwKeyHi,
UINT32  dwKeyLo 
)
protected

◆ isMasterKeySet()

bool GrayLib::cCipherRotary::isMasterKeySet ( ) const
inlineprotected

◆ put_CipherKey()

HRESULT GrayLib::cCipherRotary::put_CipherKey ( UINT32  uSeed)
protected

Generate the decrypt key based on the uSeed/IP we get from the client.

  • uSeed is usually an IP address for the connection.

◆ SetCipherKey()

HRESULT GrayLib::cCipherRotary::SetCipherKey ( const void *  pKeyData = nullptr,
size_t  nKeySize = 0 
)
overridevirtual

Reimplemented from GrayLib::cCipherBase.

◆ UNITTEST_FRIEND()

GrayLib::cCipherRotary::UNITTEST_FRIEND ( cCipherRotary  )

The documentation for this class was generated from the following files: