![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cCipherDES.h>
Public Member Functions | |
| cCipherDES (bool bEncodeMode) | |
| virtual | ~cCipherDES () |
| size_t | get_BlockAlignSize () const override |
| virtual HRESULT | SetCipherKey (const void *pKeyData, size_t nKeySize) override |
| virtual HRESULT | CipherModeECB (BYTE pOutput[k_KeySize], const BYTE pInput[k_KeySize]) override |
| virtual HRESULT | CipherModeCBC (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pIV) override |
| virtual HRESULT | Cipher (BYTE *pOutput, const BYTE *pInput, size_t nSizeBytes) override |
| UNITTEST_FRIEND (cCipherDES) | |
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 HRESULT | CipherModeECB (BYTE *pOutput, const BYTE *pInput) |
| 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) |
Static Public Member Functions | |
| static void GRAYCALL | SetKeyParity (BYTE pKey[k_KeySize]) |
| static bool GRAYCALL | IsKeyParity (const BYTE pKey[k_KeySize]) |
| static bool GRAYCALL | IsKeyWeak (const BYTE pKey[k_KeySize]) |
Static Public Member Functions inherited from GrayLib::cCipherBase | |
| static size_t GRAYCALL | CopyFillX (void *pOutput, size_t nOutSize, const void *pInput, size_t nInputSize) |
Public Attributes | |
| size_t | m_nSizeKey |
| Multiple of k_KeySize. More... | |
| UINT32 | m_RK [k_BlockSize *3] |
| 96 = size for 3DES subkeys More... | |
| BYTE | m_IV [k_KeySize] |
| for use with Cipher CIPHER_BLOCK_CBC More... | |
Static Public Attributes | |
| static const size_t | k_KeySize = 8 |
| static const size_t | k_BlockSize = 32 |
Static Protected Attributes | |
| static const UINT32 | k_SB1 [64] |
| static const UINT32 | k_SB2 [64] |
| static const UINT32 | k_SB3 [64] |
| static const UINT32 | k_SB4 [64] |
| static const UINT32 | k_SB5 [64] |
| static const UINT32 | k_SB6 [64] |
| static const UINT32 | k_SB7 [64] |
| static const UINT32 | k_SB8 [64] |
| static const UINT32 | k_LHs [16] |
| static const UINT32 | k_RHs [16] |
| static const BYTE | k_odd_parity_table [128] |
Additional Inherited Members | |
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... | |
DES and Triple-DES context structure
|
inline |
|
inlinevirtual |
|
overridevirtual |
Reimplemented from GrayLib::cCipherBase.
|
overridevirtual |
DES-CBC buffer encryption/decryption. CIPHER_BLOCK_CBC
Reimplemented from GrayLib::cCipherBase.
|
overridevirtual |
DES-ECB block encryption/decryption. CIPHER_BLOCK_ECB
|
inlineoverridevirtual |
Reimplemented from GrayLib::cCipherBase.
|
static |
NOT USED Check the given key's parity, returns 1 on failure, 0 on SUCCESS Check that key parity on the given key is odd. DES keys are 56 bits long, but each byte is padded with a parity bit to allow verification.
|
static |
NOT USED Table of weak and semi-weak keys Source: http://en.wikipedia.org/wiki/Weak_key
Weak: Alternating ones + zeros (0x0101010101010101) Alternating 'F' + 'E' (0xFEFEFEFEFEFEFEFE) '0xE0E0E0E0F1F1F1F1' '0x1F1F1F1F0E0E0E0E'
Semi-weak: 0x011F011F010E010E and 0x1F011F010E010E01 0x01E001E001F101F1 and 0xE001E001F101F101 0x01FE01FE01FE01FE and 0xFE01FE01FE01FE01 0x1FE01FE00EF10EF1 and 0xE01FE01FF10EF10E 0x1FFE1FFE0EFE0EFE and 0xFE1FFE1FFE0EFE0E 0xE0FEE0FEF1FEF1FE and 0xFEE0FEE0FEF1FEF1
Check that key is not a weak or semi-weak DES key
|
overridevirtual |
DES key schedule (56-bit, encryption) Triple-DES key schedule (112-bit, encryption)
Reimplemented from GrayLib::cCipherBase.
|
static |
NOT USED Set key parity on the given key to odd. DES keys are 56 bits long, but each byte is padded with a parity bit to allow verification.
| GrayLib::cCipherDES::UNITTEST_FRIEND | ( | cCipherDES | ) |
|
static |
|
static |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
| BYTE GrayLib::cCipherDES::m_IV[k_KeySize] |
for use with Cipher CIPHER_BLOCK_CBC
| size_t GrayLib::cCipherDES::m_nSizeKey |
Multiple of k_KeySize.
| UINT32 GrayLib::cCipherDES::m_RK[k_BlockSize *3] |
96 = size for 3DES subkeys