1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
|
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
$Id: pgpIKE.h,v 1.39 2003/09/24 03:09:32 ajivsov Exp $
____________________________________________________________________________*/
#ifndef Included_PGPike_h /* [ */
#define Included_PGPike_h
#include "pgpPubTypes.h"
PGP_BEGIN_C_DECLARATIONS
#if PGP_WIN32
# pragma pack(push, 8)
#endif
#ifdef _MSC_VER
#pragma warning (disable:4200)
#endif
typedef struct PGPikeContext * PGPikeContextRef;
#define kInvalidPGPikeContextRef ((PGPikeContextRef) NULL)
#define PGPikeContextRefIsValid( ref ) ( (ref) != kInvalidPGPikeContextRef )
#define kPGPike_CommonPort 500
#define kPGPike_AuthMaximumKeySize (512/8)
#define kPGPike_ESPMaximumKeySize 32 /* 256 bits */
#define kPGPike_MaxExplicitIVSize 16
#define kPGPike_MaxTransforms 3
#define kPGPike_DefaultKBLife 1048576 /* 1GB */
#define kPGPike_DefaultSecLife 86400 /* 1 Day */
#define kPGPike_UserDataSize 96
#define kPGPike_XAuthStringLen 128
#define kPGPike_XAuthMessageLen 256
typedef PGPByte PGPipsecSPI[4];
enum PGPikeDOI_
{
kPGPike_DOI_IKE = 0,
kPGPike_DOI_IPSEC = 1,
PGP_ENUM_FORCE( PGPikeDOI_ )
};
PGPENUM_TYPEDEF( PGPikeDOI_, PGPikeDOI );
enum PGPikeAlert_
{
kPGPike_AL_None = 0,
/* Error Types */
kPGPike_AL_InvalidPayload = 1,
kPGPike_AL_DOIUnsupported = 2,
kPGPike_AL_SituationUnsupported = 3,
kPGPike_AL_InvalidCookie = 4,
kPGPike_AL_InvalidMajorVersion = 5,
kPGPike_AL_InvalidMinorVersion = 6,
kPGPike_AL_InvalidExchange = 7,
kPGPike_AL_InvalidFlags = 8,
kPGPike_AL_InvalidMessageID = 9,
kPGPike_AL_InvalidProtocolID = 10,
kPGPike_AL_InvalidSPI = 11,
kPGPike_AL_InvalidTransform = 12,
kPGPike_AL_InvalidAttribute = 13,
kPGPike_AL_NoProposalChoice = 14,
kPGPike_AL_BadProposal = 15,
kPGPike_AL_PayloadMalformed = 16,
kPGPike_AL_InvalidKey = 17,
kPGPike_AL_InvalidID = 18,
kPGPike_AL_InvalidCertEncoding = 19,
kPGPike_AL_InvalidCert = 20,
kPGPike_AL_UnsupportedCert = 21,
kPGPike_AL_InvalidCertAuthority = 22,
kPGPike_AL_InvalidHash = 23,
kPGPike_AL_AuthenticationFailed = 24,
kPGPike_AL_InvalidSignature = 25,
kPGPike_AL_AddressNotification = 26,
kPGPike_AL_NotifySALifetime = 27,
kPGPike_AL_CertUnavailable = 28,
kPGPike_AL_UnsupportedExchange = 29,
kPGPike_AL_UnequalPayloadLengths = 30,
kPGPike_AL_NATTranslationFailure = 16300,
kPGPike_AL_LastErrorType = 16301,
/* Status Types */
kPGPike_AL_Connected = 16384,
kPGPike_AL_ResponderLifetime = 24576, /* IPSEC DOI */
kPGPike_AL_ReplayStatus = 24577, /* IPSEC DOI */
kPGPike_AL_InitialContact = 24578, /* IPSEC DOI */
PGP_ENUM_FORCE( PGPikeAlert_ )
};
PGPENUM_TYPEDEF( PGPikeAlert_, PGPikeAlert );
enum PGPikeInternalAlert_
{
kPGPike_IA_None = 0,
kPGPike_IA_ResponseTimeout = 1,
kPGPike_IA_NoProposals = 2,
kPGPike_IA_NewPhase1SA = 3,
kPGPike_IA_NewPhase2SA = 4,
kPGPike_IA_DeadPhase1SA = 5,
kPGPike_IA_DeadPhase2SA = 6,
kPGPike_IA_TooManyExchanges = 7,
kPGPike_IA_XAuthSuccess = 8,
kPGPike_IA_XAuthFailed = 9,
PGP_ENUM_FORCE( PGPikeInternalAlert_ )
};
PGPENUM_TYPEDEF( PGPikeInternalAlert_, PGPikeInternalAlert );
enum PGPikePref_
{
kPGPike_PF_None = 0,
kPGPike_PF_Expiration = 1,
kPGPike_PF_AllowedAlgorithms = 2,
kPGPike_PF_IKEProposals = 3,
kPGPike_PF_IPSECProposals = 4,
PGP_ENUM_FORCE( PGPikePref_ )
};
PGPENUM_TYPEDEF( PGPikePref_, PGPikePref );
enum PGPipsecEncapsulation_
{
kPGPike_PM_None = 0,
kPGPike_PM_Tunnel = 1,
kPGPike_PM_Transport = 2,
kPGPike_PM_UDPencapsulatedTunnel = 61443,
kPGPike_PM_UDPencapsulatedTransport = 61444,
PGP_ENUM_FORCE( PGPipsecEncapsulation_ )
};
PGPENUM_TYPEDEF( PGPipsecEncapsulation_, PGPipsecEncapsulation );
enum PGPikeLifeType_
{
kPGPike_LT_None = 0,
kPGPike_LT_Seconds = 1,
kPGPike_LT_Kilobytes = 2,
PGP_ENUM_FORCE( PGPikeLifeType_ )
};
PGPENUM_TYPEDEF( PGPikeLifeType_, PGPikeLifeType );
enum PGPipsecIdentity_
{
kPGPike_ID_None = 0,
kPGPike_ID_IPV4_Addr,
kPGPike_ID_FQDN,
kPGPike_ID_UserFQDN,
kPGPike_ID_IPV4_Addr_Subnet,
kPGPike_ID_IPV6_Addr,
kPGPike_ID_IPV6_Addr_Subnet,
kPGPike_ID_IPV4_Addr_Range,
kPGPike_ID_IPV6_Addr_Range,
kPGPike_ID_DER_ASN1_DN,
kPGPike_ID_DER_ASN1_GN,
kPGPike_ID_Key_ID, /* used for PGP fingerprint */
PGP_ENUM_FORCE( PGPipsecIdentity_ )
};
PGPENUM_TYPEDEF( PGPipsecIdentity_, PGPipsecIdentity );
/* If it doesn't say supported, it isn't. */
enum PGPipsecAHTransformID_
{
kPGPike_AH_None = 0,
kPGPike_AH_MD5 = 2, /* supported */
kPGPike_AH_SHA = 3, /* supported */
kPGPike_AH_DES = 4,
kPGPike_AH_SHA2_256 = 5, /* supported */
kPGPike_AH_SHA2_384 = 6, /* supported */
kPGPike_AH_SHA2_512 = 7, /* supported */
PGP_ENUM_FORCE( PGPipsecAHTransformID_ )
};
PGPENUM_TYPEDEF( PGPipsecAHTransformID_, PGPipsecAHTransformID );
enum PGPipsecAuthAttribute_
{
kPGPike_AA_None = 0,
kPGPike_AA_HMAC_MD5 = 1, /* supported */
kPGPike_AA_HMAC_SHA = 2, /* supported */
kPGPike_AA_DES_MAC = 3,
kPGPike_AA_KPDK = 4,
kPGPike_AA_HMAC_SHA2_256 = 5, /* supported */
kPGPike_AA_HMAC_SHA2_384 = 6, /* supported */
kPGPike_AA_HMAC_SHA2_512 = 7, /* supported */
PGP_ENUM_FORCE( PGPipsecAuthAttribute_ )
};
PGPENUM_TYPEDEF( PGPipsecAuthAttribute_, PGPipsecAuthAttribute );
enum PGPipsecESPTransformID_
{
kPGPike_ET_DES_IV64 = 1, /* supported */
kPGPike_ET_DES = 2, /* supported */
kPGPike_ET_3DES = 3, /* supported */
kPGPike_ET_RC5 = 4,
kPGPike_ET_IDEA = 5,
kPGPike_ET_CAST = 6, /* supported */
kPGPike_ET_Blowfish = 7,
kPGPike_ET_3IDEA = 8,
kPGPike_ET_DES_IV32 = 9,
kPGPike_ET_RC4 = 10,
kPGPike_ET_NULL = 11, /* supported */
kPGPike_ET_AES = 12,
PGP_ENUM_FORCE( PGPipsecESPTransformID_ )
};
PGPENUM_TYPEDEF( PGPipsecESPTransformID_, PGPipsecESPTransformID );
/* IPCOMP is not supported by this version of PGPike */
enum PGPipsecIPCOMPTransformID_
{
kPGPike_IC_None = 0,
kPGPike_IC_OUI = 1,
kPGPike_IC_Deflate = 2, /* supported */
kPGPike_IC_LZS = 3, /* supported */
kPGPike_IC_V42bis = 4,
PGP_ENUM_FORCE( PGPipsecIPCOMPTransformID_ )
};
PGPENUM_TYPEDEF( PGPipsecIPCOMPTransformID_, PGPipsecIPCOMPTransformID );
enum PGPipsecProtocol_
{
kPGPike_PR_None = 0,
kPGPike_PR_IKE = 1,
kPGPike_PR_AH = 2,
kPGPike_PR_ESP = 3,
kPGPike_PR_IPCOMP = 4,
PGP_ENUM_FORCE( PGPipsecProtocol_ )
};
PGPENUM_TYPEDEF( PGPipsecProtocol_, PGPipsecProtocol );
enum PGPikeGroupID_
{
kPGPike_GR_None = 0, /* supported */
kPGPike_GR_MODPOne = 1, /* supported */
kPGPike_GR_MODPTwo = 2, /* supported */
kPGPike_GR_MODPFive = 5, /* supported */
kPGPike_GR_ECSix = 6, /* supported */
kPGPike_GR_ECSeven = 7, /* supported */
kPGPike_GR_ECEight = 8, /* supported */
kPGPike_GR_ECNine = 9, /* supported */
kPGPike_GR_MODP2048 = 42048,/* unassigned */
kPGPike_GR_MODP3072 = 43072,/* unassigned */
kPGPike_GR_MODP4096 = 44096,/* unassigned */
kPGPike_GR_MODP6144 = 46144,/* unassigned */
kPGPike_GR_MODP8192 = 48192,/* unassigned */
PGP_ENUM_FORCE( PGPikeGroupID_ )
};
PGPENUM_TYPEDEF( PGPikeGroupID_, PGPikeGroupID );
enum PGPikeCipher_
{
kPGPike_SC_None = 0,
kPGPike_SC_DES_CBC = 1, /* supported */
kPGPike_SC_IDEA_CBC = 2,
kPGPike_SC_Blowfish_CBC = 3,
kPGPike_SC_RC5_R16_B64_CBC = 4,
kPGPike_SC_3DES_CBC = 5, /* supported */
kPGPike_SC_CAST_CBC = 6, /* supported */
kPGPike_SC_AES_CBC = 7,
PGP_ENUM_FORCE( PGPikeCipher_ )
};
PGPENUM_TYPEDEF( PGPikeCipher_, PGPikeCipher );
enum PGPikeHash_
{
kPGPike_HA_None = 0,
kPGPike_HA_MD5 = 1, /* supported */
kPGPike_HA_SHA1 = 2, /* supported */
kPGPike_HA_Tiger = 3,
kPGPike_HA_SHA2_256 = 4,
kPGPike_HA_SHA2_384 = 5,
kPGPike_HA_SHA2_512 = 6,
PGP_ENUM_FORCE( PGPikeHash_ )
};
PGPENUM_TYPEDEF( PGPikeHash_, PGPikeHash );
enum PGPikeAuthMethod_
{
kPGPike_AM_None = 0,
kPGPike_AM_PreSharedKey = 1, /* supported */
kPGPike_AM_DSS_Sig = 2, /* supported */
kPGPike_AM_RSA_Sig = 3, /* supported */
kPGPike_AM_RSA_Encrypt = 4,
kPGPike_AM_RSA_Encrypt_R = 5,
kPGPike_AM_HAuth_InitRSA = 64221,
kPGPike_AM_HAuth_RespRSA = 64222,
kPGPike_AM_HAuth_InitDSS = 64223,
kPGPike_AM_HAuth_RespDSS = 64224,
kPGPike_AM_XAuth_InitPreShared = 65001,
kPGPike_AM_XAuth_RespPreShared = 65002,
kPGPike_AM_XAuth_InitDSS = 65003,
kPGPike_AM_XAuth_RespDSS = 65004,
kPGPike_AM_XAuth_InitRSA = 65005,
kPGPike_AM_XAuth_RespRSA = 65006,
kPGPike_AM_XAuth_InitRSAEncryption = 65007,
kPGPike_AM_XAuth_RespRSAEncryption = 65008,
kPGPike_AM_XAuth_InitRSAREncryption = 65009,
kPGPike_AM_XAuth_RespRSAREncryption = 65010,
PGP_ENUM_FORCE( PGPikeAuthMethod_ )
};
PGPENUM_TYPEDEF( PGPikeAuthMethod_, PGPikeAuthMethod );
enum PGPikeAuthStyle_
{
kPGPike_AS_Normal = 0,
kPGPike_AS_XAuth = 1,
kPGPike_AS_HybridAuth = 2,
PGP_ENUM_FORCE( PGPikeAuthStyle_ )
};
PGPENUM_TYPEDEF( PGPikeAuthStyle_, PGPikeAuthStyle );
enum PGPikeXAuthType_
{
kPGPike_XT_Generic = 0,
kPGPike_XT_RADIUS_CHAP = 1,
kPGPike_XT_OTP = 2,
kPGPike_XT_SKEY = 3,
PGP_ENUM_FORCE( PGPikeXAuthType_ )
};
PGPENUM_TYPEDEF( PGPikeXAuthType_, PGPikeXAuthType );
enum PGPikeEncapsulateMode_
{
kPGPike_EM_Auto = 0,
kPGPike_EM_Always = 1,
kPGPike_EM_Never = 2,
PGP_ENUM_FORCE( PGPikeEncapsulateMode_ )
};
PGPENUM_TYPEDEF( PGPikeEncapsulateMode_, PGPikeEncapsulateMode );
typedef struct PGPipsecESPTransform
{
PGPipsecESPTransformID cipher;
PGPUInt32 keyLength;
/* cipher key bit size, must be 0 for all except AES */
PGPipsecAuthAttribute authAttr;
PGPipsecEncapsulation mode;
} PGPipsecESPTransform;
typedef struct PGPipsecAHTransform
{
PGPipsecAHTransformID authAlg;
PGPipsecAuthAttribute authAttr;
PGPipsecEncapsulation mode;
} PGPipsecAHTransform;
typedef struct PGPipsecIPCOMPTransform
{
PGPipsecIPCOMPTransformID compAlg;
} PGPipsecIPCOMPTransform;
typedef struct PGPikeTransform
{
PGPikeAuthMethod authMethod;
PGPikeHash hash;
PGPikeCipher cipher;
PGPUInt32 keyLength; /* cipher key bit size, must be 0 for all except AES */
PGPikeGroupID groupID;
} PGPikeTransform;
typedef struct PGPipsecTransform
{
PGPBoolean useESP;
PGPipsecESPTransform esp;
PGPBoolean useAH;
PGPipsecAHTransform ah;
PGPBoolean useIPCOMP;
PGPipsecIPCOMPTransform ipcomp;
PGPikeGroupID groupID;
} PGPipsecTransform;
typedef struct PGPipsecDOIParams
{
PGPipsecSPI inSPI;
PGPipsecSPI outSPI;
PGPipsecProtocol protocol;
union
{
struct
{
PGPipsecAHTransform t;
PGPByte inAuthKey[kPGPike_AuthMaximumKeySize];
PGPByte outAuthKey[kPGPike_AuthMaximumKeySize];
} ah;
struct
{
PGPipsecESPTransform t;
PGPByte inESPKey[kPGPike_ESPMaximumKeySize];
PGPByte outESPKey[kPGPike_ESPMaximumKeySize];
PGPByte inAuthKey[kPGPike_AuthMaximumKeySize];
PGPByte outAuthKey[kPGPike_AuthMaximumKeySize];
PGPByte explicitIV[kPGPike_MaxExplicitIVSize];
} esp;
struct
{
PGPipsecIPCOMPTransform t;
} ipcomp;
} u;
} PGPipsecDOIParams;
typedef struct PGPipsecSA
{
struct PGPipsecSA * nextSA; /* INTERNAL USE ONLY */
struct PGPipsecSA * prevSA; /* INTERNAL USE ONLY */
PGPUInt32 ipAddress; /* PreNATted(Original) IP Address */
PGPBoolean destIsRange; /* dest is IP range */
PGPUInt32 ipAddrStart; /* IP address */
PGPUInt32 ipMaskEnd; /* mask or end range IP address */
PGPByte ipProtocol; /* 0 if all protocols */
PGPUInt16 ipPort; /* 0 if all ports */
PGPBoolean bNATTraversal; /* NAT Encapsulation is enabled if true */
PGPBoolean bIsLocalIPNAT; /* if non-zero, our local IP is natted */
PGPBoolean bIsRemoteIPNAT; /* if non-zero, remote IP is NATed */
PGPUInt32 natIPAddress; /* NATed Dest IP Address, 0 if not NATed */
PGPUInt16 nboNATPort; /* NATed Dest Port value */
PGPUInt32 assignedIP; /* if non-zero, use as tunnel IP */
PGPUInt32 assignedDNS; /* if non-zero, use as tunnel DNS */
PGPUInt32 assignedWINS; /* if non-zero, use as tunnel WINS */
PGPBoolean initiator; /* was this SA initiated locally */
PGPBoolean activeIn; /* use for inbound data */
PGPBoolean activeOut; /* use for outbound data */
PGPUInt32 kbLifeTime; /* max KB to be sent on this SA */
PGPUInt32 secLifeTime; /* max seconds this SA will live */
/* 0 means no limit for either */
PGPTime birthTime;
PGPUInt16 numTransforms;
PGPipsecDOIParams transform[kPGPike_MaxTransforms];
PGPTime termSchedule; /* SA will be terminated, private */
PGPByte userData[kPGPike_UserDataSize];/* for your use */
} PGPipsecSA;
/* When sent a kPGPike_MT_SARequest, pgpIKE will expect that
all fields below will be filled in. The approved member is
irrelevant in that case.
When you are called with kPGPike_MT_PolicyCheck, pgpIKE will
set everything to 0 except the IP address. You are expected
to fill in the other fields with local policy. The PolicyCheck
is used for remote-initiated SA negotiation. Since you cannot
predict which remote network might be trying to communicate
with us, you should leave the destIsRange/ipAddrStart/ipMaskEnd
and ipPort/ipProtocol fields set to 0 for this message. You
will be called to check those later with the ClientIDCheck.
*/
typedef struct PGPikeMTSASetup
{
PGPBoolean approved; /* > */
PGPUInt32 ipAddress; /* destination */
PGPUInt32 localIPAddress; /* source */
PGPByte ipProtocol;
PGPUInt16 ipPort;
PGPByte * sharedKey; /* null if none, data will be copied */
PGPSize sharedKeySize; /* w/o NULL-terminate */
PGPBoolean aggressive; /* set for aggressive mode */
PGPBoolean lightweight; /* only for SARequest, set to
TRUE for only 1 retry */
/* set the fields below to use tunnel mode */
PGPBoolean destIsRange;
PGPUInt32 ipAddrStart;
PGPUInt32 ipMaskEnd;
PGPBoolean virtualIP; /* whether to use mode-cfg */
PGPikeAuthStyle authStyle; /* whether to use xauth/hybrid */
PGPikeEncapsulateMode encapsulateMode; /* Force NAT Traversal mode */
PGPipsecIdentity idType; /* only useful in shared key mode */
PGPByte * idData; /* data will be copied */
PGPSize idDataSize; /* this is the Phase 1 ID */
} PGPikeMTSASetup;
/*
When you are called with a kPGPike_MT_ClientIDCheck, all fields
will be set appropriately. If the destIsRange/ipAddrStart/ipMaskEnd
triad is permitted to be represented by the IP address, set
the approved field to true. This message is only sent in the case
where the remote side is the initiator and you have already been
called with a kPGPike_MT_PolicyCheck message.
*/
typedef struct PGPikeMTClientIDCheck
{
PGPBoolean approved; /* > */
PGPUInt32 ipAddress;
PGPByte ipProtocol;
PGPUInt16 ipPort;
PGPBoolean destIsRange;
PGPUInt32 ipAddrStart;
PGPUInt32 ipMaskEnd;
} PGPikeMTClientIDCheck;
typedef struct PGPikeMTSAEstablished
{
PGPipsecSA * sa;
PGPBoolean remoteValid;
PGPByte * remoteAuthKey; /* binary exported key data */
PGPSize remoteAuthKeySize;
} PGPikeMTSAEstablished;
typedef struct PGPikeMTSAFailed
{
PGPUInt32 ipAddress; /* destination */
PGPByte ipProtocol;
PGPUInt16 ipPort;
PGPBoolean destIsRange;
PGPUInt32 ipAddrStart;
PGPUInt32 ipMaskEnd;
} PGPikeMTSAFailed;
typedef struct PGPikeMTCert
{
PGPUInt32 ipAddress; /* < */
PGPKeyDBRef baseKeyDB; /* > */
PGPKeyDBObjRef authObj; /* > PGP key or X.509 cert */
PGPBoolean isPassKey; /* > */
void * pass; /* > null-term if passphrase, Unicode, copied */
PGPSize passLength; /* > in PGPChar8s */
} PGPikeMTCert;
typedef struct PGPikeMTRemoteCert
{
PGPBoolean approved; /* > */
PGPBoolean valid; /* > */
PGPUInt32 ipAddress; /* < */
PGPKeyDBObjRef remoteObj; /* < PGPkey or X.509 cert */
PGPKeyDBRef remoteKeyDB; /* < any other keys/certs are part of
this cert's chain */
} PGPikeMTRemoteCert;
typedef struct PGPikeMTPacket
{
PGPUInt32 ipAddress; /* source or destination */
PGPUInt16 port; /* usually UDP 500, but might not be */
PGPSize packetSize;
PGPByte * packet; /* msg *sender* must free this */
} PGPikeMTPacket;
typedef struct PGPikeMTIdentity
{
PGPBoolean active; /* TRUE = set it, FALSE= dead */
PGPUInt32 ipAddress; /* Gateway IP */
PGPUInt32 assignedIP;
PGPUInt32 assignedDNS;
PGPUInt32 assignedWINS;
} PGPikeMTIdentity;
typedef struct PGPikeMTAlert
{
PGPikeAlert alert;
PGPUInt32 ipAddress;
PGPikeInternalAlert value; /* used if alert is kPGPike_AL_None */
PGPBoolean remoteGenerated;
} PGPikeMTAlert;
typedef PGPUInt32 PGPikeAESKeyLengthMask;
#define kPGPike_AESKeyLength128 1
#define kPGPike_AESKeyLength192 2
#define kPGPike_AESKeyLength256 4
#define kPGPike_AESKeyLengthAll 7
typedef struct PGPikeAllowedAlgorithms
{
PGPBoolean cast5;
PGPBoolean tripleDES;
PGPBoolean singleDES;
PGPikeAESKeyLengthMask aes;
PGPBoolean espNULL;
PGPBoolean sha1;
PGPBoolean md5;
PGPBoolean sha2_256;
PGPBoolean sha2_384;
PGPBoolean sha2_512;
PGPBoolean noAuth;
PGPBoolean lzs;
PGPBoolean deflate;
PGPBoolean modpOne768;
PGPBoolean modpTwo1024;
PGPBoolean modpFive1536;
PGPBoolean ec2n163;
PGPBoolean ec2n283;
PGPBoolean modp2048;
PGPBoolean modp3072;
PGPBoolean modp4096;
PGPBoolean modp6144;
PGPBoolean modp8192;
} PGPikeAllowedAlgorithms;
typedef struct PGPikeMTPref
{
PGPikePref pref;
union
{
struct
{
PGPUInt32 kbLifeTimeIKE;
PGPUInt32 secLifeTimeIKE;
PGPUInt32 kbLifeTimeIPSEC;
PGPUInt32 secLifeTimeIPSEC;
} expiration; /* kPGPike_PF_Expiration */
struct
{
PGPUInt32 numTransforms;
PGPikeTransform * t;
} ikeProposals; /* kPGPike_PF_IKEProposals */
struct
{
PGPUInt32 numTransforms;
PGPipsecTransform * t;
} ipsecProposals; /* kPGPike_PF_IPSECProposals */
PGPikeAllowedAlgorithms allowedAlgorithms;
/*kPGPike_PF_AllowedAlgorithms*/
} u;
} PGPikeMTPref;
/* This message will be sent to check extended authentication. The buffer
will be freed after your callback is called, so if you need it,
copy the data elsewhere. You must retrieve the information and then
send an AuthCheck message back to IKE with the contents filled in,
and all contents preserved other than what you filled in. The message
you send back is your memory, IKE will not free it. */
typedef struct PGPikeMTAuthCheck
{
PGPBoolean success; /* set to true unless user aborts */
PGPUInt32 gatewayIP;
PGPikeXAuthType xauthType;
PGPUInt16 transactionID; /* private */
PGPBoolean includeType; /* private */
PGPBoolean useUserName;
PGPBoolean usePassword;
PGPBoolean usePasscode;
PGPBoolean useMessage;
PGPBoolean useChallenge;
PGPBoolean useDomain;
PGPChar8 userName[kPGPike_XAuthStringLen];
PGPChar8 password[kPGPike_XAuthStringLen];
PGPChar8 passcode[kPGPike_XAuthStringLen];
PGPChar8 message[kPGPike_XAuthMessageLen];
PGPChar8 challenge[kPGPike_XAuthStringLen];
PGPChar8 domain[kPGPike_XAuthStringLen];
PGPSize challengeSize;
} PGPikeMTAuthCheck;
enum PGPikeMessageType_
{
/*
Message types followed by ">" may be sent to PGPike
Message typed followed by "<" may be sent by PGPike
*/
kPGPike_MT_Idle = 0, /* > call this often */
kPGPike_MT_SARequest, /* > PGPikeMTSASetup */
kPGPike_MT_SARequestFailed, /* < PGPikeMTSAFailed */
kPGPike_MT_SAEstablished, /* < PGPikeMTSAEstablished */
kPGPike_MT_SARekey, /* > PGPipsecSA */
kPGPike_MT_SADied, /* >< PGPipsecSA */
kPGPike_MT_SAUpdate, /* < PGPipsecSA */
kPGPike_MT_SAKillAll, /* > none */
kPGPike_MT_PolicyCheck, /* < PGPikeMTSASetup */
kPGPike_MT_ClientIDCheck, /* < PGPikeMTClientIDCheck */
kPGPike_MT_AuthCheck, /* >< PGPikeMTAuthCheck */
kPGPike_MT_LocalPGPCert, /* < PGPikeMTCert */
kPGPike_MT_LocalX509Cert, /* < PGPikeMTCert */
kPGPike_MT_RemoteCert, /* < PGPikeMTRemoteCert */
kPGPike_MT_Identity, /* < PGPikeMTIdentity */
kPGPike_MT_Packet, /* >< PGPikeMTPacket */
kPGPike_MT_Alert, /* < PGPikeMTAlert */
kPGPike_MT_Pref, /* > PGPikeMTPref */
kPGPike_MT_DebugLog, /* < PGPChar8 * */
PGP_ENUM_FORCE( PGPikeMessageType_ )
};
PGPENUM_TYPEDEF( PGPikeMessageType_, PGPikeMessageType );
typedef PGPError (* PGPikeMessageProcPtr)(
PGPikeContextRef ike,
void * inUserData,
PGPikeMessageType msg,
void * data );
PGPError PGPNewIKEContext(
PGPContextRef context,
PGPikeMessageProcPtr ikeMessageProc,
void * inUserData,
PGPikeContextRef * outRef );
PGPError PGPFreeIKEContext(
PGPikeContextRef ref );
/* Any error from PGPikeProcessMessage is fatal. Non-fatal
errors are sent through the kPGPike_MT_Alert message. */
PGPError PGPikeProcessMessage(
PGPikeContextRef ref,
PGPikeMessageType msg,
void * data );
#if PGP_WIN32
# pragma pack(pop)
#endif
PGP_END_C_DECLARATIONS
#endif /* ] Included_PGPike_h */
/*__Editor_settings____
Local Variables:
tab-width: 4
End:
vi: ts=4 sw=4
vim: si
_____________________*/
|