00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
#ifndef __OPAL_H235AUTH_H
00087
#define __OPAL_H235AUTH_H
00088
00089
#ifdef P_USE_PRAGMA
00090
#pragma interface
00091
#endif
00092
00093
00094
class H323TransactionPDU;
00095
class H225_CryptoH323Token;
00096
class H225_ArrayOf_AuthenticationMechanism;
00097
class H225_ArrayOf_PASN_ObjectId;
00098
class H235_ClearToken;
00099
class H235_AuthenticationMechanism;
00100
class PASN_ObjectId;
00101
class PASN_Sequence;
00102
class PASN_Array;
00103
00104
00108 class H235Authenticator :
public PObject
00109 {
00110 PCLASSINFO(
H235Authenticator, PObject);
00111
public:
00112
H235Authenticator();
00113
00114
virtual void PrintOn(
00115 ostream & strm
00116 )
const;
00117
00118
virtual const char *
GetName()
const = 0;
00119
00120
virtual BOOL
PrepareTokens(
00121 PASN_Array & clearTokens,
00122 PASN_Array & cryptoTokens
00123 );
00124
00125
virtual H235_ClearToken *
CreateClearToken();
00126
virtual H225_CryptoH323Token *
CreateCryptoToken();
00127
00128
virtual BOOL
Finalise(
00129 PBYTEArray & rawPDU
00130 );
00131
00132 enum ValidationResult {
00133
e_OK = 0,
00134
e_Absent,
00135
e_Error,
00136
e_InvalidTime,
00137
e_BadPassword,
00138
e_ReplyAttack,
00139
e_Disabled
00140 };
00141
00142
virtual ValidationResult ValidateTokens(
00143
const PASN_Array & clearTokens,
00144
const PASN_Array & cryptoTokens,
00145
const PBYTEArray & rawPDU
00146 );
00147
00148
virtual ValidationResult ValidateClearToken(
00149
const H235_ClearToken & clearToken
00150 );
00151
00152
virtual ValidationResult ValidateCryptoToken(
00153
const H225_CryptoH323Token & cryptoToken,
00154
const PBYTEArray & rawPDU
00155 );
00156
00157
virtual BOOL IsCapability(
00158
const H235_AuthenticationMechanism & mechansim,
00159
const PASN_ObjectId & algorithmOID
00160 ) = 0;
00161
00162
virtual BOOL SetCapability(
00163
H225_ArrayOf_AuthenticationMechanism & mechansims,
00164
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
00165 ) = 0;
00166
00167
virtual BOOL
UseGkAndEpIdentifiers() const;
00168
00169 virtual BOOL IsSecuredPDU(
00170
unsigned rasPDU,
00171 BOOL received
00172 ) const;
00173
00174 virtual BOOL IsActive() const;
00175
00176 void Enable(
00177 BOOL enab = TRUE
00178 ) {
enabled = enab; }
00179 void Disable() {
enabled = FALSE; }
00180
00181 const PString &
GetRemoteId()
const {
return remoteId; }
00182 void SetRemoteId(
const PString &
id) {
remoteId =
id; }
00183
00184 const PString &
GetLocalId()
const {
return localId; }
00185 void SetLocalId(
const PString &
id) {
localId =
id; }
00186
00187 const PString &
GetPassword()
const {
return password; }
00188 void SetPassword(
const PString & pw) {
password = pw; }
00189
00190
00191
protected:
00192 BOOL AddCapability(
00193
unsigned mechanism,
00194
const PString & oid,
00195
H225_ArrayOf_AuthenticationMechanism & mechansims,
00196
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
00197 );
00198
00199 BOOL
enabled;
00200
00201 PString
remoteId;
00202 PString
localId;
00203 PString
password;
00204
00205 unsigned sentRandomSequenceNumber;
00206 unsigned lastRandomSequenceNumber;
00207 unsigned lastTimestamp;
00208 int timestampGracePeriod;
00209
00210 PMutex
mutex;
00211 };
00212
00213
00214 PDECLARE_LIST(H235Authenticators,
H235Authenticator)
00215 #ifdef DOC_PLUS_PLUS
00216 {
00217
#endif
00218
public:
00219
void PreparePDU(
00220
H323TransactionPDU & pdu,
00221 PASN_Array & clearTokens,
00222
unsigned clearOptionalField,
00223 PASN_Array & cryptoTokens,
00224
unsigned cryptoOptionalField
00225 )
const;
00226
00227 H235Authenticator::ValidationResult ValidatePDU(
00228
const H323TransactionPDU & pdu,
00229
const PASN_Array & clearTokens,
00230
unsigned clearOptionalField,
00231
const PASN_Array & cryptoTokens,
00232
unsigned cryptoOptionalField,
00233
const PBYTEArray & rawPDU
00234 )
const;
00235 };
00236
00237
00238
00239
00244 class H235AuthSimpleMD5 :
public H235Authenticator
00245 {
00246 PCLASSINFO(
H235AuthSimpleMD5,
H235Authenticator);
00247
public:
00248
H235AuthSimpleMD5();
00249
00250 PObject *
Clone()
const;
00251
00252
virtual const char *
GetName()
const;
00253
00254
virtual H225_CryptoH323Token *
CreateCryptoToken();
00255
00256
virtual ValidationResult
ValidateCryptoToken(
00257
const H225_CryptoH323Token & cryptoToken,
00258
const PBYTEArray & rawPDU
00259 );
00260
00261
virtual BOOL
IsCapability(
00262
const H235_AuthenticationMechanism & mechansim,
00263
const PASN_ObjectId & algorithmOID
00264 );
00265
00266
virtual BOOL
SetCapability(
00267
H225_ArrayOf_AuthenticationMechanism & mechansim,
00268
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
00269 );
00270
00271
virtual BOOL
IsSecuredPDU(
00272
unsigned rasPDU,
00273 BOOL received
00274 )
const;
00275 };
00276
00277
00284 class H235AuthCAT :
public H235Authenticator
00285 {
00286 PCLASSINFO(
H235AuthCAT,
H235Authenticator);
00287
public:
00288
H235AuthCAT();
00289
00290 PObject *
Clone()
const;
00291
00292
virtual const char *
GetName()
const;
00293
00294
virtual H235_ClearToken *
CreateClearToken();
00295
00296
virtual ValidationResult
ValidateClearToken(
00297
const H235_ClearToken & clearToken
00298 );
00299
00300
virtual BOOL
IsCapability(
00301
const H235_AuthenticationMechanism & mechansim,
00302
const PASN_ObjectId & algorithmOID
00303 );
00304
00305
virtual BOOL
SetCapability(
00306
H225_ArrayOf_AuthenticationMechanism & mechansim,
00307
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
00308 );
00309
00310
virtual BOOL
IsSecuredPDU(
00311
unsigned rasPDU,
00312 BOOL received
00313 )
const;
00314 };
00315
00316
00317
#if P_SSL
00318
00321
class H235AuthProcedure1 :
public H235Authenticator
00322 {
00323 PCLASSINFO(H235AuthProcedure1,
H235Authenticator);
00324
public:
00325 H235AuthProcedure1();
00326
00327 PObject * Clone() const;
00328
00329 virtual const
char * GetName() const;
00330
00331 virtual
H225_CryptoH323Token * CreateCryptoToken();
00332
00333 virtual BOOL Finalise(
00334 PBYTEArray & rawPDU
00335 );
00336
00337 virtual ValidationResult ValidateCryptoToken(
00338 const
H225_CryptoH323Token & cryptoToken,
00339 const PBYTEArray & rawPDU
00340 );
00341
00342 virtual BOOL IsCapability(
00343 const
H235_AuthenticationMechanism & mechansim,
00344 const PASN_ObjectId & algorithmOID
00345 );
00346
00347 virtual BOOL SetCapability(
00348
H225_ArrayOf_AuthenticationMechanism & mechansim,
00349
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
00350 );
00351
00352 virtual BOOL UseGkAndEpIdentifiers() const;
00353 };
00354
00355 #endif
00356
00357
00358 #endif
00359
00360