Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cPKCS.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_cPKCS_H
6 #define _INC_cPKCS_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "../GrayLibBase.h"
12 #include "../Cipher/cCipherWrap.h"
13 #include "../Hash/cHashWrap.h"
14 #include "../File/cASNReader.h"
15 
16 namespace GrayLib
17 {
19 
21  {
25  };
26 
27  class GRAYLIB_LINK cPKCS5 // static
28  {
33 
34  private:
35  static HRESULT ParsePBKDF2Params(const cASNBuf& params, OUT cASNBuf& salt, OUT int& iterations, OUT int& pnSizeKey, OUT SSL_Hash_TYPE& eHashType);
36  static HRESULT PBKDF2_Hmac(cHashWrap* pCipher, const cMemBlock& password, const cMemBlock& salt, UINT iteration_count, UINT32 nSizeKey, BYTE* pOutput);
37 
38  public:
39  static HRESULT ParsePBES2(const cASNBuf& pbe_params, bool bEncodeMode, const cMemBlock& password, const cMemBlock& data, BYTE* pOutput);
40 
42  };
43 
44  class GRAYLIB_LINK cPKCS12 // static
45  {
50 
51  private:
52  static HRESULT ParsePBEParams(const cASNBuf& params, OUT cMemBlock& salt, OUT int& iterations);
53 
54  static HRESULT pbe_derive_key_iv(const cASNBuf& pbe_params, SSL_Hash_TYPE eHashType, const cMemBlock& password, BYTE* pKey, size_t nSizeKey, BYTE* pIV, size_t ivlen);
55  static void FillBuffer(BYTE* data, size_t data_len, const BYTE* filler, size_t fill_len);
56  static HRESULT GetDerivation(BYTE* data, size_t datalen, const BYTE* pPassword, size_t nPassSize,
57  const cMemBlock& salt, SSL_Hash_TYPE eHashType, PKCS12_DERIVE_t id, int iterations);
58 
59  public:
60  static HRESULT ParsePBE_sha1_rc4_128(const cASNBuf& pbe_params, bool bEncodeMode, const cMemBlock& password, const cMemBlock& data, BYTE* output);
61  static HRESULT ParsePBE(const cASNBuf& pbe_params, bool bEncodeMode, SSL_Cipher_TYPE eCipherType, SSL_Hash_TYPE md_type, const cMemBlock& password, const cMemBlock& data, BYTE* output);
62  };
63 }
64 
65 #endif // _INC_cPKCS_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
Using X files without the sources and the makefile How to use you just create a debug directory e the sample3 directory must contain Sample3 Final Sample3 exe Sample3 Final Debug Sample3 Final Gfx OpenGL bmp Sample3 Final Gfx tiny_skin bmp Sample3 Final Gfx tiny_4anim x The source files have the DevCpp project file plus the makefile The demos use standard FreeGlut functions Technical without warranty Neither Paul Coppens nor GameDev net make any or either express or with respect to the their or fitness for a specific purpose neither Paul Coppens nor GameDev net shall have any liability to you or any other person or entity with respect to any or damage caused or alleged to have been caused directly or indirectly by the programs provided by Paul Coppens and GameDev net This but is not limited interruption of loss of data
Definition: Readme.txt:39
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cASN.h:78
Definition: cHashWrap.h:18
Definition: cPKCS.h:45
Definition: cPKCS.h:28
UNITTEST_FRIEND(cPKCS)
Definition: cMem.h:311
Definition: cMesh.h:22
PKCS12_DERIVE_t
Definition: cPKCS.h:21
@ PKCS12_DERIVE_KEY
encryption/decryption key
Definition: cPKCS.h:22
@ PKCS12_DERIVE_MAC_KEY
integrity / MAC key
Definition: cPKCS.h:24
@ PKCS12_DERIVE_IV
initialization vector
Definition: cPKCS.h:23
SSL_Cipher_TYPE
Definition: cCipherTypeDef.h:22
UNITTEST2_PREDEF(cQuadtree)
SSL_Hash_TYPE
Definition: cHashCode.h:23