h235auth.h
Go to the documentation of this file.
/*
* h235auth.h
*
* H.235 authorisation PDU's
*
* Open H323 Library
*
* Copyright (c) 1998-2001 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open H323 Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Contributor(s): Fürbass Franz <franz.fuerbass@infonova.at>
*
* $Revision: 24838 $
* $Author: rjongbloed $
* $Date: 2010-10-28 18:14:16 -0500 (Thu, 28 Oct 2010) $
*/
#ifndef OPAL_H323_H235AUTH_H
#define OPAL_H323_H235AUTH_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <opal/buildopts.h>
#if OPAL_H323
#include <ptlib/pfactory.h>
class H323TransactionPDU;
class H225_CryptoH323Token;
class H225_ArrayOf_AuthenticationMechanism;
class H225_ArrayOf_PASN_ObjectId;
class H235_ClearToken;
class H235_AuthenticationMechanism;
class PASN_ObjectId;
class PASN_Sequence;
class PASN_Array;
class H235Authenticator : public PObject
{
PCLASSINFO(H235Authenticator, PObject);
public:
H235Authenticator();
virtual void PrintOn(
ostream & strm
) const;
virtual const char * GetName() const = 0;
virtual PBoolean PrepareTokens(
PASN_Array & clearTokens,
PASN_Array & cryptoTokens
);
virtual H235_ClearToken * CreateClearToken();
virtual H225_CryptoH323Token * CreateCryptoToken(bool digits);
virtual PBoolean Finalise(
PBYTEArray & rawPDU
);
enum ValidationResult {
e_OK = 0,
e_Absent,
e_Error,
e_InvalidTime,
e_BadPassword,
e_ReplyAttack,
e_Disabled
};
virtual ValidationResult ValidateTokens(
const PASN_Array & clearTokens,
const PASN_Array & cryptoTokens,
const PBYTEArray & rawPDU
);
virtual ValidationResult ValidateClearToken(
const H235_ClearToken & clearToken
);
virtual ValidationResult ValidateCryptoToken(
const H225_CryptoH323Token & cryptoToken,
const PBYTEArray & rawPDU
);
virtual PBoolean IsCapability(
const H235_AuthenticationMechanism & mechansim,
const PASN_ObjectId & algorithmOID
) = 0;
virtual PBoolean SetCapability(
H225_ArrayOf_AuthenticationMechanism & mechansims,
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
) = 0;
virtual PBoolean UseGkAndEpIdentifiers() const;
virtual PBoolean IsSecuredPDU(
unsigned rasPDU,
PBoolean received
) const;
virtual PBoolean IsActive() const;
void Enable(
PBoolean enab = true
) { enabled = enab; }
void Disable() { enabled = false; }
const PString & GetRemoteId() const { return remoteId; }
void SetRemoteId(const PString & id) { remoteId = id; }
const PString & GetLocalId() const { return localId; }
void SetLocalId(const PString & id) { localId = id; }
const PString & GetPassword() const { return password; }
void SetPassword(const PString & pw) { password = pw; }
protected:
PBoolean AddCapability(
unsigned mechanism,
const PString & oid,
H225_ArrayOf_AuthenticationMechanism & mechansims,
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
);
PBoolean enabled;
PString remoteId; // ID of remote entity
PString localId; // ID of local entity
PString password; // shared secret
unsigned sentRandomSequenceNumber;
unsigned lastRandomSequenceNumber;
unsigned lastTimestamp;
int timestampGracePeriod;
PMutex mutex;
private:
P_REMOVE_VIRTUAL(H225_CryptoH323Token *,CreateCryptoToken(),NULL);
};
PDECLARE_LIST(H235Authenticators, H235Authenticator)
public:
void PreparePDU(
H323TransactionPDU & pdu,
PASN_Array & clearTokens,
unsigned clearOptionalField,
PASN_Array & cryptoTokens,
unsigned cryptoOptionalField
);
H235Authenticator::ValidationResult ValidatePDU(
const H323TransactionPDU & pdu,
const PASN_Array & clearTokens,
unsigned clearOptionalField,
const PASN_Array & cryptoTokens,
unsigned cryptoOptionalField,
const PBYTEArray & rawPDU
);
};
class H235AuthSimpleMD5 : public H235Authenticator
{
PCLASSINFO(H235AuthSimpleMD5, H235Authenticator);
public:
H235AuthSimpleMD5();
PObject * Clone() const;
virtual const char * GetName() const;
virtual H225_CryptoH323Token * CreateCryptoToken(bool digits);
virtual ValidationResult ValidateCryptoToken(
const H225_CryptoH323Token & cryptoToken,
const PBYTEArray & rawPDU
);
virtual PBoolean IsCapability(
const H235_AuthenticationMechanism & mechansim,
const PASN_ObjectId & algorithmOID
);
virtual PBoolean SetCapability(
H225_ArrayOf_AuthenticationMechanism & mechansim,
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
);
virtual PBoolean IsSecuredPDU(
unsigned rasPDU,
PBoolean received
) const;
};
PFACTORY_LOAD(H235AuthSimpleMD5);
class H235AuthCAT : public H235Authenticator
{
PCLASSINFO(H235AuthCAT, H235Authenticator);
public:
H235AuthCAT();
PObject * Clone() const;
virtual const char * GetName() const;
virtual H235_ClearToken * CreateClearToken();
virtual ValidationResult ValidateClearToken(
const H235_ClearToken & clearToken
);
virtual PBoolean IsCapability(
const H235_AuthenticationMechanism & mechansim,
const PASN_ObjectId & algorithmOID
);
virtual PBoolean SetCapability(
H225_ArrayOf_AuthenticationMechanism & mechansim,
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
);
virtual PBoolean IsSecuredPDU(
unsigned rasPDU,
PBoolean received
) const;
};
PFACTORY_LOAD(H235AuthCAT);
#if OPAL_PTLIB_SSL
class H235AuthProcedure1 : public H235Authenticator
{
PCLASSINFO(H235AuthProcedure1, H235Authenticator);
public:
H235AuthProcedure1();
PObject * Clone() const;
virtual const char * GetName() const;
virtual H225_CryptoH323Token * CreateCryptoToken(bool digits);
virtual PBoolean Finalise(
PBYTEArray & rawPDU
);
virtual ValidationResult ValidateCryptoToken(
const H225_CryptoH323Token & cryptoToken,
const PBYTEArray & rawPDU
);
virtual PBoolean IsCapability(
const H235_AuthenticationMechanism & mechansim,
const PASN_ObjectId & algorithmOID
);
virtual PBoolean SetCapability(
H225_ArrayOf_AuthenticationMechanism & mechansim,
H225_ArrayOf_PASN_ObjectId & algorithmOIDs
);
virtual PBoolean UseGkAndEpIdentifiers() const;
};
PFACTORY_LOAD(H235AuthProcedure1);
#endif // OPAL_PTLIB_SSL
#endif // OPAL_H323
#endif //OPAL_H323_H235AUTH_H
H235Authenticator::SetLocalId
void SetLocalId(const PString &id)
Definition: h235auth.h:136
H235Authenticator::e_Disabled
Security parameters indicate an attack was made.
Definition: h235auth.h:90
H235Authenticator::IsCapability
virtual PBoolean IsCapability(const H235_AuthenticationMechanism &mechansim, const PASN_ObjectId &algorithmOID)=0
H235Authenticator::password
PString password
Definition: h235auth.h:154
H235Authenticator::e_ReplyAttack
Security parameters indicate bad password in token.
Definition: h235auth.h:89
H235Authenticator::CreateCryptoToken
virtual H225_CryptoH323Token * CreateCryptoToken(bool digits)
H235Authenticator::lastRandomSequenceNumber
unsigned lastRandomSequenceNumber
Definition: h235auth.h:157
H235Authenticator::SetRemoteId
void SetRemoteId(const PString &id)
Definition: h235auth.h:133
H235AuthCAT::ValidateClearToken
virtual ValidationResult ValidateClearToken(const H235_ClearToken &clearToken)
H235AuthCAT::IsCapability
virtual PBoolean IsCapability(const H235_AuthenticationMechanism &mechansim, const PASN_ObjectId &algorithmOID)
H235Authenticator::GetRemoteId
const PString & GetRemoteId() const
Definition: h235auth.h:132
H235Authenticator::Finalise
virtual PBoolean Finalise(PBYTEArray &rawPDU)
buildopts.h
H235Authenticator::GetLocalId
const PString & GetLocalId() const
Definition: h235auth.h:135
H235AuthCAT::H235AuthCAT
H235AuthCAT()
H235Authenticator::GetPassword
const PString & GetPassword() const
Definition: h235auth.h:138
H235AuthCAT::CreateClearToken
virtual H235_ClearToken * CreateClearToken()
H235Authenticator::ValidateClearToken
virtual ValidationResult ValidateClearToken(const H235_ClearToken &clearToken)
H235Authenticator::localId
PString localId
Definition: h235auth.h:153
H235AuthCAT::Clone
PObject * Clone() const
H235Authenticator::remoteId
PString remoteId
Definition: h235auth.h:152
PreparePDU
void PreparePDU(H323TransactionPDU &pdu, PASN_Array &clearTokens, unsigned clearOptionalField, PASN_Array &cryptoTokens, unsigned cryptoOptionalField)
H235Authenticator::e_InvalidTime
Security parameters are present but incorrect.
Definition: h235auth.h:87
H235Authenticator::PrepareTokens
virtual PBoolean PrepareTokens(PASN_Array &clearTokens, PASN_Array &cryptoTokens)
H235Authenticator::sentRandomSequenceNumber
unsigned sentRandomSequenceNumber
Definition: h235auth.h:156
H235Authenticator::ValidateCryptoToken
virtual ValidationResult ValidateCryptoToken(const H225_CryptoH323Token &cryptoToken, const PBYTEArray &rawPDU)
H235AuthCAT
Definition: h235auth.h:237
H235Authenticator::GetName
virtual const char * GetName() const =0
H235Authenticator::Disable
void Disable()
Definition: h235auth.h:130
H235Authenticator::Enable
void Enable(PBoolean enab=true)
Definition: h235auth.h:127
H235Authenticator::PrintOn
virtual void PrintOn(ostream &strm) const
H235Authenticator::SetCapability
virtual PBoolean SetCapability(H225_ArrayOf_AuthenticationMechanism &mechansims, H225_ArrayOf_PASN_ObjectId &algorithmOIDs)=0
H235Authenticator::H235Authenticator
H235Authenticator()
H235Authenticator::AddCapability
PBoolean AddCapability(unsigned mechanism, const PString &oid, H225_ArrayOf_AuthenticationMechanism &mechansims, H225_ArrayOf_PASN_ObjectId &algorithmOIDs)
H235Authenticator::e_OK
Definition: h235auth.h:84
H235Authenticator::IsActive
virtual PBoolean IsActive() const
H235Authenticator::lastTimestamp
unsigned lastTimestamp
Definition: h235auth.h:158
H235Authenticator::timestampGracePeriod
int timestampGracePeriod
Definition: h235auth.h:159
H235Authenticator::e_Error
Security parameters are expected but absent.
Definition: h235auth.h:86
H235Authenticator
Definition: h235auth.h:59
H235Authenticator::ValidateTokens
virtual ValidationResult ValidateTokens(const PASN_Array &clearTokens, const PASN_Array &cryptoTokens, const PBYTEArray &rawPDU)
H323TransactionPDU
Definition: h323trans.h:51
H235Authenticator::ValidationResult
ValidationResult
Definition: h235auth.h:83
H235Authenticator::UseGkAndEpIdentifiers
virtual PBoolean UseGkAndEpIdentifiers() const
H235Authenticator::mutex
PMutex mutex
Definition: h235auth.h:161
H235Authenticator::IsSecuredPDU
virtual PBoolean IsSecuredPDU(unsigned rasPDU, PBoolean received) const
ValidatePDU
H235Authenticator::ValidationResult ValidatePDU(const H323TransactionPDU &pdu, const PASN_Array &clearTokens, unsigned clearOptionalField, const PASN_Array &cryptoTokens, unsigned cryptoOptionalField, const PBYTEArray &rawPDU)
H235Authenticator::CreateClearToken
virtual H235_ClearToken * CreateClearToken()
PFACTORY_LOAD
PFACTORY_LOAD(H235AuthSimpleMD5)
H235Authenticator::enabled
PBoolean enabled
Definition: h235auth.h:150
H235AuthCAT::GetName
virtual const char * GetName() const
H235AuthSimpleMD5
Definition: h235auth.h:195
H235AuthCAT::SetCapability
virtual PBoolean SetCapability(H225_ArrayOf_AuthenticationMechanism &mechansim, H225_ArrayOf_PASN_ObjectId &algorithmOIDs)
H235AuthCAT::IsSecuredPDU
virtual PBoolean IsSecuredPDU(unsigned rasPDU, PBoolean received) const
H235Authenticator::e_Absent
Security parameters and Msg are ok, no security attacks.
Definition: h235auth.h:85
H235Authenticator::SetPassword
void SetPassword(const PString &pw)
Definition: h235auth.h:139
H235Authenticator::e_BadPassword
Security parameters indicate peer has bad real time clock.
Definition: h235auth.h:88