Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

h235auth.h

Go to the documentation of this file.
00001 /* 00002 * h235auth.h 00003 * 00004 * H.235 authorisation PDU's 00005 * 00006 * Open H323 Library 00007 * 00008 * Copyright (c) 1998-2001 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Open H323 Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Contributor(s): Fürbass Franz <franz.fuerbass@infonova.at> 00025 * 00026 * $Log: h235auth.h,v $ 00027 * Revision 1.16 2004/05/13 02:26:13 dereksmithies 00028 * Fixes so make docs does not generate warning messages about brackets. 00029 * 00030 * Revision 1.15 2003/04/30 00:28:50 robertj 00031 * Redesigned the alternate credentials in ARQ system as old implementation 00032 * was fraught with concurrency issues, most importantly it can cause false 00033 * detection of replay attacks taking out an endpoint completely. 00034 * 00035 * Revision 1.14 2003/04/01 04:47:48 robertj 00036 * Abstracted H.225 RAS transaction processing (RIP and secondary thread) in 00037 * server environment for use by H.501 peer elements. 00038 * 00039 * Revision 1.13 2003/02/25 06:48:14 robertj 00040 * More work on PDU transaction abstraction. 00041 * 00042 * Revision 1.12 2003/02/11 04:43:22 robertj 00043 * Fixed use of asymmetrical authentication schemes such as MD5. 00044 * 00045 * Revision 1.11 2003/02/01 13:31:14 robertj 00046 * Changes to support CAT authentication in RAS. 00047 * 00048 * Revision 1.10 2003/01/08 04:40:31 robertj 00049 * Added more debug tracing for H.235 authenticators. 00050 * 00051 * Revision 1.9 2002/09/16 01:14:15 robertj 00052 * Added #define so can select if #pragma interface/implementation is used on 00053 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00054 * 00055 * Revision 1.8 2002/09/03 06:19:36 robertj 00056 * Normalised the multi-include header prevention ifdef/define symbol. 00057 * 00058 * Revision 1.7 2002/08/05 10:03:47 robertj 00059 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00060 * 00061 * Revision 1.6 2002/08/05 05:17:37 robertj 00062 * Fairly major modifications to support different authentication credentials 00063 * in ARQ to the logged in ones on RRQ. For both client and server. 00064 * Various other H.235 authentication bugs and anomalies fixed on the way. 00065 * 00066 * Revision 1.5 2002/05/17 03:39:28 robertj 00067 * Fixed problems with H.235 authentication on RAS for server and client. 00068 * 00069 * Revision 1.4 2001/12/06 06:44:42 robertj 00070 * Removed "Win32 SSL xxx" build configurations in favour of system 00071 * environment variables to select optional libraries. 00072 * 00073 * Revision 1.3 2001/09/14 00:13:37 robertj 00074 * Fixed problem with some athenticators needing extra conditions to be 00075 * "active", so make IsActive() virtual and add localId to H235AuthSimpleMD5 00076 * 00077 * Revision 1.2 2001/09/13 01:15:18 robertj 00078 * Added flag to H235Authenticator to determine if gkid and epid is to be 00079 * automatically set as the crypto token remote id and local id. 00080 * 00081 * Revision 1.1 2001/08/10 11:03:49 robertj 00082 * Major changes to H.235 support in RAS to support server. 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; // ID of remote entity 00202 PString localId; // ID of local entity 00203 PString password; // shared secret 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 //__OPAL_H235AUTH_H 00359 00360

Generated on Sat Jul 24 17:03:12 2004 for OpenH323 by doxygen 1.3.7