Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6dhkeyexchange.h
Go to the documentation of this file.
1 
12 #ifndef P6DHKEYEXCHANGE_H__
13 #define P6DHKEYEXCHANGE_H__ 1
14 
15 #include "p6random.h"
16 
17 
18 #ifdef __cplusplus
19 namespace P6R {
20 extern "C" {
21 #endif
22 
34 typedef enum {
35  DH_GROUP1 = 0x01,
36  DH_GROUP14 = 0x02,
37  DH_RAW = 0x03,
38  DH_MAX = 0x04
39 } P6DHGROUP;
40 
49 static const P6DHKEXFLAGS P6DHKEX_NOFLAGS = 0x00000000;
50 static const P6DHKEXFLAGS P6DHKEX_TRACEON = 0x00000001;
51 
52 
61 #undef INTERFACE
62 #define INTERFACE p6IDHKeyExchange
64 {
77  P6DECLCOMMETHOD(initialize)(P6THIS_ P6DHKEXFLAGS flags ) P6PURE;
78 
96  P6DECLCOMMETHOD(genDHKeyPair)(P6THIS_ P6DHGROUP keyType, P6CHAR* pPrime, P6UINT32 generator ) P6PURE;
97 
114  P6DECLCOMMETHOD(genDHKeyPairByBinary)(P6THIS_ P6BSTR prime, P6BSTR generator ) P6PURE;
115 
133  P6DECLCOMMETHOD(getPrime)(P6THIS_ P6UCHAR* pBuffer, P6UINT32 cBuffer, P6UINT32* pWritten ) P6PURE;
134 
148  P6DECLCOMMETHOD(checkPrime)(P6THIS) P6PURE;
149 
167  P6DECLCOMMETHOD(generatePrime)(P6THIS_ P6UINT32 primeLength, P6UINT32 generator, p6IRandom* pRandom ) P6PURE;
168 
186  P6DECLCOMMETHOD(getPublicKey)(P6THIS_ P6UCHAR* pBuffer, P6UINT32 cBuffer, P6UINT32* pWritten ) P6PURE;
187 
205  P6DECLCOMMETHOD(getPrivateKey)(P6THIS_ P6UCHAR* pBuffer, P6UINT32 cBuffer, P6UINT32* pWritten ) P6PURE;
206 
239  P6DECLCOMMETHOD(getRawPublicKey)(P6THIS_ P6BSTR* pP, P6BSTR* pG, P6BSTR* pY ) P6PURE;
240 
274  P6DECLCOMMETHOD(getRawPrivateKey)(P6THIS_ P6BSTR* pP, P6BSTR* pG, P6BSTR* pX ) P6PURE;
275 
288  P6DECLCOMMETHOD(loadPublicKey)(P6THIS_ P6UCHAR* pBuffer, P6UINT32 cBuffer ) P6PURE;
289 
302  P6DECLCOMMETHOD(loadPrivateKey)(P6THIS_ P6UCHAR* pBuffer, P6UINT32 cBuffer ) P6PURE;
303 
318  P6DECLCOMMETHOD(loadRawPublicKey)(P6THIS_ const P6BSTR* pP, const P6BSTR* pG, const P6BSTR* pY ) P6PURE;
319 
334  P6DECLCOMMETHOD(loadRawPrivateKey)(P6THIS_ const P6BSTR* pP, const P6BSTR* pG, const P6BSTR* pX ) P6PURE;
335 
357  P6DECLCOMMETHOD(calculateSharedSecret)(P6THIS_ const P6UCHAR* pPublicKey,
358  P6UINT32 keyLength,
359  P6UCHAR* pSharedSecret,
360  P6UINT32 cBuffer,
361  P6UINT32* pWritten ) P6PURE;
362 };
363 
364 // {8257A87C-B44D-453c-B28B-28D21A8E9AF6}
365 #define IF_p6IDHKeyExchange {0x8257a87c,0xb44d,0x453c,{0xb2,0x8b,0x28,0xd2,0x1a,0x8e,0x9a,0xf6}}
366 
367 // {6023D47D-767B-42b8-94B2-6D123215E854}
368 #define COMP_p6DHKeyExchange {0x6023d47d,0x767b,0x42b8,{0x94,0xb2,0x6d,0x12,0x32,0x15,0xe8,0x54}}
369 
370 #ifdef __cplusplus
371 } /* extern "C" */
372 } // namespace
373 #endif
374 
375 
376 
377 #endif
378 
379 
380 
unsigned char P6UCHAR
Definition: p6types.h:108
uint32_t P6UINT32
Definition: p6types.h:77
#define P6DECLAREICOM
Definition: p6defs.h:191
#define P6PURE
Definition: p6defs.h:192
P6UINT32 P6DHKEXFLAGS
P6DHKEXFLAGS.
[p6]COM Cryptographic Random Number Generator.
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:97
P6DHGROUP
Defines the built-in primes used to generate keys.
Provides a cryptographically strong random number generator.
Definition: p6random.h:99
Binary string.
Definition: p6types.h:185
This component provides the basics of the key exchange calculates used in the Diffe-Hellman key excha...
#define P6DECLCOMMETHOD(method)
Definition: p6defs.h:189
#define P6THIS_
Definition: p6defs.h:193
#define P6THIS
Definition: p6defs.h:194
char P6CHAR
Narrow character type.
Definition: p6types.h:105
#define P6DECLAREIF_(iface, baseif)
Definition: p6defs.h:188