Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cSecureServerStream Class Reference

#include <cSecureChannel.h>

Inheritance diagram for GrayLib::cSecureServerStream:
Gray::cRefBase GrayLib::cSecureChannel GrayLib::cProtocolStream IUnknown

Public Member Functions

 cSecureServerStream (cSecureServerFactory *pFactory, IUnkObject *pServerConnection, cStreamInput *pStreamInp, cStreamOutput *pStreamOut)
 
virtual ~cSecureServerStream ()
 
 IUNKNOWN_DISAMBIG (cRefBase)
 
virtual HRESULT DisposeThis () override
 
HASHCODE_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept override
 
cStreamInputget_SecureInp () const
 
cStreamOutputget_SecureOut () const
 
virtual HRESULT SetStateSecure ()
 
virtual HRESULT ProcessStreamPacket () override
 
- Public Member Functions inherited from Gray::cRefBase
 cRefBase (int iRefCount=0) noexcept
 
virtual ~cRefBase ()
 
int get_RefCount () const noexcept
 
HASHCODE_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept
 
virtual void onFinalRelease ()
 
bool isValidObj () const noexcept
 
 STDMETHOD_ (ULONG, AddRef)(void) override
 
 STDMETHOD_ (ULONG, Release)(void) override
 
STDMETHOD() QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
 
void IncRefCount ()
 
void DecRefCount ()
 
bool isStaticConstruct () const noexcept
 
void StaticConstruct ()
 
void StaticDestruct ()
 
bool isDestructing () noexcept
 
void SetDestructing ()
 
- Public Member Functions inherited from GrayLib::cSecureChannel
 cSecureChannel ()
 
virtual ~cSecureChannel ()
 
STATE_TYPE get_State () const noexcept
 
bool isStateSecure () const noexcept
 
cStreamInputget_SecureInp () const
 
cStreamOutputget_SecureOut () const
 
 UNITTEST_FRIEND (cSecureChannel)
 
- Public Member Functions inherited from GrayLib::cProtocolStream
 cProtocolStream (IProtocolFactory *pProtocolFactory, IUnkObject *pServerConnection, cStreamInput *pStreamInp, cStreamOutput *pStreamOut)
 
virtual ~cProtocolStream ()
 
HASHCODE_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept override
 
 STDMETHOD_ (cString, get_Name)() const override
 
 STDMETHOD_ (cStringA, get_SymName)() const override
 
bool isConnected () const
 
cStreamInputget_StreamInp () const
 
cStreamOutputget_StreamOut () const
 
virtual size_t get_ProtocolMaxMessageSize () const
 
virtual HRESULT OnTickStream ()
 

Public Attributes

cProtocolStreamPtr m_pProtocol2
 The protocol wrapped by this cSecureServerStream. More...
 
- Public Attributes inherited from GrayLib::cSecureChannel
cHashCode m_Challenge
 the random data used to form the challenge. part of crypto key for data stream. More...
 
cHashCode m_HashPass
 The working PASSCODE for login. More...
 
cSecureId m_Id
 My USERNAME and APPNAME. More...
 
- Public Attributes inherited from GrayLib::cProtocolStream
IProtocolFactory *const m_pProtocolFactory
 What IProtocolFactory produced this? More...
 
IUnkObject *const m_pServerConnection
 the cNetServerConnection or other top level parent for this protocol. More...
 
HASHCODE_t const m_nHashCode
 the m_pClient->get_HashCode() id for this client connection/stream. More...
 

Static Public Attributes

static const size_t k_ChallengeSize = cSecureHash::k_Size
 default size in bytes of the random seed. 64 = 512 bits. server can change this if it wants. More...
 

Friends

class cSecureServerFactory
 

Additional Inherited Members

- Public Types inherited from GrayLib::cSecureChannel
enum  STATE_TYPE {
  STATE_0 = 0 , Client_Knock , Server_Challenge , Client_Login ,
  STATE_Secure , STATE_Failed
}
 
- Static Public Member Functions inherited from GrayLib::cSecureChannel
static void GRAYCALL ComputeHash (OUT cSecureHash &rHash, const cHashCode &r1, const cHashCode &r2)
 
- Protected Member Functions inherited from GrayLib::cSecureChannel
HRESULT GetCipher (OUT cNewPtr< cCipherBase > &rCipher, bool bEncodeMode, const cSecureHash &hashKey)
 
- Protected Attributes inherited from GrayLib::cSecureChannel
STATE_TYPE m_eState
 current state of the negotiation of the connection. More...
 
cSecureKnock::CIPHER_TYPE m_eCipherType
 the selected crypto type. <0=Failed login, 0=no crypt by choice, 1=cCipherRC4, 2=cCipherBlowfish More...
 
cNewPtr< cCipherBasem_pCipherEnc
 the selected encryption of the channel. More...
 
cNewPtr< cStreamCipherEncm_pCipherOut
 m_pCipher as a encrypt/output stream. pads to get_BlockAlignSize(). m_pCipherEnc More...
 
cNewPtr< cCipherBasem_pCipherDec
 the selected decryption of the channel. More...
 
cNewPtr< cStreamCipherDecm_pCipherInp
 m_pCipher as a decrypt/input stream. m_pCipherDec More...
 
- Protected Attributes inherited from GrayLib::cProtocolStream
cStreamInputm_pStreamInp
 for use with ProcessStreamPacket() More...
 
cStreamOutputm_pStreamOut
 TX responses back to the remote client go here. (e.g. cNetServerConnection->cNetStream) More...
 
cString m_sName
 a user readable name. Usually the IP address or reverse DNS lookup. can be upgraded as lookup or login becomes avail. m_pClient->get_Name() More...
 

Detailed Description

a secure channel/tunnel from the servers point of view. used to wrap/encapsulate other cProtocolStream types in m_pProtocol2.

Constructor & Destructor Documentation

◆ cSecureServerStream()

GrayLib::cSecureServerStream::cSecureServerStream ( cSecureServerFactory pFactory,
IUnkObject *  pServerConnection,
cStreamInput pStreamInp,
cStreamOutput pStreamOut 
)

◆ ~cSecureServerStream()

GrayLib::cSecureServerStream::~cSecureServerStream ( )
virtual

Member Function Documentation

◆ DisposeThis()

HRESULT GrayLib::cSecureServerStream::DisposeThis ( void  )
overridevirtual

Override cProtocolStream

Reimplemented from GrayLib::cProtocolStream.

◆ get_HashCode()

HASHCODE_t GrayLib::cSecureServerStream::get_HashCode ( ) const
inlinenoexcept

◆ get_SecureInp()

cStreamInput* GrayLib::cSecureServerStream::get_SecureInp ( ) const
inline

◆ get_SecureOut()

cStreamOutput* GrayLib::cSecureServerStream::get_SecureOut ( ) const
inline

◆ IUNKNOWN_DISAMBIG()

GrayLib::cSecureServerStream::IUNKNOWN_DISAMBIG ( cRefBase  )

◆ ProcessStreamPacket()

HRESULT GrayLib::cSecureServerStream::ProcessStreamPacket ( )
overridevirtual

cProtocolStream server is receiving data from the client. Called periodically to process queued incoming data. if any. the client is sending me data. deal with it.

Returns
<0 = error. HRESULT_WIN32_C(ERROR_IO_INCOMPLETE) = not complete message. S_OK = processed full message.

Reimplemented from GrayLib::cProtocolStream.

◆ SetStateSecure()

HRESULT GrayLib::cSecureServerStream::SetStateSecure ( )
virtual

We are ready to cipher ! called inside FindChallengeMatch to set to secure mode. override this. tell the client they are OK and what m_eCipherType to use.

Reimplemented from GrayLib::cSecureChannel.

◆ STDMETHOD_()

GrayLib::cSecureServerStream::STDMETHOD_ ( HASHCODE_t  ,
get_HashCodeX   
) const
inlineoverridenoexcept

Friends And Related Function Documentation

◆ cSecureServerFactory

friend class cSecureServerFactory
friend

Member Data Documentation

◆ k_ChallengeSize

const size_t GrayLib::cSecureServerStream::k_ChallengeSize = cSecureHash::k_Size
static

default size in bytes of the random seed. 64 = 512 bits. server can change this if it wants.

◆ m_pProtocol2

cProtocolStreamPtr GrayLib::cSecureServerStream::m_pProtocol2

The protocol wrapped by this cSecureServerStream.


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