store headers only once, refs #7
This commit is contained in:
1112
actlibrary/include/actException.h
Normal file
1112
actlibrary/include/actException.h
Normal file
@@ -0,0 +1,1112 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actException.h
|
||||
// Product: cv act library
|
||||
// Purpose: exception hierarchy
|
||||
//
|
||||
// Copyright: (c) 2000 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ACT_Exception_h
|
||||
#define ACT_Exception_h
|
||||
|
||||
#include <new>
|
||||
#include <exception>
|
||||
|
||||
#include "actMove.h"
|
||||
#include "actBlob.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
enum ExceptionId
|
||||
{
|
||||
eiException = 0,
|
||||
eiBadException = eiException + 1,
|
||||
eiNullPointerException,
|
||||
eiOutOfRangeException,
|
||||
|
||||
eiBadCastException = eiException + 10,
|
||||
eiBadNumericCast,
|
||||
eiNegativeOverflow,
|
||||
eiPositiveOverflow,
|
||||
|
||||
eiRuntimeException = eiException + 20,
|
||||
eiBadAllocException,
|
||||
eiNotSupportedException,
|
||||
eiNotImplementedException,
|
||||
eiInvalidParameterException,
|
||||
eiSynchronizationException,
|
||||
|
||||
eiLogicalException = eiException + 40,
|
||||
eiASN1Exception,
|
||||
eiNoSuchDLLException,
|
||||
eiPasswordException,
|
||||
eiArithmeticException,
|
||||
eiMessageDigestException,
|
||||
eiPaddingException,
|
||||
eiSignatureException,
|
||||
|
||||
eiAlgorithmException = eiException + 80,
|
||||
eiInvalidAlgorithmParameterException,
|
||||
eiNoSuchAlgorithmException,
|
||||
|
||||
eiCertificateException = eiException + 80,
|
||||
eiInvalidCertificateException,
|
||||
eiCertificateEncodingException,
|
||||
eiCertificateExpiredException,
|
||||
eiCertificateNotYetValidException,
|
||||
eiCertificateParsingException,
|
||||
|
||||
eiKeyException = eiException + 100,
|
||||
eiInvalidKeyException,
|
||||
eiKeyManagementException,
|
||||
|
||||
eiEACException = eiException + 120,
|
||||
eiEACDataException,
|
||||
eiEACMRZException,
|
||||
eiEACCVCertException,
|
||||
|
||||
eiSmartcardException = eiException + 140,
|
||||
eiCardOutOfMemoryException,
|
||||
eiInvalidPinException,
|
||||
eiPinLockedException,
|
||||
eiPinExpiredException,
|
||||
eiPinLenRangeException,
|
||||
eiInvalidCRKeyException,
|
||||
eiInvalidCardException,
|
||||
eiInvalidAuthException,
|
||||
eiInvalidAuthObjectException,
|
||||
eiAuthProtocolException,
|
||||
eiAuthConstrainedException,
|
||||
eiSecureMessagingException,
|
||||
eiSMWrapException,
|
||||
eiSMUnwrapException,
|
||||
|
||||
eiSubsystemException = eiException + 180,
|
||||
eiNoSuchSubsystemException,
|
||||
};
|
||||
|
||||
#ifndef UNDER_CE_30
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class FileAndLine
|
||||
{
|
||||
public:
|
||||
FileAndLine(const char* file = 0, int line = 0)
|
||||
: m_line(line)
|
||||
, m_file(file)
|
||||
{ }
|
||||
|
||||
FileAndLine(const FileAndLine& other)
|
||||
: m_line(other.line())
|
||||
, m_file(other.file())
|
||||
{ }
|
||||
|
||||
int line() const { return m_line; }
|
||||
const char* file() const { return m_file; }
|
||||
|
||||
// assignment operators.
|
||||
FileAndLine& operator=(const FileAndLine& other)
|
||||
{
|
||||
m_line = other.line();
|
||||
m_file = other.file();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
int m_line;
|
||||
const char* m_file;
|
||||
};
|
||||
|
||||
//
|
||||
// base class for all exceptions thrown by cv act library
|
||||
// ---------------------------------------------------------------------------
|
||||
class Exception
|
||||
{
|
||||
public:
|
||||
typedef Exception Type;
|
||||
|
||||
explicit Exception(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: m_what(msg)
|
||||
, m_where(where)
|
||||
, m_code(code)
|
||||
{ }
|
||||
|
||||
explicit Exception(const std::exception& other)
|
||||
: m_what(other.what())
|
||||
, m_where(0)
|
||||
, m_code(0)
|
||||
{ }
|
||||
|
||||
template<typename T>
|
||||
explicit Exception(const T& other)
|
||||
: m_what(other.what())
|
||||
, m_where(other.where())
|
||||
, m_code(0)
|
||||
{ }
|
||||
|
||||
virtual ~Exception()
|
||||
{ }
|
||||
|
||||
template<typename _ExceptionT>
|
||||
_ExceptionT* TypedClone() const
|
||||
{
|
||||
return new(std::nothrow) _ExceptionT(m_what, m_where, m_code);
|
||||
}
|
||||
|
||||
template<typename _ExceptionT, typename ParamT>
|
||||
_ExceptionT* TypedClone(const ParamT& param) const
|
||||
{
|
||||
return new(std::nothrow) _ExceptionT(m_what, m_where, param);
|
||||
}
|
||||
|
||||
template<typename _ExceptionT>
|
||||
void TypedThrow() const { throw _ExceptionT(m_what, m_where, m_code); }
|
||||
|
||||
template<typename _ExceptionT, typename ParamT>
|
||||
void TypedThrow(const ParamT& param) const { throw _ExceptionT(m_what, m_where, param); }
|
||||
|
||||
virtual Exception* Clone() const { return new(std::nothrow) Exception(*this); }
|
||||
virtual int GetId() const { return eiException; }
|
||||
virtual void Throw() const { throw Exception(*this); }
|
||||
|
||||
const char* what() const { return m_what != 0 ? m_what : ""; }
|
||||
const char* where() const { return m_where != 0 ? m_where : ""; }
|
||||
ulong code() const { return m_code; }
|
||||
|
||||
template<typename ExceptionT>
|
||||
friend ExceptionT& modify(ExceptionT& e, const char* what, const char* where)
|
||||
{
|
||||
if(what != 0) e.m_what = what;
|
||||
if(where != 0) e.m_where = where;
|
||||
return e;
|
||||
}
|
||||
|
||||
protected:
|
||||
const char* m_what;
|
||||
const char* m_where;
|
||||
ulong m_code;
|
||||
};
|
||||
|
||||
//
|
||||
// ExceptionType<>
|
||||
// ---------------------------------------------------------------------------
|
||||
template
|
||||
<
|
||||
const int _exceptionId,
|
||||
class ExceptionT,
|
||||
class BaseT,
|
||||
typename OtherT = void
|
||||
>
|
||||
class ExceptionType : public BaseT, public OtherT
|
||||
{
|
||||
protected:
|
||||
typedef BaseT BaseType;
|
||||
typedef OtherT OtherType;
|
||||
enum { exceptionId = _exceptionId };
|
||||
|
||||
public:
|
||||
ExceptionType(const char* msg, const char* where, ulong code)
|
||||
: BaseType(msg, where, code)
|
||||
, OtherT()
|
||||
{ }
|
||||
|
||||
ExceptionT& operator<<(const OtherType& other)
|
||||
{
|
||||
*static_cast<OtherType*>(this) = other;
|
||||
return *static_cast<ExceptionT*>(this);
|
||||
}
|
||||
|
||||
template<typename _ExceptionT>
|
||||
_ExceptionT* TypedClone() const
|
||||
{
|
||||
_ExceptionT* e = new(std::nothrow) _ExceptionT(BaseT::m_what, BaseT::m_where, BaseT::m_code);
|
||||
if(e != 0) *e << *this;
|
||||
return e;
|
||||
}
|
||||
|
||||
virtual void Throw() const { throw ExceptionT(BaseT::m_what, BaseT::m_where, BaseT::m_code); }
|
||||
virtual int GetId() const { return exceptionId; }
|
||||
};
|
||||
|
||||
template
|
||||
<
|
||||
const int _exceptionId,
|
||||
class ExceptionT,
|
||||
class BaseT
|
||||
>
|
||||
class ExceptionType<_exceptionId, ExceptionT, BaseT, void> : public BaseT
|
||||
{
|
||||
protected:
|
||||
typedef BaseT BaseType;
|
||||
enum { exceptionId = _exceptionId };
|
||||
|
||||
public:
|
||||
ExceptionType(const char* msg, const char* where, ulong code)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual void Throw() const { throw ExceptionT(BaseT::m_what, BaseT::m_where, BaseT::m_code); }
|
||||
virtual int GetId() const { return exceptionId; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class BadException :
|
||||
public ExceptionType<eiBadException, BadException, Exception>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiBadException, BadException, Exception> BaseType;
|
||||
typedef BadException Type;
|
||||
using BaseType::exceptionId;
|
||||
|
||||
BadException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
};
|
||||
|
||||
class NullPointerException :
|
||||
public ExceptionType<eiNullPointerException, NullPointerException, BadException>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiNullPointerException, NullPointerException, BadException> BaseType;
|
||||
typedef NullPointerException Type;
|
||||
using BaseType::exceptionId;
|
||||
|
||||
NullPointerException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
};
|
||||
|
||||
class OutOfRangeException :
|
||||
public ExceptionType<eiOutOfRangeException, OutOfRangeException, BadException>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiOutOfRangeException, OutOfRangeException, BadException> BaseType;
|
||||
typedef OutOfRangeException Type;
|
||||
using BaseType::exceptionId;
|
||||
|
||||
OutOfRangeException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class BadCastException :
|
||||
public ExceptionType<eiBadCastException, BadCastException, Exception>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiBadCastException, BadCastException, Exception> BaseType;
|
||||
typedef BadCastException Type;
|
||||
using BaseType::exceptionId;
|
||||
|
||||
BadCastException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
};
|
||||
|
||||
class BadNumericCast :
|
||||
public ExceptionType<eiBadNumericCast, BadNumericCast, BadCastException>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiBadNumericCast, BadNumericCast, BadCastException> BaseType;
|
||||
typedef BadNumericCast Type;
|
||||
using BaseType::exceptionId;
|
||||
|
||||
BadNumericCast(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
|
||||
template<typename overflow_type>
|
||||
void operator()(overflow_type overflow)
|
||||
{
|
||||
switch(eiBadNumericCast + overflow)
|
||||
{
|
||||
case eiNegativeOverflow: TypedThrow<ExceptionType<eiNegativeOverflow, Type, BaseType> >();
|
||||
case eiPositiveOverflow: TypedThrow<ExceptionType<eiNegativeOverflow, Type, BaseType> >();
|
||||
default: /* do nothing */;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class RuntimeException :
|
||||
public ExceptionType<eiRuntimeException, RuntimeException, Exception>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiRuntimeException, RuntimeException, Exception> BaseType;
|
||||
typedef RuntimeException Type;
|
||||
using BaseType::exceptionId;
|
||||
|
||||
RuntimeException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
};
|
||||
|
||||
class BadAllocException :
|
||||
public ExceptionType<eiBadAllocException, BadAllocException, RuntimeException>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiBadAllocException, BadAllocException, RuntimeException> BaseType;
|
||||
typedef BadAllocException Type;
|
||||
using BaseType::exceptionId;
|
||||
|
||||
BadAllocException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
};
|
||||
|
||||
class NotSupportedException :
|
||||
public ExceptionType<eiNotSupportedException, NotSupportedException, RuntimeException, FileAndLine>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiNotSupportedException, NotSupportedException, RuntimeException, FileAndLine> BaseType;
|
||||
typedef NotSupportedException Type;
|
||||
using BaseType::exceptionId;
|
||||
using BaseType::operator<<;
|
||||
|
||||
explicit NotSupportedException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
};
|
||||
|
||||
class NotImplementedException :
|
||||
public ExceptionType<eiNotImplementedException, NotImplementedException, RuntimeException, FileAndLine>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiNotImplementedException, NotImplementedException, RuntimeException, FileAndLine> BaseType;
|
||||
typedef NotImplementedException Type;
|
||||
using BaseType::exceptionId;
|
||||
using BaseType::operator<<;
|
||||
|
||||
NotImplementedException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
};
|
||||
|
||||
class InvalidParameterException :
|
||||
public ExceptionType<eiInvalidParameterException, InvalidParameterException, RuntimeException, FileAndLine>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiInvalidParameterException, InvalidParameterException, RuntimeException, FileAndLine> BaseType;
|
||||
typedef InvalidParameterException Type;
|
||||
using BaseType::exceptionId;
|
||||
using BaseType::operator<<;
|
||||
|
||||
InvalidParameterException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
};
|
||||
|
||||
class SynchronizationException :
|
||||
public ExceptionType<eiSynchronizationException, SynchronizationException, RuntimeException, FileAndLine>
|
||||
{
|
||||
public:
|
||||
typedef ExceptionType<eiSynchronizationException, SynchronizationException, RuntimeException, FileAndLine> BaseType;
|
||||
typedef SynchronizationException Type;
|
||||
using BaseType::exceptionId;
|
||||
using BaseType::operator<<;
|
||||
|
||||
SynchronizationException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: BaseType(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class LogicalException : public Exception
|
||||
{
|
||||
public:
|
||||
typedef Exception BaseType;
|
||||
typedef LogicalException Type;
|
||||
|
||||
LogicalException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: Exception(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiLogicalException; }
|
||||
};
|
||||
|
||||
class ASN1Exception : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef ASN1Exception Type;
|
||||
|
||||
ASN1Exception(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiASN1Exception; }
|
||||
};
|
||||
|
||||
class NoSuchDLLException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef NoSuchDLLException Type;
|
||||
|
||||
NoSuchDLLException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiNoSuchDLLException; }
|
||||
};
|
||||
|
||||
class PasswordException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef PasswordException Type;
|
||||
|
||||
PasswordException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiPasswordException; }
|
||||
};
|
||||
|
||||
class ArithmeticException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef ArithmeticException Type;
|
||||
|
||||
ArithmeticException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiArithmeticException; }
|
||||
};
|
||||
|
||||
class MessageDigestException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef MessageDigestException Type;
|
||||
|
||||
MessageDigestException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiMessageDigestException; }
|
||||
};
|
||||
|
||||
class PaddingException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef PaddingException Type;
|
||||
|
||||
PaddingException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiPaddingException; }
|
||||
};
|
||||
|
||||
class SignatureException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef SignatureException Type;
|
||||
|
||||
SignatureException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiSignatureException; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class AlgorithmException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef AlgorithmException Type;
|
||||
|
||||
AlgorithmException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiAlgorithmException; }
|
||||
};
|
||||
|
||||
class InvalidAlgorithmParameterException : public AlgorithmException
|
||||
{
|
||||
public:
|
||||
typedef AlgorithmException BaseType;
|
||||
typedef InvalidAlgorithmParameterException Type;
|
||||
|
||||
InvalidAlgorithmParameterException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: AlgorithmException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiInvalidAlgorithmParameterException; }
|
||||
};
|
||||
|
||||
class NoSuchAlgorithmException : public AlgorithmException
|
||||
{
|
||||
public:
|
||||
typedef AlgorithmException BaseType;
|
||||
typedef NoSuchAlgorithmException Type;
|
||||
|
||||
NoSuchAlgorithmException(const char* msg = 0, const char* where = 0, const char* algorithm = 0)
|
||||
: AlgorithmException(msg, where)
|
||||
, m_algorithm(algorithm)
|
||||
{
|
||||
m_algorithm.push_back(0);
|
||||
}
|
||||
|
||||
// GCC 4.2.1 whats to have it
|
||||
virtual ~NoSuchAlgorithmException()
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(algorithm()); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, algorithm()); }
|
||||
virtual int GetId() const { return eiNoSuchAlgorithmException; }
|
||||
|
||||
const char* algorithm() const { return reinterpret_cast<const char*>(&m_algorithm[0]); }
|
||||
|
||||
protected:
|
||||
mutable Blob m_algorithm;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class CertificateException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef CertificateException Type;
|
||||
|
||||
CertificateException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiCertificateException; }
|
||||
};
|
||||
|
||||
class InvalidCertificateException : public CertificateException
|
||||
{
|
||||
public:
|
||||
typedef CertificateException BaseType;
|
||||
typedef InvalidCertificateException Type;
|
||||
|
||||
InvalidCertificateException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: CertificateException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiInvalidCertificateException; }
|
||||
};
|
||||
|
||||
class CertificateEncodingException : public CertificateException
|
||||
{
|
||||
public:
|
||||
typedef CertificateException BaseType;
|
||||
typedef CertificateEncodingException Type;
|
||||
|
||||
CertificateEncodingException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: CertificateException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiCertificateEncodingException; }
|
||||
};
|
||||
|
||||
class CertificateExpiredException : public CertificateException
|
||||
{
|
||||
public:
|
||||
typedef CertificateException BaseType;
|
||||
typedef CertificateExpiredException Type;
|
||||
|
||||
CertificateExpiredException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: CertificateException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiCertificateExpiredException; }
|
||||
};
|
||||
|
||||
class CertificateNotYetValidException : public CertificateException
|
||||
{
|
||||
public:
|
||||
typedef CertificateException BaseType;
|
||||
typedef CertificateNotYetValidException Type;
|
||||
|
||||
CertificateNotYetValidException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: CertificateException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiCertificateNotYetValidException; }
|
||||
};
|
||||
|
||||
class CertificateParsingException : public CertificateException
|
||||
{
|
||||
public:
|
||||
typedef CertificateException BaseType;
|
||||
typedef CertificateParsingException Type;
|
||||
|
||||
CertificateParsingException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: CertificateException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiCertificateParsingException; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class KeyException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef KeyException Type;
|
||||
|
||||
KeyException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiKeyException; }
|
||||
};
|
||||
|
||||
class InvalidKeyException : public KeyException
|
||||
{
|
||||
public:
|
||||
typedef KeyException BaseType;
|
||||
typedef InvalidKeyException Type;
|
||||
|
||||
InvalidKeyException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: KeyException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiInvalidKeyException; }
|
||||
};
|
||||
|
||||
class KeyManagementException : public KeyException
|
||||
{
|
||||
public:
|
||||
typedef KeyException BaseType;
|
||||
typedef KeyManagementException Type;
|
||||
|
||||
KeyManagementException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: KeyException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiKeyManagementException; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class EACException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef EACException Type;
|
||||
|
||||
EACException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiEACException; }
|
||||
};
|
||||
|
||||
class EACDataException : public EACException
|
||||
{
|
||||
public:
|
||||
typedef EACException BaseType;
|
||||
typedef EACDataException Type;
|
||||
|
||||
EACDataException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: EACException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiEACDataException; }
|
||||
};
|
||||
|
||||
class EACMRZException : public EACDataException
|
||||
{
|
||||
public:
|
||||
typedef EACDataException BaseType;
|
||||
typedef EACMRZException Type;
|
||||
|
||||
EACMRZException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: EACDataException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiEACMRZException; }
|
||||
};
|
||||
|
||||
class EACCVCertException : public EACDataException
|
||||
{
|
||||
public:
|
||||
typedef EACDataException BaseType;
|
||||
typedef EACCVCertException Type;
|
||||
|
||||
EACCVCertException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: EACDataException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiEACCVCertException; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class SmartcardException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef SmartcardException Type;
|
||||
|
||||
SmartcardException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiSmartcardException; }
|
||||
};
|
||||
|
||||
class CardOutOfMemoryException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef CardOutOfMemoryException Type;
|
||||
|
||||
CardOutOfMemoryException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiCardOutOfMemoryException; }
|
||||
};
|
||||
|
||||
class InvalidPinException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef InvalidPinException Type;
|
||||
|
||||
InvalidPinException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiInvalidPinException; }
|
||||
};
|
||||
|
||||
class PinLockedException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef PinLockedException Type;
|
||||
|
||||
PinLockedException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiPinLockedException; }
|
||||
};
|
||||
|
||||
class PinExpiredException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef PinExpiredException Type;
|
||||
|
||||
PinExpiredException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiPinExpiredException; }
|
||||
};
|
||||
|
||||
class PinLenRangeException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef PinLenRangeException Type;
|
||||
|
||||
PinLenRangeException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiPinLenRangeException; }
|
||||
};
|
||||
|
||||
class InvalidCRKeyException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef InvalidCRKeyException Type;
|
||||
|
||||
InvalidCRKeyException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiInvalidCRKeyException; }
|
||||
};
|
||||
|
||||
class InvalidCardException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef InvalidCardException Type;
|
||||
|
||||
InvalidCardException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiInvalidCardException; }
|
||||
};
|
||||
|
||||
class InvalidAuthException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef InvalidAuthException Type;
|
||||
|
||||
InvalidAuthException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiInvalidAuthException; }
|
||||
};
|
||||
|
||||
class InvalidAuthObjectException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef InvalidAuthObjectException Type;
|
||||
|
||||
InvalidAuthObjectException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiInvalidAuthObjectException; }
|
||||
};
|
||||
|
||||
class AuthProtocolException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef AuthProtocolException Type;
|
||||
|
||||
AuthProtocolException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiAuthProtocolException; }
|
||||
};
|
||||
|
||||
class AuthConstrainedException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef AuthConstrainedException Type;
|
||||
|
||||
AuthConstrainedException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiAuthConstrainedException; }
|
||||
};
|
||||
|
||||
class SecureMessagingException : public SmartcardException
|
||||
{
|
||||
public:
|
||||
typedef SmartcardException BaseType;
|
||||
typedef SecureMessagingException Type;
|
||||
|
||||
SecureMessagingException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SmartcardException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiSecureMessagingException; }
|
||||
};
|
||||
|
||||
class SMWrapException : public SecureMessagingException
|
||||
{
|
||||
public:
|
||||
typedef SecureMessagingException BaseType;
|
||||
typedef SMWrapException Type;
|
||||
|
||||
SMWrapException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SecureMessagingException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiSMWrapException; }
|
||||
};
|
||||
|
||||
class SMUnwrapException : public SecureMessagingException
|
||||
{
|
||||
public:
|
||||
typedef SecureMessagingException BaseType;
|
||||
typedef SMUnwrapException Type;
|
||||
|
||||
SMUnwrapException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SecureMessagingException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiSMUnwrapException; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class SubsystemException : public LogicalException
|
||||
{
|
||||
public:
|
||||
typedef LogicalException BaseType;
|
||||
typedef SubsystemException Type;
|
||||
|
||||
SubsystemException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: LogicalException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiSubsystemException; }
|
||||
};
|
||||
|
||||
class NoSuchSubsystemException : public SubsystemException
|
||||
{
|
||||
public:
|
||||
typedef SubsystemException BaseType;
|
||||
typedef NoSuchSubsystemException Type;
|
||||
|
||||
NoSuchSubsystemException(const char* msg = 0, const char* where = 0, ulong code = 0)
|
||||
: SubsystemException(msg, where, code)
|
||||
{ }
|
||||
|
||||
virtual Type* Clone() const { return TypedClone<Type>(); }
|
||||
virtual void Throw() const { throw Type(m_what, m_where, m_code); }
|
||||
virtual int GetId() const { return eiNoSuchSubsystemException; }
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#define throw(_x) _exit(_x)
|
||||
|
||||
int Exception(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int BadException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int NullPointerException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int OutOfRangeException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int BadCastException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int BadNumericCast(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int RuntimeException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int BadAllocException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int NotSupportedException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int NotImplementedException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int InvalidParameterException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int SynchronizationException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int LogicalException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int AlgorithmException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int InvalidAlgorithmParameterException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int NoSuchAlgorithmException(const char* msg = 0, const char* where = 0, const char* algorithm);
|
||||
int ArithmeticException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int CertificateException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int CertificateEncodingException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int CertificateExpiredException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int CertificateNotYetValidException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int CertificateParsingException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int KeyException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int InvalidKeyException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int KeyManagementException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int MessageDigestException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int PaddingException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int SignatureException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int EACException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int EACDataException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int EACMRZException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int EACCVCertException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int SmartcardException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int CardOutOfMemoryException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int InvalidPinException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int InvalidCardException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int InvalidAuthObjectException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int AuthProtocolException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int AuthConstrainedException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int SecureMessagingException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int SMWrapException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int SMUnwrapException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int SubsystemException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
int NoSuchSubsystemException(const char* msg = 0, const char* where = 0, ulong code = 0);
|
||||
|
||||
#endif // UNDER_CE_30
|
||||
|
||||
}// namespace act
|
||||
|
||||
#endif // ACT_Exception_h
|
Reference in New Issue
Block a user