store headers only once, refs #7
This commit is contained in:
@@ -4,6 +4,7 @@ Komponenten werden müssen separat gebaut werden.
|
||||
actlibrary
|
||||
Beinhaltet Unterverzeichnisse für die "actlibrary" und die dazugehörigen
|
||||
Include-Dateien der einzelnen Architekturen
|
||||
Enthält APDUs.
|
||||
|
||||
openssl-act-engine
|
||||
OpenSSL-Engine auf Basis der actlibrary zur Benutzung von
|
||||
@@ -44,3 +45,8 @@ Sample_executables
|
||||
Beinhaltet z.Zt. vorcompiliertes Beispiel der engine_act.dll
|
||||
(OpenSSL-Engine unter Windows)
|
||||
|
||||
Kompilieren:
|
||||
1. Build openssl-act-engine
|
||||
2. Qt-Patch anwenden
|
||||
3. Qt-builden
|
||||
4. Test_Qt_Frontend
|
||||
|
||||
@@ -18,7 +18,8 @@ void SmartCardAuth::initialize() {
|
||||
q_ENGINE_load_dynamic();
|
||||
e = q_ENGINE_by_id("dynamic");
|
||||
|
||||
int r=q_ENGINE_ctrl_cmd_string(e, "SO_PATH", "C:\\Windows\\System32\\engine_act.dll", 0);
|
||||
//! @todo add library-name
|
||||
int r=q_ENGINE_ctrl_cmd_string(e, "SO_PATH", "...library-name...", 0);
|
||||
r=q_ENGINE_ctrl_cmd_string(e, "ID", "act", 0);
|
||||
r=q_ENGINE_ctrl_cmd_string(e, "LIST_ADD", "1", 0);
|
||||
r=q_ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0);
|
||||
@@ -143,6 +144,7 @@ bool SmartCardAuth::hookInitSslContext(SSL_CTX *ctx)
|
||||
|
||||
#ifdef USE_CERTIFICATE_FILE
|
||||
// Load a specific intermediate certificate from a file
|
||||
//! @todo PEM-File
|
||||
BIO* cert_file= q_BIO_new_file("D:\\QtSmartCardAuth_TMI\\QtSslTest\\swsign_interm.pem", "r");
|
||||
X509* interm=q_PEM_read_bio_X509(cert_file,NULL,NULL, NULL);
|
||||
q_BIO_free(cert_file);
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actAllocator.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche (MTE)
|
||||
// Date: 09/29/2008
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ACT_Allocator_h
|
||||
#define ACT_Allocator_h
|
||||
|
||||
#include "actBasics.h"
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
namespace act
|
||||
{
|
||||
//
|
||||
// Allocator<>
|
||||
template<typename TypeT, typename SizeT>
|
||||
class Allocator
|
||||
{
|
||||
public:
|
||||
typedef SizeT size_type;
|
||||
typedef TypeT value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
protected:
|
||||
typedef Allocator<TypeT, SizeT> ThisT;
|
||||
typedef pointer (*fptr_allocate)(ThisT*, size_type n, const void* hint);
|
||||
typedef void (*fptr_deallocate)(ThisT*, pointer p, size_type n);
|
||||
|
||||
private:
|
||||
Allocator(const Allocator&);
|
||||
Allocator& operator=(const Allocator&);
|
||||
|
||||
protected:
|
||||
Allocator(fptr_allocate pAllocate, fptr_deallocate pDeallocate) throw()
|
||||
: m_pAllocate(pAllocate)
|
||||
, m_pDeallocate(pDeallocate)
|
||||
{ }
|
||||
|
||||
public:
|
||||
inline pointer allocate(size_type n, const void* hint)
|
||||
{
|
||||
return m_pAllocate(this, n, hint);
|
||||
}
|
||||
|
||||
inline void deallocate(pointer p, size_type n)
|
||||
{
|
||||
if(p != 0) m_pDeallocate(this, p, n);
|
||||
}
|
||||
|
||||
protected:
|
||||
fptr_allocate m_pAllocate;
|
||||
fptr_deallocate m_pDeallocate;
|
||||
};
|
||||
|
||||
//
|
||||
// AllocatorImpl<>
|
||||
template
|
||||
<
|
||||
class AllocatorT,
|
||||
class BaseT = Allocator<typename AllocatorT::value_type, typename AllocatorT::size_type>
|
||||
>
|
||||
class AllocatorImpl : public BaseT
|
||||
{
|
||||
public:
|
||||
typedef typename BaseT::pointer pointer;
|
||||
typedef typename BaseT::size_type size_type;
|
||||
|
||||
protected:
|
||||
typedef AllocatorImpl<AllocatorT, BaseT> ThisT;
|
||||
|
||||
public:
|
||||
AllocatorImpl() throw()
|
||||
: BaseT(_allocate, _deallocate)
|
||||
{ }
|
||||
|
||||
AllocatorT& ref_alloc() { return m_Alloc; }
|
||||
|
||||
private:
|
||||
inline static pointer _allocate(BaseT* pThis, size_type n, const void* hint)
|
||||
{
|
||||
return static_cast<ThisT*>(pThis)->m_Alloc.allocate(n, hint);
|
||||
}
|
||||
|
||||
inline static void _deallocate(BaseT* pThis, pointer p, size_type n)
|
||||
{
|
||||
static_cast<ThisT*>(pThis)->m_Alloc.deallocate(p, n);
|
||||
}
|
||||
|
||||
private:
|
||||
AllocatorT m_Alloc;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Allocator_h
|
||||
@@ -1,93 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actBasics.h
|
||||
// Product: cv act library
|
||||
// Purpose: integration of globally available identifiers
|
||||
//
|
||||
// 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_Basics_h
|
||||
#define ACT_Basics_h
|
||||
|
||||
#include "actEnv.h"
|
||||
|
||||
#ifndef ACT_LITTLE_ENDIAN
|
||||
# define ACT_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined(__BIG_ENDIAN__) || \
|
||||
defined(__sun__) || \
|
||||
defined(__sparc) || \
|
||||
defined(__sparc__) || \
|
||||
defined(__ppc__) || \
|
||||
defined(__ppc64__)
|
||||
# undef ACT_LITTLE_ENDIAN
|
||||
#endif // __sun__
|
||||
|
||||
|
||||
#ifndef NO_STL_SUPPORT
|
||||
# include <cstddef> // used for ptrdiff_t,size_t
|
||||
#else
|
||||
# ifndef _PTRDIFF_T_DEFINED
|
||||
typedef int ptrdiff_t;
|
||||
# define _PTRDIFF_T_DEFINED
|
||||
# endif
|
||||
|
||||
|
||||
# ifndef _SIZE_T_DEFINED
|
||||
typedef unsigned int size_t;
|
||||
# define _SIZE_T_DEFINED
|
||||
# endif
|
||||
#endif // NO_STL_SUPPORT
|
||||
|
||||
namespace act
|
||||
{
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int dword;
|
||||
|
||||
#if defined(_MSC_VER) & !defined(__MWERKS__)
|
||||
using ::size_t;
|
||||
using ::ptrdiff_t;
|
||||
#else
|
||||
using std::size_t;
|
||||
using std::ptrdiff_t;
|
||||
#endif
|
||||
|
||||
typedef int paramid_t;
|
||||
typedef int status_t;
|
||||
typedef int mode_t;
|
||||
typedef int export_t;
|
||||
|
||||
typedef ushort uint16;
|
||||
typedef uint uint32;
|
||||
#if defined(__GNUC__) || defined(__MWERKS__)
|
||||
typedef unsigned long long uint64;
|
||||
# define U64(x) x##ULL
|
||||
#else
|
||||
//#ifdef _MSC_EXTENSIONS
|
||||
typedef unsigned __int64 uint64;
|
||||
# define U64(x) x##ui64
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
const export_t DEFAULT = 0;
|
||||
|
||||
//
|
||||
// scoped_delete<>
|
||||
template<typename TypeT, typename DestructF = void, int id = 0>
|
||||
struct scoped_delete { };
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Basics_h
|
||||
@@ -1,644 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actBlob.h
|
||||
// Product: cv act library
|
||||
// Purpose: The datatype Blob (Binary Large Object) is a universal type, which
|
||||
// can be used for any data. The class Blob almost behaves like
|
||||
// std::vector<unsigned char> with the difference that freed memory
|
||||
// is filled with zeros to enhance security.
|
||||
//
|
||||
// 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_Blob_h
|
||||
#define ACT_Blob_h
|
||||
|
||||
#include "actMove.h"
|
||||
#include "actBasics.h"
|
||||
#include "actAllocator.h"
|
||||
|
||||
#ifndef UNDER_CE_30
|
||||
# include <iostream>
|
||||
#endif // UNDER_CE_30
|
||||
|
||||
#ifndef NO_STL_SUPPORT
|
||||
# include <utility> // used for reserve_iterator
|
||||
# include <string> // used for string
|
||||
#else
|
||||
// --------------------------------------------------------------------------------
|
||||
// if there is no STL support, we define reverse_iterator here.
|
||||
// --------------------------------------------------------------------------------
|
||||
namespace std
|
||||
{
|
||||
// ITERATOR TAGS (from <iterator>)
|
||||
struct input_iterator_tag {};
|
||||
struct output_iterator_tag {};
|
||||
struct forward_iterator_tag
|
||||
: public input_iterator_tag {};
|
||||
struct bidirectional_iterator_tag
|
||||
: public forward_iterator_tag {};
|
||||
struct random_access_iterator_tag
|
||||
: public bidirectional_iterator_tag {};
|
||||
|
||||
// TEMPLATE CLASS iterator (from <iterator>)
|
||||
template<class _C, class _Ty, class _D = ptrdiff_t>
|
||||
struct iterator {
|
||||
typedef _C iterator_category;
|
||||
typedef _Ty value_type;
|
||||
typedef _D distance_type;
|
||||
};
|
||||
template<class _Ty, class _D>
|
||||
struct _Bidit : public iterator<bidirectional_iterator_tag,
|
||||
_Ty, _D> {};
|
||||
template<class _Ty, class _D>
|
||||
struct _Ranit : public iterator<random_access_iterator_tag,
|
||||
_Ty, _D> {};
|
||||
|
||||
// TEMPLATE CLASS iterator_traits (from <iterator>)
|
||||
template<class _It>
|
||||
struct iterator_traits {
|
||||
typedef _It::iterator_category iterator_category;
|
||||
typedef _It::value_type value_type;
|
||||
typedef _It::distance_type distance_type;
|
||||
};
|
||||
|
||||
|
||||
// TEMPLATE CLASS reverse_iterator (from <iterator>)
|
||||
template<class _RI,
|
||||
class _Ty,
|
||||
class _Rt = _Ty&,
|
||||
class _Pt = _Ty *,
|
||||
class _D = int>
|
||||
class reverse_iterator : public _Ranit<_Ty, _D> {
|
||||
public:
|
||||
typedef reverse_iterator<_RI, _Ty, _Rt, _Pt, _D> _Myt;
|
||||
typedef _RI iter_type;
|
||||
typedef _Rt reference_type;
|
||||
typedef _Pt pointer_type;
|
||||
reverse_iterator()
|
||||
{}
|
||||
explicit reverse_iterator(_RI _X)
|
||||
: current(_X) {}
|
||||
_RI base() const
|
||||
{return(current); }
|
||||
_Rt operator*() const
|
||||
{return(*(current - 1)); }
|
||||
// _Pt operator->() const
|
||||
// {return(&**this); }
|
||||
_Myt& operator++()
|
||||
{--current;
|
||||
return(*this); }
|
||||
_Myt operator++(int)
|
||||
{_Myt _Tmp = *this;
|
||||
--current;
|
||||
return(_Tmp); }
|
||||
_Myt& operator--()
|
||||
{++current;
|
||||
return(*this); }
|
||||
_Myt operator--(int)
|
||||
{_Myt _Tmp = *this;
|
||||
++current;
|
||||
return(_Tmp); }
|
||||
_Myt& operator+=(_D _N)
|
||||
{current -= _N;
|
||||
return(*this); }
|
||||
_Myt operator+(_D _N) const
|
||||
{return(_Myt(current - _N)); }
|
||||
_Myt& operator-=(_D _N)
|
||||
{current += _N;
|
||||
return(*this); }
|
||||
_Myt operator-(_D _N) const
|
||||
{return(_Myt(current + _N)); }
|
||||
_Rt operator[](_D _N) const
|
||||
{return(*(*this + _N)); }
|
||||
protected:
|
||||
_RI current;
|
||||
};
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator==(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(get_base(_X) == get_base(_Y)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator!=(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(!(_X == _Y)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator<(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(get_base(_Y) < get_base(_X)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator>(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(_Y < _X); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator<=(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(!(_Y < _X)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator>=(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(!(_X < _Y)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
_D __cdecl operator-(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(get_base(_Y) - get_base(_X)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
reverse_iterator<_RI, _Ty, _Rt, _Pt, _D> __cdecl operator+(_D _N,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>(
|
||||
get_base(_Y) - _N)); }
|
||||
} // namespace std
|
||||
|
||||
#endif //NO_STL_SUPPORT
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
namespace act
|
||||
{
|
||||
//
|
||||
// byte_array for fixed data
|
||||
struct byte_array
|
||||
{
|
||||
const act::byte* value;
|
||||
const size_t size;
|
||||
};
|
||||
|
||||
inline byte_array make_array(const act::byte* value = 0, size_t size = 0)
|
||||
{
|
||||
const byte_array ba = { value, size };
|
||||
return ba;
|
||||
};
|
||||
|
||||
#ifndef ACT_NO_BYTE_ARRAY_MACROS
|
||||
# define _A(x) x.value, x.size
|
||||
# define _B(x) act::make_array(reinterpret_cast<const act::byte*>(x), sizeof(x) - sizeof(x[0]))
|
||||
# define _C(x) act::make_array(reinterpret_cast<const act::byte*>(x), sizeof(x))
|
||||
# define _H(x) { (const act::byte*) x, sizeof(x) - sizeof(x[0]) }
|
||||
#endif
|
||||
|
||||
#if(_MSC_VER >= 1300)
|
||||
template
|
||||
<
|
||||
class _Ty,
|
||||
class _Diff,
|
||||
class _Pointer,
|
||||
class _Reference,
|
||||
class _Pointer2,
|
||||
class _Reference2
|
||||
>
|
||||
class _Ptrit :
|
||||
public std::iterator<std::random_access_iterator_tag, _Ty, _Diff, _Pointer, _Reference>
|
||||
{ // wrap pointer as random-access iterator
|
||||
public:
|
||||
typedef _Ptrit<_Ty, _Diff, _Pointer, _Reference, _Pointer2, _Reference2> _Myt;
|
||||
|
||||
_Ptrit()
|
||||
{ // construct with uninitialized wrapped pointer
|
||||
}
|
||||
|
||||
_Ptrit(_Pointer _Ptr) : current(_Ptr)
|
||||
{ // construct wrapped pointer from _Ptr
|
||||
}
|
||||
|
||||
_Ptrit(const _Ptrit<_Ty, _Diff, _Pointer2, _Reference2, _Pointer2, _Reference2>& _Iter)
|
||||
: current(_Iter.base())
|
||||
{ // const converter or copy constructor
|
||||
}
|
||||
|
||||
_Pointer base() const
|
||||
{ // return wrapped pointer
|
||||
return current;
|
||||
}
|
||||
|
||||
_Reference operator*() const
|
||||
{ // return designated value
|
||||
return *current;
|
||||
}
|
||||
|
||||
_Pointer operator->() const
|
||||
{ // return pointer to class object
|
||||
return &**this;
|
||||
}
|
||||
|
||||
_Myt& operator++()
|
||||
{ // preincrement
|
||||
++current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Myt operator++(int)
|
||||
{ // postincrement
|
||||
_Myt _Tmp = *this;
|
||||
++current;
|
||||
return _Tmp;
|
||||
}
|
||||
|
||||
_Myt& operator--()
|
||||
{ // predecrement
|
||||
--current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Myt operator--(int)
|
||||
{ // postdecrement
|
||||
_Myt _Tmp = *this;
|
||||
--current;
|
||||
return _Tmp;
|
||||
}
|
||||
|
||||
bool operator==(size_t _Right) const
|
||||
{ // test if wrapped pointer == integer (null pointer constant)
|
||||
return current == (_Pointer) _Right;
|
||||
}
|
||||
|
||||
bool operator==(const _Myt& _Right) const
|
||||
{ // test for iterator equality
|
||||
return current == _Right.current;
|
||||
}
|
||||
|
||||
bool operator!=(const _Myt& _Right) const
|
||||
{ // test for iterator inequality
|
||||
return !(*this == _Right);
|
||||
}
|
||||
|
||||
_Myt& operator+=(_Diff _Off)
|
||||
{ // increment by integer
|
||||
current += _Off;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Myt operator+(_Diff _Off) const
|
||||
{ // return this + integer
|
||||
return _Myt(current + _Off);
|
||||
}
|
||||
|
||||
_Myt& operator-=(_Diff _Off)
|
||||
{ // decrement by integer
|
||||
current -= _Off;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Myt operator-(_Diff _Off) const
|
||||
{ // return this - integer
|
||||
return _Myt(current - _Off);
|
||||
}
|
||||
|
||||
_Reference operator[](_Diff _Off) const
|
||||
{ // subscript
|
||||
return *(*this + _Off);
|
||||
}
|
||||
|
||||
bool operator<(const _Myt& _Right) const
|
||||
{ // test if this < _Right
|
||||
return current < _Right.current;
|
||||
}
|
||||
|
||||
bool operator>(const _Myt& _Right) const
|
||||
{ // test if this > _Right
|
||||
return _Right < *this;
|
||||
}
|
||||
|
||||
bool operator<=(const _Myt& _Right) const
|
||||
{ // test if this <= _Right
|
||||
return !(_Right < *this);
|
||||
}
|
||||
|
||||
bool operator>=(const _Myt& _Right) const
|
||||
{ // test if this >= _Right
|
||||
return !(*this < _Right);
|
||||
}
|
||||
|
||||
_Diff operator-(const _Myt& _Right) const
|
||||
{ // return difference of iterators
|
||||
return current - _Right.current;
|
||||
}
|
||||
|
||||
protected:
|
||||
_Pointer current; // the wrapped pointer
|
||||
};
|
||||
|
||||
#endif // _MSC_VER >= 1300
|
||||
|
||||
//
|
||||
// Blob
|
||||
class Blob
|
||||
{
|
||||
protected:
|
||||
struct flags
|
||||
{
|
||||
byte copy_on_write:1;
|
||||
byte external_allocated:1;
|
||||
|
||||
flags() throw()
|
||||
: copy_on_write(0)
|
||||
, external_allocated(0)
|
||||
{ }
|
||||
};
|
||||
|
||||
public:
|
||||
typedef Allocator<byte, size_t> _Alloc;
|
||||
typedef _Alloc allocator_type;
|
||||
typedef _Alloc::size_type size_type;
|
||||
typedef _Alloc::value_type value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef const value_type& const_reference;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
#if(_MSC_VER >= 1300)
|
||||
typedef _Ptrit
|
||||
< value_type, difference_type, pointer, reference, pointer, reference
|
||||
> iterator;
|
||||
|
||||
typedef _Ptrit
|
||||
< value_type, difference_type, const_pointer, const_reference, pointer, reference
|
||||
> const_iterator;
|
||||
|
||||
inline static pointer get_base(iterator it) { return it.base(); }
|
||||
inline static const_pointer get_base(const_iterator it) { return it.base(); }
|
||||
|
||||
#else
|
||||
typedef byte* iterator;
|
||||
typedef const byte* const_iterator;
|
||||
|
||||
inline static pointer get_base(iterator it) { return it; }
|
||||
inline static const_pointer get_base(const_iterator it) { return it; }
|
||||
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER >= 1200) && (_MSC_VER < 1300)
|
||||
typedef std::reverse_iterator
|
||||
< iterator, value_type, reference, pointer, difference_type
|
||||
> reverse_iterator;
|
||||
|
||||
typedef std::reverse_iterator
|
||||
< const_iterator, value_type, const_reference, const_pointer, difference_type
|
||||
> const_reverse_iterator;
|
||||
|
||||
#else
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
#endif
|
||||
// construct/copy/destroy
|
||||
Blob();
|
||||
|
||||
explicit Blob(allocator_type* allocator);
|
||||
explicit Blob(const char* str, allocator_type* allocator = dAllocator);
|
||||
|
||||
#ifndef NO_STL_SUPPORT
|
||||
explicit Blob(std::string& str, allocator_type* allocator = dAllocator);
|
||||
explicit Blob(const std::string& str, allocator_type* allocator = dAllocator);
|
||||
#endif // NO_STL_SUPPORT
|
||||
|
||||
explicit Blob(const byte_array& ba, allocator_type* allocator = dAllocator);
|
||||
explicit Blob(size_type n, byte v = byte(0), allocator_type* allocator = dAllocator);
|
||||
|
||||
template<class inputit>
|
||||
Blob(inputit f, inputit l, allocator_type* allocator = dAllocator)
|
||||
: mFirst(0), mLast(0), mEnd(0), mAllocator(allocator)
|
||||
{
|
||||
insert(begin(), f, l);
|
||||
}
|
||||
|
||||
Blob(move_from<Blob> other);
|
||||
Blob(const Blob& other);
|
||||
~Blob();
|
||||
|
||||
Blob& operator=(const Blob& other);
|
||||
Blob& operator=(move_from<Blob> other);
|
||||
|
||||
template<class inputit>
|
||||
void assign(inputit f, inputit l)
|
||||
{
|
||||
erase(begin(), end());
|
||||
insert(begin(), f, l);
|
||||
}
|
||||
|
||||
void assign(const byte_array& ba);
|
||||
void assign(size_type n, byte x = byte(0));
|
||||
|
||||
// capacity
|
||||
bool empty() const { return size() == 0; }
|
||||
size_type size() const { return mFirst == 0 ? 0 : mLast - mFirst; }
|
||||
size_type capacity() const { return mFirst == 0 ? 0 : mEnd - mFirst; }
|
||||
size_type max_size() const;
|
||||
void reserve(size_type n);
|
||||
void resize(size_type n, byte x = byte(0));
|
||||
|
||||
// iterators
|
||||
iterator begin() { return mFirst; }
|
||||
const_iterator begin() const { return const_iterator(mFirst); }
|
||||
iterator end() { return mLast; }
|
||||
const_iterator end() const { return const_iterator(mLast); }
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
||||
|
||||
|
||||
// element access:
|
||||
reference at(size_type p);
|
||||
const_reference at(size_type p) const;
|
||||
reference operator[](size_type p) { return *(begin() + p); }
|
||||
const_reference operator[](size_type p) const { return *(begin() + p); }
|
||||
|
||||
reference front() { return *begin(); }
|
||||
const_reference front() const { return *begin(); }
|
||||
reference back() { return *(end() - 1); }
|
||||
const_reference back() const { return *(end() - 1); }
|
||||
|
||||
// modifiers
|
||||
void push_back(byte x) { insert(end(), x); }
|
||||
void pop_back() { erase(end() - 1); }
|
||||
|
||||
void insert(iterator p, size_type m, byte x);
|
||||
iterator insert(iterator p, byte x = byte(0));
|
||||
|
||||
template<class inputit>
|
||||
void insert(iterator p, inputit f, inputit l)
|
||||
{
|
||||
size_type m = 0;
|
||||
_distance(f, l, m);
|
||||
if(size_type(mEnd - mLast) < m)
|
||||
{
|
||||
size_type n = size();
|
||||
n = aligned_size(n + (m < n ? n : m));
|
||||
iterator s = allocate(n, (void*) 0);
|
||||
iterator q = ucopy(mFirst, p, s);
|
||||
q = ucopy(f, l, q);
|
||||
ucopy(p, mLast, q);
|
||||
_destroy(mFirst, mLast);
|
||||
deallocate(get_base(mFirst), mEnd - mFirst);
|
||||
mEnd = s + n;
|
||||
mLast = s + size() + m;
|
||||
mFirst = s;
|
||||
}
|
||||
else if(size_type(mLast - p) < m)
|
||||
{
|
||||
ucopy(p, mLast, p + m);
|
||||
ucopy(f + (mLast - p), l, mLast);
|
||||
copy(f, f + (mLast - p), p);
|
||||
mLast += m;
|
||||
}
|
||||
else if(0 < m)
|
||||
{
|
||||
ucopy(mLast - m, mLast, mLast);
|
||||
copy_backward(p, mLast - m, mLast);
|
||||
copy(f, l, p);
|
||||
mLast += m;
|
||||
}
|
||||
}
|
||||
|
||||
Blob& append(const Blob& x)
|
||||
{
|
||||
insert(end(), x.begin(), x.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
Blob& append(size_type m, byte x)
|
||||
{
|
||||
insert(end(), m, x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class inputit>
|
||||
Blob& append(inputit f, inputit l)
|
||||
{
|
||||
insert(end(), f, l);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator erase(iterator p);
|
||||
iterator erase(iterator f, iterator l);
|
||||
void clear();
|
||||
void swap(Blob& x);
|
||||
|
||||
// used by compare operators
|
||||
bool _eq(const Blob& x) const;
|
||||
bool _lt(const Blob& x) const;
|
||||
|
||||
allocator_type* get_allocator() const { return mAllocator; }
|
||||
static allocator_type* set_default_allocator(allocator_type* allocator)
|
||||
{
|
||||
std::swap(dAllocator, allocator);
|
||||
return allocator;
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename inputit, typename outputit>
|
||||
outputit copy(inputit f, inputit l, outputit x)
|
||||
{
|
||||
for(; f != l; ++x, ++f)
|
||||
*x = *f;
|
||||
return x;
|
||||
}
|
||||
|
||||
iterator copy_backward(const_iterator f, const_iterator l, iterator x);
|
||||
|
||||
template<typename inputit, typename outputit>
|
||||
outputit ucopy(inputit f, inputit l, outputit p)
|
||||
{
|
||||
for(; f != l; ++p, ++f)
|
||||
construct(get_base(p), *f);
|
||||
return p;
|
||||
}
|
||||
|
||||
void fill(iterator f, const_iterator l, byte x);
|
||||
void ufill(iterator f, size_type n, byte x);
|
||||
|
||||
size_type distance(const_iterator f, const_iterator l) const;
|
||||
|
||||
template<typename inputit>
|
||||
void _distance(inputit f, inputit l, size_type& n) const
|
||||
{
|
||||
for(; f != l; ++f)
|
||||
++n;
|
||||
}
|
||||
|
||||
bool equal(const_iterator f, const_iterator l, const_iterator x) const;
|
||||
bool lexicographical_compare(const_iterator f1, const_iterator l1, const_iterator f2, const_iterator l2) const;
|
||||
|
||||
byte* allocate(size_type n, const void* hint);
|
||||
void deallocate(pointer p, size_type n);
|
||||
|
||||
void construct(byte* p, const_reference v) { *p = v; }
|
||||
void destroy(byte* p) { *p = 0; }
|
||||
|
||||
void _destroy(iterator f, iterator l);
|
||||
|
||||
void outofrange() const;
|
||||
|
||||
static size_type aligned_size(size_type size);
|
||||
|
||||
protected:
|
||||
flags mFlags;
|
||||
iterator mFirst, mLast, mEnd;
|
||||
allocator_type* mAllocator;
|
||||
static allocator_type* dAllocator;
|
||||
};
|
||||
|
||||
#ifndef UNDER_CE_30
|
||||
std::ostream &operator<<(std::ostream& os, const Blob& blob);
|
||||
#endif // UNDER_CE_30
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
inline bool operator==(const Blob& x, const Blob&y)
|
||||
{
|
||||
return x._eq(y);
|
||||
}
|
||||
|
||||
inline bool operator!=(const Blob& x, const Blob&y)
|
||||
{
|
||||
return !(x._eq(y));
|
||||
}
|
||||
|
||||
inline bool operator<(const Blob& x, const Blob&y)
|
||||
{
|
||||
return x._lt(y);
|
||||
}
|
||||
|
||||
inline bool operator>=(const Blob& x, const Blob&y)
|
||||
{
|
||||
return !(x._lt(y));
|
||||
}
|
||||
|
||||
inline bool operator<=(const Blob& x, const Blob&y)
|
||||
{
|
||||
return x._eq(y) || x._lt(y);
|
||||
}
|
||||
|
||||
inline bool operator>(const Blob& x, const Blob&y)
|
||||
{
|
||||
return !(x._eq(y) || x._lt(y));
|
||||
}
|
||||
|
||||
} // namespace act
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
namespace std
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void swap(act::Blob& left, act::Blob& right) { left.swap(right); }
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // ACT_Blob_h
|
||||
@@ -1,27 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actBlockCipherModeKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// 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_BlockCipherModeKit_h
|
||||
#define ACT_BlockCipherModeKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IBlockCipherMode;
|
||||
|
||||
IBlockCipherMode* CreateECBMode();
|
||||
IBlockCipherMode* CreateCBCMode();
|
||||
IBlockCipherMode* CreateCFBMode();
|
||||
IBlockCipherMode* CreateOFBMode();
|
||||
IBlockCipherMode* CreateCTRMode();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actBlockCipherModeReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions in actBlockCipherModeKit.h
|
||||
//
|
||||
// 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_BlockCipherModeReg_h
|
||||
#define ACT_BlockCipherModeReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IBlockCipherMode;
|
||||
|
||||
typedef IBlockCipherMode* (*CreateBlockCipherModePtr)();
|
||||
|
||||
struct BlockCipherModeMapEntry
|
||||
{
|
||||
const char* Name;
|
||||
CreateBlockCipherModePtr CreatePtr;
|
||||
};
|
||||
|
||||
class BlockCipherModeReg
|
||||
{
|
||||
public:
|
||||
static IBlockCipherMode* CreateBlockCipherMode(const char* name);
|
||||
static CreateBlockCipherModePtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateBlockCipherModePtr createptr);
|
||||
static void Insert(const BlockCipherModeMapEntry* map);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_BlockCipherModeReg_h
|
||||
@@ -1,68 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actCRL.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// 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_CRL_h
|
||||
#define ACT_CRL_h
|
||||
#include "actBasics.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IKey;
|
||||
class Blob;
|
||||
class ICertificate;
|
||||
class ICRL;
|
||||
class CRL
|
||||
{
|
||||
public:
|
||||
CRL(const char* type);
|
||||
CRL(const char* type, const Blob& crlblob);
|
||||
CRL(const CRL& crl);
|
||||
|
||||
void SetParam(paramid_t id,const Blob& blob);
|
||||
void SetParam(paramid_t id,int val);
|
||||
void SetParam(paramid_t id,const char* cstr);
|
||||
void GetParam(paramid_t id,Blob& blob) const;
|
||||
int GetParam(paramid_t) const;
|
||||
|
||||
void Import(const Blob& crl);
|
||||
void Export(Blob& crl) const;
|
||||
|
||||
void Revoke(const ICertificate* cert);
|
||||
bool IsRevoked(const ICertificate* Cert) const;
|
||||
void RemoveRevokation(const ICertificate* cert);
|
||||
|
||||
void Revoke(const Blob& blob);
|
||||
bool IsRevoked(const Blob& blob) const;
|
||||
void RemoveRevokation(const Blob& blob);
|
||||
|
||||
void Sign(const IKey* privkey);
|
||||
int Verify(const IKey* pubkey) const;
|
||||
|
||||
const ICRL* GetPointer() const;
|
||||
ICRL* GetPointer();
|
||||
|
||||
operator const ICRL* () const;
|
||||
operator ICRL* ();
|
||||
|
||||
|
||||
ICRL* ReleasePointer();
|
||||
|
||||
CRL& operator= (const CRL& crl);
|
||||
|
||||
~CRL();
|
||||
private:
|
||||
ICRL* mCRL;
|
||||
};
|
||||
|
||||
}; // namespace act
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actCertificateKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// 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_CERTIFICATEKIT_H
|
||||
#define ACT_CERTIFICATEKIT_H
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ICertificate;
|
||||
class ICRL;
|
||||
class ICVCertRequest;
|
||||
|
||||
ICertificate* CreateX509Certificate();
|
||||
ICRL* CreateX509CRL();
|
||||
|
||||
ICertificate* CreateCVCertificate();
|
||||
ICVCertRequest* CreateCVCertRequest();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actCertificateReg.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// 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_CERTIFICATEREG_H
|
||||
#define ACT_CERTIFICATEREG_H
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ICertificate;
|
||||
class ICRL;
|
||||
|
||||
typedef ICertificate* (*CreateCertificatePtr)();
|
||||
typedef ICRL* (*CreateCRLPtr)();
|
||||
|
||||
struct CertificateMapEntry {
|
||||
const char* Name;
|
||||
CreateCertificatePtr CreatePtr;
|
||||
};
|
||||
|
||||
struct CRLMapEntry {
|
||||
const char* Name;
|
||||
CreateCRLPtr CreatePtr;
|
||||
};
|
||||
|
||||
class CertificateReg
|
||||
{
|
||||
public:
|
||||
static ICertificate* CreateCertificate(const char* name);
|
||||
static CreateCertificatePtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateCertificatePtr createptr);
|
||||
static void Insert(const CertificateMapEntry* certmap);
|
||||
};
|
||||
|
||||
class CRLReg
|
||||
{
|
||||
public:
|
||||
static ICRL* CreateCRL(const char* name);
|
||||
static CreateCRLPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateCRLPtr createptr);
|
||||
static void Insert(const CRLMapEntry* certmap);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actDate.h
|
||||
// Product: cv act library
|
||||
// Purpose: The Date function used in act Library
|
||||
//
|
||||
// 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_Date_h
|
||||
#define ACT_Date_h
|
||||
|
||||
#include "actBasics.h"
|
||||
|
||||
#if defined(ACT_POSIX)
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Blob;
|
||||
|
||||
class Date
|
||||
{
|
||||
public:
|
||||
Date(); //today
|
||||
Date(int day, int month ,int year);
|
||||
Date(int day, int month, int year, int hour, int minute, int sec);
|
||||
Date(const Blob& der);
|
||||
|
||||
Date(const unsigned char* ch, const unsigned int size);
|
||||
|
||||
Date& SetToday();
|
||||
|
||||
int GetDay() const { return m_day; }
|
||||
int GetMonth() const { return m_month; }
|
||||
int GetYear() const { return m_year; }
|
||||
int GetHour() const { return m_hour; }
|
||||
int GetMinute() const { return m_min; }
|
||||
int GetSecond() const { return m_sec; }
|
||||
|
||||
void IgnoreTime(bool b); // ignore time(hour, min,sec) in the operators
|
||||
const Date& operator=(const Date&);
|
||||
bool operator>(const Date&) const;
|
||||
bool operator>=(const Date&) const;
|
||||
bool operator<(const Date&) const;
|
||||
bool operator<=(const Date&) const;
|
||||
bool operator==(const Date&) const;
|
||||
bool operator!=(const Date&) const;
|
||||
|
||||
const Date& AddMonths(int m);
|
||||
const Date& SubMonths(int m);
|
||||
const Date& AddYears(int y);
|
||||
const Date& SubYears(int y);
|
||||
const Date& AddDays(int d);
|
||||
const Date& SubDays(int d);
|
||||
const Date& AddHours(int h);
|
||||
const Date& SubHours(int h);
|
||||
const Date& AddMinutes(int m);
|
||||
const Date& SubMinutes(int m);
|
||||
const Date& AddSecond(int m);
|
||||
const Date& SubSecond(int m);
|
||||
|
||||
int DayOfWeek() const; // 0:Sunday, 1=Monday ... 6=Saturday
|
||||
int IsLeap(int y) const; // 1:leapyear, 0:else
|
||||
int DaysPerMonth(int m, int y) const;
|
||||
long GetDifference(const Date& d2) const;
|
||||
|
||||
long GetJulian() const;
|
||||
long GetJulian(int d, int m, int y) const;
|
||||
void ConvertFromJulian(long jd, int& d, int& m, int& y);
|
||||
|
||||
Blob Encode() const;
|
||||
size_t Encode(Blob& encoded) const;
|
||||
|
||||
Blob EncodeToGeneralizedTime() const;
|
||||
Blob GetGeneralizedTimeString() const;
|
||||
Blob GetLocalTimeString() const; // fixed format: "DD/MM/YYYY HH:MM:SS"
|
||||
|
||||
operator Blob() const;
|
||||
|
||||
int GetDayFromWeekDay (int weekday, int year, int month, int which);
|
||||
|
||||
#if defined(ACT_POSIX)
|
||||
static void copyDatetm(act::Date a, struct tm& b);
|
||||
static void copytmDate(struct tm a, act::Date& b);
|
||||
#endif
|
||||
|
||||
private:
|
||||
Date& SetYear(int year) { m_year = year; return *this; }
|
||||
Date& SetMonth(int month) { m_month = month; return *this; }
|
||||
Date& SetDay(int day) { m_day = day; return *this; }
|
||||
Date& SetHour(int hour) { m_hour = hour; return *this; }
|
||||
Date& SetMinute(int minute) { m_min = minute; return *this; }
|
||||
Date& SetSecond(int sec) { m_sec = sec; return *this; }
|
||||
bool IsValid() const;
|
||||
void AdjustDays();
|
||||
|
||||
private:
|
||||
int m_day, m_month, m_year;
|
||||
int m_hour, m_min, m_sec;
|
||||
bool m_ignore_time;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Date_h
|
||||
@@ -1,24 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actDefaultRNG.h
|
||||
// Product: cv act library
|
||||
// Purpose: actDefaultRNG.h provides defaults for the class IRNGAlg.
|
||||
//
|
||||
// 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_DefaultRNG_h
|
||||
#define ACT_DefaultRNG_h
|
||||
namespace act
|
||||
{
|
||||
class IRNGAlg;
|
||||
typedef IRNGAlg* (*CreateRNGPtr)();
|
||||
|
||||
extern CreateRNGPtr CreateFastRNG;
|
||||
extern CreateRNGPtr CreateStrongRNG;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actDerivatorReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for the factory functions in actDerivatorKit.h
|
||||
//
|
||||
// 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_DerivatorReg_h
|
||||
#define ACT_DerivatorReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IDerivator;
|
||||
class Blob;
|
||||
|
||||
typedef IDerivator* (*CreateDerivatorPtr)();
|
||||
|
||||
struct DerivatorMapEntry
|
||||
{
|
||||
const char* Name;
|
||||
CreateDerivatorPtr CreatePtr;
|
||||
};
|
||||
|
||||
class DerivatorReg
|
||||
{
|
||||
public:
|
||||
static IDerivator* CreateDerivator(const char* name);
|
||||
static CreateDerivatorPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateDerivatorPtr createptr);
|
||||
static void Insert(const DerivatorMapEntry* derivatormap);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_DerivatorReg_h
|
||||
@@ -1,40 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actEMSAReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions in actEMSAKit.h
|
||||
//
|
||||
// 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_EMSAReg_h
|
||||
#define ACT_EMSAReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IEMSAAlg;
|
||||
|
||||
typedef IEMSAAlg* (*CreateEMSAPtr)();
|
||||
|
||||
struct EMSAMapEntry
|
||||
{
|
||||
const char* Name;
|
||||
CreateEMSAPtr CreatePtr;
|
||||
};
|
||||
|
||||
class EMSAReg
|
||||
{
|
||||
public:
|
||||
static IEMSAAlg* CreateEMSAAlg(const char* name);
|
||||
static CreateEMSAPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateEMSAPtr createptr);
|
||||
static void Insert(const EMSAMapEntry* map);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_EMSAReg_h
|
||||
@@ -1,146 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actFactoryReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: Templates for simple factory-registry implementation.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 06/02/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_FactoryReg_h
|
||||
#define ACT_FactoryReg_h
|
||||
|
||||
#include <map>
|
||||
#include <cstring>
|
||||
|
||||
namespace act
|
||||
{
|
||||
//
|
||||
// FactoryMapEntry<>
|
||||
template<typename CreatePtrT>
|
||||
struct FactoryMapEntry
|
||||
{
|
||||
typedef char KeyType;
|
||||
|
||||
struct KeyLessPredicate
|
||||
: public std::binary_function<const KeyType*, const KeyType*, bool>
|
||||
{
|
||||
bool operator()(const KeyType* left, const KeyType* right) const
|
||||
{
|
||||
if(left == 0) return false;
|
||||
if(right == 0) return true;
|
||||
return strcmp(left, right) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map
|
||||
< const KeyType*, CreatePtrT, KeyLessPredicate
|
||||
> MapType;
|
||||
|
||||
static const KeyType* Empty;
|
||||
|
||||
const KeyType* Name;
|
||||
CreatePtrT createPtr;
|
||||
};
|
||||
|
||||
template<typename CreatePtrT>
|
||||
const typename FactoryMapEntry<CreatePtrT>::KeyType*
|
||||
FactoryMapEntry<CreatePtrT>::Empty = "";
|
||||
|
||||
|
||||
//
|
||||
// FactoryReg<>
|
||||
template
|
||||
<
|
||||
class ResultT,
|
||||
class CreatePtrT,
|
||||
class MapEntryT,
|
||||
class MapT = typename MapEntryT::MapType
|
||||
>
|
||||
class FactoryReg
|
||||
{
|
||||
public:
|
||||
typedef typename MapEntryT::KeyType KeyType;
|
||||
typedef MapEntryT MapEntryType;
|
||||
typedef MapT MapType;
|
||||
|
||||
// Creates default ...
|
||||
static ResultT* Create(const KeyType* name)
|
||||
{
|
||||
if(name == 0) name = MapEntryType::Empty;
|
||||
typename MapType::const_iterator result(g_map.find(name));
|
||||
return result != g_map.end() ? result->second(name) : 0;
|
||||
}
|
||||
|
||||
template<typename ParamT>
|
||||
static ResultT* Create(const KeyType* name, ParamT* param)
|
||||
{
|
||||
if(name == 0) name = MapEntryType::Empty;
|
||||
typename MapType::const_iterator result(g_map.find(name));
|
||||
return result != g_map.end() ? result->second(name, param) : 0;
|
||||
}
|
||||
|
||||
template<typename ParamT>
|
||||
static ResultT* Create(ParamT* param) { return Create(0, param); }
|
||||
static ResultT* Create() { return Create(0); }
|
||||
|
||||
static const KeyType* GetName(void* createptr)
|
||||
{
|
||||
if(createptr == 0) return 0;
|
||||
for(typename MapType::const_iterator i(g_map.begin()),
|
||||
end(g_map.end()); i != end; ++i)
|
||||
if(i->second == createptr)
|
||||
return i->first;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const KeyType* GetNextName(const KeyType* name)
|
||||
{
|
||||
if(name == 0)
|
||||
return g_map.empty() == true ? 0 : g_map.begin()->first;
|
||||
|
||||
typename MapType::const_iterator result(g_map.find(name));
|
||||
return result == g_map.end() || ++result == g_map.end() ? 0 : result->first;
|
||||
}
|
||||
|
||||
static CreatePtrT GetCreatePointer(const KeyType* name)
|
||||
{
|
||||
if(name != 0)
|
||||
{
|
||||
typename MapType::const_iterator result(g_map.find(name));
|
||||
return result != g_map.end() ? result->second : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Insert(const KeyType* name, CreatePtrT createPtr)
|
||||
{
|
||||
std::pair<typename MapType::iterator, bool>
|
||||
result(g_map.insert(typename MapType::value_type(name, createPtr)));
|
||||
}
|
||||
|
||||
static void Insert(const MapEntryType* entry)
|
||||
{
|
||||
while(entry->Name != 0)
|
||||
{
|
||||
Insert(entry->Name, entry->createPtr);
|
||||
++entry;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
static MapT g_map;
|
||||
};
|
||||
|
||||
template<class ResultT, class CreatePtrT, class MapEntryT, class MapT>
|
||||
MapT FactoryReg<ResultT, CreatePtrT, MapEntryT, MapT>::g_map;
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_FactoryReg_h
|
||||
@@ -1,98 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Name: actHandle.h
|
||||
// Product: cv act library
|
||||
// Purpose: Handle helper templates
|
||||
//
|
||||
// Copyright: (c) 2010 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 07/27/2010
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ACT_Handle_h
|
||||
#define ACT_Handle_h
|
||||
|
||||
#include "actMove.h"
|
||||
#include "actException.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
//
|
||||
// Handle
|
||||
class Handle
|
||||
{
|
||||
public:
|
||||
virtual ~Handle() { /* essential */ }
|
||||
|
||||
template<typename TypeT> TypeT* as() const;
|
||||
template<typename TypeT> TypeT& requiredAs() const;
|
||||
|
||||
template<typename TypeT>
|
||||
friend inline TypeT& getPointer(const Handle& handle)
|
||||
{
|
||||
return handle.as<TypeT>();
|
||||
}
|
||||
|
||||
template<typename TypeT>
|
||||
friend inline TypeT& getRef(const Handle& handle)
|
||||
{
|
||||
return handle.requiredAs<TypeT>();
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// ValueHandle<>
|
||||
template<typename TypeT>
|
||||
class ValueHandle : public Handle
|
||||
{
|
||||
public:
|
||||
typedef TypeT value_type;
|
||||
|
||||
ValueHandle() : m_val() { }
|
||||
explicit ValueHandle(const TypeT& other) : m_val(other) { }
|
||||
|
||||
template<typename O>
|
||||
explicit ValueHandle(move_from<O> other) : m_val() { other.move(m_val); }
|
||||
|
||||
template<typename O> void operator=(const O& other) { m_val = other; }
|
||||
template<typename O> void operator=(move_from<O> other) { other.move(m_val); }
|
||||
|
||||
inline TypeT& valueRef() const { return m_val; }
|
||||
|
||||
inline operator TypeT&() const { return m_val; }
|
||||
|
||||
inline TypeT& operator*() const { return m_val; }
|
||||
inline TypeT* operator->() const { return &m_val; }
|
||||
|
||||
private:
|
||||
mutable TypeT m_val;
|
||||
|
||||
private:
|
||||
friend class Handle;
|
||||
};
|
||||
|
||||
//
|
||||
// Handle::as<>
|
||||
template<typename TypeT>
|
||||
inline TypeT* Handle::as() const
|
||||
{
|
||||
const ValueHandle<TypeT>* self = dynamic_cast<const ValueHandle<TypeT>*>(this);
|
||||
return self != 0 ? &self->m_val : 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle::requiredAs<>
|
||||
template<typename TypeT>
|
||||
inline TypeT& Handle::requiredAs() const
|
||||
{
|
||||
TypeT* value = as<TypeT>();
|
||||
if(value != 0) return *value;
|
||||
throw NullPointerException("invalid handle value type");
|
||||
}
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Handle_h
|
||||
@@ -1,40 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actHashReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions in actHashKit.h
|
||||
//
|
||||
// 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_HashReg_H
|
||||
#define ACT_HashReg_H
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IHashAlg;
|
||||
|
||||
typedef IHashAlg* (*CreateHashPtr)();
|
||||
|
||||
struct HashMapEntry
|
||||
{
|
||||
const char* Name;
|
||||
CreateHashPtr CreatePtr;
|
||||
};
|
||||
|
||||
class HashReg
|
||||
{
|
||||
public:
|
||||
static IHashAlg* CreateHashAlg(const char* name);
|
||||
static CreateHashPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateHashPtr createptr);
|
||||
static void Insert(const HashMapEntry* hashmap);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_HashReg_H
|
||||
@@ -1,163 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actIAccessConditions.h
|
||||
// Product: cv act library
|
||||
// Purpose: The IAccessCondition interface is used to map access conditions for
|
||||
// Files, Keys etc. on specific smartcard's
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 10/29/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_IAccessConditions_h
|
||||
#define ACT_IAccessConditions_h
|
||||
|
||||
#include "actBlob.h"
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IToken;
|
||||
class ISCardOS;
|
||||
|
||||
enum
|
||||
{
|
||||
AC_AUTH_ID_MASK = 0x7f,
|
||||
};
|
||||
|
||||
enum ACType
|
||||
{
|
||||
AC_TYPE_UNKNOWN = 0,
|
||||
AC_TYPE_RAW = 1, // Already transformed for specific OS
|
||||
AC_TYPE_GENERIC = 2 // OS independant, requires to be transformed before used
|
||||
};
|
||||
|
||||
// SCard object specific rights by type
|
||||
enum ACSCardObjType
|
||||
{
|
||||
// { AC_TOKEN_USER, AC_TOKEN_SO, AC_TOKEN_USER_OR_SO }
|
||||
AC_OBJ_MAP = 0x00, // Used for access condition (f.e. tag 0x86)
|
||||
AC_OBJREF_MAP = 0x01, // Used as object reference for access condition
|
||||
|
||||
AC_RIGHTS_EF = 0x02, // Access Rights for EF's
|
||||
AC_RIGHTS_DF = 0x03, // Access Rights for DF's
|
||||
AC_RIGHTS_KEY = 0x04, // Access Rights for Key Objects
|
||||
AC_RIGHTS_AUTH = 0x05, // Access Rights for Authentication Objects
|
||||
// ... add additional types here
|
||||
};
|
||||
|
||||
// SCard specific rights
|
||||
enum ACSCard
|
||||
{
|
||||
AC_ALWAYS = 0x00,
|
||||
// Any other from 0x01..0x7f
|
||||
AC_NEVER = 0xff
|
||||
};
|
||||
|
||||
// Token specific rights
|
||||
enum ACToken
|
||||
{
|
||||
AC_TOKEN_USER = 0x80,
|
||||
AC_TOKEN_SO = 0x81,
|
||||
AC_TOKEN_USER_OR_SO = 0x82,
|
||||
AC_TOKEN_USER_AND_SO = 0x83,
|
||||
AC_TOKEN_ADMIN = 0x84,
|
||||
|
||||
AC_TOKEN_FLAG = 0x80,
|
||||
};
|
||||
|
||||
// AuthId Index
|
||||
enum AIIndex
|
||||
{
|
||||
AI_INVALID = -1,
|
||||
AI_USER = AC_TOKEN_USER & ~AC_TOKEN_FLAG,
|
||||
AI_SO = AC_TOKEN_SO & ~AC_TOKEN_FLAG,
|
||||
AI_USER_OR_SO = AC_TOKEN_USER_OR_SO & ~AC_TOKEN_FLAG,
|
||||
AI_USER_AND_SO = AC_TOKEN_USER_AND_SO & ~AC_TOKEN_FLAG,
|
||||
AI_ADMIN = AC_TOKEN_ADMIN & ~AC_TOKEN_FLAG,
|
||||
};
|
||||
|
||||
enum ACOperation
|
||||
{
|
||||
AC_OR = 0x00,
|
||||
AC_AND = 0x01,
|
||||
};
|
||||
|
||||
enum ACMode
|
||||
{
|
||||
AC_MODE_READ = 0,
|
||||
AC_MODE_UPDATE = 1,
|
||||
AC_MODE_EXECUTE = 2,
|
||||
AC_MODE_DELETE = 3,
|
||||
};
|
||||
|
||||
enum ACRight
|
||||
{
|
||||
// Used for EF/DF
|
||||
AC_READ = 0x00,
|
||||
AC_WRITE = 0x01,
|
||||
AC_UPDATE = 0x01,
|
||||
AC_APPEND = 0x02,
|
||||
AC_DEACTIVATE = 0x03,
|
||||
AC_LOCK = 0x03,
|
||||
AC_ACTIVATE = 0x04,
|
||||
AC_UNLOCK = 0x04,
|
||||
AC_DELETE = 0x05,
|
||||
AC_ADMIN = 0x06,
|
||||
AC_CREATE = 0x07,
|
||||
AC_INCREASE = 0x08,
|
||||
AC_DECREASE = 0x09,
|
||||
AC_TERMINATE = 0x0a,
|
||||
|
||||
// Used for Objects
|
||||
AC_USE = 0x00,
|
||||
AC_CHANGE = 0x01,
|
||||
AC_UNBLOCK = 0x02,
|
||||
AC_GENKEY = 0x07,
|
||||
AC_SIGN = 0x08,
|
||||
AC_DEC = 0x09,
|
||||
AC_ENC = 0x0a,
|
||||
};
|
||||
|
||||
enum ACRange
|
||||
{
|
||||
AC_FIRST = AC_READ,
|
||||
AC_LAST = AC_ENC,
|
||||
};
|
||||
|
||||
//
|
||||
// IAccessCondition
|
||||
class IAccessCondition : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual IAccessCondition* Clone() const = 0;
|
||||
|
||||
virtual const char* GetName() const = 0;
|
||||
virtual ACType GetAcType() const = 0;
|
||||
|
||||
virtual Blob& GetAccessRights() = 0;
|
||||
virtual const Blob& GetAccessRights() const = 0;
|
||||
|
||||
virtual IAccessCondition* ConvertAc(const IToken* token, ACType acdest) const = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// IAcConverter
|
||||
class IAcConverter
|
||||
{
|
||||
protected:
|
||||
virtual ~IAcConverter() { }
|
||||
|
||||
public:
|
||||
virtual IAccessCondition* ConvertAc(const IAccessCondition* ac, ACType acdest) const = 0;
|
||||
virtual Blob ConvertAc(const IAccessCondition* ac) const = 0;
|
||||
virtual IAccessCondition* ConvertAc(const Blob& ac) const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IAccessConditions_h
|
||||
@@ -1,32 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIAgreementKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: The abstract class IAgreementKey derived from IKey is the
|
||||
// interface to all key agreements.
|
||||
//
|
||||
// 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_IAgreementKey_H
|
||||
#define ACT_IAgreementKey_H
|
||||
|
||||
#include "actIKey.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IDerivator;
|
||||
|
||||
class IAgreementKey : public IKey
|
||||
{
|
||||
public:
|
||||
virtual void SetDerivator(IDerivator* derivator) = 0;
|
||||
virtual const IDerivator* GetDerivator() const = 0;
|
||||
virtual IDerivator* GetDerivator() = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IAgreementKey_H
|
||||
@@ -1,48 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIBlockCipherKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class IBlockCipherKey extends the interface of the class IKey
|
||||
// and supports the peculiarities of symmetric keys.
|
||||
//
|
||||
//
|
||||
// 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_IBlockCipherKey_h
|
||||
#define ACT_IBlockCipherKey_h
|
||||
|
||||
#include "actIKey.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IPadding;
|
||||
class IBlockCipher;
|
||||
class IBlockCipherMode;
|
||||
class IDerivator;
|
||||
|
||||
class IBlockCipherKey : public IKey
|
||||
{
|
||||
public:
|
||||
virtual void SetPadding(IPadding* padding) = 0;
|
||||
virtual const IPadding* GetPadding() const = 0;
|
||||
virtual IPadding* GetPadding() = 0;
|
||||
|
||||
virtual void SetCipher(IBlockCipher* cipher) = 0;
|
||||
virtual const IBlockCipher* GetCipher() const = 0;
|
||||
virtual IBlockCipher* GetCipher() = 0;
|
||||
|
||||
virtual void SetMode(IBlockCipherMode* mode) = 0;
|
||||
virtual const IBlockCipherMode* GetMode() const = 0;
|
||||
virtual IBlockCipherMode* GetMode() = 0;
|
||||
|
||||
virtual void SetDerivator(IDerivator* derive) = 0;
|
||||
virtual const IDerivator* GetDerivator() const = 0;
|
||||
virtual IDerivator* GetDerivator() = 0;
|
||||
};
|
||||
|
||||
} //namespace act
|
||||
|
||||
#endif // ACT_IBlockCipherKey_h
|
||||
@@ -1,31 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actICBCMACKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: interface for the class CBCMAC.
|
||||
//
|
||||
// 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_ICBCMACKey_h
|
||||
#define ACT_ICBCMACKey_h
|
||||
|
||||
#include "actIMACKey.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IBlockCipher;
|
||||
|
||||
class ICBCMACKey : public IMACKey
|
||||
{
|
||||
public:
|
||||
virtual void SetCipher(IBlockCipher* cipher) = 0;
|
||||
virtual const IBlockCipher* GetCipher() const = 0;
|
||||
virtual IBlockCipher* GetCipher() = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ICBCMACKey_h
|
||||
@@ -1,45 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIDerivator.h
|
||||
// Product: cv act library
|
||||
// Purpose: This interface provides a shared secret key (the last step in
|
||||
// a Key Agreement Scheme).
|
||||
//
|
||||
// Copyright: (c) 2006 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_IDerivator_h
|
||||
#define ACT_IDerivator_h
|
||||
|
||||
#include"actBasics.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Blob;
|
||||
|
||||
class IDerivator
|
||||
{
|
||||
public:
|
||||
virtual IDerivator* Clone() const=0;
|
||||
|
||||
virtual void Import(const Blob &blob)=0;
|
||||
virtual void Export(Blob &blob) const=0;
|
||||
|
||||
virtual void SetParam(paramid_t id,const Blob &blob)=0;
|
||||
virtual void SetParam(paramid_t id,int val)=0;
|
||||
virtual void SetParam(paramid_t id,const char* cstr)=0;
|
||||
virtual void GetParam(paramid_t id,Blob &blob) const=0;
|
||||
virtual int GetParam(paramid_t) const=0;
|
||||
|
||||
virtual void Derive(const Blob& secret, const Blob& salt, Blob& keymat) const=0;
|
||||
|
||||
virtual void* GetCreatePointer() const =0;
|
||||
virtual ~IDerivator() {}
|
||||
};
|
||||
} // namespace act
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIEMSAAlg.h
|
||||
// Product: cv act library
|
||||
// Purpose: IEMSAAlg (Encoding Methods for Signatures with Appendix) is an
|
||||
// abstract class derived from IAlgorithm. Encoding methods do not
|
||||
// use keys. These algorithms prepare the data to sign. They can be
|
||||
// implemented with or without hash functions.
|
||||
//
|
||||
// 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_IEMSAAlg_h
|
||||
#define ACT_IEMSAAlg_h
|
||||
|
||||
#include "actBasics.h"
|
||||
#include "actIAlgorithm.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
|
||||
class IEMSAAlg : public IAlgorithm
|
||||
{
|
||||
public:
|
||||
virtual IEMSAAlg* Clone() const =0;
|
||||
|
||||
virtual void Import(const Blob &blob) =0;
|
||||
virtual void Export(Blob &blob) const =0;
|
||||
virtual void SetParam(paramid_t id,const Blob &blob) =0;
|
||||
virtual void SetParam(paramid_t id,int val) =0;
|
||||
virtual void SetParam(paramid_t id,const char* cstr) =0;
|
||||
virtual void GetParam(paramid_t id,Blob &blob) const =0;
|
||||
virtual int GetParam(paramid_t) const =0;
|
||||
|
||||
virtual void Reset(size_t sizeinbits) =0;
|
||||
|
||||
virtual void* GetCreatePointer() const =0;
|
||||
|
||||
virtual bool Verify(const Blob &em, const Blob &sig_inv) =0;
|
||||
|
||||
virtual ~IEMSAAlg(){}
|
||||
};
|
||||
} // namespace act
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIEMSAWithHashAlg.h
|
||||
// Product: cv act library
|
||||
// Purpose: IEMSAWithHashAlg is the abstract class derived from IEMSAAlg
|
||||
// which provides access on the aggregated hashobject of an
|
||||
// EMSA-object.
|
||||
//
|
||||
// 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_IEMSAWithHashAlg_h
|
||||
#define ACT_IEMSAWithHashAlg_h
|
||||
|
||||
#include "actIEMSAAlg.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IHashAlg;
|
||||
|
||||
class IEMSAWithHashAlg : public IEMSAAlg
|
||||
{
|
||||
public:
|
||||
virtual void SetHash(IHashAlg* hash) =0;
|
||||
virtual const IHashAlg* GetHash() const =0;
|
||||
virtual IHashAlg* GetHash() =0;
|
||||
};
|
||||
} // namespace act
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actIEventHandler.h
|
||||
// Product: cv act library
|
||||
// Purpose: Interfaces required to receive token, slot or subsystem events
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Markus Tesche
|
||||
// Date: 03/26/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_IEventHandler_h
|
||||
#define ACT_IEventHandler_h
|
||||
|
||||
#include "actTypeTags.h"
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
enum EventCode
|
||||
{
|
||||
TOKEN_REMOVED = 0x00000010,
|
||||
TOKEN_INSERTED = 0x00000020,
|
||||
SLOT_REMOVED = 0x00000040,
|
||||
SLOT_INSERTED = 0x00000080,
|
||||
SUBSYSTEM_STOPPED = 0x00000100,
|
||||
SUBSYSTEM_STARTED = 0x00000200,
|
||||
MONITORING_STOPPED = 0x00000400,
|
||||
MONITORING_STARTED = 0x00000800,
|
||||
MONITORING_ERROR = 0x80000000,
|
||||
};
|
||||
|
||||
class ISubsystem;
|
||||
class IEventMonitoring;
|
||||
|
||||
//
|
||||
// IEventHandler
|
||||
class IEventHandler : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual IEventHandler* Clone() = 0;
|
||||
virtual void Source(IEventMonitoring* source) = 0;
|
||||
virtual void OnEvent(int event, ISubsystem* source) = 0;
|
||||
};
|
||||
|
||||
typedef TypeTag<IEventHandler> TagEH;
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IEventHandler_h
|
||||
@@ -1,42 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIHashAlg.h
|
||||
// Product: cv act library
|
||||
// Purpose: IHashAlg is an abstract base class, which provides the interface
|
||||
// of all hash-algorithms.
|
||||
//
|
||||
// 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_IHASHALG_H
|
||||
#define ACT_IHASHALG_H
|
||||
|
||||
#include "actIAlgorithm.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
|
||||
class IHashAlg : public IAlgorithm
|
||||
{
|
||||
public:
|
||||
virtual IHashAlg* Clone() const =0;
|
||||
virtual void Import(const Blob& indata) =0;
|
||||
virtual void Export(Blob& outdata) const =0;
|
||||
virtual void SetParam(paramid_t id,const Blob &blob) =0;
|
||||
virtual void SetParam(paramid_t id,int val) =0;
|
||||
virtual void SetParam(paramid_t id,const char* cstr) =0;
|
||||
virtual void GetParam(paramid_t id,Blob &blob) const =0;
|
||||
virtual int GetParam(paramid_t) const =0;
|
||||
virtual size_t GetBlockSize() const = 0;
|
||||
virtual size_t GetHashSize() const = 0;
|
||||
virtual void Reset() =0;
|
||||
virtual void* GetCreatePointer() const =0;
|
||||
virtual ~IHashAlg() {}
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: IKey is an abstract base class. All concrete Key-classes are
|
||||
// derived from IKey.
|
||||
//
|
||||
// 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_IKey_h
|
||||
#define ACT_IKey_h
|
||||
|
||||
#include "actIParam.h"
|
||||
#include "actBlob.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IAlgorithm;
|
||||
class IRNGAlg;
|
||||
|
||||
class IKey : public IParam
|
||||
{
|
||||
public:
|
||||
virtual ~IKey() { }
|
||||
|
||||
virtual IKey* Clone() const = 0;
|
||||
|
||||
virtual void Import(const Blob& keyblob) = 0;
|
||||
virtual void Export(Blob& keyblob, export_t type = DEFAULT) const = 0;
|
||||
|
||||
virtual void Generate(IRNGAlg* prng = 0) = 0;
|
||||
virtual void Derive(const Blob& data, const Blob& salt = Blob()) = 0;
|
||||
|
||||
virtual IAlgorithm* CreateAlgorithm(mode_t Mode) const = 0;
|
||||
virtual IAlgorithm* CreateAlgorithm(mode_t Mode, const Blob& data) const = 0;
|
||||
|
||||
virtual void* GetCreatePointer() const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IKey_h
|
||||
@@ -1,70 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actIKeyDerivation.h
|
||||
// Product: cv act library
|
||||
// Purpose: IKeyDerivation for general prupose
|
||||
//
|
||||
// Copyright: (c) 2003-2010 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Ulrich Birkenhauer
|
||||
// Markus Tesche
|
||||
// Date: 07/05/2010
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_IKeyDerivation_h
|
||||
#define ACT_IKeyDerivation_h
|
||||
|
||||
#include "actMove.h"
|
||||
#include "actMode.h"
|
||||
|
||||
#include "actIParam.h"
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
enum KDParam
|
||||
{
|
||||
KD_DATA = SALT,
|
||||
KD_HASH = HASH,
|
||||
KD_SERIAL = SERIALNR,
|
||||
KD_DERIVATOR = DERIVATOR,
|
||||
KD_MODE = BCMODE, // key configuration
|
||||
KD_PADDING = PADDING, // key configuration
|
||||
};
|
||||
|
||||
enum KDMode
|
||||
{
|
||||
KD_MODE_DEFAULT = 0,
|
||||
KD_MODE_CARD_MANAGER,
|
||||
|
||||
KD_MODE_LAST
|
||||
};
|
||||
|
||||
class IKeyDerivation;
|
||||
class IBlockCipherKey;
|
||||
|
||||
typedef void (*DerivationFunc)(IKeyDerivation* owner, const Blob& data,
|
||||
Blob& k_enc, Blob& k_mac, Blob& k_kek);
|
||||
|
||||
//
|
||||
// IKeyDerivation
|
||||
class IKeyDerivation
|
||||
: public IParam
|
||||
, public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual Blob Derive(const Blob& deriveData) = 0;
|
||||
virtual void Derive(uint mode, const Blob& data, Blob& k_enc, Blob& k_mac) = 0;
|
||||
virtual void Derive(uint mode, const Blob& data, Blob& k_enc, Blob& k_mac, Blob& k_kek) = 0;
|
||||
|
||||
virtual void SetKey(IBlockCipherKey* key) = 0;
|
||||
//
|
||||
// If mode already registered, it will be overwritten and the previous will be returned.
|
||||
virtual DerivationFunc Register(uint mode, DerivationFunc df) = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IKeyDerivation_h
|
||||
@@ -1,27 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIMACKEY.h
|
||||
// Product: cv act library
|
||||
// Purpose: interface for the class CBCMAC
|
||||
//
|
||||
// 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_IMACKey_h
|
||||
#define ACT_IMACKey_h
|
||||
|
||||
#include "actIKey.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IMACKey : public IKey
|
||||
{
|
||||
public:
|
||||
virtual const char* KeyName() const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IMACKey_h
|
||||
@@ -1,89 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actIPKCS15Behavior.h
|
||||
// Product: cv act library
|
||||
// Purpose: IPKCS15Behavior interface, encapsulates Manufacturer specific logic
|
||||
// for PKCS15 to cvProfile mapping.
|
||||
//
|
||||
// Copyright: (c) 2002-2008 cv cryptovision GmbH all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 06/02/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_IPKCS15Behavior_h
|
||||
#define ACT_IPKCS15Behavior_h
|
||||
|
||||
#include "actISCardOSBehavior.h"
|
||||
|
||||
#include "cvProfileInfos.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IAuthIdRef;
|
||||
|
||||
class IToken;
|
||||
class ITokenPIN;
|
||||
class ITokenKey;
|
||||
class ITokenFile;
|
||||
class ITokenFileMap;
|
||||
class ISecurityManager;
|
||||
class ITokenBlockCipherKey;
|
||||
|
||||
class PKCS15Container;
|
||||
struct PKCS15Path;
|
||||
struct PKCS15Object;
|
||||
|
||||
//
|
||||
// IPKCS15Behavior
|
||||
class IPKCS15Behavior : public ISCardOSBehavior
|
||||
{
|
||||
public:
|
||||
virtual void Init(IToken* token) = 0;
|
||||
|
||||
virtual int GetTokenType(const IToken* token) const throw() = 0;
|
||||
virtual void GetProfileCapabilities(ITokenConfig* tkcfg) const = 0;
|
||||
|
||||
virtual bool IsReadOnly() const = 0;
|
||||
virtual const Blob& GetMID() const = 0;
|
||||
|
||||
// Returns a valid instance or throws !
|
||||
virtual ITokenFile* GetPath() const = 0;
|
||||
virtual ITokenFile* GetTokenFile(const Blob& p15path) = 0;
|
||||
virtual ITokenFile* GetTokenFile(const PKCS15Path& p15path) = 0;
|
||||
|
||||
virtual ITokenPIN* GetPin(IToken* token, const PKCS15Object& p15object, bool use_obj_ref = false) = 0;
|
||||
|
||||
// NOTE: If one of these functions return false, the object gets destroyed
|
||||
// and is not added to the corresponding collection, therefore not accessable!
|
||||
virtual bool InitTokenPIN(ITokenPIN* pin, const PKCS15Object& p15object) = 0;
|
||||
virtual bool InitTokenKey(ITokenKey* key, const FileInfo& fi, int usage, const PKCS15Object& p15object) = 0;
|
||||
virtual bool InitTokenKey(ITokenBlockCipherKey* key, const FileInfo& fi, const PKCS15Object& p15object) = 0;
|
||||
|
||||
virtual FIDType GetFirstFID(byte obj_type, size_t key_size = 0) const = 0;
|
||||
virtual void GetObjectInfo(FIDType fid, Blob& object_path, byte* obj_ref, byte obj_type, size_t key_size = 0) const = 0;
|
||||
|
||||
virtual FIDType TransformKeyReference(FIDType id, bool to_on_card_reference = false, bool* bReference = 0) const = 0;
|
||||
|
||||
virtual FIDType GetNativeFID(byte obj_type, const FIDType fid, byte object_reference = 0) const = 0;
|
||||
|
||||
virtual void GetRelativeFilePath(Blob& absolute_filepath) const = 0;
|
||||
|
||||
virtual const Blob& GetACTokenRights() const = 0;
|
||||
virtual Blob GetAccessRights(const ITokenPIN* pin, byte obj_type) const = 0;
|
||||
virtual Blob GetAccessRights(IAuthIdRef* authIdRef, IAuthIdRef* parentAuthIdRef, byte obj_type) const = 0;
|
||||
|
||||
virtual ISecurityManager* SecurityManager(IToken* token, int authManagerType) const = 0;
|
||||
virtual void CreateAuthObj(ITokenPIN* pin, byte obj_type) const = 0;
|
||||
|
||||
virtual bool GetNativePubKeySupport() const = 0;
|
||||
virtual Blob ReadNativePublicKey(ISCardOS* os, FIDType fid) const = 0;
|
||||
virtual Blob ReadNativeECPublicKey(ISCardOS* os, FIDType fid) const = 0;
|
||||
virtual FIDType GetNativePubKeyInfo(FIDType priv_key_fid, const PublicKeyInfo& info,
|
||||
PKCS15Object& p15object) const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IPKCS15Behavior_h
|
||||
@@ -1,67 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actIParam.h
|
||||
// Product: cv act library
|
||||
// Purpose: Declares act::IParam interface.
|
||||
//
|
||||
// Copyright: (c) 2006 cv cryptovision GmbH
|
||||
// all rights reserved.
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche (MTE)
|
||||
// Date: 3/1/2006
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_IParam_h
|
||||
#define ACT_IParam_h
|
||||
|
||||
#include "actBasics.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Blob;
|
||||
|
||||
enum
|
||||
{
|
||||
PARAM_ANY = -3,
|
||||
PARAM_UNKNOWN_SIZE = -2,
|
||||
PARAM_INVALID_VALUE = -1,
|
||||
PARAM_FALSE = 0,
|
||||
PARAM_TRUE = 1
|
||||
};
|
||||
|
||||
static inline int param_bool(bool value)
|
||||
{
|
||||
return value == true ? PARAM_TRUE : PARAM_FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// IParam
|
||||
class IParam
|
||||
{
|
||||
public:
|
||||
virtual ~IParam() { }
|
||||
|
||||
virtual void SetParam(paramid_t id, int value) = 0;
|
||||
virtual void SetParam(paramid_t id, const char* value) = 0;
|
||||
virtual void SetParam(paramid_t id, const Blob& value) = 0;
|
||||
|
||||
//
|
||||
// Get value for id, otherwise PARAM_INVALID_VALUE.
|
||||
// NOTE: May throws an act::Exception derived exception.
|
||||
virtual int GetParam(paramid_t id) const = 0;
|
||||
|
||||
//
|
||||
// Get value for id, returns size[PARAM_UNKNOWN_SIZE|0-n] or PARAM_INVALID_VALUE.
|
||||
// NOTE: May throws an act::Exception derived exception.
|
||||
virtual size_t GetParam(paramid_t id, const char** value) const = 0;
|
||||
|
||||
//
|
||||
// Get value for id, returns size[PARAM_UNKNOWN_SIZE|0-n] or PARAM_INVALID_VALUE.
|
||||
// NOTE: May throws an act::Exception derived exception.
|
||||
virtual size_t GetParam(paramid_t id, Blob& value) const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IParam_h
|
||||
@@ -1,38 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIRNGAlg.h
|
||||
// Product: cv act library
|
||||
// Purpose: IRNGAlg is the interface for Random Number Generators.
|
||||
//
|
||||
// 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_IRNGAlg_h
|
||||
#define ACT_IRNGAlg_h
|
||||
|
||||
#include "actIAlgorithm.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Blob;
|
||||
|
||||
class IRNGAlg : public IAlgorithm
|
||||
{
|
||||
public:
|
||||
virtual IRNGAlg* Clone() const = 0;
|
||||
virtual void Import(const Blob& keyblob) = 0;
|
||||
virtual void Export(Blob& keyblob) const = 0;
|
||||
virtual void SetParam(paramid_t id, const Blob& blob) = 0;
|
||||
virtual void SetParam(paramid_t id, int val) = 0;
|
||||
virtual void SetParam(paramid_t id, const char* cstr) = 0;
|
||||
virtual int GetParam(paramid_t id) const = 0;
|
||||
virtual void GetParam(paramid_t id, Blob& blob) const = 0;
|
||||
|
||||
virtual void* GetCreatePointer() const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IRNGAlg_h
|
||||
@@ -1,32 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIRSAKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: IRSAKey is the interface for the class IRSAKey enabling access to
|
||||
// the aggregated padding-object of an RSAKeys.
|
||||
//
|
||||
// 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_IRSAKey_h
|
||||
#define ACT_IRSAKey_h
|
||||
|
||||
#include "actISignatureKey.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IPadding;
|
||||
|
||||
class IRSAKey : public ISignatureKey
|
||||
{
|
||||
public:
|
||||
virtual void SetPadding(IPadding* padding) = 0;
|
||||
virtual const IPadding* GetPadding() const = 0;
|
||||
virtual IPadding* GetPadding() = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IRSAKey_h
|
||||
@@ -1,33 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actIRefCounted.h
|
||||
// Product: cv act library
|
||||
// Purpose: The IRefCounted interface.
|
||||
//
|
||||
// Copyright: (c) 2006 cv cryptovision GmbH
|
||||
// all rights reserved.
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche (MTE)
|
||||
// Date: 1/18/2006
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_IRefCounted_h
|
||||
#define ACT_IRefCounted_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
//
|
||||
// IRefCounted, methods for reference counting.
|
||||
class IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual ~IRefCounted() { }
|
||||
|
||||
virtual void AddRef() = 0;
|
||||
virtual void Release() = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IRefCounted_h
|
||||
@@ -1,198 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actISCardAccess.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class ISCardAccess manages the operations with the smartcards and readers
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 03/21/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ISCardAccess_h
|
||||
#define ACT_ISCardAccess_h
|
||||
|
||||
#include "actBlob.h"
|
||||
#include "actIRefCounted.h"
|
||||
#include "actISynchronize.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class SyncObject;
|
||||
|
||||
const ushort RESPONSE_MAXLEN = 2048;
|
||||
|
||||
enum ReturnCode
|
||||
{
|
||||
APDU_RESPONSE_MASK = 0xffff,
|
||||
|
||||
APDU_OK = 0x9000,
|
||||
APDU_OK1 = 0x9001,
|
||||
|
||||
// error codes defined in ISO7816-4
|
||||
APDU_STATE_UNCHANGED = 0x6200,
|
||||
APDU_RETURN_CORRUPTED = 0x6281,
|
||||
APDU_END_REACHED = 0x6282,
|
||||
APDU_SELECTFILE_INVALID = 0x6283,
|
||||
APDU_FCI_FORMAT = 0x6284,
|
||||
|
||||
APDU_AUTHEN_FAILED = 0x6300,
|
||||
APDU_RETRY_COUNTER = 0x63C0,
|
||||
APDU_FILE_FILLED_UP = 0x6381,
|
||||
|
||||
APDU_STATE_UNCHANGED2 = 0x6400,
|
||||
|
||||
APDU_STATE_CHANGED = 0x6500,
|
||||
APDU_MEMORY_FAILURE = 0x6581,
|
||||
|
||||
APDU_SECURITY_ERROR = 0x6600, // not defined in ISO7816
|
||||
|
||||
APDU_WRONG_LEN = 0x6700,
|
||||
|
||||
APDU_NO_CLA_FUNCTION = 0x6800,
|
||||
APDU_NO_LOGICAL_CHANNEL = 0x6881,
|
||||
APDU_NO_SM = 0x6882,
|
||||
|
||||
APDU_CMD_NOT_ALLOWED = 0x6900,
|
||||
APDU_CMD_INCOMPATIBLE = 0x6981,
|
||||
APDU_SECURITY_STATE = 0x6982,
|
||||
APDU_AUTHEN_BLOCKED = 0x6983,
|
||||
APDU_REF_DATA_INVALID = 0x6984,
|
||||
APDU_NO_CONDITION = 0x6985,
|
||||
APDU_CMD_EF_NOT_ALLOWED = 0x6986,
|
||||
APDU_SM_DATA_MISSING = 0x6987,
|
||||
APDU_SM_DATA_INCORRECT = 0x6988,
|
||||
|
||||
APDU_WRONG_PARAMETER = 0x6A00,
|
||||
APDU_WRONG_DATA = 0x6A80,
|
||||
APDU_FUNCTION_NOT_SUPPORTED = 0x6A81,
|
||||
APDU_FILE_NOT_FOUND = 0x6A82,
|
||||
APDU_RECORD_NOT_FOUND = 0x6A83,
|
||||
APDU_NOT_ENOUGH_MEMORY = 0x6A84,
|
||||
APDU_LC_TLV_INCONSISTENT = 0x6A85,
|
||||
APDU_INVALID_P1P2 = 0x6A86,
|
||||
APDU_LC_P1P2_INCONSISTENT = 0x6A87,
|
||||
APDU_REF_DATA_NOT_FOUND = 0x6A88,
|
||||
APDU_FILE_ALREADY_EXISTS = 0x6A89,
|
||||
|
||||
APDU_WRONG_PARAMETER2 = 0x6B00,
|
||||
|
||||
APDU_WRONG_LE = 0x6C00,
|
||||
|
||||
APDU_INS_INVALID = 0x6D00,
|
||||
|
||||
APDU_CLA_INVALID = 0x6E00,
|
||||
|
||||
APDU_TECHNICAL_ERROR = 0x6F00,
|
||||
|
||||
|
||||
// other error codes depend on card OS
|
||||
APDU_NO_ICC = 0x64A1,
|
||||
APDU_PROTOCOL_ERROR = 0x64A8,
|
||||
|
||||
APDU_NO_AC_RIGHT = 0x6982,
|
||||
APDU_PIN_LOCKED = 0x6983,
|
||||
APDU_PIN_FORMAT_ERROR = 0x6984,
|
||||
|
||||
APDU_OBJECT_NOT_FOUND = 0x6A88,
|
||||
|
||||
APDU_KEYGEN_FAILED = 0x6F83, // ACOS
|
||||
|
||||
|
||||
// JavaCardOS
|
||||
APDU_MORE_DATA_AVAILABLE = 0x6310,
|
||||
APDU_APPLET_SELECTION_FAILED = 0x6999,
|
||||
APDU_PIN_FAILED = 0x69C0,
|
||||
APDU_ASSERT = 0x6FFF,
|
||||
APDU_ASSERT_NOTRANSACTION = 0x6FFE,
|
||||
};
|
||||
|
||||
enum ProtocolType
|
||||
{
|
||||
PROTOCOL_UNDEFINED = 0x00000, // There is no active protocol.
|
||||
PROTOCOL_T0 = 0x00001, // T=0 is the active protocol.
|
||||
PROTOCOL_T1 = 0x00002, // T=1 is the active protocol.
|
||||
PROTOCOL_RAW = 0x10000 // Raw is the active protocol.
|
||||
};
|
||||
|
||||
enum DispositionType
|
||||
{
|
||||
LEAVE_CARD = 0, // Don't do anything special.
|
||||
RESET_CARD = 1, // Reset the card.
|
||||
UNPOWER_CARD = 2, // Power down the card.
|
||||
EJECT_CARD = 3 // Eject the card.
|
||||
};
|
||||
|
||||
inline bool APDUSUCCESS(word sw1sw2)
|
||||
{
|
||||
return sw1sw2 == act::APDU_OK
|
||||
|| sw1sw2 == act::APDU_OK1;
|
||||
}
|
||||
|
||||
// extract
|
||||
template<typename ExceptionT>
|
||||
inline word apdu_response(const ExceptionT& e)
|
||||
{
|
||||
return word(e.code() & APDU_RESPONSE_MASK);
|
||||
}
|
||||
|
||||
// LengthInfo
|
||||
struct LengthInfo;
|
||||
typedef LengthInfo VerifyInfo;
|
||||
|
||||
class ISlot;
|
||||
class ISCardSM;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class ISCardAccess
|
||||
: public IRefCounted
|
||||
, public ISynchronize
|
||||
{
|
||||
public:
|
||||
virtual ~ISCardAccess()
|
||||
{ }
|
||||
|
||||
virtual long GetProtocol() const = 0;
|
||||
virtual void SetProtocol(long protocol) = 0;
|
||||
|
||||
virtual ulong GetTimeout() const = 0;
|
||||
virtual bool SetTimeout(ulong timeout_msec) = 0;
|
||||
|
||||
virtual void Open() = 0;
|
||||
virtual void Close() = 0;
|
||||
virtual void ResetCard() = 0;
|
||||
virtual long CancelCardOperation() = 0;
|
||||
|
||||
virtual void BeginTransaction() = 0;
|
||||
virtual void EndTransaction(DispositionType disposition = LEAVE_CARD) = 0;
|
||||
virtual ulong GetTransactionDepth() const = 0;
|
||||
|
||||
virtual const ISlot* GetSlot() const = 0;
|
||||
|
||||
virtual word SendCard(const Blob& cmd, Blob& response, ushort response_len = RESPONSE_MAXLEN) = 0;
|
||||
|
||||
virtual Blob GetResponse() const = 0;
|
||||
virtual Blob& GetResponse(Blob& response) const = 0;
|
||||
|
||||
virtual word Send(const Blob& cmd) = 0;
|
||||
virtual word Send(const Blob& header, const Blob& data) = 0;
|
||||
virtual word Send(const Blob& header, const Blob& data, byte le) = 0;
|
||||
|
||||
// Extended APDU
|
||||
virtual word SendX(const Blob& header, const Blob& data) = 0;
|
||||
virtual word SendX(const Blob& header, const Blob& data, ushort le) = 0;
|
||||
|
||||
// Secure Pin Entry
|
||||
virtual word SendVerifyToReader(const Blob& apdu, const VerifyInfo& info) = 0;
|
||||
|
||||
// Secure Messaging
|
||||
virtual ISCardSM* GetSM() const = 0;
|
||||
virtual void SetSM(ISCardSM* sm) = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ISCardAccess_h
|
||||
@@ -1,262 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actISCardOS.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class ISCardOS accesses the card operating system
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 03/21/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ISCardOS_h
|
||||
#define ACT_ISCardOS_h
|
||||
|
||||
#include "actBlob.h"
|
||||
#include "actTokenBase.h"
|
||||
|
||||
#include "actITokenPIN.h"
|
||||
#include "actITokenConfig.h"
|
||||
#include "actITokenInitializer.h"
|
||||
|
||||
#include "actIRefCounted.h"
|
||||
#include "actIAccessCondition.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IKey;
|
||||
class IEMSAAlg;
|
||||
class ITokenFile;
|
||||
class ISCardAccess;
|
||||
class ISCardOSBehavior;
|
||||
class IKeyDerivation;
|
||||
|
||||
class EFDIR;
|
||||
|
||||
const FIDType FID_EF_DIR = 0x2F00;
|
||||
const FIDType FID_EF_ATR = 0x2F01;
|
||||
|
||||
//
|
||||
// ISO 7816-4
|
||||
enum SCardFileType
|
||||
{
|
||||
BINARY = 0x01,
|
||||
LINEAR_FIXED = 0x02,
|
||||
LINEAR_TLV = 0x05,
|
||||
LINEAR_VARIABLE = 0x04,
|
||||
CYCLIC_FIXED = 0x06,
|
||||
DF = 0x38
|
||||
};
|
||||
|
||||
//
|
||||
// ISO 7816-4
|
||||
enum SCardRecordMode
|
||||
{
|
||||
ABSOLUTE_MODE = 0x04
|
||||
};
|
||||
|
||||
//
|
||||
// ISO 7816-4
|
||||
enum SCardSelectType
|
||||
{
|
||||
MFType = 0x00,
|
||||
DFType = 0x01,
|
||||
EFType = 0x02,
|
||||
AIDType = 0x04,
|
||||
PathType = 0x08
|
||||
};
|
||||
|
||||
enum SCardSelectMode
|
||||
{
|
||||
FCI = 0x00, // FCI template
|
||||
FCP = 0x04, // FCP template
|
||||
FMD = 0x08, // FMD template
|
||||
NoData = 0x0c, // No response data
|
||||
};
|
||||
|
||||
enum SCardError
|
||||
{
|
||||
SCARD_SUCCESS = 0,
|
||||
SCARD_FUNCTION_NOT_SUPPORTED = -1,
|
||||
SCARD_FUNCTION_FAILED = -2
|
||||
};
|
||||
|
||||
//
|
||||
// ISCardOS
|
||||
class ISCardOS
|
||||
: public IRefCounted
|
||||
, public IAcConverter
|
||||
{
|
||||
public:
|
||||
virtual ~ISCardOS() { }
|
||||
|
||||
// ISCardOS
|
||||
virtual ISCardOS* Clone() const = 0;
|
||||
|
||||
virtual bool IsMoC() = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
virtual Blob GetSerialNumber() const = 0; // hardware serial number
|
||||
virtual Blob GetCardId(unsigned short fid_card_id) = 0;
|
||||
virtual Blob GetCardCF(unsigned short fid_card_cf) = 0;
|
||||
|
||||
virtual ISCardAccess* GetAccess() const = 0;
|
||||
|
||||
virtual Blob ComputeDigitalSignature(const Blob& data, int mode = SIGN_DATA) = 0;
|
||||
virtual Blob ComputeDigitalSignature(IEMSAAlg* emsa, int mode = SIGN_DATA) = 0;
|
||||
virtual Blob Encipher(const Blob& plaintext) = 0;
|
||||
virtual Blob Decipher(const Blob& encrypted_data) = 0;
|
||||
virtual Blob AgreeKey(const Blob& pubkey) = 0;
|
||||
|
||||
virtual void ComputeECDigitalSignature(const Blob& data, Blob& signature) = 0;
|
||||
|
||||
virtual Blob SelectFile(const int filetype, const char* filepath) = 0; // return file control information
|
||||
virtual Blob SelectFile(const int filetype, const Blob& filepath) = 0; // return file control information
|
||||
virtual Blob SelectFile(const int filetype, FIDType fid) = 0; // return file control information
|
||||
virtual Blob SelectApp(const Blob& aid, SCardSelectMode mode = NoData) = 0;
|
||||
|
||||
// EF.DIR
|
||||
virtual EFDIR* GetEFDIR(ushort fid = FID_INVALID) = 0;
|
||||
|
||||
virtual int GetEFSize(FIDType fid) = 0;
|
||||
virtual int GetEFSize(const Blob& filepath, Blob& fci) = 0;
|
||||
virtual void GetFCI(FIDType fid, Blob& fci) = 0;
|
||||
virtual Blob GetFCIValue(const Blob& fci, const byte tag) = 0;
|
||||
virtual byte GetFileInfo(const Blob& fc_data, unsigned short& ef_size, size_t& num_of_records) = 0;
|
||||
|
||||
// select and read binary
|
||||
virtual Blob ReadBinary(const char* filepath) = 0;
|
||||
virtual Blob ReadBinary(const Blob& filepath) = 0;
|
||||
virtual Blob ReadBinary(FIDType fid) = 0;
|
||||
|
||||
// read/update binary, file is selected, file size is known
|
||||
virtual Blob ReadSelectedBinary(size_t file_size, unsigned short offset = 0) = 0;
|
||||
virtual void UpdateSelectedBinary(const Blob& data, unsigned short offset = 0) = 0;
|
||||
|
||||
// select and update binary
|
||||
virtual void UpdateBinary(const Blob& filepath, const Blob& data, unsigned short offset = 0) = 0;
|
||||
virtual void UpdateBinary(FIDType fid, const Blob& data, unsigned short offset = 0) = 0;
|
||||
|
||||
// read binary with XL-APDUs
|
||||
virtual Blob ReadBinaryX(const char* filepath) = 0;
|
||||
virtual Blob ReadBinaryX(const Blob& filepath) = 0;
|
||||
virtual Blob ReadBinaryX(FIDType fid) = 0;
|
||||
virtual Blob ReadSelectedBinaryX(size_t file_size, unsigned short offset = 0) = 0;
|
||||
|
||||
// update binary with XL-APDUs
|
||||
virtual void UpdateBinaryX(const Blob& filepath, const Blob& data, unsigned short offset = 0) = 0;
|
||||
virtual void UpdateBinaryX(FIDType fid, const Blob& data, unsigned short offset = 0) = 0;
|
||||
virtual void UpdateSelectedBinaryX(const Blob& data, unsigned short offset = 0) = 0;
|
||||
|
||||
// record read/write (file must be selected)
|
||||
virtual Blob ReadRecord(byte mode) = 0; // p2
|
||||
virtual Blob ReadRecord(byte rec_id, byte mode) = 0; // p1, p2
|
||||
virtual void UpdateRecord(const Blob& data, byte rec_id, byte mode) = 0; // data, p1, p2
|
||||
virtual void AppendRecord(const Blob& data, byte ef_id = 0) = 0; // data, p2
|
||||
|
||||
// record write (includes file selection and resize)
|
||||
virtual void UpdateRecord(const Blob& filepath, const Blob& data, byte rec_id, byte mode) = 0;
|
||||
virtual void AppendRecord(const Blob& filepath, const Blob& data) = 0;
|
||||
|
||||
virtual void DeleteEF(const Blob& fid) = 0;
|
||||
virtual void DeleteEF(FIDType fid) = 0;
|
||||
|
||||
virtual void CreateEF(const Blob& fcp) = 0;
|
||||
virtual void CreateEF(const Blob& fid, unsigned short len, bool secure = false) = 0;
|
||||
virtual void CreateEF(FIDType fid, unsigned short len, bool secure = false) = 0;
|
||||
|
||||
virtual void CreateEF_TLV(FIDType fid, unsigned short len, unsigned short num_of_records = 1) = 0;
|
||||
virtual void CreateEF_TLV(const Blob& fid, unsigned short len, unsigned short num_of_records = 1) = 0;
|
||||
|
||||
virtual unsigned short GetOSFileOffset() const = 0;
|
||||
|
||||
// get/put dat
|
||||
virtual Blob GetData(ushort tag, ushort le = 0) const = 0; // INS=CA
|
||||
virtual void PutData(ushort tag, const Blob& data) = 0; // INS=DA
|
||||
|
||||
// MSE/PSO functions
|
||||
virtual void ManageSecurityEnvironment(byte p1, byte p2, const Blob& data = Blob()) = 0;
|
||||
virtual void PerformSecurityOperation(Blob& response, byte p1, byte p2, const Blob& data, bool chaining = false) = 0;
|
||||
virtual void PerformSecurityOperationX(Blob& response, byte p1, byte p2, const Blob& data) = 0; // explicit extended APDU
|
||||
|
||||
// ISO authentication functions
|
||||
virtual void ExternalAuthenticate(byte key_id, const Blob& response, bool odd_INS = false) = 0; // INS=82/83, P1=00, P2=key_id
|
||||
virtual Blob InternalAuthenticate(byte key_id, const Blob& challenge, bool odd_INS = false) = 0; // INS=88/89, P1=00, P2=key_id
|
||||
virtual Blob MutualAuthenticate(byte key_id, const Blob& auth_data, bool odd_INS = false) = 0; // INS=82/83, P1=00, P2=key_id
|
||||
virtual Blob GeneralAuthenticate(byte key_id, const Blob& auth_data, bool chaining = false, bool odd_INS = false) = 0; // INS=86/87, P1=00, P2=key_id
|
||||
|
||||
virtual void ResetRetryCounter(byte p1, byte p2, const Blob& data) = 0;
|
||||
virtual void Verify(byte p1, byte p2, const Blob& data, bool odd_INS = false) = 0; // INS=20/21
|
||||
|
||||
// random functions
|
||||
virtual Blob GetChallenge(byte le = byte(8)) const = 0;
|
||||
virtual Blob GetRandom(const unsigned long count) const = 0;
|
||||
|
||||
// token type / config
|
||||
virtual ProfileType GetProfileType(bool refresh = false) = 0;
|
||||
|
||||
virtual void SetTokenConfig(ITokenConfig* tkcfg) = 0;
|
||||
virtual ITokenConfig* GetTokenConfig() const = 0;
|
||||
|
||||
// set/get behavior
|
||||
virtual void SetBehavior(ISCardOSBehavior* behave) = 0;
|
||||
virtual ISCardOSBehavior* GetBehavior() = 0;
|
||||
|
||||
// access rights
|
||||
virtual void SetAccessRights(const Blob& access_rights) = 0;
|
||||
virtual void SetAccessRights(move_from<Blob> access_rights) = 0;
|
||||
virtual void SetExplicitRights(IAccessCondition* ac, size_t ac_cnt = 1) = 0;
|
||||
|
||||
virtual bool HasExplicitRights() const = 0;
|
||||
|
||||
virtual Blob GetAccessRights() = 0;
|
||||
virtual IAccessCondition* GetAccessRights(const Blob& fci) = 0;
|
||||
virtual Blob GetAccessRights(ACSCardObjType ac_obj_type, bool tagged) const = 0;
|
||||
|
||||
// selected path
|
||||
virtual void SetSelectedPath(ITokenFile* selected_path) const = 0;
|
||||
virtual ITokenFile* GetSelectedPath() const = 0;
|
||||
|
||||
// key derivation
|
||||
virtual void SetKeyDerivation(IKeyDerivation* key_derivation) = 0;
|
||||
virtual IKeyDerivation* GetKeyDerivation() const = 0;
|
||||
|
||||
// key handling
|
||||
virtual void GenerateRSAKeyPair(int key_id, size_t key_size, // in bits
|
||||
Blob& pubkey) = 0;
|
||||
|
||||
virtual void ImportRSAKeyPair(int key_id, const Blob& prime_p,
|
||||
const Blob& prime_q, const Blob& priv_exp, Blob& pubkey) = 0;
|
||||
|
||||
virtual void GenerateECKeyPair(Blob& pubkey) = 0;
|
||||
|
||||
virtual void GenerateECKeyPair(int key_id, const Blob& curve_oid,
|
||||
const Blob& curve_param, Blob& pubkey) = 0;
|
||||
|
||||
virtual void ImportECKeyPair(int key_nr, const Blob& curve_oid,
|
||||
const Blob& curve_param, const Blob& privkey, const Blob& pubkey) = 0;
|
||||
|
||||
virtual void ImportDESKey(int key_id, const Blob& keyblob) = 0;
|
||||
|
||||
virtual void DeletePrivateKeyObj(FIDType fid) = 0;
|
||||
virtual void DeleteECPrivateKeyObj(FIDType fid) = 0;
|
||||
virtual void DeleteBlockCipherKeyObj(FIDType fid) = 0;
|
||||
virtual void SelectKey(int key_id) = 0;
|
||||
|
||||
// authentication functions
|
||||
virtual Blob ComputeResponse(const Blob& auth_key, const Blob& challenge) const = 0;
|
||||
virtual void UpdateExternalAuthenticateKey(byte key_id, const Blob& auth_key) = 0;
|
||||
|
||||
virtual void ResetSecurityStatus() = 0;
|
||||
virtual SecStatus GetSecurityStatus(byte obj_ref, Blob& context) const = 0;
|
||||
|
||||
// token initialization
|
||||
virtual void SetDefaultLabel(move_from<Blob> label) = 0;
|
||||
virtual ITokenInitializer* GetTokenInitializer() = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ISCardOS_h
|
||||
@@ -1,60 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actISecurityManager.h
|
||||
// Product: cv act library
|
||||
// Purpose: ISecurityManager used to manage the token authentication objects.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche (MTE)
|
||||
// Date: 08/05/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ISecurityManager_h
|
||||
#define ACT_ISecurityManager_h
|
||||
|
||||
#include "actBasics.h"
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ITokenPIN;
|
||||
class IAuthIdRef;
|
||||
|
||||
enum SecManType
|
||||
{
|
||||
SecManUnknown = 0,
|
||||
SecManPIN,
|
||||
SecManBio,
|
||||
};
|
||||
|
||||
//
|
||||
// ISecurityManager
|
||||
// TODO: MTE: Add access control management
|
||||
class ISecurityManager : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual SecManType GetType() const = 0;
|
||||
virtual void Delete(ITokenPIN* auth_obj) = 0;
|
||||
};
|
||||
|
||||
class IPINManager : public ISecurityManager
|
||||
{
|
||||
public:
|
||||
// NOTE: MTE: pin can be empty!
|
||||
virtual ITokenPIN* Create(IAuthIdRef* authIdRef, IAuthIdRef* parentAuthIdRef,
|
||||
int retryCount, const Blob& pin) = 0;
|
||||
};
|
||||
|
||||
class IBioManager : public ISecurityManager
|
||||
{
|
||||
public:
|
||||
virtual ITokenPIN* Create(IAuthIdRef* authIdRef, IAuthIdRef* parentAuthIdRef,
|
||||
int retryCount, int bioFinger) = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ISecurityManager_h
|
||||
@@ -1,32 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actISignatureKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: The interface ISignatureKey enables access to the aggregated
|
||||
// EMSA-object of the SignatureKeys.
|
||||
//
|
||||
// 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_ISignatureKey_h
|
||||
#define ACT_ISignatureKey_h
|
||||
|
||||
#include "actIKey.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IEMSAAlg;
|
||||
|
||||
class ISignatureKey : public IKey
|
||||
{
|
||||
public:
|
||||
virtual void SetEncoder(IEMSAAlg* padding) = 0;
|
||||
virtual const IEMSAAlg* GetEncoder() const = 0;
|
||||
virtual IEMSAAlg* GetEncoder() = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ISignatureKey_h
|
||||
@@ -1,82 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actISlot.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class ISlot manages the Tokens
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 03/26/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ISlot_h
|
||||
#define ACT_ISlot_h
|
||||
|
||||
#include "actBasics.h"
|
||||
#include "actBlob.h"
|
||||
|
||||
#include "actIRefCounted.h"
|
||||
#include "actISynchronize.h"
|
||||
#include "actIEventMonitoring.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IToken;
|
||||
class ITokenConfig;
|
||||
class ISCardOS;
|
||||
class ISCardAccess;
|
||||
class ISubsystem;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
class ISlot
|
||||
: public IRefCounted
|
||||
, public ISynchronize
|
||||
, public IEventMonitoring
|
||||
{
|
||||
protected:
|
||||
virtual ~ISlot() { }
|
||||
|
||||
public:
|
||||
virtual ISlot* Clone() const = 0;
|
||||
|
||||
virtual bool IsTokenPresent() const = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
virtual ISubsystem* GetSystem() const = 0;
|
||||
|
||||
virtual Blob GetATR() const = 0;
|
||||
virtual Blob GetHistoricalBytes() const = 0;
|
||||
|
||||
virtual ISCardOS* CreateOS(const Blob& historical_bytes = Blob()) = 0;
|
||||
virtual IToken* CreateToken(ISCardOS* os = 0) = 0;
|
||||
virtual ISCardAccess* CreateAccess() = 0;
|
||||
|
||||
virtual void SetTokenConfig(ITokenConfig* tkcfg) = 0;
|
||||
|
||||
virtual bool HasSecurePinEntry(ISCardAccess* ac = 0) const = 0;
|
||||
virtual bool HasSecurePinChange(ISCardAccess* ac = 0) const = 0;
|
||||
|
||||
virtual void SetParam(paramid_t id,int val) = 0;
|
||||
virtual int GetParam(paramid_t id) const = 0;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
struct ATRCardInfo
|
||||
{
|
||||
const char* name;
|
||||
const char* atr;
|
||||
const char* atr_mask;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
void InitCardInfoMap(const ATRCardInfo* mapCardInfo);
|
||||
const ATRCardInfo* GetATRCardInfo(const Blob& atr);
|
||||
const char* GetOSName(const Blob& atr);
|
||||
Blob GetHistoricalBytes(const Blob& atr);
|
||||
bool GetATRStructInfo(const Blob& atr, size_t& his_pos, size_t& his_len, bool& has_tck);
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ISlot_h
|
||||
@@ -1,39 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actISlotMonitor.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class SlotMonitor notifies the slot events
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 05/27/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ISlotMonitor_h
|
||||
#define ACT_ISlotMonitor_h
|
||||
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IEventHandler;
|
||||
|
||||
//
|
||||
// ISlotMonitor
|
||||
class ISlotMonitor : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual void Stop() = 0;
|
||||
virtual void Start(IEventHandler* cmd) = 0;
|
||||
virtual bool Interrupted() const = 0;
|
||||
|
||||
protected:
|
||||
virtual void Run() = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ISlotMonitor_h
|
||||
@@ -1,51 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIStreamCipher.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class IStreamCipher creates the symmetric StreamCipher, which is
|
||||
// defined by IStreamCipherKey. It offers operations like encrypt, decrypt
|
||||
// and queries involving validity or keylength etc.
|
||||
//
|
||||
// Copyright: (c) 2001 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_IStreamCipher_h
|
||||
#define ACT_IStreamCipher_h
|
||||
|
||||
#include "actBasics.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
|
||||
class Blob;
|
||||
|
||||
class IStreamCipher
|
||||
{
|
||||
public:
|
||||
|
||||
virtual IStreamCipher* Clone() const =0;
|
||||
virtual void Import( const Blob& indata ) =0;
|
||||
virtual void Export( Blob& outdata ) const =0;
|
||||
|
||||
virtual void SetRawKey( const Blob& keyblob ) =0;
|
||||
virtual void GetRawKey( Blob& keyblob ) const =0;
|
||||
|
||||
virtual void Process(const byte* input, byte* output, size_t input_len) const =0;
|
||||
|
||||
virtual size_t GetKeySize(size_t keysize=0) const =0;
|
||||
virtual size_t GetMinKeySize() const =0;
|
||||
virtual size_t GetMaxKeySize() const =0;
|
||||
virtual size_t GetNextKeySize(size_t prevsize) const =0;
|
||||
|
||||
virtual void* GetCreatePointer() const =0;
|
||||
|
||||
virtual ~IStreamCipher() {};
|
||||
};
|
||||
|
||||
|
||||
}// namespace act
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIStreamCipherKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class IStreamCipherKey extends the interface of the class IKey
|
||||
// and supports the peculiarities of symmetric keys.
|
||||
//
|
||||
//
|
||||
// Copyright: (c) 2001 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_IStreamCipherKey_h
|
||||
#define ACT_IStreamCipherKey_h
|
||||
|
||||
#include "actIKey.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IStreamCipher;
|
||||
class IDerivator;
|
||||
|
||||
class IStreamCipherKey : public IKey
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void SetCipher(IStreamCipher* cipher) = 0;
|
||||
virtual const IStreamCipher* GetCipher() const = 0;
|
||||
virtual IStreamCipher* GetCipher() = 0;
|
||||
|
||||
virtual void SetDerivator(IDerivator* derive) = 0;
|
||||
virtual const IDerivator* GetDerivator() const = 0;
|
||||
virtual IDerivator* GetDerivator() = 0;
|
||||
};
|
||||
|
||||
} //namespace act
|
||||
|
||||
#endif // ACT_IStreamCipherKey_h
|
||||
@@ -1,38 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actISubsystemConfig.h
|
||||
// Product: cv act library
|
||||
// Purpose: The Subsystem configuration.
|
||||
//
|
||||
// Copyright: (c) 2006 cv cryptovision GmbH
|
||||
// all rights reserved.
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche (MTE)
|
||||
// Date: 1/12/2006
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ISubsystemConfig_h
|
||||
#define ACT_ISubsystemConfig_h
|
||||
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ISubsystem;
|
||||
|
||||
//
|
||||
// ISubsystemConfig
|
||||
class ISubsystemConfig : public IRefCounted
|
||||
{
|
||||
public:
|
||||
// Returns the Subsystem name.
|
||||
virtual const char* GetName() const = 0;
|
||||
|
||||
// Configures the Subsystem, if fails throws an Exception.
|
||||
virtual void ConfigureSubsystem(ISubsystem*) = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ISubsystemConfig_h
|
||||
@@ -1,165 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actIToken.h
|
||||
// Product: cv act library
|
||||
// Purpose: The IToken interface represents the profile and the application
|
||||
// supported by a token.
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 03/22/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_IToken_h
|
||||
#define ACT_IToken_h
|
||||
|
||||
#include "actBlob.h"
|
||||
#include "actBasics.h"
|
||||
#include "actTokenBase.h"
|
||||
|
||||
#include "actISynchronize.h"
|
||||
#include "actITokenFileCache.h"
|
||||
#include "actIAccessCondition.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IKey;
|
||||
class IEMSAAlg;
|
||||
class ICertificate;
|
||||
class IAuthIdRef;
|
||||
class ITokenPIN;
|
||||
class ITokenAuth;
|
||||
class ITokenFile;
|
||||
class ITokenFileMap;
|
||||
class ITokenConfig;
|
||||
class ITokenKeyIterator;
|
||||
class ISecurityManager;
|
||||
class ITokenAuthIterator;
|
||||
|
||||
struct CertEntry
|
||||
{
|
||||
int usage;
|
||||
Blob certblob;
|
||||
};
|
||||
|
||||
//
|
||||
// ITokenView
|
||||
class ITokenView
|
||||
{
|
||||
protected:
|
||||
virtual ~ITokenView() { }
|
||||
|
||||
public:
|
||||
virtual IToken* GetToken() = 0;
|
||||
|
||||
virtual ITokenView* GetPrev() const = 0;
|
||||
virtual ITokenView* GetNext() const = 0;
|
||||
|
||||
virtual ITokenFile* GetPath() const = 0;
|
||||
virtual ITokenFileMap* GetFileMap() const = 0;
|
||||
|
||||
virtual bool Equals(const ITokenView* other) const = 0;
|
||||
|
||||
// Divide view into partitions, based on type[PATH|PIN]
|
||||
virtual size_t Split(paramid_t type) = 0;
|
||||
virtual ITokenView* SetDefault() = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// IToken
|
||||
class IToken
|
||||
: public IRefCounted
|
||||
, public IAcConverter
|
||||
, public ISynchronize
|
||||
{
|
||||
protected:
|
||||
virtual ~IToken() { }
|
||||
|
||||
public:
|
||||
virtual ITokenView* GetView() const = 0;
|
||||
virtual ITokenConfig* GetConfig() const = 0;
|
||||
virtual ITokenFile* GetTokenFile(const Blob& path) = 0;
|
||||
|
||||
virtual int GetStatus() const = 0;
|
||||
virtual int GetType() const = 0;
|
||||
virtual ProfileType GetProfileType() = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
|
||||
// Returns the serial number, which may (!) be empty or equal the hardware serial!
|
||||
virtual Blob GetSerialNumber() const = 0;
|
||||
virtual Blob GetCardholderName() const = 0;
|
||||
virtual Blob GetRandom(const unsigned long count) const = 0;
|
||||
virtual void SetSeed(const Blob& seed) = 0;
|
||||
|
||||
// Generate a new key
|
||||
virtual IKey* NewKey(int key_type) = 0;
|
||||
|
||||
// Add key to token, takes ownership - even on exception!
|
||||
virtual void AddKey(IKey* key) = 0;
|
||||
virtual bool RemoveKey(IKey* key) = 0;
|
||||
|
||||
// Write/Import a (soft) key to token
|
||||
virtual IKey* WriteKey(const IKey* key) = 0;
|
||||
|
||||
// Get a token key instance from matching certificate
|
||||
virtual IKey* CreateKey(const Blob& cert) const = 0;
|
||||
virtual IKey* CreateKey(const ICertificate* cert) const = 0;
|
||||
|
||||
// Key Objects
|
||||
virtual int GetKeyNumber() const = 0;
|
||||
virtual IKey* GetKey(int pos) const = 0;
|
||||
virtual ITokenKeyIterator* GetKeyIterator(KeyType type, const Blob& authId = Blob()) = 0;
|
||||
|
||||
// Certificate Objects
|
||||
virtual int GetCertificateNumber() const = 0;
|
||||
virtual CertEntry GetCertificate(int pos) const = 0;
|
||||
|
||||
// Write/Delete a certificate (corresponding to a key) to token
|
||||
virtual void WriteCertificate(const Blob& cert, IKey* key = 0) = 0;
|
||||
virtual void DeleteCertificate(const Blob& cert, IKey* key = 0) = 0;
|
||||
|
||||
// Authentication Objects
|
||||
virtual ITokenAuth* GetAuth() const = 0;
|
||||
virtual ISecurityManager* SecurityManager(int authManagerType) = 0;
|
||||
virtual ITokenAuthIterator* GetAuthIterator(int type, const Blob& authId = Blob()) = 0;
|
||||
|
||||
virtual int GetPinNumber() const = 0;
|
||||
virtual ITokenPIN* GetPin(const IAuthIdRef* authIdRef, const ITokenFile* location) const = 0;
|
||||
virtual ITokenPIN* GetPin(int pos, const ITokenFile* location) const = 0;
|
||||
virtual ITokenPIN* GetPin(const char* pin_name) const = 0;
|
||||
virtual ITokenPIN* GetPin(const Blob& authId) const = 0;
|
||||
|
||||
virtual ITokenPIN* GetUserPin() const = 0;
|
||||
virtual ITokenPIN* GetSOPin() const = 0;
|
||||
virtual void VerifyUserPin(const Blob& pinvalue) = 0;
|
||||
virtual void ChangeUserPin(const Blob& oldpin, const Blob& newpin) = 0;
|
||||
virtual void UnlockUserPin(const Blob& so_pin, const Blob& new_userpin) = 0;
|
||||
virtual void VerifySOPin(const Blob& pinvalue) = 0;
|
||||
virtual void ChangeSOPin(const Blob& oldpin, const Blob& newpin) = 0;
|
||||
|
||||
virtual bool ResetSecurityState() const = 0;
|
||||
|
||||
// Token specific
|
||||
virtual void SelectDataPath() const = 0; // TODO: MTE: To be removed soon!
|
||||
virtual ISCardOS* GetOS() const = 0; // TODO: MTE: To be removed soon!
|
||||
|
||||
// Delete a key pair from token with matching token key or certificate
|
||||
virtual void DeleteKeyPair(const IKey* key) = 0;
|
||||
virtual void DeleteKeyPair(const Blob& cert) = 0;
|
||||
|
||||
virtual bool IsPKCS15() const = 0;
|
||||
virtual bool IsReadOnly() const = 0;
|
||||
virtual bool LoginRequired() const = 0;
|
||||
|
||||
virtual bool IsLocked() const = 0;
|
||||
|
||||
virtual Blob GetCardId() const = 0;
|
||||
virtual Blob GetCardCF() const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_IToken_h
|
||||
@@ -1,139 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actITokenAuth.h
|
||||
// Product: cv act library
|
||||
// Purpose: The ITokenAuth interface represents a IToken authentication state
|
||||
// using one the ITokenPIN objects owned by a token.
|
||||
//
|
||||
// Copyright: (c) 2007 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche (MTE)
|
||||
// Date: 11/09/2007
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ITokenAuth_h
|
||||
#define ACT_ITokenAuth_h
|
||||
|
||||
#include "actBlob.h"
|
||||
#include "actBasics.h"
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class AuthInfo;
|
||||
|
||||
class IToken;
|
||||
class ITokenPIN;
|
||||
class ITokenFile;
|
||||
class IAuthIdRef;
|
||||
class IAuthConstrained;
|
||||
|
||||
enum AuthConstrainedType
|
||||
{
|
||||
AUTH_CONSTRAINED_ALWAYS = 0,
|
||||
AUTH_CONSTRAINED_NOT,
|
||||
AUTH_CONSTRAINED_AND,
|
||||
AUTH_CONSTRAINED_OR,
|
||||
};
|
||||
|
||||
//
|
||||
// IAuthFactory
|
||||
class IAuthFactory
|
||||
{
|
||||
public:
|
||||
virtual IAuthIdRef* CreateAuthIdRef(const Blob& authId, ITokenFile* path,
|
||||
byte constrained_mode = AUTH_CONSTRAINED_ALWAYS) = 0;
|
||||
|
||||
virtual ITokenPIN* CreatePin(const AuthInfo& ai, byte objRef, ITokenFile* path,
|
||||
IAuthIdRef* authIdRef, IAuthIdRef* parentAuthIdRef) = 0;
|
||||
|
||||
// TODO: MTE: deprecated, use CreatePin(const AuthInfo&...) instead
|
||||
virtual ITokenPIN* CreatePin(int type, int usage, byte objRef, int minLen,
|
||||
int maxLen, IAuthIdRef* authIdRef, const char* name = 0) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~IAuthFactory() { }
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// IAuthIdRef
|
||||
class IAuthIdRef : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual byte GetAuthIdByte() const = 0;
|
||||
virtual const Blob& GetAuthId() const = 0;
|
||||
virtual IAuthConstrained* GetAuthConstrained() = 0;
|
||||
|
||||
virtual bool Equals(const Blob& authId) const = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// IAuthIdRefIterator
|
||||
class IAuthIdRefIterator : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual void Reset() = 0;
|
||||
virtual IAuthIdRef* Next() = 0;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ITokenAuthIterator
|
||||
class ITokenAuthIterator : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual void Reset(ITokenFile* parent = 0) = 0;
|
||||
virtual ITokenPIN* Next() = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// ITokenAuth
|
||||
class ITokenAuth : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual bool Login(ITokenPIN* auth_obj, const Blob& pin) = 0;
|
||||
|
||||
virtual bool Logout() = 0;
|
||||
virtual bool Logout(const ITokenPIN* auth_obj) = 0;
|
||||
virtual bool LogoutEx(bool reset_security_state) = 0;
|
||||
|
||||
virtual Blob GetChallenge(const ITokenPIN* auth_obj) = 0;
|
||||
|
||||
virtual IToken* GetToken() const = 0;
|
||||
virtual ITokenPIN* GetAuthenticated() const = 0;
|
||||
virtual ITokenPIN* GetAuthenticated(size_t index) const = 0;
|
||||
|
||||
virtual bool NeedsPINValue() const = 0;
|
||||
virtual bool HasChallenge() const = 0;
|
||||
virtual bool HasChallenge(const ITokenPIN* auth_obj) const = 0;
|
||||
virtual bool IsAuthenticated(const ITokenPIN* auth_obj) const = 0;
|
||||
virtual bool IsAuthenticated(bool verify_security_state = false) const = 0;
|
||||
|
||||
/*!
|
||||
* Clears the internal authentication state for given auth_obj.
|
||||
*
|
||||
* If auth_obj is not authenticated:
|
||||
* - do nothing
|
||||
* - return false
|
||||
*
|
||||
* If auth_obj is authenticated:
|
||||
* - remove auth_obj from authenticated-list.
|
||||
* - return true
|
||||
*
|
||||
* \note does NOT reset the card's authentication state!
|
||||
*
|
||||
* \param auth_obj \ref ITokenPIN
|
||||
* \return true if succeeded, false if not
|
||||
*/
|
||||
virtual bool Invalidate(ITokenPIN* auth_obj) = 0;
|
||||
virtual bool Select(const ITokenPIN* auth_obj, bool force) = 0;
|
||||
|
||||
virtual ITokenAuthIterator* Iterator(int type, const Blob& authId = Blob()) const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenAuth_h
|
||||
@@ -1,59 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actITokenBlockCipherKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: The interface ITokenBlockCipherKey enables access to a key stored
|
||||
// on a secure token.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 05/15/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ITokenBlockCipherKey_h
|
||||
#define ACT_ITokenBlockCipherKey_h
|
||||
|
||||
#include "actTokenBase.h"
|
||||
|
||||
#include "actIBlockCipherKey.h"
|
||||
|
||||
#include "actITokenAuthOwner.h"
|
||||
#include "actITokenFileOwner.h"
|
||||
#include "actITokenBlockCipher.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IToken;
|
||||
class ITokenConfig;
|
||||
|
||||
//
|
||||
// ITokenBlockCipherKey
|
||||
class ITokenBlockCipherKey
|
||||
: public IBlockCipherKey
|
||||
, public ITokenAuthOwner
|
||||
, public ITokenFileOwner
|
||||
{
|
||||
public:
|
||||
virtual ITokenBlockCipherKey* Clone() const = 0;
|
||||
|
||||
virtual ITokenBlockCipher* GetCipher() = 0;
|
||||
virtual const ITokenBlockCipher* GetCipher() const = 0;
|
||||
|
||||
virtual KeyType GetType() const = 0;
|
||||
virtual IToken* GetToken() const = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
virtual void Configure(ITokenConfig* tkcfg) = 0;
|
||||
|
||||
virtual void SetRawKey(const Blob& raw_key) = 0;
|
||||
virtual void GetRawKey(Blob& raw_key) const = 0;
|
||||
|
||||
virtual void SetMode(const char* modename) = 0;
|
||||
virtual void SetPadding(const char* padname) = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenBlockCipherKey_h
|
||||
@@ -1,60 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actITokenConfig.h
|
||||
// Product: cv act library
|
||||
// Purpose: IToken configuration.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved.
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 11/07/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ITokenConfig_h
|
||||
#define ACT_ITokenConfig_h
|
||||
|
||||
#include "actIParam.h"
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ISCardOS;
|
||||
class IToken;
|
||||
class ITokenPIN;
|
||||
class ITokenAuth;
|
||||
class ITokenKey;
|
||||
class ITokenBlockCipher;
|
||||
class ITokenBlockCipherKey;
|
||||
class ITokenFileMap;
|
||||
class ITokenFileCache;
|
||||
|
||||
//
|
||||
// ITokenConfig
|
||||
class ITokenConfig
|
||||
: public IParam
|
||||
, virtual public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual ITokenConfig* Clone() const = 0;
|
||||
|
||||
// Individual card detection
|
||||
virtual bool IsSupported(ISCardOS* os) const = 0;
|
||||
|
||||
// Configures the token, if fails throws an Exception
|
||||
virtual void Configure(IToken* token) const = 0;
|
||||
virtual void Configure(ITokenPIN* auth_obj) const = 0;
|
||||
virtual void Configure(ITokenKey* key) const = 0;
|
||||
virtual void Configure(ITokenBlockCipher* cipher) const = 0;
|
||||
virtual void Configure(ITokenBlockCipherKey* key) const = 0;
|
||||
|
||||
// Factory's for token helper objects
|
||||
virtual ITokenAuth* CreateAuth(IToken* token) = 0;
|
||||
virtual ITokenFileMap* CreateFileMap(const IToken* token) = 0;
|
||||
virtual ITokenFileCache* CreateFileCache(IToken* token) = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenConfig_h
|
||||
@@ -1,39 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actITokenExtension.h
|
||||
// Product: cv act library
|
||||
// Purpose: Interface ITokenExtension provides functionality to register extensions to
|
||||
// IToken derived objects.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 12/02/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ITokenExtension_h
|
||||
#define ACT_ITokenExtension_h
|
||||
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IToken;
|
||||
|
||||
//
|
||||
// ITokenExtension
|
||||
class ITokenExtension : public IRefCounted
|
||||
{
|
||||
protected:
|
||||
virtual ~ITokenExtension() { }
|
||||
|
||||
public:
|
||||
virtual void* GetCreatePtr() throw() = 0;
|
||||
virtual bool Register(IToken* token) = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenExtension_h
|
||||
@@ -1,42 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actITokenFileCache.h
|
||||
// Product: cv act library
|
||||
// Purpose: Interface used for FID based binary cache.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved.
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 11/07/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ITokenFileCache_h
|
||||
#define ACT_ITokenFileCache_h
|
||||
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Blob;
|
||||
class IToken;
|
||||
|
||||
//
|
||||
// ITokenFileCache
|
||||
class ITokenFileCache : public IRefCounted
|
||||
{
|
||||
protected:
|
||||
typedef std::map<Blob, Blob> CacheMap;
|
||||
|
||||
public:
|
||||
virtual bool InitCache(IToken* token) = 0;
|
||||
virtual Blob GetCache(const Blob& filepath) const = 0;
|
||||
virtual void PutCache(const Blob& filepath, const Blob& memory) const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenFileCache_h
|
||||
@@ -1,37 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actITokenFileOwner.h
|
||||
// Product: cv act library
|
||||
// Purpose: The ITokenFileOwner interface is implemented by objects which
|
||||
// refer to a specific location on token represented by ITokenFile.
|
||||
//
|
||||
// Copyright: (c) 2010 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 28/03/2010
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ITokenFileOwner_h
|
||||
#define ACT_ITokenFileOwner_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ITokenFile;
|
||||
|
||||
//
|
||||
// ITokenFileOwner
|
||||
class ITokenFileOwner
|
||||
{
|
||||
public:
|
||||
virtual ITokenFile* GetPath() const = 0;
|
||||
virtual void SetPath(ITokenFile* file) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ITokenFileOwner() { }
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenFileOwner_h
|
||||
@@ -1,131 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actITokenInitializer.h
|
||||
// Product: cv act library
|
||||
// Purpose: ITokenInitializer interface declares common token profile initialization functionality.
|
||||
//
|
||||
// Copyright: (c) 2009 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 04/20/2009
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ITokenInitializer_h
|
||||
#define ACT_ITokenInitializer_h
|
||||
|
||||
#include "actBlob.h"
|
||||
#include "actTokenBase.h"
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
extern const byte PIN_PAD_CHAR;
|
||||
|
||||
struct TIData
|
||||
{
|
||||
private:
|
||||
TIData(const TIData&) throw();
|
||||
TIData& operator=(const TIData&) throw();
|
||||
|
||||
public:
|
||||
TIData(const char* _profile_name = 0)
|
||||
: profile_name(_profile_name)
|
||||
, profile_type(PROFILE_UNKNOWN)
|
||||
, retry_counter(3)
|
||||
, pin_pad_byte(PIN_PAD_CHAR)
|
||||
, enable_pin_padding(false)
|
||||
, enable_pin_pce_so(false)
|
||||
, enable_pin_pce_user(false)
|
||||
, enable_minidriver(false)
|
||||
, enable_minidriver_pnp(false)
|
||||
, enable_biometric(false)
|
||||
, enable_biometric_pins(false)
|
||||
, load_only(false)
|
||||
, load_package_MoC(false)
|
||||
, load_package_2048(false)
|
||||
, load_package_ecc(false)
|
||||
{ }
|
||||
|
||||
Blob atr_historical_bytes;
|
||||
Blob atr_historical_bytes_suffix;
|
||||
Blob card_pin;
|
||||
Blob so_pin;
|
||||
Blob user_pin;
|
||||
Blob serial_number;
|
||||
Blob last_update_pin_utc;
|
||||
Blob challenge_response_key;
|
||||
Blob binary_data;
|
||||
|
||||
const char* profile_name;
|
||||
ProfileType profile_type;
|
||||
|
||||
short retry_counter;
|
||||
byte pin_pad_byte;
|
||||
|
||||
bool enable_pin_padding;
|
||||
bool enable_pin_pce_so;
|
||||
bool enable_pin_pce_user;
|
||||
bool enable_minidriver;
|
||||
bool enable_minidriver_pnp;
|
||||
bool enable_biometric;
|
||||
bool enable_biometric_pins;
|
||||
|
||||
bool load_only;
|
||||
bool load_package_MoC;
|
||||
bool load_package_2048;
|
||||
bool load_package_ecc;
|
||||
};
|
||||
|
||||
struct TITokenInfo
|
||||
{
|
||||
TITokenInfo(size_t pin_len_max, size_t pin_len_min, size_t _key_len_cr)
|
||||
: serial_number_len(16)
|
||||
, key_len_cr(_key_len_cr)
|
||||
{
|
||||
pin_len_max_admin = pin_len_max_so = pin_len_max_user = pin_len_max;
|
||||
pin_len_min_admin = pin_len_min_so = pin_len_min_user = pin_len_min;
|
||||
}
|
||||
|
||||
size_t serial_number_len;
|
||||
|
||||
size_t key_len_cr;
|
||||
|
||||
size_t pin_len_max_admin;
|
||||
size_t pin_len_max_so;
|
||||
size_t pin_len_max_user;
|
||||
|
||||
size_t pin_len_min_admin;
|
||||
size_t pin_len_min_so;
|
||||
size_t pin_len_min_user;
|
||||
};
|
||||
|
||||
class ISCardOS;
|
||||
class IProfileGenerator;
|
||||
class ISCardCmdObserver;
|
||||
|
||||
//
|
||||
// ITokenInitializer
|
||||
class ITokenInitializer : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual ISCardOS* GetOS() const= 0;
|
||||
virtual const TITokenInfo& GetTokenInfo() const = 0;
|
||||
virtual const ProfileType* GetSupportedProfileList() const = 0;
|
||||
|
||||
virtual bool SupportsProfile(ProfileType profile_type) const = 0;
|
||||
virtual void SetGenerator(IProfileGenerator* generator) = 0;
|
||||
virtual void SetObserver(ISCardCmdObserver* observer) = 0;
|
||||
|
||||
virtual bool EraseProfile(const Blob& card_pin) = 0;
|
||||
virtual bool ExistProfile(bool& is_pkcs15, bool& requires_adminpin) = 0;
|
||||
virtual void CreateProfile(TIData& data, ProfileType profile_type) = 0;
|
||||
virtual void FinalizeProfile(TIData& data) = 0;
|
||||
|
||||
virtual void PinChangeReminder(TIData& data, bool enable) = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenInitializer_h
|
||||
@@ -1,64 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actITokenKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: The interface ITokenKey enables access to a key stored in a secure token.
|
||||
//
|
||||
// Copyright: (c) 2003 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_ITokenKey_h
|
||||
#define ACT_ITokenKey_h
|
||||
|
||||
#include "actIRefCounted.h"
|
||||
#include "actISignatureKey.h"
|
||||
#include "actITokenAuthOwner.h"
|
||||
#include "actITokenFileOwner.h"
|
||||
|
||||
#include "actTokenBase.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IToken;
|
||||
class ITokenConfig;
|
||||
|
||||
//
|
||||
// ITokenKeyIterator
|
||||
class ITokenKeyIterator : public IRefCounted
|
||||
{
|
||||
public:
|
||||
virtual void Reset(ITokenFile* parent = 0) = 0;
|
||||
virtual IKey* Next() = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// ITokenKey
|
||||
class ITokenKey
|
||||
: public ISignatureKey
|
||||
, public ITokenAuthOwner
|
||||
, public ITokenFileOwner
|
||||
{
|
||||
public:
|
||||
virtual ITokenKey* Clone() const = 0;
|
||||
|
||||
virtual KeyType GetType() const = 0;
|
||||
virtual IToken* GetToken() const = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
virtual void Configure(ITokenConfig* tkcfg) = 0;
|
||||
|
||||
virtual Blob GetCertificate() const = 0;
|
||||
virtual IKey* GetPublicKey() const = 0;
|
||||
|
||||
virtual void VerifyPin(const Blob& pin) = 0;
|
||||
|
||||
virtual Blob GetID() const = 0;
|
||||
virtual Blob GetSubject() const = 0;
|
||||
|
||||
virtual ITokenKeyIterator* Iterator(KeyType type, const Blob& authId = Blob()) const = 0;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenKey_h
|
||||
@@ -1,221 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actITokenPIN.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class ITokenPIN defines the interfaces of the PIN operations
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 04/05/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ITokenPIN_h
|
||||
#define ACT_ITokenPIN_h
|
||||
|
||||
#include "actBasics.h"
|
||||
#include "actDate.h"
|
||||
#include "actBlob.h"
|
||||
|
||||
#include "actITokenAuth.h"
|
||||
#include "actITokenFileOwner.h"
|
||||
#include "actIRefCounted.h"
|
||||
|
||||
#include "actTokenBase.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
enum PINType
|
||||
{
|
||||
UNKNOWN_PIN = 0x0000,
|
||||
SO_PIN = 0x0001,
|
||||
USER_PIN = 0x0002,
|
||||
UNBLOCK_PIN = 0x0003,
|
||||
|
||||
PIN_MASK = 0x000F,
|
||||
|
||||
EXAUTH_PIN = 0x0010,
|
||||
BIOMETRIC_PIN = 0x0020,
|
||||
CERTBASED_PIN = 0x0040,
|
||||
|
||||
BAC_PIN = 0x0100,
|
||||
ICAO_PIN = 0x0200,
|
||||
|
||||
EAC_PACE_PIN = 0x0400,
|
||||
EAC_TA_PIN = 0x0800,
|
||||
EAC_CA_PIN = 0x1000,
|
||||
|
||||
PIN_TYPE_MASK = 0x7fff,
|
||||
|
||||
AUTHENTICATED_PIN = 0x8000, // Current authenticated PIN
|
||||
|
||||
// combined types
|
||||
EXAUTH_SO_PIN = EXAUTH_PIN | SO_PIN,
|
||||
EXAUTH_UNBLOCK_PIN = EXAUTH_PIN | UNBLOCK_PIN,
|
||||
|
||||
BIOMETRIC_USER_PIN = BIOMETRIC_PIN | USER_PIN,
|
||||
BIOMETRIC_SO_PIN = BIOMETRIC_PIN | SO_PIN,
|
||||
|
||||
EAC_PACE_UNKNOWN_PIN = EAC_PACE_PIN | UNKNOWN_PIN,
|
||||
EAC_PACE_SO_PIN = EAC_PACE_PIN | SO_PIN,
|
||||
EAC_PACE_USER_PIN = EAC_PACE_PIN | USER_PIN,
|
||||
EAC_PACE_UNBLOCK_PIN = EAC_PACE_PIN | UNBLOCK_PIN,
|
||||
|
||||
EAC_TA_UNKNOWN_PIN = EAC_TA_PIN | UNKNOWN_PIN,
|
||||
EAC_TA_USER_PIN = EAC_TA_PIN | USER_PIN,
|
||||
|
||||
EAC_CA_UNKNOWN_PIN = EAC_CA_PIN | UNKNOWN_PIN,
|
||||
EAC_CA_USER_PIN = EAC_CA_PIN | USER_PIN,
|
||||
};
|
||||
|
||||
enum PINFlags
|
||||
{
|
||||
PIN_INITIALIZED = (1 << 0),
|
||||
PIN_IS_LOCAL = (1 << 1),
|
||||
PIN_CASE_SENSITIVE = (1 << 2),
|
||||
PIN_CHANGE_DISABLED = (1 << 3),
|
||||
PIN_UNBLOCK_DISABLED = (1 << 4),
|
||||
PIN_DISABLE_ALLOWED = (1 << 5),
|
||||
PIN_NEEDS_PADDING = (1 << 6),
|
||||
PIN_NEEDS_UPDATE = (1 << 7),
|
||||
PIN_REQUIRES_SM = (1 << 8),
|
||||
PIN_REQUIRES_NO_DATA = (1 << 9),
|
||||
PIN_REQUIRES_ENCRYPTION = (1 << 10),
|
||||
PIN_CHANGE_REQUIRES_OLD = (1 << 11),
|
||||
PIN_IS_DEFAULT = (1 << 12), // marks the one and only default pin
|
||||
|
||||
PIN_FLAGS_MASK = (1 << 13) - 1,
|
||||
|
||||
// combined flags
|
||||
PIN_FLAGS = PIN_INITIALIZED | PIN_IS_LOCAL | PIN_CASE_SENSITIVE,
|
||||
PIN_FLAGS_DEFAULT = PIN_IS_DEFAULT | PIN_FLAGS,
|
||||
PIN_FLAGS_SO = PIN_INITIALIZED | PIN_IS_LOCAL | PIN_CASE_SENSITIVE | PIN_UNBLOCK_DISABLED,
|
||||
PIN_FLAGS_EXAUTH = PIN_INITIALIZED | PIN_IS_LOCAL,
|
||||
PIN_FLAGS_BIOMETRIC = PIN_INITIALIZED | PIN_IS_LOCAL,
|
||||
PIN_FLAGS_CERTBASED = PIN_INITIALIZED | PIN_IS_LOCAL | PIN_REQUIRES_NO_DATA | PIN_CHANGE_DISABLED | PIN_UNBLOCK_DISABLED,
|
||||
};
|
||||
|
||||
enum AuthDataEncoding
|
||||
{
|
||||
PIN_ENCODING_UNKNOWN = -1,
|
||||
PIN_ENCODING_BINARY = 0,
|
||||
PIN_ENCODING_ASCII_NUMERIC,
|
||||
PIN_ENCODING_UTF8,
|
||||
PIN_ENCODING_BCD,
|
||||
PIN_ENCODING_HALF_NIBBLE_BCD,
|
||||
PIN_ENCODING_ISO9564_1,
|
||||
|
||||
PIN_ENCODING = PIN_ENCODING_ASCII_NUMERIC,
|
||||
};
|
||||
|
||||
enum AuthId
|
||||
{
|
||||
AUTHID_INVALID = 0x00,
|
||||
};
|
||||
|
||||
enum BioFinger
|
||||
{
|
||||
FINGER_UNKNOWN = 0,
|
||||
FINGER_RIGHT_THUMB = 1,
|
||||
FINGER_RIGHT_INDEX = 2,
|
||||
FINGER_RIGHT_MIDDLE = 3,
|
||||
FINGER_RIGHT_RING = 4,
|
||||
FINGER_RIGHT_LITTLE = 5,
|
||||
FINGER_LEFT_THUMB = 6,
|
||||
FINGER_LEFT_INDEX = 7,
|
||||
FINGER_LEFT_MIDDLE = 8,
|
||||
FINGER_LEFT_RING = 9,
|
||||
FINGER_LEFT_LITTLE = 10
|
||||
};
|
||||
|
||||
class IAuthIdRef;
|
||||
class ITokenFile;
|
||||
class IToken;
|
||||
class ISCardOS;
|
||||
class AuthInfo;
|
||||
|
||||
//
|
||||
// ITokenPIN
|
||||
class ITokenPIN
|
||||
: public IRefCounted
|
||||
, public ITokenFileOwner
|
||||
{
|
||||
public:
|
||||
virtual ITokenPIN* Clone() const = 0;
|
||||
virtual bool Equals(const ITokenPIN* other) const = 0;
|
||||
virtual int Compare(const ITokenPIN* other) const = 0;
|
||||
|
||||
virtual int GetType() const = 0;
|
||||
virtual int GetUsage() const = 0;
|
||||
virtual byte GetObjRef() const = 0;
|
||||
virtual IToken* GetToken() const = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
virtual AuthDataEncoding GetEncoding() const = 0;
|
||||
|
||||
virtual const AuthInfo* GetInfo() const = 0;
|
||||
virtual void SetInfo(const AuthInfo* ai) = 0;
|
||||
|
||||
virtual void SetDefault(bool is_default) = 0;
|
||||
virtual bool IsDefault() const = 0;
|
||||
|
||||
virtual bool IsInitialized() const = 0;
|
||||
virtual bool IsAuthenticated() const = 0;
|
||||
|
||||
virtual bool NeedsUpdate() const = 0;
|
||||
virtual bool NeedsPINValue() const = 0;
|
||||
|
||||
virtual bool GetLengthInfo(LengthInfo& info) const = 0;
|
||||
virtual bool CheckPinLength(const Blob& pin) const = 0;
|
||||
virtual bool GetLastChange(Date& date, bool& supported) const = 0;
|
||||
|
||||
virtual void VerifyPin(const Blob& pin) = 0;
|
||||
|
||||
// NOTE: ChangePin preserves the authentication state if successfull
|
||||
// TODO: MTE: Describe in detail!
|
||||
virtual void ChangePin(const Blob& oldpin, const Blob& newpin) = 0;
|
||||
|
||||
// NOTE: UnlockPin preserves the authentication state if successfull
|
||||
// TODO: MTE: Describe in detail!
|
||||
virtual void UnlockPin(ITokenPIN* so, const Blob& pin, const Blob& newpin) = 0;
|
||||
|
||||
// NOTE: SetPinValue preserves the authentication state if successfull
|
||||
// TODO: MTE: Describe in detail!
|
||||
virtual void SetPinValue(ITokenPIN* so, const Blob& so_pin, const Blob& newpin) = 0;
|
||||
|
||||
virtual void Select(ISCardOS* os = 0) const = 0;
|
||||
|
||||
virtual ITokenPIN* GetParent() const = 0;
|
||||
|
||||
virtual IAuthIdRef* GetAuthIdRef() const = 0;
|
||||
virtual IAuthIdRef* GetParentAuthIdRef() const = 0;
|
||||
|
||||
// Bio extensions
|
||||
virtual byte GetFinger() const = 0;
|
||||
virtual bool GetBioHeader(Blob& bioheader) = 0;
|
||||
|
||||
// ExternalAuth Key extensions
|
||||
virtual Blob GetChallenge() const = 0;
|
||||
virtual void ResetChallenge() = 0;
|
||||
virtual Blob ComputeResponse(const Blob& auth_key, const Blob& challenge) const = 0;
|
||||
|
||||
// Certificate based authentication extensions
|
||||
virtual void SetCHAT(const Blob& chat) = 0;
|
||||
virtual void SetCHAT(move_from<Blob> chat) = 0;
|
||||
virtual Blob GetCHAT() const = 0;
|
||||
|
||||
protected:
|
||||
// SCard Functionality
|
||||
virtual Blob doGetChallenge() const = 0;
|
||||
virtual void doResetChallenge() const = 0;
|
||||
virtual void doVerify(const Blob& pin) const = 0;
|
||||
virtual SecStatus doGetSecurityStatus(Blob& context) const = 0;
|
||||
|
||||
private:
|
||||
friend class TokenAuth;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ITokenPIN_h
|
||||
@@ -1,48 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIX509CRL.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// 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_IX509CRL_h
|
||||
#define ACT_IX509CRL_h
|
||||
#include "actICRL.h"
|
||||
#include "actX509Extension.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
|
||||
class IX509CRL: public ICRL
|
||||
{
|
||||
public:
|
||||
virtual void SetThisUpdate(const Date &date )=0;
|
||||
virtual void SetNextUpdate(const Date &date )=0;
|
||||
virtual void GetThisUpdate(Date &date ) const=0;
|
||||
virtual void GetNextUpdate(Date &date ) const=0;
|
||||
|
||||
virtual X509Extension GetExtension(const char* oid) const=0;
|
||||
virtual X509Extension GetExtension(const act::Blob& oidbl) const=0;
|
||||
virtual void SetExtension(const X509Extension &ext)=0;
|
||||
virtual X509Extension GetNextExtension(const X509Extension& ext) const=0;
|
||||
virtual void RemoveExtension(const char* oid)=0;
|
||||
|
||||
virtual Blob GetNextEntry(const Blob& certsernr) const=0;
|
||||
|
||||
virtual void SetEntryRevocationDate(const Blob& certsn, const Date &vnbefore )=0;
|
||||
virtual void GetEntryRevocationDate(const Blob& certsn, Date &vnbefore ) const=0;
|
||||
|
||||
virtual X509Extension GetEntryExtension(const Blob& certsn, const char* oid) const=0;
|
||||
virtual void SetEntryExtension(const Blob& certsn, const X509Extension &ext)=0;
|
||||
virtual X509Extension GetNextEntryExtension(const Blob& certsn,const X509Extension& ext) const=0;
|
||||
virtual void RemoveEntryExtension(const Blob& certsn,const char* oid)=0;
|
||||
|
||||
};
|
||||
} // namespace act
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actIX509Certificate.h
|
||||
// Product: cv act library
|
||||
// Purpose: The abstract class IX509Certificate enables access to a certificate,
|
||||
// e.g. its public key and the corresponding validity.
|
||||
//
|
||||
// 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_IX509Certificate_h
|
||||
#define ACT_IX509Certificate_h
|
||||
|
||||
#include "actBasics.h"
|
||||
#include "actDate.h"
|
||||
#include "actICertificate.h"
|
||||
#include "actX509Extension.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IKey;
|
||||
class Blob;
|
||||
|
||||
class IX509Certificate : public ICertificate
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void SetValidityNotBefore(const Date &vnbefore ) =0;
|
||||
virtual void SetValidityNotAfter(const Date &vnafter ) =0;
|
||||
virtual void GetValidityNotBefore(Date &vnbefore ) const =0;
|
||||
virtual void GetValidityNotAfter(Date &vnafter ) const =0;
|
||||
|
||||
virtual bool CheckValidity(const Date& date = Date() ) const =0;
|
||||
|
||||
virtual X509Extension GetExtension(const char* oid) const=0;
|
||||
virtual X509Extension GetExtension(const act::Blob& oidbl) const=0;
|
||||
virtual void SetExtension(const X509Extension &ext)=0;
|
||||
virtual X509Extension GetNextExtension(const X509Extension& ext) const=0;
|
||||
virtual void RemoveExtension(const char* oid)=0;
|
||||
};
|
||||
} // namespace act
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,578 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actInit.h
|
||||
// Product: cv act library
|
||||
// Purpose: initialize the map entries of the objects
|
||||
//
|
||||
// Copyright: (c) 2007 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
// remarks:
|
||||
// declare NO_SMARTCARD: no smartcard support required.
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef actInit_h
|
||||
#define actInit_h
|
||||
|
||||
#include "actEnv.h"
|
||||
#include "actKeyKit.h"
|
||||
#include "actKeyReg.h"
|
||||
#include "actBlockCipherKit.h"
|
||||
#include "actBlockCipherReg.h"
|
||||
#include "actBlockCipherModeReg.h"
|
||||
#include "actBlockCipherModeKit.h"
|
||||
#include "actStreamCipherKit.h"
|
||||
#include "actStreamCipherReg.h"
|
||||
#include "actHashKit.h"
|
||||
#include "actHashReg.h"
|
||||
#include "actEMSAReg.h"
|
||||
#include "actEMSAKit.h"
|
||||
#include "actDerivatorReg.h"
|
||||
#include "actDerivatorKit.h"
|
||||
#include "actPaddingReg.h"
|
||||
#include "actPaddingKit.h"
|
||||
#include "actCertificateReg.h"
|
||||
#include "actCertificateKit.h"
|
||||
#include "actX509KeyReg.h"
|
||||
#include "actX509SignReg.h"
|
||||
#include "actX509SignHashReg.h"
|
||||
#include "actX509Kit.h"
|
||||
#include "actDefaultRNG.h"
|
||||
#include "actRNGKit.h"
|
||||
|
||||
#ifndef NO_SMARTCARD
|
||||
// NOTE: To Enable support for additional smartcards / profiles define:
|
||||
// ACT_SUPPORT_TCOS_NETKEY30
|
||||
# include "actSCardOSReg.h"
|
||||
# include "actSCardOSKit.h"
|
||||
# include "actSCardTokenReg.h"
|
||||
# include "actSCardTokenKit.h"
|
||||
# include "actSubsystemReg.h"
|
||||
# include "actSubsystemKit.h"
|
||||
# include "actSlotMonitorReg.h"
|
||||
# include "actSlotMonitorKit.h"
|
||||
# include "actTokenExtensionReg.h"
|
||||
# include "actTokenExtensionKit.h"
|
||||
# include "actTokenAuthProtocolReg.h"
|
||||
# include "actTokenAuthProtocolKit.h"
|
||||
# include "actJCAppletKit.h"
|
||||
# include "actJCAppletReg.h"
|
||||
# include "actPKCS15BehaviorReg.h"
|
||||
# include "actPKCS15BehaviorKit.h"
|
||||
# include "actProfileGeneratorReg.h"
|
||||
# include "actProfileGeneratorKit.h"
|
||||
#endif // NO_SMARTCARD
|
||||
|
||||
namespace act
|
||||
{
|
||||
// ------------------------------------------------------------------------
|
||||
const KeyMapEntry KeyMap[] =
|
||||
{
|
||||
{ "BlockCipher", CreateBlockCipherKey },
|
||||
{ "StreamCipher", CreateStreamCipherKey },
|
||||
|
||||
{ "IES", CreateIESKey },
|
||||
{ "DSA", CreateDSAKey },
|
||||
{ "RSA", CreateRSAKey },
|
||||
{ "ECDSA", CreateECDSAKey },
|
||||
{ "ECGDSA", CreateECGDSAKey },
|
||||
|
||||
{ "DH", CreateDHKey },
|
||||
{ "ECDH", CreateECDHKey },
|
||||
|
||||
{ "HashMAC", CreateHashMACKey },
|
||||
{ "CBCMAC", CreateCBCMACKey },
|
||||
{ "SecretKeyMAC", CreateSecretKeyMACKey },
|
||||
{ "RetailCFBMAC", CreateRetailCFBMACKey },
|
||||
{ "iMAC3", Create_iMAC3Key }, // ISO9797-1 M2 Alg 3 MAC8
|
||||
{ "CMAC", CreateCMACKey }, // NIST 800-38B CMAC
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const BlockCipherMapEntry BlockCipherMap[] =
|
||||
{
|
||||
{ "AES", CreateRijndael },
|
||||
{ "DES", CreateDES },
|
||||
{ "TripleDES", CreateTripleDES },
|
||||
{ "CAST128", CreateCAST128 },
|
||||
{ "BlowFish", CreateBlowFish },
|
||||
{ "Mars", CreateMars },
|
||||
{ "Serpent", CreateSerpent },
|
||||
{ "Rijndael", CreateRijndael },
|
||||
{ "TwoFish", CreateTwoFish },
|
||||
{ "RC2", CreateRC2 },
|
||||
//{ "RC6", CreateRC6 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const BlockCipherModeMapEntry BlockCipherModeMap[] =
|
||||
{
|
||||
{ "ECB", CreateECBMode },
|
||||
{ "CBC", CreateCBCMode },
|
||||
{ "CFB", CreateCFBMode },
|
||||
{ "OFB", CreateOFBMode },
|
||||
{ "CTR", CreateCTRMode },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const StreamCipherMapEntry StreamCipherMap[] =
|
||||
{
|
||||
{ "ARC4", CreateARC4 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const HashMapEntry HashMap[] =
|
||||
{
|
||||
{ "MD2", CreateMD2 },
|
||||
{ "MD4", CreateMD4 },
|
||||
{ "MD5", CreateMD5 },
|
||||
{ "RIPEMD128", CreateRipemd128 },
|
||||
{ "RIPEMD160", CreateRipemd160 },
|
||||
{ "SHA0", CreateSHA0 },
|
||||
{ "SHA1", CreateSHA1 },
|
||||
{ "SHA224", CreateSHA224 },
|
||||
{ "SHA256", CreateSHA256 },
|
||||
{ "SHA384", CreateSHA384 },
|
||||
{ "SHA512", CreateSHA512 },
|
||||
{ "DummyHash", CreateDummyHash },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const EMSAMapEntry EMSAMap[] =
|
||||
{
|
||||
{ "EMSA1", CreateEMSA1 },
|
||||
{ "PKCS1V1_5EMSA", CreatePKCS1V1_5EMSA },
|
||||
{ "TLS_EMSA", CreateTLS_EMSA},
|
||||
{ "PKCS1_PSS_EMSA", CreatePKCS1_PSS_EMSA },
|
||||
{ "DummyEMSA", CreateDummyEMSA }, // Used for "Hash on Card"
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const DerivatorMapEntry DerivatorMap[] =
|
||||
{
|
||||
{ "KDF1", CreateKDF1 }, // IEEE P1363 KDF1
|
||||
{ "KDF2", CreateX963KDF }, // IEEE P1363 KDF2 (= X963KDF)
|
||||
{ "X963KDF", CreateX963KDF }, // ANSI X9.63 KDF
|
||||
{ "PBKDF1", CreatePBKDF1 }, // PKCS#5 PBKDF1
|
||||
{ "PBKDF2", CreatePBKDF2 }, // PKCS#5 PBKDF2
|
||||
{ "EACKDF", CreateEACKDF }, // EAC 2.01, BSI TR-03110 A.2.3
|
||||
{ "SessionKDF", CreateEACKDF }, // BSI TR-03111 (= EACKDF)
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const PaddingMapEntry PaddingMap[] =
|
||||
{
|
||||
{ "PKCS5", CreatePKCS5Pad },
|
||||
{ "RSAES", CreatePKCS1V1_5EMEPad },
|
||||
{ "ISO", CreateOneAndZerosPad },
|
||||
{ "ISO9796", CreateISO9796Pad },
|
||||
{ "NOPAD", CreateNoPad },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const CertificateMapEntry CertificateMap[] =
|
||||
{
|
||||
{ "X509", CreateX509Certificate },
|
||||
{ "CV", CreateCVCertificate },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const CRLMapEntry CRLMap[] =
|
||||
{
|
||||
{ "X509", CreateX509CRL },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const X509KeyMapEntry X509KeyMap[] =
|
||||
{
|
||||
{ "1.2.840.113549.1.1.1", CreateRSAKey, X509ToRSA, RSAToX509 },
|
||||
{ "2.5.8.1.1", CreateRSAKey, X509ToRSA, RSAToX509 },
|
||||
{ "1.2.840.10040.4.1", CreateDSAKey, X509ToDSA, DSAToX509 },
|
||||
{ "1.3.14.3.2.20", CreateDSAKey, X509ToDSA, DSAToX509 },
|
||||
{ "1.3.14.3.2.12", CreateDSAKey, X509ToDSA, DSAToX509 }, // secude DSA oid
|
||||
{ "1.2.840.10046.2.1", CreateDHKey, X509ToDH, DHToX509 },
|
||||
{ "1.2.840.10045.2.1", CreateECDSAKey, X509ToECDSA, ECDSAToX509 },
|
||||
{ "1.2.840.10045.2.1", CreateECDHKey, X509ToECDSA, ECDSAToX509 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const X509SignMapEntry X509SignMap[] =
|
||||
{
|
||||
{ CreateRSAKey, RSAGetAlgID, RSASetAlgID },
|
||||
{ CreateDSAKey, DSAGetAlgID, DSASetAlgID },
|
||||
{ CreateECDSAKey, ECDSAGetAlgID, ECDSASetAlgID },
|
||||
{ CreateDHKey, DHGetAlgID, DHSetAlgID },
|
||||
{ CreateECDHKey, ECDHGetAlgID, ECDHSetAlgID },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const X509SignHashMapEntry X509SignHashMap[] =
|
||||
{
|
||||
// RSA
|
||||
{ "1.2.840.113549.1.1.2", "MD2", "RSA" }, // md2WithRSAEncryption
|
||||
{ "1.2.840.113549.1.1.3", "MD4", "RSA" }, // md4WithRSAEncryption
|
||||
{ "1.2.840.113549.1.1.4", "MD5", "RSA" }, // md5WithRSAEncryption
|
||||
{ "1.2.840.113549.1.1.5", "SHA1", "RSA" }, // shaWithRSAEncryption
|
||||
{ "1.3.14.3.2.29", "SHA1", "RSA" },
|
||||
{ "1.2.840.113549.1.1.11", "SHA256", "RSA" }, // sha256WithRSAEncryption
|
||||
{ "1.2.840.113549.1.1.12", "SHA384", "RSA" }, // sha384WithRSAEncryption
|
||||
{ "1.2.840.113549.1.1.13", "SHA512", "RSA" }, // sha512WithRSAEncryption
|
||||
{ "1.2.840.113549.1.1.14", "SHA224", "RSA" }, // sha224WithRSAEncryption
|
||||
{ "1.3.36.3.3.1.2", "RIPEMD160", "RSA" },
|
||||
{ "1.3.36.3.3.1.3", "RIPEMD128", "RSA" },
|
||||
// DSA
|
||||
{ "1.2.840.10040.4.3", "SHA1", "DSA" },
|
||||
{ "1.3.14.3.2.28", "SHA1", "DSA" },
|
||||
{ "1.3.14.3.2.27", "SHA1", "DSA" }, // secude DSA oid
|
||||
// ECDSA
|
||||
{ "1.2.840.10045.4.1", "SHA1", "ECDSA" }, // ecdsa-with-Sha1
|
||||
{ "1.2.840.10045.2.1", "SHA1", "ECDSA" }, // ecdsa-with-Sha1 (deprecated)
|
||||
{ "1.2.840.10045.4.3.1", "SHA224", "ECDSA" }, // ecdsa-with-Sha224
|
||||
{ "1.2.840.10045.4.3.2", "SHA256", "ECDSA" }, // ecdsa-with-Sha256
|
||||
{ "1.2.840.10045.4.3.3", "SHA384", "ECDSA" }, // ecdsa-with-Sha384
|
||||
{ "1.2.840.10045.4.3.4", "SHA512", "ECDSA" }, // ecdsa-with-Sha512
|
||||
// DH
|
||||
{ "1.3.6.1.5.5.7.6.4", "SHA1", "DH" }, // DH-POP
|
||||
// ECDH
|
||||
{ "1.2.840.10045.2.1", "SHA1", "ECDH" }, // "ECDH-POP"
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
#ifndef NO_SMARTCARD
|
||||
// ------------------------------------------------------------------------
|
||||
const SCardOSMapEntry SCardOSMap[] =
|
||||
{
|
||||
// NOTE: Only lower case historical bytes !
|
||||
/*
|
||||
{ "0064050a020131809000", CreateTCOS }, // NetKey (TCOS V2R1)
|
||||
{ "00640560020331809000", CreateTCOS }, // NetKey (TCOS V2R3)
|
||||
{ "0064057b020331809000", CreateTCOS }, // NetKey (TCOS V2R?)
|
||||
{ "00640514020231809000", CreateTCOS }, // etrust (TCOS V2R2)
|
||||
{ "00640561020331809000", CreateTCOS }, // TCOS USB Crypt Token
|
||||
{ "0068d276000028ff051e3180009000", CreateMicardOS }, // Micardo P2.1
|
||||
{ "4d4943323045", CreateMicardo20E }, // Micardo EC 2.0
|
||||
{ "0068d276000028ff05233180009000", CreateMicardo23E }, // Micardo EC 2.3
|
||||
*/
|
||||
|
||||
// ACOS
|
||||
{ "454d56203033202006", CreateACOS_D01 }, // Austria Card ACOS EMV-D01
|
||||
{ "44492030324d", CreateACOS_D01 }, // Austria Card ACOS EMV-D01 contactless
|
||||
{ "455041000000000228505900000000", CreateACOS_A04 }, // Austria Card ACOS EMV-A04/A05
|
||||
{ "455041000000000000000000000000", CreateACOS_A04 }, // Austria Card ACOS EMV-A04/A05
|
||||
|
||||
// CardOS
|
||||
{ "c802", CreateCardOS_M4 }, // CardOS M4.0 siemens profile
|
||||
{ "c803", CreateCardOS_M4 }, // CardOS M4.01 siemens profile
|
||||
{ "c804", CreateCardOS_M4 }, // CardOS M4.01a siemens profile
|
||||
{ "4d346376", CreateCardOS_M4 }, // CardOS M4.01(a) cv profile
|
||||
{ "4d3463765f4d", CreateCardOS_M4_MoC }, // CardOS M4.01_M cv profile
|
||||
{ "4d3463765f45", CreateCardOS_M4_ECC }, // CardOS M4.01_E cv profile
|
||||
{ "c806", CreateCardOS_V4 }, // CardOS V4.2
|
||||
{ "c807", CreateCardOS_V4 }, // CardOS V4.3
|
||||
{ "c808", CreateCardOS_V4 }, // CardOS V4.3B
|
||||
{ "c809", CreateCardOS_V4 }, // CardOS V4.2B
|
||||
{ "c80a", CreateCardOS_V4 }, // CardOS V4.2B DI
|
||||
{ "0000c80a3381b100", CreateCardOS_V4 }, // CardOS V4.2B DI contactless
|
||||
{ "c80b", CreateCardOS_V4 }, // CardOS V4.2C
|
||||
{ "c80d", CreateCardOS_V4 }, // CardOS V4.4
|
||||
{ "56346376", CreateCardOS_V4 }, // CardOS V4.2/4.3/4.3B cv profile
|
||||
{ "563432626376", CreateCardOS_V4 }, // CardOS V4.2b cv profile
|
||||
{ "5634326244496376", CreateCardOS_V4 }, // CardOS V4.2b DI cv profile
|
||||
{ "563432636376", CreateCardOS_V4 }, // CardOS V4.2c cv profile
|
||||
{ "5634346376", CreateCardOS_V4 }, // CardOS V4.4 cv profile
|
||||
{ "563463765f45", CreateCardOS_V4_ECC }, // CardOS V4.3B ECC cv profile
|
||||
{ "006b0508c806012101434e53103180", CreateCardOS_V4 }, // CardOS V4.2 CNS profile, 2004.02.20
|
||||
{ "006b0508c807012101434e53103180", CreateCardOS_V4 }, // CardOS V4.3 CNS profile, 2004.02.20
|
||||
{ "006b0508c808012101434e53103180", CreateCardOS_V4 }, // CardOS V4.3B CNS profile, 2004.02.20
|
||||
{ "006b0508c806011101434e53103180", CreateCardOS_V4 }, // CardOS V4.2 CNS profile, 2005.03.11
|
||||
{ "006b0508c807011101434e53103180", CreateCardOS_V4 }, // CardOS V4.3 CNS profile, 2005.03.11
|
||||
{ "006b0508c808011101434e53103180", CreateCardOS_V4 }, // CardOS V4.3B CNS profile, 2005.03.11
|
||||
{ "006b0508c808011101434e53103180", CreateCardOS_V4 }, // CardOS V4.3B CNS profile, 2005.03.11
|
||||
{ "4b53776973735369676e", CreateCardOS_V4 }, // CardOS V4.3B/V4.4 ATR by SwissSign
|
||||
|
||||
// STARCOS
|
||||
//{ "53504b32339000", CreateStarCOS_3_0}, // G&D STARCOS SPK 2.3
|
||||
{ "80670412b0030300008101", CreateStarCOS_3_0 }, // G&D STARCOS 3.0 (creational state)
|
||||
{ "80670412b0030300008105", CreateStarCOS_3_0 }, // G&D STARCOS 3.0
|
||||
{ "80670412b003030000", CreateStarCOS_3_0 }, // G&D STARCOS 3.0 contactless
|
||||
{ "80655343010d067394211b8101", CreateStarCOS_3_0 }, // G&D STARCOS 3.1 (creational state)
|
||||
{ "80655343010d067394211b8105", CreateStarCOS_3_0 }, // G&D STARCOS 3.1
|
||||
{ "0064051eb20031b0739621db019000", CreateStarCOS_3_2 }, // G&D STARCOS 3.2 (creational state)
|
||||
{ "0064051eb20031b0739621db059000", CreateStarCOS_3_2 }, // G&D STARCOS 3.2
|
||||
|
||||
// TCOS
|
||||
#ifdef ACT_SUPPORT_TCOS_NETKEY30
|
||||
{ "00640411030131c073f701d0009000", CreateTCOS_3_0 }, // NetKey (TCOS 3.0)
|
||||
#endif
|
||||
// JavaCards
|
||||
{ "8073002113574a544861314a00", CreateJavaCardOS_2_2 }, // G&D SmartCafe Expert 64 (cfg1)
|
||||
{ "8073002113574a544861314700", CreateJavaCardOS_2_2 }, // G&D SmartCafe Expert 64 (cfg2)
|
||||
{ "8073002113574a544861314800", CreateJavaCardOS_2_2 }, // G&D SmartCafe Expert 64 (cfg3)
|
||||
{ "8073002113574a544861314b00", CreateJavaCardOS_2_2 }, // G&D SmartCafe Expert 64 (cfg4)
|
||||
{ "8073002113574a544861314c00", CreateJavaCardOS_2_2 }, // G&D SmartCafe Expert 64 (cfg5)
|
||||
{ "8073002113574a544861314900", CreateJavaCardOS_2_2 }, // G&D SmartCafe Expert 64 (cfg8)
|
||||
{ "404d4f504153530000000000000000", CreateJavaCardOS_2_2 }, // G&D SmartCafe Expert 64 (XMC2)
|
||||
|
||||
{ "534653452d43583332322d56180308", CreateJavaCardOS_2_1_1 },// G&D SmartCafe Expert 2.0
|
||||
{ "0073c84013009000", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.0 / 3.1 / 3.1 contactless
|
||||
{ "4138004133b1020073c840130090", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.1 contactless (SCM SDI010, Firmware V6.28)
|
||||
{ "4138004133b10073c84013009000", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.1 contactless (SCM SDI010, Firmware V6.32)
|
||||
{ "73667465206364313434", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.2 PIV 144 KB
|
||||
{ "736674652D6364303830", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.2 PIV 80 KB
|
||||
{ "73667465", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.2 (sfte)
|
||||
{ "736674652d6e66", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.2 (sfte-nf)
|
||||
{ "73c840130090009b", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.2 USB Token
|
||||
{ "736674652063643038302d6e66", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 3.2 (sfte cd080-nf)
|
||||
{ "53462d3443432d3031", CreateJavaCardOS_2_2_1 }, // G&D SmartCafe Expert 5.0
|
||||
{ "53504b323544499000", CreateJavaCardOS_2_2_1 }, // G&D Mobile Security Card 3.x
|
||||
{ "4d5343", CreateJavaCardOS_2_2_1 }, // G&D Mobile Security Card 3.x
|
||||
|
||||
//{ "4a434f503230", CreateJavaCardOS_2_1 }, // JCOP 20
|
||||
{ "4a434f503231563232", CreateJavaCardOS_2_2_1 }, // JCOP 21 V2.2
|
||||
{ "4a434f50323156323331", CreateJavaCardOS_2_2_1 }, // JCOP 21 V2.3.1
|
||||
{ "4a434f503331563231", CreateJavaCardOS_2_1 }, // JCOP 31 V2.1
|
||||
{ "4a434f503331563232", CreateJavaCardOS_2_2_1 }, // JCOP 31 V2.2
|
||||
{ "4a434f50333156323331", CreateJavaCardOS_2_2_1 }, // JCOP 31 V2.3.1
|
||||
{ "4a434f503331563234", CreateJavaCardOS_2_2_1 }, // JCOP 31 V2.4
|
||||
//{ "4a434f5033313336474454", CreateJavaCardOS_2_2_1 }, // JCOP 31 36GDT
|
||||
{ "4a434f503431563232", CreateJavaCardOS_2_2_1 }, // JCOP 41 V2.2 / V2.2 contactless
|
||||
{ "4128001133b04a434f5034315632", CreateJavaCardOS_2_2_1 }, // JCOP 41 V2.2 contactless (SCM SDI010, Firmware V6.32)
|
||||
{ "4a434f50343156323231", CreateJavaCardOS_2_2_1 }, // JCOP 41 V2.2.1
|
||||
{ "4138001133b04a434f5034315632", CreateJavaCardOS_2_2_1 }, // JCOP 41 V2.2.1 contactless
|
||||
{ "4a434f50343156323331", CreateJavaCardOS_2_2_1 }, // JCOP 41 V2.3.1
|
||||
{ "4a434f50343156323332", CreateJavaCardOS_2_2_1 }, // JCOP 41 V2.3.2
|
||||
{ "4a434f503431563234", CreateJavaCardOS_2_2_1 }, // JCOP 41 V2.4
|
||||
{ "4a434f5076323431", CreateJavaCardOS_2_2_2 }, // JCOP v2.4.1
|
||||
{ "434f50343156323231ff", CreateJavaCardOS_2_2_1 }, // JCOP 41 V2.2.1 (IDptoken 200)
|
||||
{ "4a434f507632343262657461", CreateJavaCardOS_2_2_2 }, // JCOP v2.4.2 beta
|
||||
{ "0073c84000009000", CreateJavaCardOS_2_2_1 }, // JCOP V2.3.2
|
||||
|
||||
{ "4a434f50563231", CreateJavaCardOS_2_1 }, // JCOP V2.1
|
||||
{ "4a434f50563232", CreateJavaCardOS_2_2_1 }, // JCOP V2.2
|
||||
{ "4a434f5056323231", CreateJavaCardOS_2_2_1 }, // JCOP V2.2.1
|
||||
{ "4a434f50563233", CreateJavaCardOS_2_2_1 }, // JCOP V2.3
|
||||
{ "4a434f5056323331", CreateJavaCardOS_2_2_1 }, // JCOP V2.3.1
|
||||
{ "4a434f5056323332", CreateJavaCardOS_2_2_1 }, // JCOP V2.3.2
|
||||
{ "4a434f50563234", CreateJavaCardOS_2_2_1 }, // JCOP V2.4
|
||||
{ "4a434f5056323431", CreateJavaCardOS_2_2_2 }, // JCOP V2.4.1
|
||||
{ "4a434f5056323432", CreateJavaCardOS_2_2_2 }, // JCOP V2.4.2
|
||||
|
||||
{ "4a434f5033314d34", CreateJavaCardOS_2_2_1 }, // Austriacard JCOP31M4
|
||||
{ "4a434f5032315632325f", CreateJavaCardOS_2_2_1 }, // AustriaCard JCOP 21 V2.2, T0, T1
|
||||
{ "4a434f5033315632325f", CreateJavaCardOS_2_2_1 }, // AustriaCard JCOP 31 V2.2, T0, T1
|
||||
{ "4a434f5034315632345f", CreateJavaCardOS_2_2_1 }, // AustriaCard JCOP 41 V2.4, T0, T1
|
||||
{ "4a434f50563234314143", CreateJavaCardOS_2_2_1 }, // AustriaCard JCOP V2.4.1, T0, T1
|
||||
|
||||
{ "5257414e44415f4944", CreateJavaCardOS_2_2_1 }, // AustriaCard JCOP V2.4.1 'RWANDA_ID'
|
||||
{ "44654c61527565", CreateJavaCardOS_2_2_1 }, // AustriaCard JCOP V2.4.1 'DeLaRue'
|
||||
|
||||
{ "803180664090a4561b1183019000", CreateJavaCardOS_2_2_1 }, // Infineon jTOP 20ID
|
||||
|
||||
{ "80318065b0831148c883009000", CreateJavaCardOS_2_2_1 }, // Gemalto TOP IM GX4
|
||||
//{ "80318065b08301029083009000", CreateJavaCardOS_2_2_1 }, // Gemalto I-DENTITY CARD
|
||||
{ "8065b08301017483009000", CreateJavaCardOS_2_1_1 }, // Gemplus GemXpresso Pro R3
|
||||
{ "8065b08301037483009000", CreateJavaCardOS_2_1_1 }, // Gemplus GemXpresso Pro R3
|
||||
//{ "8065a20101013d72d643", CreateJavaCardOS_2_1_1 }, // Gemplus GemXpresso Pro R3 E32 PK
|
||||
|
||||
{ "0031c06477e30300829000", CreateJavaCardOS_2_1_1 }, // Oberthur CosmopolIC 64K v5.2D
|
||||
|
||||
{ "8059017f4849444a43327300011b", CreateJavaCardOS_2_2_2 }, // HID Crescendo C700 (JC2s) ("Standard JavaCard, T0/1, Platform Default Packages")
|
||||
{ "804f0ca0000003060a001d00000000", CreateJavaCardOS_2_2_2 },// HID Crescendo C700 (JC2s) contactless
|
||||
|
||||
{ ACT_ISO7816OS_NAME, CreateISO7816OS }, // use act::ISO7816OS as fallback
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const SCardTokenMapEntry SCardTokenMap[] =
|
||||
{
|
||||
// Passport
|
||||
{ IsEPAProfile, CreateEPAProfile },
|
||||
|
||||
// PKCS#15
|
||||
{ IsM4PKCS15Profile, CreateM4PKCS15Profile },
|
||||
{ IsV4PKCS15ECProfile, CreateV4PKCS15ECProfile },
|
||||
{ IsV4PKCS15Profile, CreateV4PKCS15Profile },
|
||||
{ IsJCPKCS15ECProfile, CreateJCPKCS15ECProfile },
|
||||
{ IsJCPKCS15Profile, CreateJCPKCS15Profile },
|
||||
{ IsACOSPKCS15Profile, CreateACOSPKCS15Profile },
|
||||
{ IsStarCOSPKCS15Profile, CreateStarCOSPKCS15Profile },
|
||||
|
||||
// ACOS
|
||||
{ IsACOScvProfile, CreateACOScvProfile },
|
||||
|
||||
// CardOS
|
||||
{ IsM4cvMoCProfile, CreateM4cvMoCProfile },
|
||||
{ IsM4cvECProfile, CreateM4cvECProfile },
|
||||
{ IsV4cvECProfile, CreateV4cvECProfile },
|
||||
{ IsV4cvProfile, CreateV4cvProfile },
|
||||
{ IsM4cvProfile, CreateM4cvProfile },
|
||||
// { IsV4CNSProfile, CreateV4CNSProfile },
|
||||
|
||||
// TCOS
|
||||
#ifdef ACT_SUPPORT_TCOS_NETKEY30
|
||||
{ IsNetKey30Token, CreateNetKey30Token },
|
||||
#endif
|
||||
|
||||
// JavaCardOS
|
||||
{ IsJCProfile, CreateJCProfile },
|
||||
// { IsJavaCardAppletManager, CreateJavaCardAppletManager },
|
||||
|
||||
/*
|
||||
{ IsStarCOSToken, CreateStarCOSToken },
|
||||
{ IsNetKey2000Token, CreateNetKey2000Token },
|
||||
{ IsNetKeyE4Token, CreateNetKeyE4Token },
|
||||
{ IsNetKeyPKSToken, CreateNetKeyPKSToken },
|
||||
{ IsNetKeyOldToken, CreateNetKeyOldToken },
|
||||
{ IseTrustToken, CreateeTrustToken },
|
||||
{ IsMicardoECToken, CreateMicardoECToken },
|
||||
{ IsM4SiemensProfile, CreateM4SiemensProfile },
|
||||
*/
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const ProfileGeneratorMapEntry ProfileGeneratorMap[] =
|
||||
{
|
||||
{ "JavaCardOS", CreateJCPKCS15Generator },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const PKCS15BehaviorMapEntry PKCS15BehaviorMap[] =
|
||||
{
|
||||
{ "cv cryptovision gmbh (c) v1.0j", CreateJCPKCS15Behavior },
|
||||
{ "cv cryptovision gmbh (c) v1.0jEAC", CreateJCPKCS15mEACBehavior },
|
||||
{ "cv cryptovision gmbh (c) v1.0n", CreateV4PKCS15Behavior },
|
||||
{ "cv cryptovision gmbh (c) v1.0na", CreateACOSPKCS15Behavior },
|
||||
{ "cv cryptovision gmbh (c) v1.0ns", CreateStarCOSPKCS15Behavior },
|
||||
{ "A.E.T. Europe B.V.", CreateSafeSignBehavior },
|
||||
{ "Giesecke&Devrient GmbH", CreateStarSignBehavior },
|
||||
{ "D-TRUST GmbH (C)", CreateDTRUSTBehavior },
|
||||
{ "Siemens AG (C)", CreateHiPathBehavior },
|
||||
{ "Technology Nexus", CreateNexusBehavior },
|
||||
{ "Volkswagen AG", CreateVWBehavior },
|
||||
{ "", CreatePKCS15Behavior }, // default
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const TokenExtensionMapEntry TokenExtensionMap[] =
|
||||
{
|
||||
{ "MDProfileExt", CreateMDProfileExt }, // Minidriver FS Profile Extension
|
||||
|
||||
# if defined(ACT_WIN32) && !defined(ACT_MINGW)
|
||||
{ "EAC 2.01 TA", CreateEACTAwithCAPI },
|
||||
|
||||
# endif
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const TokenAuthProtocolMapEntry TokenAuthProtocolMap[] =
|
||||
{
|
||||
{ "EAC 2.01 PACE", CreateTokenAuthPACE },
|
||||
{ "EAC 2.01 TA", CreateTokenAuthTA },
|
||||
{ "EAC 2.01 CA", CreateTokenAuthCA },
|
||||
{ "BAC", CreateTokenAuthBAC },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const SubsystemMapEntry SubsystemMap[] =
|
||||
{
|
||||
{ "PCSC", CreatePCSCSystem, CreatePCSCSystemEx },
|
||||
{ "CTAPI", CreateCTAPISystem, 0 },
|
||||
{ "PKCS11", CreatePKCS11System, 0 },
|
||||
|
||||
# if defined(ACT_WIN32) && !defined(ACT_MINGW)
|
||||
{ "CSP", CreateCSPSystem, 0 },
|
||||
|
||||
# endif
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const SlotMonitorRegEntry SlotMonitorMap[] =
|
||||
{
|
||||
{ "PCSC", { CreatePCSCSlotMonitor, CreatePCSCSystemSlotMonitor } },
|
||||
{ "CTAPI", { CreateSlotMonitor, 0 } },
|
||||
{ "PKCS11", { CreateSlotMonitor, 0 } },
|
||||
|
||||
# if defined(ACT_WIN32) && !defined(ACT_MINGW)
|
||||
{ "CSP", { CreateSlotMonitor, 0 } },
|
||||
|
||||
# endif
|
||||
{ 0, { 0, 0 } }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
const JCardAppletEntry JCardAppletMap[] =
|
||||
{
|
||||
// AID if it is equal to 0 then all AID are able
|
||||
// function returns true if the Applet can used
|
||||
// creates an new applet
|
||||
// number of PIN's Key's Certificate's
|
||||
// if they are -1 then it will be checked
|
||||
// if they are biger or equal to 0 they are const
|
||||
{ "D276000098C00000", IsJCProfileApplet, CreateJCProfileApplet, 1, 1, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
#endif // NO_SMARTCARD
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Version: V1R4M4
|
||||
const char* GetVersion();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
inline void Init(bool bAlwaysInit = false)
|
||||
{
|
||||
static bool loaded = false;
|
||||
if(loaded == true && bAlwaysInit == false)
|
||||
return;
|
||||
|
||||
KeyReg::Insert(KeyMap);
|
||||
BlockCipherReg::Insert(BlockCipherMap);
|
||||
BlockCipherModeReg::Insert(BlockCipherModeMap);
|
||||
StreamCipherReg::Insert(StreamCipherMap);
|
||||
HashReg::Insert(HashMap);
|
||||
EMSAReg::Insert(EMSAMap);
|
||||
DerivatorReg::Insert(DerivatorMap);
|
||||
PaddingReg::Insert(PaddingMap);
|
||||
CertificateReg::Insert(CertificateMap);
|
||||
CRLReg::Insert(CRLMap);
|
||||
X509KeyReg::Insert(X509KeyMap);
|
||||
X509SignReg::Insert(X509SignMap);
|
||||
X509SignHashReg::Insert(X509SignHashMap);
|
||||
|
||||
#ifndef NO_SMARTCARD
|
||||
SubsystemReg::Insert(SubsystemMap);
|
||||
SlotMonitorReg::Insert(SlotMonitorMap);
|
||||
SCardOSReg::Insert(SCardOSMap);
|
||||
SCardTokenReg::Insert(SCardTokenMap);
|
||||
ProfileGeneratorReg::Insert(ProfileGeneratorMap);
|
||||
PKCS15BehaviorReg::Insert(PKCS15BehaviorMap);
|
||||
TokenExtensionReg::Insert(TokenExtensionMap);
|
||||
TokenAuthProtocolReg::Insert(TokenAuthProtocolMap);
|
||||
JCardAppletReg::Insert(JCardAppletMap);
|
||||
#endif
|
||||
CreateFastRNG = CreateFIPS186;
|
||||
CreateStrongRNG = CreateBBS;
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // actInit_h
|
||||
@@ -1,62 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actAppletReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions to create JavaCardApplet object
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor:
|
||||
// Date: 02/10/2003
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_AppletReg_h
|
||||
#define ACT_AppletReg_h
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable:4786)
|
||||
#endif
|
||||
|
||||
namespace act
|
||||
{
|
||||
class JavaCardOS;
|
||||
class IToken;
|
||||
class Blob;
|
||||
|
||||
typedef IToken* (*CreateJCardAppletPtr)(JavaCardOS*, const Blob& aid);
|
||||
typedef bool (*CheckJCardAppletPtr)(JavaCardOS*, const Blob& aid);
|
||||
|
||||
struct JCardAppletEntry
|
||||
{
|
||||
const char* hexid;
|
||||
CheckJCardAppletPtr CheckPtr;
|
||||
CreateJCardAppletPtr CreatePtr;
|
||||
int keys;
|
||||
int certs;
|
||||
int auth_objs;
|
||||
};
|
||||
|
||||
struct JCardAppletInfoEntry
|
||||
{
|
||||
int keys;
|
||||
int certs;
|
||||
int auth_objs;
|
||||
};
|
||||
|
||||
class JCardAppletReg
|
||||
{
|
||||
public:
|
||||
static IToken* CreateJCardApplet(JavaCardOS* os, const Blob& aid);
|
||||
static JCardAppletInfoEntry GetJCardAppletInfo(JavaCardOS* os, const Blob& aid);
|
||||
static bool IsJCardApplet(JavaCardOS* os, const Blob& aid);
|
||||
|
||||
static void Insert(const JCardAppletEntry* entry);
|
||||
static void Insert(const char* id, CheckJCardAppletPtr checkptr, CreateJCardAppletPtr createptr,
|
||||
int keys = -1, int auth_objs = -1, int certs = -1);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_AppletReg_h
|
||||
@@ -1,82 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actKey.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class Key manages information relevant to keys (e.g.
|
||||
// domain parameters or the key itself). In the case of symmetric
|
||||
// encryption only a (the) secret key is generated. In the case of
|
||||
// of asymetric encryption a private and a public key are generated.
|
||||
// This handle allows a universal approach for different families of
|
||||
// algorithms.
|
||||
//
|
||||
//
|
||||
// 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_Key_h
|
||||
#define ACT_Key_h
|
||||
|
||||
#include "actBasics.h"
|
||||
#include "actBlob.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IRNGAlg;
|
||||
class IAlgorithm;
|
||||
class IKey;
|
||||
class ICertificate;
|
||||
|
||||
class Key
|
||||
{
|
||||
public:
|
||||
Key();
|
||||
Key(const Key& key);
|
||||
Key(IKey* keyptr);
|
||||
Key(const Blob& keyblob);
|
||||
Key(const ICertificate* cert);
|
||||
Key(const char* keytype);
|
||||
|
||||
void Import(const Blob& keyblob);
|
||||
void Export(Blob& keyblob, export_t type = DEFAULT) const;
|
||||
|
||||
void SetParam(paramid_t id, const Blob& blob);
|
||||
void SetParam(paramid_t id, int val);
|
||||
void SetParam(paramid_t id, const char* cstr);
|
||||
|
||||
int GetParam(paramid_t id) const;
|
||||
void GetParam(paramid_t id, Blob& blob) const;
|
||||
|
||||
void Generate(IAlgorithm* prng = 0);
|
||||
void Derive(const Blob& data, const Blob& salt = Blob());
|
||||
|
||||
IAlgorithm* CreateAlgorithm(mode_t Mode) const;
|
||||
IAlgorithm* CreateAlgorithm(mode_t Mode, const Blob& data) const;
|
||||
|
||||
IKey* GetPointer();
|
||||
const IKey* GetPointer() const;
|
||||
operator IKey*();
|
||||
operator const IKey*() const;
|
||||
|
||||
IKey* ReleasePointer();
|
||||
|
||||
template<typename KeyTypeT>
|
||||
inline KeyTypeT* As() { return static_cast<KeyTypeT*>(GetPointer()); }
|
||||
|
||||
template<typename KeyTypeT>
|
||||
inline const KeyTypeT* As() const { return static_cast<const KeyTypeT*>(GetPointer()); }
|
||||
|
||||
Key& operator=(const Key& key);
|
||||
Key& Reset(IKey* key);
|
||||
Key& Required(const char* where = 0);
|
||||
|
||||
~Key();
|
||||
|
||||
private:
|
||||
IKey *mKey;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Key_h
|
||||
@@ -1,110 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actLogger.h
|
||||
// Product: cv act library
|
||||
// Purpose: Logger
|
||||
//
|
||||
// Copyright: (c) 2000-2001 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_Logger_h
|
||||
#define ACT_Logger_h
|
||||
|
||||
#include "actDebug.h"
|
||||
#include "actBlob.h"
|
||||
|
||||
#include "SyncObject.h"
|
||||
|
||||
// for convenience:
|
||||
#ifdef _MSC_VER
|
||||
# define ACT_SNPRINTF _snprintf
|
||||
#else
|
||||
# include <cstdio>
|
||||
# define ACT_SNPRINTF snprintf
|
||||
#endif
|
||||
|
||||
//
|
||||
// MTE [11/1/2006]: Added addtional accessing macros.
|
||||
// NOTE: Redefine to use another Logger.
|
||||
#define ACT_LOGGER(x) act::Logger::x
|
||||
|
||||
//
|
||||
// MTE [11/1/2006]: Added to replace direct usage of ACT_LOGGER(LogInit)().
|
||||
#define ACT_LOGISENABLED() (ACT_DEBUG != 0 || ACT_LOGGER(LogInit)())
|
||||
|
||||
//
|
||||
// MTE [11/1/2006]: Changed to use ACT_LOGISENABLED().
|
||||
#define ACT_LOGINFO(info) { if(ACT_LOGISENABLED()) ACT_LOGGER(Log)(ACT_LOGGER(LEVEL_INFO), info); }
|
||||
#define ACT_LOGWARN(warn) { if(ACT_LOGISENABLED()) ACT_LOGGER(Log)(ACT_LOGGER(LEVEL_WARN), warn); }
|
||||
#define ACT_LOGERROR(error) { if(ACT_LOGISENABLED()) ACT_LOGGER(Log)(ACT_LOGGER(LEVEL_ERROR), error); }
|
||||
#define ACT_LOGEXCEPTION(e) { if(ACT_LOGISENABLED()) { char buf[1024]; ACT_SNPRINTF(buf, 1024, "Exception:\t '%s' in '%s'", e.what(), e.where()); ACT_LOGERROR(buf) }}
|
||||
|
||||
#define ACT_LOGINFODATA(info, data) { if(ACT_LOGISENABLED()) ACT_LOGGER(Log)(ACT_LOGGER(LEVEL_INFO), info, data); }
|
||||
#define ACT_LOGWARNDATA(warn, data) { if(ACT_LOGISENABLED()) ACT_LOGGER(Log)(ACT_LOGGER(LEVEL_WARN), warn, data); }
|
||||
#define ACT_LOGERRORDATA(error, data) { if(ACT_LOGISENABLED()) ACT_LOGGER(Log)(ACT_LOGGER(LEVEL_ERROR), error, data); }
|
||||
#define ACT_LOGBLOB(blob) { if(ACT_LOGISENABLED()) ACT_LOGGER(Log)(ACT_LOGGER(LEVEL_INFO), #blob, blob); }
|
||||
|
||||
#define ACT_LOGVALUE(name, value, format) { if(ACT_LOGISENABLED()) { char buf[256]; ACT_SNPRINTF(buf, 256, name " :\t " format, value); ACT_LOGINFO(buf) }}
|
||||
|
||||
#define ACT_LOGINT(value) ACT_LOGVALUE(#value, int(value), "%i")
|
||||
#define ACT_LOGHEX(value) ACT_LOGVALUE(#value, act::ulong(value), "0x%08x")
|
||||
#define ACT_LOGSTRING(value) ACT_LOGVALUE(#value, value, "%s")
|
||||
|
||||
#define ACT_LOGNAMEDINT(name, value) ACT_LOGVALUE(name, int(value), "%i")
|
||||
#define ACT_LOGNAMEDHEX(name, value) ACT_LOGVALUE(name, act::ulong(value), "0x%08x")
|
||||
#define ACT_LOGNAMEDSTRING(name, value) ACT_LOGVALUE(name, value, "%s")
|
||||
|
||||
#ifdef WIN32
|
||||
#define ACT_LOGPTR(value) ACT_LOGINT(value)
|
||||
#else
|
||||
#define ACT_LOGPTR(value) ACT_LOGVALUE(#value, value, "%lp")
|
||||
#endif
|
||||
|
||||
// TODO: MTE: What about this "nice" construct ?
|
||||
#define ACT_LOGPOINTER(p) { if(ACT_LOGISENABLED()) { if(p != 0) ACT_LOGINT(*p) else ACT_LOGHEX(p) }}
|
||||
#define ACT_LOGISNULL(p) { if(ACT_LOGISENABLED()) { char buf[256]; if(p != 0) ACT_SNPRINTF(buf, 256, #p " :\t *"); else ACT_SNPRINTF(buf, 256, #p " :\t 0"); ACT_LOGINFO(buf) }}
|
||||
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
enum Levels
|
||||
{
|
||||
LEVEL_OFF = 0,
|
||||
LEVEL_ERROR = 30,
|
||||
LEVEL_WARNING = 50,
|
||||
LEVEL_WARN = LEVEL_WARNING,
|
||||
LEVEL_INFO = 80,
|
||||
LEVEL_MAX = 99
|
||||
};
|
||||
|
||||
static void SetLogger(Logger* pLogger);
|
||||
static void FreeLogger();
|
||||
static void Log(short level, const char* msg);
|
||||
static void Log(short level, const Blob& blobmsg);
|
||||
static void Log(short level, const char* msg, const Blob& blobmsg);
|
||||
static void SetLoglevel(short level);
|
||||
static bool LogInit()
|
||||
{
|
||||
return(s_pLogger != 0 ? true : false);
|
||||
}
|
||||
|
||||
protected:
|
||||
Logger(){}
|
||||
virtual ~Logger(){}
|
||||
virtual void doLog(short level, const char* msg) = 0;
|
||||
virtual void doSetLoglevel(short level) = 0;
|
||||
|
||||
private:
|
||||
static Logger* s_pLogger;
|
||||
static SyncObject m_sync;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Logger_h
|
||||
|
||||
@@ -1,269 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actMode.h
|
||||
// Product: cv act library
|
||||
// Purpose: enumerations
|
||||
//
|
||||
// Copyright: (c) 2006 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_Mode_h
|
||||
#define ACT_Mode_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
enum
|
||||
{
|
||||
MODE_RANGE_BEGIN = 100,
|
||||
|
||||
ENCRYPT = 100,
|
||||
DECRYPT,
|
||||
SIGN,
|
||||
VERIFY,
|
||||
MAC,
|
||||
|
||||
PRIVATE =200,
|
||||
PUBLIC,
|
||||
SECRET,
|
||||
DOMAINPARAMS,
|
||||
PKCS8_TYPE,
|
||||
|
||||
CIPHER = 300,
|
||||
PADDING,
|
||||
DERIVATOR,
|
||||
BCMODE,
|
||||
KEYSIZE,
|
||||
RAWKEY,
|
||||
IV,
|
||||
BLOCKSIZE,
|
||||
CHAINING_VALUE,
|
||||
CHAINING_BITCOUNT,
|
||||
EFFECTIVE_KEYSIZE,
|
||||
SHAREDDATA_1,
|
||||
SHAREDDATA_2,
|
||||
KEYDATALEN,
|
||||
ITERATIONCOUNT,
|
||||
COUNTER,
|
||||
OUTDATALEN,
|
||||
|
||||
ENCODER=400,
|
||||
PRIVATEKEY,
|
||||
PUBLICKEY,
|
||||
PUBLICSIZE,
|
||||
KEY,
|
||||
SIGNATURE,
|
||||
AGREEMENT,
|
||||
|
||||
MODULO=500,
|
||||
PRIME_P,
|
||||
PRIME_Q,
|
||||
MODULOSIZE,
|
||||
PRIME_P_SIZE,
|
||||
PRIME_Q_SIZE,
|
||||
CRT_EXPONENT_1,
|
||||
CRT_EXPONENT_2,
|
||||
CRT_COEFFICIENT,
|
||||
PKCS1_PRIVATEKEY,
|
||||
PKCS1_PUBLICKEY,
|
||||
|
||||
CURVE=600,
|
||||
PUBLIC_X,
|
||||
PUBLIC_Y,
|
||||
STATICPUBLIC_X,
|
||||
STATICPUBLIC_Y,
|
||||
EPHEMERALPUBLIC_X,
|
||||
EPHEMERALPUBLIC_Y,
|
||||
CURVEPARAM,
|
||||
PUBLICKEY_EXPORT_TYPE,
|
||||
BASEPOINT_EXPORT_TYPE,
|
||||
COMPRESSED,
|
||||
UNCOMPRESSED,
|
||||
HYBRID,
|
||||
IMPLICITLYCA,
|
||||
GF2CURVE,
|
||||
PRIMECURVE,
|
||||
ENCODE_SIGNATURE,
|
||||
PLAIN_SECRET,
|
||||
|
||||
RING = 700,
|
||||
RINGORDER,
|
||||
RINGGENERATOR,
|
||||
COFACTOR,
|
||||
COMPATIBLE,
|
||||
NEWEPHEMERAL,
|
||||
CHECKDOMAINPARAMS,
|
||||
|
||||
STATICPRIVATEKEY,
|
||||
STATICPUBLICKEY,
|
||||
EPHEMERALPRIVATEKEY,
|
||||
EPHEMERALPUBLICKEY,
|
||||
|
||||
PIN = 800,
|
||||
CARDTYPE,
|
||||
CARDPORTTYPE,
|
||||
PORTNR,
|
||||
DLLNAME,
|
||||
READERNAME,
|
||||
CHANGEMASTERPIN,
|
||||
CHANGEPIN,
|
||||
USERPIN,
|
||||
MASTERPIN,
|
||||
PINPAD,
|
||||
USERNAME,
|
||||
INFOTEXT,
|
||||
SIGNKEY,
|
||||
ENCKEY,
|
||||
SIGNCERTIFICATE,
|
||||
ENCCERTIFICATE,
|
||||
ROOTCERTIFICATE,
|
||||
LOCK_KEY,
|
||||
DHKEY,
|
||||
DHCERTIFICATE,
|
||||
PERSONALIZED,
|
||||
READERNAMES,
|
||||
AID,
|
||||
PATH,
|
||||
NULLPIN,
|
||||
SELECTKEY,
|
||||
ALLCERTIFICATE,
|
||||
APPLICATION,
|
||||
KEYUSAGE,
|
||||
MECHANISM,
|
||||
CERTIFICATE,
|
||||
DATA,
|
||||
KEYTYPE,
|
||||
LABEL,
|
||||
ID,
|
||||
|
||||
CTAPI_PORT = 900,
|
||||
PCSC_PORT,
|
||||
|
||||
CARDOS_CARD = 1000,
|
||||
TCOS_CARD,
|
||||
CVACT_CARD,
|
||||
PKCS11_CARD,
|
||||
MICARDOEC_CARD,
|
||||
STARCOSPK_CARD,
|
||||
ETRUST_CARD,
|
||||
// MICARDOPUBLIC_CARD,
|
||||
CARDOSM4_CARD,
|
||||
MICARDOP21_CARD,
|
||||
|
||||
HASH=1100,
|
||||
SALT,
|
||||
SALT_LENGTH,
|
||||
EMLEN,
|
||||
|
||||
X = 1200,
|
||||
SEED,
|
||||
MULTIPLIER,
|
||||
|
||||
VERSION = 1300,
|
||||
ISSUER,
|
||||
SUBJECT,
|
||||
SERIALNR,
|
||||
ISSUER_DER,
|
||||
SUBJECT_DER,
|
||||
ISSUER_UID,
|
||||
SUBJECT_UID,
|
||||
NOTBEFORE_DER,
|
||||
NOTAFTER_DER,
|
||||
THISUPDATE_DER,
|
||||
NEXTUPDATE_DER,
|
||||
TBS,
|
||||
|
||||
CVPROFILEID = 1400,
|
||||
CVCAREFERENCE,
|
||||
CVHOLDERREFERENCE,
|
||||
CVHATEMPLATE,
|
||||
CVEACTEMPLATE,
|
||||
CVEFFECTIVEDATE,
|
||||
CVEXPIRATIONDATE,
|
||||
CVPUBLICKEY_TLV,
|
||||
CVPUBLICKEY_MECHANISM,
|
||||
|
||||
// GF(P)-Curves
|
||||
SECGp112r1 = 0x1000,
|
||||
SECGp112r2,
|
||||
SECGp128r1,
|
||||
SECGp128r2,
|
||||
SECGp160r1,
|
||||
SECGp160r2,
|
||||
SECGp160k1,
|
||||
ANSIp192r1,
|
||||
ANSIp192r2,
|
||||
ANSIp192r3,
|
||||
NISTp192r1,
|
||||
SECGp192r1,
|
||||
SECGp192k1,
|
||||
NISTp224r1,
|
||||
SECGp224r1,
|
||||
SECGp224k1,
|
||||
ANSIp239r1,
|
||||
ANSIp239r2,
|
||||
ANSIp239r3,
|
||||
ANSIp256r1,
|
||||
NISTp256r1,
|
||||
SECGp256r1,
|
||||
SECGp256k1,
|
||||
NISTp384r1,
|
||||
NISTp521r1,
|
||||
brainpoolP256r1,
|
||||
brainpoolP256t1,
|
||||
|
||||
// GF(2^m)-Curves
|
||||
SECGz113r1 = 0x1200,
|
||||
SECGz113r2,
|
||||
SECGz131r1,
|
||||
SECGz131r2,
|
||||
ANSIz163r1,
|
||||
ANSIz163r2,
|
||||
ANSIz163r3,
|
||||
NISTz163r1,
|
||||
NISTz163k1,
|
||||
SECGz163r1,
|
||||
SECGz163r2,
|
||||
SECGz163k1,
|
||||
ANSIz176w1,
|
||||
ANSIz191r1,
|
||||
ANSIz191r2,
|
||||
ANSIz191r3,
|
||||
SECGz193r1,
|
||||
SECGz193r2,
|
||||
ANSIz208w1,
|
||||
NISTz233r1,
|
||||
NISTz233k1,
|
||||
SECGz233r1,
|
||||
SECGz233k1,
|
||||
ANSIz239r1,
|
||||
ANSIz239r2,
|
||||
ANSIz239r3,
|
||||
SECGz239k1,
|
||||
ANSIz272w1,
|
||||
NISTz283r1,
|
||||
NISTz283k1,
|
||||
SECGz283r1,
|
||||
SECGz283k1,
|
||||
ANSIz304w1,
|
||||
ANSIz359r1,
|
||||
ANSIz368w1,
|
||||
NISTz409r1,
|
||||
NISTz409k1,
|
||||
SECGz409r1,
|
||||
SECGz409k1,
|
||||
ANSIz431r1,
|
||||
NISTz571r1,
|
||||
NISTz571k1,
|
||||
SECGz571r1,
|
||||
SECGz571k1,
|
||||
|
||||
MODE_RANGE_LAST = 0x1400, // insert new elements here
|
||||
|
||||
TOKEN_CONFIG = 0x2000, // token config start
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Mode_h
|
||||
@@ -1,34 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actPKCS15BehaviorReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: Registry for factory functions to create specific PKCS15Behavior objects.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 06/02/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_PKCS15BehaviorReg_h
|
||||
#define ACT_PKCS15BehaviorReg_h
|
||||
|
||||
#include "actFactoryReg.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IToken;
|
||||
class IPKCS15Behavior;
|
||||
|
||||
typedef IPKCS15Behavior* (*CreatePKCS15BehaviorPtr)(const char* mid, IToken* token);
|
||||
typedef FactoryMapEntry<CreatePKCS15BehaviorPtr> PKCS15BehaviorMapEntry;
|
||||
|
||||
typedef FactoryReg
|
||||
< IPKCS15Behavior, CreatePKCS15BehaviorPtr, PKCS15BehaviorMapEntry
|
||||
> PKCS15BehaviorReg;
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_PKCS15BehaviorReg_h
|
||||
@@ -1,26 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actPaddingKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// 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_PaddingKit_h
|
||||
#define ACT_PaddingKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IPadding;
|
||||
|
||||
IPadding* CreatePKCS5Pad();
|
||||
IPadding* CreatePKCS1V1_5EMEPad();
|
||||
IPadding* CreateOneAndZerosPad();
|
||||
IPadding* CreateISO9796Pad();
|
||||
IPadding* CreateNoPad();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actPaddingReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for the factory functions in actPaddingKit.h
|
||||
//
|
||||
// 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_PaddingReg_h
|
||||
#define ACT_PaddingReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IPadding;
|
||||
class Blob;
|
||||
|
||||
typedef IPadding* (*CreatePaddingPtr)();
|
||||
|
||||
struct PaddingMapEntry
|
||||
{
|
||||
const char* Name;
|
||||
CreatePaddingPtr CreatePtr;
|
||||
};
|
||||
|
||||
class PaddingReg
|
||||
{
|
||||
public:
|
||||
static IPadding* CreatePadding(const char* name);
|
||||
static CreatePaddingPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreatePaddingPtr createptr);
|
||||
static void Insert(const PaddingMapEntry* paddingmap);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_PaddingReg_h
|
||||
@@ -1,26 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actProfileGeneratorKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: Factory functions for smartcard profile generators.
|
||||
//
|
||||
// Copyright: (c) 2009 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 12/18/2009
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_ProfileGeneratorKit_h
|
||||
#define ACT_ProfileGeneratorKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IProfileGenerator;
|
||||
|
||||
IProfileGenerator* CreateJCPKCS15Generator(const char* name);
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ProfileGeneratorKit_h
|
||||
@@ -1,44 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actRNGKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// Copyright: (c) 2010 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_RNGKit_h
|
||||
#define ACT_RNGKit_h
|
||||
namespace act
|
||||
{
|
||||
class IRNGAlg;
|
||||
|
||||
// Dummy PRNG (uses rand() / srand(time(0)))
|
||||
IRNGAlg* CreateDummyPRNG();
|
||||
|
||||
// Deterministic PRNGs
|
||||
IRNGAlg* CreateARC4RNG();
|
||||
IRNGAlg* CreateBBS();
|
||||
IRNGAlg* CreateFIPS186();
|
||||
IRNGAlg* CreateFIPS186DES();
|
||||
IRNGAlg* CreateLCG();
|
||||
|
||||
// AIS 20, K1 - K4 evaluated deterministic PRNG
|
||||
IRNGAlg* CreateFIPS186K4();
|
||||
|
||||
// 'True' RNGs
|
||||
IRNGAlg* CreateDevRandomRNG();
|
||||
#ifndef UNDER_CE_30
|
||||
IRNGAlg* CreateWinRNG();
|
||||
#endif
|
||||
|
||||
// Token RNG (uses IToken::GetRandom())
|
||||
#ifndef NO_SMARTCARD
|
||||
IRNGAlg* CreateTokenRNG();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actSCardOSKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions to create SCardOS object
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 05/13/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_SCardOSKit_h
|
||||
#define ACT_SCardOSKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ISCardOS;
|
||||
class ISCardAccess;
|
||||
|
||||
/*
|
||||
ISCardOS* CreateMicardOS(ISCardAccess*);
|
||||
ISCardOS* CreateMicardo20E(ISCardAccess*);
|
||||
ISCardOS* CreateMicardo23E(ISCardAccess* ac);
|
||||
*/
|
||||
|
||||
bool IsACOS(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateACOS_D01(ISCardAccess*);
|
||||
ISCardOS* CreateACOS_A04(ISCardAccess*);
|
||||
|
||||
bool IsCardOS_M4(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateCardOS_M4(ISCardAccess*);
|
||||
ISCardOS* CreateCardOS_M4_MoC(ISCardAccess*);
|
||||
|
||||
bool IsCardOS_M4_ECC(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateCardOS_M4_ECC(ISCardAccess*);
|
||||
|
||||
bool IsCardOS_V4(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateCardOS_V4(ISCardAccess*);
|
||||
|
||||
bool IsCardOS_V4_ECC(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateCardOS_V4_ECC(ISCardAccess*);
|
||||
|
||||
bool IsStarCOS(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateStarCOS_3_0(ISCardAccess*);
|
||||
ISCardOS* CreateStarCOS_3_2(ISCardAccess*);
|
||||
|
||||
bool IsTCOS(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateTCOS_3_0(ISCardAccess*);
|
||||
|
||||
bool IsJavaCardOS(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateJavaCardOS_2_2_2(ISCardAccess*);
|
||||
ISCardOS* CreateJavaCardOS_2_2_1(ISCardAccess*);
|
||||
ISCardOS* CreateJavaCardOS_2_2(ISCardAccess*);
|
||||
ISCardOS* CreateJavaCardOS_2_1_2(ISCardAccess*);
|
||||
ISCardOS* CreateJavaCardOS_2_1_1(ISCardAccess*);
|
||||
ISCardOS* CreateJavaCardOS_2_1(ISCardAccess*);
|
||||
|
||||
bool IsISO7816OS(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateISO7816OS(ISCardAccess*);
|
||||
|
||||
//
|
||||
// Passport OS
|
||||
// ---------------------------------------------------------------------------
|
||||
bool IsBACOS(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateBACOS(ISCardAccess* ac);
|
||||
|
||||
bool IsEACOS(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateEACOS(ISCardAccess* ac);
|
||||
|
||||
bool IsEACOS201(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateEACOS201(ISCardAccess* ac);
|
||||
|
||||
bool IsEPAOS(CreateSCardOSPtr ptr);
|
||||
ISCardOS* CreateEPAOS(ISCardAccess* ac);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsACOS(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateACOS_D01
|
||||
|| ptr == CreateACOS_A04;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsCardOS_M4(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateCardOS_M4
|
||||
|| ptr == CreateCardOS_M4_MoC;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsCardOS_M4_ECC(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateCardOS_M4_ECC;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsCardOS_V4(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateCardOS_V4;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsCardOS_V4_ECC(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateCardOS_V4_ECC;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsStarCOS(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateStarCOS_3_0
|
||||
|| ptr == CreateStarCOS_3_2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsTCOS(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateTCOS_3_0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsJavaCardOS(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateJavaCardOS_2_2_2
|
||||
|| ptr == CreateJavaCardOS_2_2_1
|
||||
|| ptr == CreateJavaCardOS_2_2
|
||||
|| ptr == CreateJavaCardOS_2_1_2
|
||||
|| ptr == CreateJavaCardOS_2_1_1
|
||||
|| ptr == CreateJavaCardOS_2_1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsISO7816OS(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateISO7816OS;
|
||||
}
|
||||
|
||||
//
|
||||
// Passport OS
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsBACOS(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateBACOS;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsEACOS(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateEACOS;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsEACOS201(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateEACOS201;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool IsEPAOS(CreateSCardOSPtr ptr)
|
||||
{
|
||||
return ptr == CreateEPAOS;
|
||||
}
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_SCardOSKit_h
|
||||
@@ -1,46 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actSCardOSReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: factory functions registry to create SCardOS objects.
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 04/09/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_SCardOSReg_h
|
||||
#define ACT_SCardOSReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
# define ACT_ISO7816OS_NAME "ISO7816OS"
|
||||
|
||||
class ISCardOS;
|
||||
class ISCardAccess;
|
||||
|
||||
typedef ISCardOS* (*CreateSCardOSPtr)(ISCardAccess*);
|
||||
|
||||
struct SCardOSMapEntry
|
||||
{
|
||||
const char* Name;
|
||||
CreateSCardOSPtr CreatePtr;
|
||||
};
|
||||
|
||||
class SCardOSReg
|
||||
{
|
||||
public:
|
||||
static ISCardOS* CreateSCardOS(const char* name, ISCardAccess* ac);
|
||||
static CreateSCardOSPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateSCardOSPtr createptr);
|
||||
static void Insert(const SCardOSMapEntry* entry);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_SCardOSReg_h
|
||||
@@ -1,105 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actSCardTokenKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions to create SCardOS and SCardToken objects
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 05/14/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_SCardTokenKit_h
|
||||
#define ACT_SCardTokenKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ISCardOS;
|
||||
class SCardToken;
|
||||
|
||||
bool IsStarCOSToken(ISCardOS* os);
|
||||
SCardToken* CreateStarCOSToken(ISCardOS* os);
|
||||
|
||||
bool IsV4cvProfile(ISCardOS* os);
|
||||
SCardToken* CreateV4cvProfile(ISCardOS* os);
|
||||
|
||||
bool IsV4cvECProfile(ISCardOS* os);
|
||||
SCardToken* CreateV4cvECProfile(ISCardOS* os);
|
||||
|
||||
bool IsV4CNSProfile(ISCardOS* os);
|
||||
SCardToken* CreateV4CNSProfile(ISCardOS* os);
|
||||
|
||||
bool IsNetKey2000Token(ISCardOS* os);
|
||||
SCardToken* CreateNetKey2000Token(ISCardOS* os);
|
||||
|
||||
bool IsNetKeyE4Token(ISCardOS* os);
|
||||
SCardToken* CreateNetKeyE4Token(ISCardOS* os);
|
||||
|
||||
bool IsNetKey30Token(ISCardOS* os);
|
||||
SCardToken* CreateNetKey30Token(ISCardOS* os);
|
||||
|
||||
bool IsNetKeyPKSToken(ISCardOS* os);
|
||||
SCardToken* CreateNetKeyPKSToken(ISCardOS* os);
|
||||
|
||||
bool IsNetKeyOldToken(ISCardOS* os);
|
||||
SCardToken* CreateNetKeyOldToken(ISCardOS* os);
|
||||
|
||||
bool IseTrustToken(ISCardOS* os);
|
||||
SCardToken* CreateeTrustToken(ISCardOS* os);
|
||||
|
||||
bool IsMicardoECToken(ISCardOS* os);
|
||||
SCardToken* CreateMicardoECToken(ISCardOS* os);
|
||||
|
||||
bool IsM4cvProfile(ISCardOS* os);
|
||||
SCardToken* CreateM4cvProfile(ISCardOS* os);
|
||||
|
||||
bool IsACOScvProfile(ISCardOS* os);
|
||||
SCardToken* CreateACOScvProfile(ISCardOS* os);
|
||||
|
||||
bool IsM4SiemensProfile(ISCardOS* os);
|
||||
SCardToken* CreateM4SiemensProfile(ISCardOS* os);
|
||||
|
||||
bool IsM4cvECProfile(ISCardOS* os);
|
||||
SCardToken* CreateM4cvECProfile(ISCardOS* os);
|
||||
|
||||
bool IsM4cvMoCProfile(ISCardOS* os);
|
||||
SCardToken* CreateM4cvMoCProfile(ISCardOS* os);
|
||||
|
||||
bool IsJavaCardAppletManager(ISCardOS* os);
|
||||
SCardToken* CreateJavaCardAppletManager(ISCardOS* os);
|
||||
|
||||
bool IsJCProfile(ISCardOS* os);
|
||||
SCardToken* CreateJCProfile(ISCardOS* os);
|
||||
|
||||
// PKCS#15 Profiles
|
||||
bool IsM4PKCS15Profile(ISCardOS* os);
|
||||
SCardToken* CreateM4PKCS15Profile(ISCardOS* os);
|
||||
|
||||
bool IsV4PKCS15Profile(ISCardOS* os);
|
||||
SCardToken* CreateV4PKCS15Profile(ISCardOS* os);
|
||||
|
||||
bool IsV4PKCS15ECProfile(ISCardOS* os);
|
||||
SCardToken* CreateV4PKCS15ECProfile(ISCardOS* os);
|
||||
|
||||
bool IsJCPKCS15Profile(ISCardOS* os);
|
||||
SCardToken* CreateJCPKCS15Profile(ISCardOS* os);
|
||||
|
||||
bool IsJCPKCS15ECProfile(ISCardOS* os);
|
||||
SCardToken* CreateJCPKCS15ECProfile(ISCardOS* os);
|
||||
|
||||
bool IsACOSPKCS15Profile(ISCardOS* os);
|
||||
SCardToken* CreateACOSPKCS15Profile(ISCardOS* os);
|
||||
|
||||
bool IsStarCOSPKCS15Profile(ISCardOS* os);
|
||||
SCardToken* CreateStarCOSPKCS15Profile(ISCardOS* os);
|
||||
|
||||
// Passport
|
||||
bool IsEPAProfile(ISCardOS* os);
|
||||
SCardToken* CreateEPAProfile(ISCardOS* os);
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_SCardTokenKit_h
|
||||
@@ -1,42 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actSCardTokenReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: factory functions registry to create SCardToken objects.
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Date: 05/13/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_SCardTokenReg_h
|
||||
#define ACT_SCardTokenReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ISCardOS;
|
||||
class SCardToken;
|
||||
|
||||
typedef bool (*CheckSCardTokenPtr)(ISCardOS*);
|
||||
typedef SCardToken* (*CreateSCardTokenPtr)(ISCardOS*);
|
||||
|
||||
struct SCardTokenMapEntry
|
||||
{
|
||||
CheckSCardTokenPtr CheckPtr;
|
||||
CreateSCardTokenPtr CreatePtr;
|
||||
};
|
||||
|
||||
class SCardTokenReg
|
||||
{
|
||||
public:
|
||||
static SCardToken* CreateSCardToken(ISCardOS* os);
|
||||
static void Insert(CheckSCardTokenPtr checkptr, CreateSCardTokenPtr createptr);
|
||||
static void Insert(const SCardTokenMapEntry* entry);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_SCardTokenReg_h
|
||||
@@ -1,27 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actSCardUtil.h
|
||||
// Product: cv act library
|
||||
// Purpose: useful global functions
|
||||
//
|
||||
// Copyright: (c) 2008 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 actSCardUtil_h
|
||||
#define actSCardUtil_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
template<class BlobT>
|
||||
inline BlobT short2blob(unsigned short n)
|
||||
{
|
||||
byte data[2] = { byte((n >> 8) & 0xff), byte(n & 0xff) };
|
||||
return BlobT(&data[0], &data[0] + sizeof(data));
|
||||
}
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // actSCardUtil_h
|
||||
@@ -1,81 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actSlotManager.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class SlotManager detects and manages the subsystems and the slots
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang
|
||||
// Markus Tesche
|
||||
// Date: 03/26/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_SlotManager_h
|
||||
#define ACT_SlotManager_h
|
||||
|
||||
#include "actIEventMonitoring.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ISubsystem;
|
||||
class ISubsystemConfig;
|
||||
|
||||
class ISlot;
|
||||
class ITokenConfig;
|
||||
|
||||
//
|
||||
// SlotManager
|
||||
class SlotManager : public IEventMonitoring
|
||||
{
|
||||
private:
|
||||
struct SubsystemList
|
||||
{
|
||||
SubsystemList(ISubsystem* system, SubsystemList* next = 0);
|
||||
~SubsystemList();
|
||||
|
||||
SubsystemList* insert(SubsystemList* prev);
|
||||
SubsystemList* remove(SubsystemList* prev);
|
||||
|
||||
ISubsystem* system;
|
||||
SubsystemList* next;
|
||||
};
|
||||
|
||||
public:
|
||||
SlotManager(ITokenConfig* tkcfg = 0);
|
||||
~SlotManager();
|
||||
|
||||
bool Install(ISubsystem* system);
|
||||
bool Install(ISubsystemConfig* config);
|
||||
|
||||
void Refresh();
|
||||
void Disconnect();
|
||||
ISubsystem* GetSystem(size_t pos = 0) const;
|
||||
|
||||
// SlotList
|
||||
int GetSlotNumber() const;
|
||||
const ISlot* GetSlot(int pos) const;
|
||||
ISlot* CreateSlot(const char* name) const;
|
||||
|
||||
// IEventMonitoring functions
|
||||
virtual bool IsMonitored() const;
|
||||
virtual void StopMonitor(bool force = false);
|
||||
virtual void StartMonitor(IEventHandler* cmd);
|
||||
|
||||
protected:
|
||||
IEventHandler* SetMonitor(SubsystemList* begin, IEventHandler* cmd, bool force);
|
||||
|
||||
private:
|
||||
int m_total;
|
||||
ITokenConfig* m_tkcfg;
|
||||
SubsystemList* m_begin;
|
||||
SubsystemList* m_current;
|
||||
IEventHandler* m_cmd_root;
|
||||
IEventHandler* m_cmd_current;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_SlotManager_h
|
||||
@@ -1,29 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actState.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// 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_STATE_H
|
||||
#define ACT_STATE_H
|
||||
|
||||
namespace act
|
||||
{
|
||||
|
||||
const int READY=0;
|
||||
const int SIGNATURE_OK=1;
|
||||
const int IS_FINALIZED=2;
|
||||
const int DECRYPT_ERROR=3;
|
||||
const int CERTIFICATE_OK=4;
|
||||
const int CERTIFICATE_ERROR=5;
|
||||
const int VERIFY_ERROR=6;
|
||||
|
||||
} // namspace act
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actStreamCipherKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// Copyright: (c) 2001 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_StreamCipherKit_h
|
||||
#define ACT_StreamCipherKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IStreamCipher;
|
||||
|
||||
IStreamCipher* CreateARC4();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actStreamCipherReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions in actStreamCipherKit.h
|
||||
//
|
||||
// Copyright: (c) 2001 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_StreamCipherReg_h
|
||||
#define ACT_StreamCipherReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IStreamCipher;
|
||||
|
||||
typedef IStreamCipher* (*CreateStreamCipherPtr)();
|
||||
|
||||
struct StreamCipherMapEntry {
|
||||
const char* Name;
|
||||
CreateStreamCipherPtr CreatePtr;
|
||||
};
|
||||
|
||||
class StreamCipherReg
|
||||
{
|
||||
public:
|
||||
static IStreamCipher* CreateStreamCipher(const char* name);
|
||||
static CreateStreamCipherPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name,CreateStreamCipherPtr createptr);
|
||||
static void Insert(const StreamCipherMapEntry* map);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actSubsystemReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: factory functions registry to create Subsystem objects.
|
||||
//
|
||||
// Copyright: (c) 2002 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Dr. Xiangdong Wang (XWG)
|
||||
// Markus Tesche
|
||||
// Date: 05/14/2002
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_SubsystemReg_h
|
||||
#define ACT_SubsystemReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ISubsystem;
|
||||
class ISubsystemConfig;
|
||||
|
||||
typedef ISubsystem* (*CreateSubsystemPtr)(const char*);
|
||||
typedef ISubsystem* (*CreateSubsystemExPtr)(ISubsystemConfig*);
|
||||
|
||||
struct SubsystemMapEntry
|
||||
{
|
||||
const char* Name;
|
||||
CreateSubsystemPtr CreatePtr;
|
||||
CreateSubsystemExPtr CreateExPtr;
|
||||
};
|
||||
|
||||
class SubsystemReg
|
||||
{
|
||||
public:
|
||||
static ISubsystem* CreateSubsystem(ISubsystemConfig* config);
|
||||
static ISubsystem* CreateSubsystem(const char* name, const char* dll_name = 0);
|
||||
|
||||
static CreateSubsystemPtr GetCreatePointer(const char* name);
|
||||
static CreateSubsystemExPtr GetCreateExPointer(const char* name);
|
||||
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
|
||||
static void Insert(const char* name, CreateSubsystemPtr createptr);
|
||||
static void Insert(const char* name, CreateSubsystemExPtr createexptr);
|
||||
static void Insert(const SubsystemMapEntry* map);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_SubsystemReg_h
|
||||
@@ -1,30 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actTokenAuthProtocolKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: Factory functions to create specific ITokenAuthProtocol objects.
|
||||
//
|
||||
// Copyright: (c) 2009 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 14/10/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_TokenAuthProtocolKit_h
|
||||
#define ACT_TokenAuthProtocolKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ITokenAuthProtocol;
|
||||
|
||||
ITokenAuthProtocol* CreateTokenAuthPACE(const char* name); // EACv2-PACE
|
||||
ITokenAuthProtocol* CreateTokenAuthTA(const char* name); // EACv2-TA
|
||||
ITokenAuthProtocol* CreateTokenAuthCA(const char* name); // EACv2-CA
|
||||
|
||||
ITokenAuthProtocol* CreateTokenAuthBAC(const char* name); // EACv1-BAC
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_TokenAuthProtocolKit_h
|
||||
@@ -1,200 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actTokenBase.h
|
||||
// Product: cv act library
|
||||
// Purpose: Declares common token enums and constants.
|
||||
//
|
||||
// Copyright: (c) 2010 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 03/24/2010
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_TokenBase_h
|
||||
#define ACT_TokenBase_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
enum TokenError
|
||||
{
|
||||
TOKEN_SUCCESS = 0,
|
||||
TOKEN_FUNCTION_NOT_SUPPORTED = -1,
|
||||
TOKEN_FUNCTION_FAILED = -2,
|
||||
TOKEN_LOCKED = -3
|
||||
};
|
||||
|
||||
enum TokenType
|
||||
{
|
||||
TOKEN_RSA = 0x0001,
|
||||
TOKEN_DSA = 0x0002,
|
||||
TOKEN_DH = 0x0004,
|
||||
TOKEN_ECDSA = 0x0008,
|
||||
TOKEN_ECDH = 0x0010,
|
||||
TOKEN_SECRET = 0x0080,
|
||||
|
||||
TOKEN_BAC = 0x0100,
|
||||
TOKEN_EAC = 0x0200,
|
||||
TOKEN_EPA = 0x0400,
|
||||
};
|
||||
|
||||
enum TokenStatusCode
|
||||
{
|
||||
TOKEN_EMPTY = 0x0000,
|
||||
TOKEN_INITIALIZED = 0x0001,
|
||||
TOKEN_PERSONALIZED = 0x0002
|
||||
};
|
||||
|
||||
enum ProfileType
|
||||
{
|
||||
PROFILE_EMPTY = 0x00,
|
||||
PROFILE_CV = 0x01,
|
||||
PROFILE_CNS = 0x02,
|
||||
PROFILE_GDO = 0x03,
|
||||
PROFILE_CVEC = 0x04,
|
||||
PROFILE_SIGG = 0x05,
|
||||
PROFILE_JC = 0x06,
|
||||
PROFILE_MICARDOEC = 0x07,
|
||||
PROFILE_STARCOS = 0x08,
|
||||
PROFILE_NETKEY = 0x09,
|
||||
PROFILE_CVMOC = 0x0a,
|
||||
|
||||
PROFILE_PKCS15 = 0x0f,
|
||||
PROFILE_PKCS15_mEAC = 0x10, // includes PACE-Pin's
|
||||
PROFILE_PKCS15_mEAC_TA = 0x11, // includes PACE-Pin's and TA-IS, TA-ST, TA-AT
|
||||
|
||||
PROFILE_BAC = 0x80,
|
||||
PROFILE_EAC = 0x81,
|
||||
PROFILE_EAC201 = 0x82,
|
||||
PROFILE_EPA = 0x83,
|
||||
|
||||
PROFILE_PKCS11 = 0xa0,
|
||||
PROFILE_CSP = 0xa1,
|
||||
PROFILE_MD = 0xa2,
|
||||
|
||||
PROFILE_ANY = 0xfe,
|
||||
PROFILE_UNKNOWN = 0xff
|
||||
};
|
||||
|
||||
// usage of key, pin
|
||||
enum KeyUsage
|
||||
{
|
||||
KEY_EMPTY = 0x0000,
|
||||
SIGN_DATA = 0x0001,
|
||||
DEC_DATA = 0x0002,
|
||||
AGREE_KEY = 0x0004,
|
||||
AUTH_DATA = 0x0008,
|
||||
BLOCKCIPHER_KEY = 0x0010,
|
||||
VERIFY_DATA = 0x0020,
|
||||
ENC_DATA = 0x0040,
|
||||
UNLOCK_PIN = 0x0100,
|
||||
UPDATE_BINARY = 0x0200,
|
||||
DELETE_BINARY = 0x0400,
|
||||
ALL_USAGE = 0xffff,
|
||||
|
||||
// custom usage
|
||||
SIGN_HASH = 0x00010000,
|
||||
CUSTOM_USAGE_MASK = 0xffff0000,
|
||||
|
||||
// combined usage
|
||||
ENC_DEC_DATA = DEC_DATA | ENC_DATA,
|
||||
SIGN_DEC_DATA = DEC_DATA | SIGN_DATA,
|
||||
SIGN_HASH_DATA = SIGN_HASH | SIGN_DATA,
|
||||
};
|
||||
|
||||
enum KeyType
|
||||
{ // NOTE: Never change (!), used for serialization.
|
||||
KEY_UNKNOWN = 0xffff,
|
||||
|
||||
KEY_RSA = 0x0000,
|
||||
KEY_DSA = 0x0001,
|
||||
KEY_DH = 0x0002,
|
||||
KEY_ECDSA = 0x0003,
|
||||
KEY_ECDH = 0x0004,
|
||||
|
||||
KEY_SECRET = 0x0010,
|
||||
KEY_DES = 0x0001 + KEY_SECRET,
|
||||
KEY_2DES = 0x0002 + KEY_SECRET,
|
||||
KEY_3DES = 0x0003 + KEY_SECRET,
|
||||
KEY_AES = 0x0004 + KEY_SECRET,
|
||||
|
||||
KEY_TYPE_MASK = 0x001f
|
||||
};
|
||||
|
||||
enum CertificateType
|
||||
{ // NOTE: Never change (!), used for serialization.
|
||||
CERT_UNKNOWN = 0xffff,
|
||||
|
||||
CERT_X509 = 0x0000,
|
||||
CERT_CV = 0x0001
|
||||
};
|
||||
|
||||
enum CertificateUsage
|
||||
{
|
||||
EMPTY_CERT = 0x0000,
|
||||
SIGN_CERT = 0x0001,
|
||||
DEC_CERT = 0x0002,
|
||||
ROOT_CERT = 0x0004,
|
||||
AUTH_CERT = 0x0008,
|
||||
CA_CERT = 0x0010,
|
||||
SMARTCARD_LOGON_CERT = 0x0100, // lib version >= 1.5
|
||||
UNSPECIFIED_CERT = 0xffff
|
||||
};
|
||||
|
||||
enum SecStatus
|
||||
{
|
||||
SS_INVALID = 0x0000,
|
||||
SS_AUTHENTICATED = 0x0001,
|
||||
SS_UNKNOWN = 0xffff,
|
||||
};
|
||||
|
||||
enum AUTH_OBJ_TYPE
|
||||
{
|
||||
AUTH_OBJ_PIN = 0xff, // -1
|
||||
AUTH_OBJ_BIOMETRIC = 0xfe, // -2
|
||||
};
|
||||
|
||||
typedef ulong IDType;
|
||||
typedef ushort FIDType;
|
||||
|
||||
const IDType ID_INVALID = 0;
|
||||
const FIDType FID_INVALID = 0x0000;
|
||||
|
||||
//
|
||||
// FileInfo
|
||||
struct FileInfo
|
||||
{
|
||||
explicit FileInfo(FIDType val_fid = FID_INVALID, IDType val_rec_nr = ID_INVALID)
|
||||
: fid(val_fid)
|
||||
, rec_nr(val_rec_nr)
|
||||
{ }
|
||||
|
||||
FIDType fid;
|
||||
IDType rec_nr;
|
||||
};
|
||||
|
||||
// LengthInfo
|
||||
struct LengthInfo
|
||||
{
|
||||
LengthInfo(ulong _minLen = 0, ulong _maxLen = 0, ulong _storedLen = 0)
|
||||
: minLen(_minLen)
|
||||
, maxLen(_maxLen)
|
||||
, storedLen(_storedLen)
|
||||
{ }
|
||||
|
||||
void swap(LengthInfo& other)
|
||||
{
|
||||
std::swap(minLen, other.minLen);
|
||||
std::swap(storedLen, other.storedLen);
|
||||
std::swap(maxLen, other.maxLen);
|
||||
}
|
||||
|
||||
ulong minLen;
|
||||
ulong storedLen;
|
||||
ulong maxLen;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_TokenBase_h
|
||||
@@ -1,104 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actTokenConfig.h
|
||||
// Product: cv act library
|
||||
// Purpose: Declares all availabl param_id's for ITokenCofing.
|
||||
//
|
||||
// Copyright: (c) 2009 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 05/07/2009
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_TokenConfig_h
|
||||
#define ACT_TokenConfig_h
|
||||
|
||||
#include "actMode.h"
|
||||
#include "actIParam.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
// according to ISO 24727-3, definition of supported Data Set's
|
||||
enum DataSetList
|
||||
{
|
||||
DATA_SET_NONE = 0,
|
||||
DATA_SET_PUBLIC_DATA = (1 << 0),
|
||||
DATA_SET_PRIVATE_DATA = (1 << 1),
|
||||
DATA_SET_CERTIFICATES = (1 << 2),
|
||||
DATA_SET_USEFUL_CERTIFICATES = (1 << 3),
|
||||
DATA_SET_TRUSTED_CERTIFICATES = (1 << 4),
|
||||
DATA_SET_TRUSTED_PUBLIC_KEYS = (1 << 5),
|
||||
//
|
||||
// ...
|
||||
DATA_SET_NEXT = (1 << 6),
|
||||
DATA_SET_MASK = DATA_SET_NEXT - 1,
|
||||
DATA_SET_ALL = PARAM_INVALID_VALUE,
|
||||
};
|
||||
|
||||
enum ObjectTypeList
|
||||
{
|
||||
OBJECT_TYPE_NONE = 0,
|
||||
OBJECT_TYPE_KEY_DES = (1 << 0),
|
||||
OBJECT_TYPE_KEY_2DES = (1 << 1),
|
||||
OBJECT_TYPE_KEY_3DES = (1 << 2),
|
||||
OBJECT_TYPE_KEY_AES = (1 << 3),
|
||||
OBJECT_TYPE_KEY_RSA = (1 << 4),
|
||||
OBJECT_TYPE_KEY_DSA = (1 << 5),
|
||||
OBJECT_TYPE_KEY_DH = (1 << 6),
|
||||
OBJECT_TYPE_KEY_ECC = (1 << 7),
|
||||
OBJECT_TYPE_DATA = (1 << 8),
|
||||
OBJECT_TYPE_CERTIFICATE = (1 << 9),
|
||||
OBJECT_TYPE_USEFUL_CERTIFICATE = (1 << 10),
|
||||
OBJECT_TYPE_TRUSTED_CERTIFICATE = (1 << 11),
|
||||
OBJECT_TYPE_TRUSTED_PUBLIC_KEY = (1 << 12),
|
||||
//
|
||||
// Mark an object as private
|
||||
OBJECT_TYPE_PRVIVATE = (1 << 13),
|
||||
//
|
||||
// ...
|
||||
OBJECT_TYPE_NEXT = (1 << 14),
|
||||
OBJECT_TYPE_MASK = OBJECT_TYPE_NEXT - 1,
|
||||
OBJECT_TYPE_ALL = PARAM_INVALID_VALUE,
|
||||
};
|
||||
|
||||
enum ObjectAttributeList
|
||||
{
|
||||
OBJECT_ATTR_LABEL_P = OBJECT_TYPE_NEXT,
|
||||
OBJECT_ATTR_LABEL_P_PUB = OBJECT_ATTR_LABEL_P,
|
||||
OBJECT_ATTR_LABEL_P_PRV = OBJECT_ATTR_LABEL_P | OBJECT_TYPE_PRVIVATE,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TC_TYPE = TOKEN_CONFIG,
|
||||
TC_HAS_TOKEN_CAPABILITIES,
|
||||
TC_HAS_WRITABLE_AODF,
|
||||
TC_IS_MOC_ENABLED,
|
||||
TC_IS_MINIDRIVER_ENABLED,
|
||||
TC_IS_PROFILE_ERASABLE,
|
||||
TC_PINPAD_CHAR,
|
||||
TC_DATA_SET_LIST,
|
||||
TC_OBJECT_TYPE_LIST,
|
||||
//
|
||||
// Object naming - Label Prefix
|
||||
TC_LABEL_P_PRV_DES = OBJECT_ATTR_LABEL_P_PRV + OBJECT_TYPE_KEY_DES,
|
||||
TC_LABEL_P_PRV_2DES = OBJECT_ATTR_LABEL_P_PRV + OBJECT_TYPE_KEY_2DES,
|
||||
TC_LABEL_P_PRV_3DES = OBJECT_ATTR_LABEL_P_PRV + OBJECT_TYPE_KEY_3DES,
|
||||
TC_LABEL_P_PRV_AES = OBJECT_ATTR_LABEL_P_PRV + OBJECT_TYPE_KEY_AES,
|
||||
TC_LABEL_P_PUB_RSA = OBJECT_ATTR_LABEL_P_PUB + OBJECT_TYPE_KEY_RSA,
|
||||
TC_LABEL_P_PRV_RSA = OBJECT_ATTR_LABEL_P_PRV + OBJECT_TYPE_KEY_RSA,
|
||||
TC_LABEL_P_PUB_ECC = OBJECT_ATTR_LABEL_P_PUB + OBJECT_TYPE_KEY_ECC,
|
||||
TC_LABEL_P_PRV_ECC = OBJECT_ATTR_LABEL_P_PRV + OBJECT_TYPE_KEY_ECC,
|
||||
TC_LABEL_P_PUB_DATA = OBJECT_ATTR_LABEL_P_PUB + OBJECT_TYPE_DATA,
|
||||
TC_LABEL_P_PRV_DATA = OBJECT_ATTR_LABEL_P_PRV + OBJECT_TYPE_DATA,
|
||||
TC_LABEL_P_PUB_CERTIFICATE = OBJECT_ATTR_LABEL_P_PUB + OBJECT_TYPE_CERTIFICATE,
|
||||
TC_LABEL_P_PUB_USEFUL_CERTIFICATE = OBJECT_ATTR_LABEL_P_PUB + OBJECT_TYPE_USEFUL_CERTIFICATE,
|
||||
TC_LABEL_P_PUB_TRUSTED_CERTIFICATE = OBJECT_ATTR_LABEL_P_PUB + OBJECT_TYPE_TRUSTED_CERTIFICATE,
|
||||
TC_LABEL_P_PUB_TRUSTED_PUBLIC_KEY = OBJECT_ATTR_LABEL_P_PUB + OBJECT_TYPE_TRUSTED_PUBLIC_KEY,
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_TokenConfig_h
|
||||
@@ -1,28 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actTokenExtensionKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: Factory functions to create specific ITokenExtension objects.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 12/02/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_TokenExtensionKit_h
|
||||
#define ACT_TokenExtensionKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IToken;
|
||||
class ITokenExtension;
|
||||
|
||||
ITokenExtension* CreateMDProfileExt(const char* name, IToken*); // Minidriver
|
||||
ITokenExtension* CreateEACTAwithCAPI(const char* name, IToken*); // EACv2-TA with CAPI
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_TokenExtensionKit_h
|
||||
@@ -1,34 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actTokenExtensionReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: factory functions registry to create ITokenExtension objects.
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 12/02/2008
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_TokenExtensionReg_h
|
||||
#define ACT_TokenExtensionReg_h
|
||||
|
||||
#include "actFactoryReg.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IToken;
|
||||
class ITokenExtension;
|
||||
|
||||
typedef ITokenExtension* (*CreateTokenExtensionPtr)(const char*, IToken*);
|
||||
typedef FactoryMapEntry<CreateTokenExtensionPtr> TokenExtensionMapEntry;
|
||||
|
||||
typedef FactoryReg
|
||||
< ITokenExtension, CreateTokenExtensionPtr, TokenExtensionMapEntry
|
||||
> TokenExtensionReg;
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_TokenExtensionReg_h
|
||||
@@ -1,99 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actToolsECC.h
|
||||
// Product: cv act library
|
||||
// Purpose: useful ECC functions
|
||||
//
|
||||
// Copyright: (c) 2009 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_ToolsECC_h
|
||||
#define ACT_ToolsECC_h
|
||||
|
||||
#include "actMode.h"
|
||||
#include "actBlob.h"
|
||||
#include "actIKey.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
// Functions for ECC scalar multiplication, addition of points.
|
||||
// Input points must be in ASN.1 point representation (uncompressed,
|
||||
// compressed or hybrid). The output point will be in ASN.1 representation
|
||||
// as indicated in 'output_format'.
|
||||
//
|
||||
// 1) Calculate s * Q, s unsigned in ASN.1 OCTET STRING representation
|
||||
// (leading zeros will be ignored)
|
||||
Blob ECMultiplyPoint(IKey* ec_key, const Blob& s, const Blob& Q,
|
||||
int output_format = UNCOMPRESSED);
|
||||
// 2) Calculate Q1 + Q2
|
||||
Blob ECAddPoints(IKey* ec_key, const Blob& Q1, const Blob& Q2,
|
||||
int output_format = UNCOMPRESSED);
|
||||
|
||||
|
||||
// Functions to encode an (EC-)DSA signature (r, s) in ASN1 format and backwards.
|
||||
//
|
||||
// 1) Plain signature I/O as string
|
||||
// - for encode: r and s must be in hex notation
|
||||
// - for decode: the user has to allocate r and s buffers
|
||||
void EncodeSignature(const char* r, const char* s, Blob& signature_ASN1);
|
||||
void DecodeSignature(const Blob& signature_ASN1, char* r, char* s);
|
||||
// 2) Plain signature I/O as byte array (Blob)
|
||||
// - r and s I/O in big endian representation
|
||||
void EncodeSignature(const Blob& r, const Blob& s, Blob& signature_ASN1);
|
||||
void DecodeSignature(const Blob& signature_ASN1, Blob& r, Blob& s);
|
||||
// 3) Plain signature I/O as byte array (Blob)
|
||||
// - r_s length even, left haft = r, right half = s
|
||||
// - if order_bytes is non zero, decode output length is 2 * order_bytes
|
||||
void EncodeSignature(const Blob& r_s, Blob& signature_ASN1);
|
||||
void DecodeSignature(const Blob& signature_ASN1, Blob& r_s, size_t order_bytes = 0);
|
||||
|
||||
|
||||
// Tools for elliptic curves over GF(P).
|
||||
// The basepoint can be given by it's coordinates (Gx, Gy) or as
|
||||
// COMPRESSED, UNCOMPRESSED or HYBRID octetstring G corresponding
|
||||
// to ANSI X9.62/63 standard.
|
||||
// By default, the basepoint will be encoded in UNCOMPRESSED format.
|
||||
|
||||
Blob EncodePrimeCurveParam(const Blob& p, const Blob& a, const Blob& b,
|
||||
const Blob& Gx, const Blob& Gy, const Blob& n, const Blob& h,
|
||||
int output_type = UNCOMPRESSED);
|
||||
|
||||
Blob EncodePrimeCurveParam(const Blob& p, const Blob& a, const Blob& b,
|
||||
const Blob& G, const Blob& n, const Blob& h, int output_type = UNCOMPRESSED);
|
||||
|
||||
// dto. for elliptic curves over GF(2^m), tri- or pentanomial basis.
|
||||
|
||||
// tri- or pentanomial in hex presentation
|
||||
Blob EncodeGF2CurveParam(const Blob& p, const Blob& a, const Blob& b,
|
||||
const Blob& Gx, const Blob& Gy, const Blob& n, const Blob& h,
|
||||
int output_type = UNCOMPRESSED);
|
||||
|
||||
// tri- or pentanomial in hex presentation
|
||||
Blob EncodeGF2CurveParam(const Blob& p, const Blob& a, const Blob& b,
|
||||
const Blob& G, const Blob& n, const Blob& h, int output_type = UNCOMPRESSED);
|
||||
|
||||
// f(t) = t^m + t^k + 1
|
||||
Blob EncodeTrinomialCurveParam(const int m, const int k,
|
||||
const Blob& a, const Blob& b, const Blob& Gx, const Blob& Gy,
|
||||
const Blob& n, const Blob& h, int output_type = UNCOMPRESSED);
|
||||
|
||||
// f(t) = t^m + t^k + 1
|
||||
Blob EncodeTrinomialCurveParam(const int m, const int k,
|
||||
const Blob& a, const Blob& b, const Blob& G, const Blob& n,
|
||||
const Blob& h, int output_type = UNCOMPRESSED);
|
||||
|
||||
// f(t) = t^m + t^k3 + t^k2 + t^k1 + 1
|
||||
Blob EncodePentanomialCurveParam(const int m, const int k3, const int k2,
|
||||
const int k1, const Blob& a, const Blob& b, const Blob& Gx, const Blob& Gy,
|
||||
const Blob& n, const Blob& h, int output_type = UNCOMPRESSED);
|
||||
|
||||
// f(t) = t^m + t^k3 + t^k2 + t^k1 + 1
|
||||
Blob EncodePentanomialCurveParam(const int m, const int k3, const int k2,
|
||||
const int k1, const Blob& a, const Blob& b, const Blob& G,
|
||||
const Blob& n, const Blob& h, int output_type = UNCOMPRESSED);
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_ToolsECC_h
|
||||
@@ -1,19 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actToolsRSA.h
|
||||
// Product: cv act library
|
||||
// Purpose: useful RSA functions
|
||||
//
|
||||
// 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_TOOLS_RSA_H
|
||||
#define ACT_TOOLS_RSA_H
|
||||
|
||||
#include "actTools.h"
|
||||
|
||||
// TODO: MTE: Move all RSA functions from "actTools.h" to here! include inside "actTools.h"
|
||||
|
||||
#endif // ACT_TOOLS_RSA_H
|
||||
@@ -1,32 +0,0 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: actTypeTags.h
|
||||
// Product: cv act library
|
||||
// Purpose: TypeTag<> and usibility forward declarations.
|
||||
//
|
||||
// Copyright: (c) 2010 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche
|
||||
// Date: 09/10/2010
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ACT_TypeTags_h
|
||||
#define ACT_TypeTags_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
//
|
||||
// TypeTag<>
|
||||
template<typename TypeT>
|
||||
struct TypeTag { typedef TypeT Type; };
|
||||
|
||||
//
|
||||
// CloneFactory<>
|
||||
template<typename Tag, typename P1 = void, typename P2 = void, typename P3 = void>
|
||||
struct CloneFactory;
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_TypeTags_h
|
||||
@@ -1,50 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actX509Extension.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// 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_X509Extension_H
|
||||
#define ACT_X509Extension_H
|
||||
|
||||
#include "actBlob.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class X509Extension
|
||||
{
|
||||
public:
|
||||
X509Extension();
|
||||
X509Extension(const Blob& oid, const Blob& value, bool critflag);
|
||||
X509Extension(const char* oid, const Blob& value, bool critflag);
|
||||
|
||||
void GetOID(Blob& oid) const;
|
||||
void GetOIDString(Blob& oid) const;
|
||||
void SetOID(const Blob& oid);
|
||||
void SetOIDString(const char* oid);
|
||||
|
||||
void GetValue(Blob& value) const;
|
||||
void SetValue(const Blob& value);
|
||||
|
||||
bool IsCritical() const;
|
||||
void SetCritical(bool crit = true);
|
||||
|
||||
void GetDER(Blob& der) const;
|
||||
void SetDER(const Blob& der);
|
||||
|
||||
bool IsPresent() { return mValue.size() > 0; }
|
||||
|
||||
private:
|
||||
Blob mOID;
|
||||
Blob mValue;
|
||||
bool mCrit;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_X509Extension_H
|
||||
@@ -1,48 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actX509KeyReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions in actX509Kit.h
|
||||
//
|
||||
// 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_X509KeyReg_h
|
||||
#define ACT_X509KeyReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IKey;
|
||||
class Blob;
|
||||
|
||||
typedef IKey* (*CreateKeyPtr)();
|
||||
typedef void (*X509ToKeyPtr)(const Blob& pkinfo, IKey* key);
|
||||
typedef void (*KeyToX509Ptr)(const IKey* key, Blob& pkinfo );
|
||||
|
||||
struct X509KeyMapEntry
|
||||
{
|
||||
const char* OID;
|
||||
CreateKeyPtr CreatePtr;
|
||||
X509ToKeyPtr X509ToKey;
|
||||
KeyToX509Ptr KeyToX509;
|
||||
};
|
||||
|
||||
class X509KeyReg
|
||||
{
|
||||
public:
|
||||
static IKey* CreateX509Key(const Blob& pkInfo);
|
||||
static void GetX509KeyInfo(const IKey* key, Blob& pkInfo);
|
||||
|
||||
static CreateKeyPtr GetCreatePointer(const char* oid);
|
||||
static const char* GetOID(void* createptr);
|
||||
static const char* GetNextOID(const char* oid);
|
||||
|
||||
static void Insert(const char* name, CreateKeyPtr createptr, X509ToKeyPtr x509tokey, KeyToX509Ptr keytox509);
|
||||
static void Insert(const X509KeyMapEntry* keymap);
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_X509KeyReg_h
|
||||
@@ -1,45 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actX509Kit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// 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_X509Kit_h
|
||||
#define ACT_X509Kit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Blob;
|
||||
class IKey;
|
||||
|
||||
void X509ToRSA(const Blob& pkinfo, IKey* key);
|
||||
void RSAToX509(const IKey* key, Blob& pkinfo);
|
||||
void RSAGetAlgID(const IKey* key, Blob& algid);
|
||||
void RSASetAlgID(const Blob& algid, IKey* key );
|
||||
|
||||
void X509ToDSA(const Blob& pkinfo, IKey* key);
|
||||
void DSAToX509(const IKey* key, Blob& pkinfo);
|
||||
void DSAGetAlgID(const IKey* key, Blob& algid);
|
||||
void DSASetAlgID(const Blob& algid, IKey* key );
|
||||
|
||||
void X509ToECDSA(const Blob& pkinfo, IKey* key);
|
||||
void ECDSAToX509(const IKey* key, Blob& pkinfo);
|
||||
void ECDSAGetAlgID(const IKey* key, Blob& algid);
|
||||
void ECDSASetAlgID(const Blob& algid, IKey* key );
|
||||
|
||||
void X509ToDH(const Blob& pkinfo, IKey* key);
|
||||
void DHToX509(const IKey* key, Blob& pkinfo);
|
||||
void DHGetAlgID(const IKey* key, Blob& algid);
|
||||
void DHSetAlgID(const Blob& algid, IKey* key );
|
||||
|
||||
void ECDHGetAlgID(const IKey* key, Blob& algid);
|
||||
void ECDHSetAlgID(const Blob& algid, IKey* key );
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actX509SignHashReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions in actX509Kit.h
|
||||
//
|
||||
// Copyright: (c) 2000-2001 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_X509SignHashReg_h
|
||||
#define ACT_X509SignHashReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Blob;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
struct X509SignHashMapEntry {
|
||||
const char* OID;
|
||||
const char* HashAlg;
|
||||
const char* SignAlg;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
class X509SignHashReg
|
||||
{
|
||||
public:
|
||||
static void GetOID(const char* algo, const char* sign_algo, Blob& algid);
|
||||
static const char* GetHashAlg(const Blob& algid);
|
||||
static const char* GetSignAlg(const Blob& algid);
|
||||
static void Insert(const X509SignHashMapEntry* map);
|
||||
|
||||
static const char* GetHashAlg(const Blob& algid, const char* sign_algo); // deprecated
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actX509SignReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions in actX509Kit.h
|
||||
//
|
||||
// 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_X509SignReg_h
|
||||
#define ACT_X509SignReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IKey;
|
||||
class Blob;
|
||||
|
||||
typedef IKey* (*CreateKeyPtr)();
|
||||
typedef void (*GetX509AlgIDPtr)(const IKey* key, Blob& algid);
|
||||
typedef void (*SetX509AlgIDPtr)(const Blob& algid, IKey* key);
|
||||
|
||||
struct X509SignMapEntry {
|
||||
CreateKeyPtr CreatePtr;
|
||||
GetX509AlgIDPtr GetAlgID;
|
||||
SetX509AlgIDPtr SetAlgID;
|
||||
};
|
||||
|
||||
class X509SignReg
|
||||
{
|
||||
public:
|
||||
static void GetAlgID(const IKey* key, Blob& algid);
|
||||
static void SetAlgID(const Blob& algid, IKey* key);
|
||||
|
||||
static void Insert(CreateKeyPtr createptr, GetX509AlgIDPtr getalgid, SetX509AlgIDPtr setalgid );
|
||||
static void Insert(const X509SignMapEntry* keymap);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actAlgorithm.h
|
||||
// Product: cv act library
|
||||
// Purpose: The class Algorithm generates algorithms for encryption and signing.
|
||||
// The class Key defined these algorithms. By using this handle the
|
||||
// necessary methods (e.g. hash-algorithms, verifying-primitiva, etc.)
|
||||
// can be generated.
|
||||
//
|
||||
// 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_Algorithm_h
|
||||
#define ACT_Algorithm_h
|
||||
|
||||
#include "actBasics.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IAlgorithm;
|
||||
class IKey;
|
||||
class Blob;
|
||||
|
||||
class Algorithm
|
||||
{
|
||||
private:
|
||||
Algorithm(const Algorithm&);
|
||||
Algorithm &operator=(const Algorithm&);
|
||||
|
||||
public:
|
||||
Algorithm(IAlgorithm* alg);
|
||||
Algorithm(const IKey* key, mode_t mode);
|
||||
Algorithm(const IKey* key, mode_t mode, const Blob& data);
|
||||
Algorithm(const char* name);
|
||||
~Algorithm();
|
||||
|
||||
void Write(const Blob& indata);
|
||||
void Write(const byte* indata, size_t insize);
|
||||
|
||||
void Finalize();
|
||||
|
||||
size_t Read(Blob& outdata, size_t max = 0);
|
||||
size_t Read(byte* outbuffer, size_t buffersize);
|
||||
|
||||
size_t GetAvailableSize() const;
|
||||
status_t GetStatus() const;
|
||||
|
||||
Algorithm& operator<<(const Blob& indata) { Write(indata); return *this; }
|
||||
Algorithm& operator<<(Algorithm& (*manipulator)(Algorithm &alg)) { return manipulator(*this); }
|
||||
Algorithm& operator>>(Blob& outdata) { Read(outdata); return *this; }
|
||||
|
||||
operator IAlgorithm*();
|
||||
operator const IAlgorithm* () const;
|
||||
IAlgorithm* GetPointer();
|
||||
const IAlgorithm* GetPointer() const;
|
||||
|
||||
IAlgorithm* ReleasePointer();
|
||||
|
||||
private:
|
||||
IAlgorithm* mAlg;
|
||||
};
|
||||
|
||||
inline Algorithm& final(Algorithm& alg)
|
||||
{
|
||||
alg.Finalize();
|
||||
return alg;
|
||||
}
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Algorithm_h
|
||||
@@ -1,107 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actAllocator.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// Copyright: (c) 2008 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche (MTE)
|
||||
// Date: 09/29/2008
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ACT_Allocator_h
|
||||
#define ACT_Allocator_h
|
||||
|
||||
#include "actBasics.h"
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
namespace act
|
||||
{
|
||||
//
|
||||
// Allocator<>
|
||||
template<typename TypeT, typename SizeT>
|
||||
class Allocator
|
||||
{
|
||||
public:
|
||||
typedef SizeT size_type;
|
||||
typedef TypeT value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
protected:
|
||||
typedef Allocator<TypeT, SizeT> ThisT;
|
||||
typedef pointer (*fptr_allocate)(ThisT*, size_type n, const void* hint);
|
||||
typedef void (*fptr_deallocate)(ThisT*, pointer p, size_type n);
|
||||
|
||||
private:
|
||||
Allocator(const Allocator&);
|
||||
Allocator& operator=(const Allocator&);
|
||||
|
||||
protected:
|
||||
Allocator(fptr_allocate pAllocate, fptr_deallocate pDeallocate) throw()
|
||||
: m_pAllocate(pAllocate)
|
||||
, m_pDeallocate(pDeallocate)
|
||||
{ }
|
||||
|
||||
public:
|
||||
inline pointer allocate(size_type n, const void* hint)
|
||||
{
|
||||
return m_pAllocate(this, n, hint);
|
||||
}
|
||||
|
||||
inline void deallocate(pointer p, size_type n)
|
||||
{
|
||||
if(p != 0) m_pDeallocate(this, p, n);
|
||||
}
|
||||
|
||||
protected:
|
||||
fptr_allocate m_pAllocate;
|
||||
fptr_deallocate m_pDeallocate;
|
||||
};
|
||||
|
||||
//
|
||||
// AllocatorImpl<>
|
||||
template
|
||||
<
|
||||
class AllocatorT,
|
||||
class BaseT = Allocator<typename AllocatorT::value_type, typename AllocatorT::size_type>
|
||||
>
|
||||
class AllocatorImpl : public BaseT
|
||||
{
|
||||
public:
|
||||
typedef typename BaseT::pointer pointer;
|
||||
typedef typename BaseT::size_type size_type;
|
||||
|
||||
protected:
|
||||
typedef AllocatorImpl<AllocatorT, BaseT> ThisT;
|
||||
|
||||
public:
|
||||
AllocatorImpl() throw()
|
||||
: BaseT(_allocate, _deallocate)
|
||||
{ }
|
||||
|
||||
AllocatorT& ref_alloc() { return m_Alloc; }
|
||||
|
||||
private:
|
||||
inline static pointer _allocate(BaseT* pThis, size_type n, const void* hint)
|
||||
{
|
||||
return static_cast<ThisT*>(pThis)->m_Alloc.allocate(n, hint);
|
||||
}
|
||||
|
||||
inline static void _deallocate(BaseT* pThis, pointer p, size_type n)
|
||||
{
|
||||
static_cast<ThisT*>(pThis)->m_Alloc.deallocate(p, n);
|
||||
}
|
||||
|
||||
private:
|
||||
AllocatorT m_Alloc;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Allocator_h
|
||||
@@ -1,644 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actBlob.h
|
||||
// Product: cv act library
|
||||
// Purpose: The datatype Blob (Binary Large Object) is a universal type, which
|
||||
// can be used for any data. The class Blob almost behaves like
|
||||
// std::vector<unsigned char> with the difference that freed memory
|
||||
// is filled with zeros to enhance security.
|
||||
//
|
||||
// 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_Blob_h
|
||||
#define ACT_Blob_h
|
||||
|
||||
#include "actMove.h"
|
||||
#include "actBasics.h"
|
||||
#include "actAllocator.h"
|
||||
|
||||
#ifndef UNDER_CE_30
|
||||
# include <iostream>
|
||||
#endif // UNDER_CE_30
|
||||
|
||||
#ifndef NO_STL_SUPPORT
|
||||
# include <utility> // used for reserve_iterator
|
||||
# include <string> // used for string
|
||||
#else
|
||||
// --------------------------------------------------------------------------------
|
||||
// if there is no STL support, we define reverse_iterator here.
|
||||
// --------------------------------------------------------------------------------
|
||||
namespace std
|
||||
{
|
||||
// ITERATOR TAGS (from <iterator>)
|
||||
struct input_iterator_tag {};
|
||||
struct output_iterator_tag {};
|
||||
struct forward_iterator_tag
|
||||
: public input_iterator_tag {};
|
||||
struct bidirectional_iterator_tag
|
||||
: public forward_iterator_tag {};
|
||||
struct random_access_iterator_tag
|
||||
: public bidirectional_iterator_tag {};
|
||||
|
||||
// TEMPLATE CLASS iterator (from <iterator>)
|
||||
template<class _C, class _Ty, class _D = ptrdiff_t>
|
||||
struct iterator {
|
||||
typedef _C iterator_category;
|
||||
typedef _Ty value_type;
|
||||
typedef _D distance_type;
|
||||
};
|
||||
template<class _Ty, class _D>
|
||||
struct _Bidit : public iterator<bidirectional_iterator_tag,
|
||||
_Ty, _D> {};
|
||||
template<class _Ty, class _D>
|
||||
struct _Ranit : public iterator<random_access_iterator_tag,
|
||||
_Ty, _D> {};
|
||||
|
||||
// TEMPLATE CLASS iterator_traits (from <iterator>)
|
||||
template<class _It>
|
||||
struct iterator_traits {
|
||||
typedef _It::iterator_category iterator_category;
|
||||
typedef _It::value_type value_type;
|
||||
typedef _It::distance_type distance_type;
|
||||
};
|
||||
|
||||
|
||||
// TEMPLATE CLASS reverse_iterator (from <iterator>)
|
||||
template<class _RI,
|
||||
class _Ty,
|
||||
class _Rt = _Ty&,
|
||||
class _Pt = _Ty *,
|
||||
class _D = int>
|
||||
class reverse_iterator : public _Ranit<_Ty, _D> {
|
||||
public:
|
||||
typedef reverse_iterator<_RI, _Ty, _Rt, _Pt, _D> _Myt;
|
||||
typedef _RI iter_type;
|
||||
typedef _Rt reference_type;
|
||||
typedef _Pt pointer_type;
|
||||
reverse_iterator()
|
||||
{}
|
||||
explicit reverse_iterator(_RI _X)
|
||||
: current(_X) {}
|
||||
_RI base() const
|
||||
{return(current); }
|
||||
_Rt operator*() const
|
||||
{return(*(current - 1)); }
|
||||
// _Pt operator->() const
|
||||
// {return(&**this); }
|
||||
_Myt& operator++()
|
||||
{--current;
|
||||
return(*this); }
|
||||
_Myt operator++(int)
|
||||
{_Myt _Tmp = *this;
|
||||
--current;
|
||||
return(_Tmp); }
|
||||
_Myt& operator--()
|
||||
{++current;
|
||||
return(*this); }
|
||||
_Myt operator--(int)
|
||||
{_Myt _Tmp = *this;
|
||||
++current;
|
||||
return(_Tmp); }
|
||||
_Myt& operator+=(_D _N)
|
||||
{current -= _N;
|
||||
return(*this); }
|
||||
_Myt operator+(_D _N) const
|
||||
{return(_Myt(current - _N)); }
|
||||
_Myt& operator-=(_D _N)
|
||||
{current += _N;
|
||||
return(*this); }
|
||||
_Myt operator-(_D _N) const
|
||||
{return(_Myt(current + _N)); }
|
||||
_Rt operator[](_D _N) const
|
||||
{return(*(*this + _N)); }
|
||||
protected:
|
||||
_RI current;
|
||||
};
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator==(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(get_base(_X) == get_base(_Y)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator!=(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(!(_X == _Y)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator<(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(get_base(_Y) < get_base(_X)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator>(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(_Y < _X); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator<=(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(!(_Y < _X)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
bool __cdecl operator>=(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(!(_X < _Y)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
_D __cdecl operator-(
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _X,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(get_base(_Y) - get_base(_X)); }
|
||||
template<class _RI, class _Ty, class _Rt, class _Pt,
|
||||
class _D> inline
|
||||
reverse_iterator<_RI, _Ty, _Rt, _Pt, _D> __cdecl operator+(_D _N,
|
||||
const reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>& _Y)
|
||||
{return(reverse_iterator<_RI, _Ty, _Rt, _Pt, _D>(
|
||||
get_base(_Y) - _N)); }
|
||||
} // namespace std
|
||||
|
||||
#endif //NO_STL_SUPPORT
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
namespace act
|
||||
{
|
||||
//
|
||||
// byte_array for fixed data
|
||||
struct byte_array
|
||||
{
|
||||
const act::byte* value;
|
||||
const size_t size;
|
||||
};
|
||||
|
||||
inline byte_array make_array(const act::byte* value = 0, size_t size = 0)
|
||||
{
|
||||
const byte_array ba = { value, size };
|
||||
return ba;
|
||||
};
|
||||
|
||||
#ifndef ACT_NO_BYTE_ARRAY_MACROS
|
||||
# define _A(x) x.value, x.size
|
||||
# define _B(x) act::make_array(reinterpret_cast<const act::byte*>(x), sizeof(x) - sizeof(x[0]))
|
||||
# define _C(x) act::make_array(reinterpret_cast<const act::byte*>(x), sizeof(x))
|
||||
# define _H(x) { (const act::byte*) x, sizeof(x) - sizeof(x[0]) }
|
||||
#endif
|
||||
|
||||
#if(_MSC_VER >= 1300)
|
||||
template
|
||||
<
|
||||
class _Ty,
|
||||
class _Diff,
|
||||
class _Pointer,
|
||||
class _Reference,
|
||||
class _Pointer2,
|
||||
class _Reference2
|
||||
>
|
||||
class _Ptrit :
|
||||
public std::iterator<std::random_access_iterator_tag, _Ty, _Diff, _Pointer, _Reference>
|
||||
{ // wrap pointer as random-access iterator
|
||||
public:
|
||||
typedef _Ptrit<_Ty, _Diff, _Pointer, _Reference, _Pointer2, _Reference2> _Myt;
|
||||
|
||||
_Ptrit()
|
||||
{ // construct with uninitialized wrapped pointer
|
||||
}
|
||||
|
||||
_Ptrit(_Pointer _Ptr) : current(_Ptr)
|
||||
{ // construct wrapped pointer from _Ptr
|
||||
}
|
||||
|
||||
_Ptrit(const _Ptrit<_Ty, _Diff, _Pointer2, _Reference2, _Pointer2, _Reference2>& _Iter)
|
||||
: current(_Iter.base())
|
||||
{ // const converter or copy constructor
|
||||
}
|
||||
|
||||
_Pointer base() const
|
||||
{ // return wrapped pointer
|
||||
return current;
|
||||
}
|
||||
|
||||
_Reference operator*() const
|
||||
{ // return designated value
|
||||
return *current;
|
||||
}
|
||||
|
||||
_Pointer operator->() const
|
||||
{ // return pointer to class object
|
||||
return &**this;
|
||||
}
|
||||
|
||||
_Myt& operator++()
|
||||
{ // preincrement
|
||||
++current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Myt operator++(int)
|
||||
{ // postincrement
|
||||
_Myt _Tmp = *this;
|
||||
++current;
|
||||
return _Tmp;
|
||||
}
|
||||
|
||||
_Myt& operator--()
|
||||
{ // predecrement
|
||||
--current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Myt operator--(int)
|
||||
{ // postdecrement
|
||||
_Myt _Tmp = *this;
|
||||
--current;
|
||||
return _Tmp;
|
||||
}
|
||||
|
||||
bool operator==(size_t _Right) const
|
||||
{ // test if wrapped pointer == integer (null pointer constant)
|
||||
return current == (_Pointer) _Right;
|
||||
}
|
||||
|
||||
bool operator==(const _Myt& _Right) const
|
||||
{ // test for iterator equality
|
||||
return current == _Right.current;
|
||||
}
|
||||
|
||||
bool operator!=(const _Myt& _Right) const
|
||||
{ // test for iterator inequality
|
||||
return !(*this == _Right);
|
||||
}
|
||||
|
||||
_Myt& operator+=(_Diff _Off)
|
||||
{ // increment by integer
|
||||
current += _Off;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Myt operator+(_Diff _Off) const
|
||||
{ // return this + integer
|
||||
return _Myt(current + _Off);
|
||||
}
|
||||
|
||||
_Myt& operator-=(_Diff _Off)
|
||||
{ // decrement by integer
|
||||
current -= _Off;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_Myt operator-(_Diff _Off) const
|
||||
{ // return this - integer
|
||||
return _Myt(current - _Off);
|
||||
}
|
||||
|
||||
_Reference operator[](_Diff _Off) const
|
||||
{ // subscript
|
||||
return *(*this + _Off);
|
||||
}
|
||||
|
||||
bool operator<(const _Myt& _Right) const
|
||||
{ // test if this < _Right
|
||||
return current < _Right.current;
|
||||
}
|
||||
|
||||
bool operator>(const _Myt& _Right) const
|
||||
{ // test if this > _Right
|
||||
return _Right < *this;
|
||||
}
|
||||
|
||||
bool operator<=(const _Myt& _Right) const
|
||||
{ // test if this <= _Right
|
||||
return !(_Right < *this);
|
||||
}
|
||||
|
||||
bool operator>=(const _Myt& _Right) const
|
||||
{ // test if this >= _Right
|
||||
return !(*this < _Right);
|
||||
}
|
||||
|
||||
_Diff operator-(const _Myt& _Right) const
|
||||
{ // return difference of iterators
|
||||
return current - _Right.current;
|
||||
}
|
||||
|
||||
protected:
|
||||
_Pointer current; // the wrapped pointer
|
||||
};
|
||||
|
||||
#endif // _MSC_VER >= 1300
|
||||
|
||||
//
|
||||
// Blob
|
||||
class Blob
|
||||
{
|
||||
protected:
|
||||
struct flags
|
||||
{
|
||||
byte copy_on_write:1;
|
||||
byte external_allocated:1;
|
||||
|
||||
flags() throw()
|
||||
: copy_on_write(0)
|
||||
, external_allocated(0)
|
||||
{ }
|
||||
};
|
||||
|
||||
public:
|
||||
typedef Allocator<byte, size_t> _Alloc;
|
||||
typedef _Alloc allocator_type;
|
||||
typedef _Alloc::size_type size_type;
|
||||
typedef _Alloc::value_type value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef const value_type& const_reference;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
#if(_MSC_VER >= 1300)
|
||||
typedef _Ptrit
|
||||
< value_type, difference_type, pointer, reference, pointer, reference
|
||||
> iterator;
|
||||
|
||||
typedef _Ptrit
|
||||
< value_type, difference_type, const_pointer, const_reference, pointer, reference
|
||||
> const_iterator;
|
||||
|
||||
inline static pointer get_base(iterator it) { return it.base(); }
|
||||
inline static const_pointer get_base(const_iterator it) { return it.base(); }
|
||||
|
||||
#else
|
||||
typedef byte* iterator;
|
||||
typedef const byte* const_iterator;
|
||||
|
||||
inline static pointer get_base(iterator it) { return it; }
|
||||
inline static const_pointer get_base(const_iterator it) { return it; }
|
||||
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER >= 1200) && (_MSC_VER < 1300)
|
||||
typedef std::reverse_iterator
|
||||
< iterator, value_type, reference, pointer, difference_type
|
||||
> reverse_iterator;
|
||||
|
||||
typedef std::reverse_iterator
|
||||
< const_iterator, value_type, const_reference, const_pointer, difference_type
|
||||
> const_reverse_iterator;
|
||||
|
||||
#else
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
#endif
|
||||
// construct/copy/destroy
|
||||
Blob();
|
||||
|
||||
explicit Blob(allocator_type* allocator);
|
||||
explicit Blob(const char* str, allocator_type* allocator = dAllocator);
|
||||
|
||||
#ifndef NO_STL_SUPPORT
|
||||
explicit Blob(std::string& str, allocator_type* allocator = dAllocator);
|
||||
explicit Blob(const std::string& str, allocator_type* allocator = dAllocator);
|
||||
#endif // NO_STL_SUPPORT
|
||||
|
||||
explicit Blob(const byte_array& ba, allocator_type* allocator = dAllocator);
|
||||
explicit Blob(size_type n, byte v = byte(0), allocator_type* allocator = dAllocator);
|
||||
|
||||
template<class inputit>
|
||||
Blob(inputit f, inputit l, allocator_type* allocator = dAllocator)
|
||||
: mFirst(0), mLast(0), mEnd(0), mAllocator(allocator)
|
||||
{
|
||||
insert(begin(), f, l);
|
||||
}
|
||||
|
||||
Blob(move_from<Blob> other);
|
||||
Blob(const Blob& other);
|
||||
~Blob();
|
||||
|
||||
Blob& operator=(const Blob& other);
|
||||
Blob& operator=(move_from<Blob> other);
|
||||
|
||||
template<class inputit>
|
||||
void assign(inputit f, inputit l)
|
||||
{
|
||||
erase(begin(), end());
|
||||
insert(begin(), f, l);
|
||||
}
|
||||
|
||||
void assign(const byte_array& ba);
|
||||
void assign(size_type n, byte x = byte(0));
|
||||
|
||||
// capacity
|
||||
bool empty() const { return size() == 0; }
|
||||
size_type size() const { return mFirst == 0 ? 0 : mLast - mFirst; }
|
||||
size_type capacity() const { return mFirst == 0 ? 0 : mEnd - mFirst; }
|
||||
size_type max_size() const;
|
||||
void reserve(size_type n);
|
||||
void resize(size_type n, byte x = byte(0));
|
||||
|
||||
// iterators
|
||||
iterator begin() { return mFirst; }
|
||||
const_iterator begin() const { return const_iterator(mFirst); }
|
||||
iterator end() { return mLast; }
|
||||
const_iterator end() const { return const_iterator(mLast); }
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
||||
|
||||
|
||||
// element access:
|
||||
reference at(size_type p);
|
||||
const_reference at(size_type p) const;
|
||||
reference operator[](size_type p) { return *(begin() + p); }
|
||||
const_reference operator[](size_type p) const { return *(begin() + p); }
|
||||
|
||||
reference front() { return *begin(); }
|
||||
const_reference front() const { return *begin(); }
|
||||
reference back() { return *(end() - 1); }
|
||||
const_reference back() const { return *(end() - 1); }
|
||||
|
||||
// modifiers
|
||||
void push_back(byte x) { insert(end(), x); }
|
||||
void pop_back() { erase(end() - 1); }
|
||||
|
||||
void insert(iterator p, size_type m, byte x);
|
||||
iterator insert(iterator p, byte x = byte(0));
|
||||
|
||||
template<class inputit>
|
||||
void insert(iterator p, inputit f, inputit l)
|
||||
{
|
||||
size_type m = 0;
|
||||
_distance(f, l, m);
|
||||
if(size_type(mEnd - mLast) < m)
|
||||
{
|
||||
size_type n = size();
|
||||
n = aligned_size(n + (m < n ? n : m));
|
||||
iterator s = allocate(n, (void*) 0);
|
||||
iterator q = ucopy(mFirst, p, s);
|
||||
q = ucopy(f, l, q);
|
||||
ucopy(p, mLast, q);
|
||||
_destroy(mFirst, mLast);
|
||||
deallocate(get_base(mFirst), mEnd - mFirst);
|
||||
mEnd = s + n;
|
||||
mLast = s + size() + m;
|
||||
mFirst = s;
|
||||
}
|
||||
else if(size_type(mLast - p) < m)
|
||||
{
|
||||
ucopy(p, mLast, p + m);
|
||||
ucopy(f + (mLast - p), l, mLast);
|
||||
copy(f, f + (mLast - p), p);
|
||||
mLast += m;
|
||||
}
|
||||
else if(0 < m)
|
||||
{
|
||||
ucopy(mLast - m, mLast, mLast);
|
||||
copy_backward(p, mLast - m, mLast);
|
||||
copy(f, l, p);
|
||||
mLast += m;
|
||||
}
|
||||
}
|
||||
|
||||
Blob& append(const Blob& x)
|
||||
{
|
||||
insert(end(), x.begin(), x.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
Blob& append(size_type m, byte x)
|
||||
{
|
||||
insert(end(), m, x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class inputit>
|
||||
Blob& append(inputit f, inputit l)
|
||||
{
|
||||
insert(end(), f, l);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator erase(iterator p);
|
||||
iterator erase(iterator f, iterator l);
|
||||
void clear();
|
||||
void swap(Blob& x);
|
||||
|
||||
// used by compare operators
|
||||
bool _eq(const Blob& x) const;
|
||||
bool _lt(const Blob& x) const;
|
||||
|
||||
allocator_type* get_allocator() const { return mAllocator; }
|
||||
static allocator_type* set_default_allocator(allocator_type* allocator)
|
||||
{
|
||||
std::swap(dAllocator, allocator);
|
||||
return allocator;
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename inputit, typename outputit>
|
||||
outputit copy(inputit f, inputit l, outputit x)
|
||||
{
|
||||
for(; f != l; ++x, ++f)
|
||||
*x = *f;
|
||||
return x;
|
||||
}
|
||||
|
||||
iterator copy_backward(const_iterator f, const_iterator l, iterator x);
|
||||
|
||||
template<typename inputit, typename outputit>
|
||||
outputit ucopy(inputit f, inputit l, outputit p)
|
||||
{
|
||||
for(; f != l; ++p, ++f)
|
||||
construct(get_base(p), *f);
|
||||
return p;
|
||||
}
|
||||
|
||||
void fill(iterator f, const_iterator l, byte x);
|
||||
void ufill(iterator f, size_type n, byte x);
|
||||
|
||||
size_type distance(const_iterator f, const_iterator l) const;
|
||||
|
||||
template<typename inputit>
|
||||
void _distance(inputit f, inputit l, size_type& n) const
|
||||
{
|
||||
for(; f != l; ++f)
|
||||
++n;
|
||||
}
|
||||
|
||||
bool equal(const_iterator f, const_iterator l, const_iterator x) const;
|
||||
bool lexicographical_compare(const_iterator f1, const_iterator l1, const_iterator f2, const_iterator l2) const;
|
||||
|
||||
byte* allocate(size_type n, const void* hint);
|
||||
void deallocate(pointer p, size_type n);
|
||||
|
||||
void construct(byte* p, const_reference v) { *p = v; }
|
||||
void destroy(byte* p) { *p = 0; }
|
||||
|
||||
void _destroy(iterator f, iterator l);
|
||||
|
||||
void outofrange() const;
|
||||
|
||||
static size_type aligned_size(size_type size);
|
||||
|
||||
protected:
|
||||
flags mFlags;
|
||||
iterator mFirst, mLast, mEnd;
|
||||
allocator_type* mAllocator;
|
||||
static allocator_type* dAllocator;
|
||||
};
|
||||
|
||||
#ifndef UNDER_CE_30
|
||||
std::ostream &operator<<(std::ostream& os, const Blob& blob);
|
||||
#endif // UNDER_CE_30
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
inline bool operator==(const Blob& x, const Blob&y)
|
||||
{
|
||||
return x._eq(y);
|
||||
}
|
||||
|
||||
inline bool operator!=(const Blob& x, const Blob&y)
|
||||
{
|
||||
return !(x._eq(y));
|
||||
}
|
||||
|
||||
inline bool operator<(const Blob& x, const Blob&y)
|
||||
{
|
||||
return x._lt(y);
|
||||
}
|
||||
|
||||
inline bool operator>=(const Blob& x, const Blob&y)
|
||||
{
|
||||
return !(x._lt(y));
|
||||
}
|
||||
|
||||
inline bool operator<=(const Blob& x, const Blob&y)
|
||||
{
|
||||
return x._eq(y) || x._lt(y);
|
||||
}
|
||||
|
||||
inline bool operator>(const Blob& x, const Blob&y)
|
||||
{
|
||||
return !(x._eq(y) || x._lt(y));
|
||||
}
|
||||
|
||||
} // namespace act
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
namespace std
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void swap(act::Blob& left, act::Blob& right) { left.swap(right); }
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // ACT_Blob_h
|
||||
@@ -1,31 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actBlockCipherKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// 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_BlockCipherKit_h
|
||||
#define ACT_BlockCipherKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IBlockCipher;
|
||||
|
||||
IBlockCipher* CreateDES();
|
||||
IBlockCipher* CreateTripleDES();
|
||||
IBlockCipher* CreateCAST128();
|
||||
IBlockCipher* CreateBlowFish();
|
||||
IBlockCipher* CreateTwoFish();
|
||||
IBlockCipher* CreateMars();
|
||||
IBlockCipher* CreateRijndael();
|
||||
IBlockCipher* CreateSerpent();
|
||||
IBlockCipher* CreateRC2();
|
||||
//IBlockCipher* CreateRC6();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actBlockCipherModeKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// 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_BlockCipherModeKit_h
|
||||
#define ACT_BlockCipherModeKit_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IBlockCipherMode;
|
||||
|
||||
IBlockCipherMode* CreateECBMode();
|
||||
IBlockCipherMode* CreateCBCMode();
|
||||
IBlockCipherMode* CreateCFBMode();
|
||||
IBlockCipherMode* CreateOFBMode();
|
||||
IBlockCipherMode* CreateCTRMode();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actBlockCipherReg.h
|
||||
// Product: cv act library
|
||||
// Purpose: registry for factory functions in actBlockCipherKit.h
|
||||
//
|
||||
// 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_BlockCipherReg_h
|
||||
#define ACT_BlockCipherReg_h
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IBlockCipher;
|
||||
|
||||
typedef IBlockCipher* (*CreateBlockCipherPtr)();
|
||||
|
||||
struct BlockCipherMapEntry {
|
||||
const char* Name;
|
||||
CreateBlockCipherPtr CreatePtr;
|
||||
};
|
||||
|
||||
class BlockCipherReg
|
||||
{
|
||||
public:
|
||||
static IBlockCipher* CreateBlockCipher(const char* name);
|
||||
static CreateBlockCipherPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name,CreateBlockCipherPtr createptr);
|
||||
static void Insert(const BlockCipherMapEntry* map);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actCRL.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// 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_CRL_h
|
||||
#define ACT_CRL_h
|
||||
#include "actBasics.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IKey;
|
||||
class Blob;
|
||||
class ICertificate;
|
||||
class ICRL;
|
||||
class CRL
|
||||
{
|
||||
public:
|
||||
CRL(const char* type);
|
||||
CRL(const char* type, const Blob& crlblob);
|
||||
CRL(const CRL& crl);
|
||||
|
||||
void SetParam(paramid_t id,const Blob& blob);
|
||||
void SetParam(paramid_t id,int val);
|
||||
void SetParam(paramid_t id,const char* cstr);
|
||||
void GetParam(paramid_t id,Blob& blob) const;
|
||||
int GetParam(paramid_t) const;
|
||||
|
||||
void Import(const Blob& crl);
|
||||
void Export(Blob& crl) const;
|
||||
|
||||
void Revoke(const ICertificate* cert);
|
||||
bool IsRevoked(const ICertificate* Cert) const;
|
||||
void RemoveRevokation(const ICertificate* cert);
|
||||
|
||||
void Revoke(const Blob& blob);
|
||||
bool IsRevoked(const Blob& blob) const;
|
||||
void RemoveRevokation(const Blob& blob);
|
||||
|
||||
void Sign(const IKey* privkey);
|
||||
int Verify(const IKey* pubkey) const;
|
||||
|
||||
const ICRL* GetPointer() const;
|
||||
ICRL* GetPointer();
|
||||
|
||||
operator const ICRL* () const;
|
||||
operator ICRL* ();
|
||||
|
||||
|
||||
ICRL* ReleasePointer();
|
||||
|
||||
CRL& operator= (const CRL& crl);
|
||||
|
||||
~CRL();
|
||||
private:
|
||||
ICRL* mCRL;
|
||||
};
|
||||
|
||||
}; // namespace act
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actCertificate.h
|
||||
// Product: cv act library
|
||||
// Purpose: The concrete class Certificate enables direct access to a certificate,
|
||||
// e.g. its public key and the corresponding validity.
|
||||
//
|
||||
// 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_Certificate_h
|
||||
#define ACT_Certificate_h
|
||||
|
||||
#include "actBasics.h"
|
||||
|
||||
namespace act
|
||||
{
|
||||
class IKey;
|
||||
class Blob;
|
||||
class ICertificate;
|
||||
|
||||
class Certificate
|
||||
{
|
||||
public:
|
||||
Certificate();
|
||||
Certificate(const char* type);
|
||||
Certificate(const char* type, const Blob& certblob);
|
||||
Certificate(const Certificate& cert);
|
||||
|
||||
void SetParam(paramid_t id, const Blob& blob);
|
||||
void SetParam(paramid_t id, int val);
|
||||
void SetParam(paramid_t id, const char* cstr);
|
||||
void GetParam(paramid_t id, Blob& blob) const;
|
||||
int GetParam(paramid_t id) const;
|
||||
|
||||
void Import(const Blob& certblob);
|
||||
void Export(Blob& certblob) const;
|
||||
|
||||
void SetPublicKey(const IKey* pubkey);
|
||||
IKey* CreatePublicKey(const char* = 0) const;
|
||||
|
||||
void Sign(const IKey* privkey);
|
||||
int Verify(const IKey* pubkey) const;
|
||||
|
||||
const ICertificate* GetPointer() const;
|
||||
ICertificate* GetPointer();
|
||||
|
||||
operator const ICertificate*() const;
|
||||
operator ICertificate*();
|
||||
|
||||
ICertificate* ReleasePointer();
|
||||
|
||||
Certificate& operator=(const Certificate& cert);
|
||||
Certificate& Reset(ICertificate* cert);
|
||||
Certificate& Required(const char* where = 0);
|
||||
|
||||
~Certificate();
|
||||
|
||||
private:
|
||||
ICertificate* mCert;
|
||||
};
|
||||
|
||||
}; // namespace act
|
||||
|
||||
#endif // ACT_Certificate_h
|
||||
@@ -1,28 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actCertificateKit.h
|
||||
// Product: cv act library
|
||||
// Purpose: declaration of all factory functions
|
||||
//
|
||||
// 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_CERTIFICATEKIT_H
|
||||
#define ACT_CERTIFICATEKIT_H
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ICertificate;
|
||||
class ICRL;
|
||||
class ICVCertRequest;
|
||||
|
||||
ICertificate* CreateX509Certificate();
|
||||
ICRL* CreateX509CRL();
|
||||
|
||||
ICertificate* CreateCVCertificate();
|
||||
ICVCertRequest* CreateCVCertRequest();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actCertificateReg.h
|
||||
// Product: cv act library
|
||||
// Purpose:
|
||||
//
|
||||
// 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_CERTIFICATEREG_H
|
||||
#define ACT_CERTIFICATEREG_H
|
||||
|
||||
namespace act
|
||||
{
|
||||
class ICertificate;
|
||||
class ICRL;
|
||||
|
||||
typedef ICertificate* (*CreateCertificatePtr)();
|
||||
typedef ICRL* (*CreateCRLPtr)();
|
||||
|
||||
struct CertificateMapEntry {
|
||||
const char* Name;
|
||||
CreateCertificatePtr CreatePtr;
|
||||
};
|
||||
|
||||
struct CRLMapEntry {
|
||||
const char* Name;
|
||||
CreateCRLPtr CreatePtr;
|
||||
};
|
||||
|
||||
class CertificateReg
|
||||
{
|
||||
public:
|
||||
static ICertificate* CreateCertificate(const char* name);
|
||||
static CreateCertificatePtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateCertificatePtr createptr);
|
||||
static void Insert(const CertificateMapEntry* certmap);
|
||||
};
|
||||
|
||||
class CRLReg
|
||||
{
|
||||
public:
|
||||
static ICRL* CreateCRL(const char* name);
|
||||
static CreateCRLPtr GetCreatePointer(const char* name);
|
||||
static const char* GetName(void* createptr);
|
||||
static const char* GetNextName(const char* name);
|
||||
static void Insert(const char* name, CreateCRLPtr createptr);
|
||||
static void Insert(const CRLMapEntry* certmap);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: actDate.h
|
||||
// Product: cv act library
|
||||
// Purpose: The Date function used in act Library
|
||||
//
|
||||
// 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_Date_h
|
||||
#define ACT_Date_h
|
||||
|
||||
#include "actBasics.h"
|
||||
|
||||
#if defined(ACT_POSIX)
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
namespace act
|
||||
{
|
||||
class Blob;
|
||||
|
||||
class Date
|
||||
{
|
||||
public:
|
||||
Date(); //today
|
||||
Date(int day, int month ,int year);
|
||||
Date(int day, int month, int year, int hour, int minute, int sec);
|
||||
Date(const Blob& der);
|
||||
|
||||
Date(const unsigned char* ch, const unsigned int size);
|
||||
|
||||
Date& SetToday();
|
||||
|
||||
int GetDay() const { return m_day; }
|
||||
int GetMonth() const { return m_month; }
|
||||
int GetYear() const { return m_year; }
|
||||
int GetHour() const { return m_hour; }
|
||||
int GetMinute() const { return m_min; }
|
||||
int GetSecond() const { return m_sec; }
|
||||
|
||||
void IgnoreTime(bool b); // ignore time(hour, min,sec) in the operators
|
||||
const Date& operator=(const Date&);
|
||||
bool operator>(const Date&) const;
|
||||
bool operator>=(const Date&) const;
|
||||
bool operator<(const Date&) const;
|
||||
bool operator<=(const Date&) const;
|
||||
bool operator==(const Date&) const;
|
||||
bool operator!=(const Date&) const;
|
||||
|
||||
const Date& AddMonths(int m);
|
||||
const Date& SubMonths(int m);
|
||||
const Date& AddYears(int y);
|
||||
const Date& SubYears(int y);
|
||||
const Date& AddDays(int d);
|
||||
const Date& SubDays(int d);
|
||||
const Date& AddHours(int h);
|
||||
const Date& SubHours(int h);
|
||||
const Date& AddMinutes(int m);
|
||||
const Date& SubMinutes(int m);
|
||||
const Date& AddSecond(int m);
|
||||
const Date& SubSecond(int m);
|
||||
|
||||
int DayOfWeek() const; // 0:Sunday, 1=Monday ... 6=Saturday
|
||||
int IsLeap(int y) const; // 1:leapyear, 0:else
|
||||
int DaysPerMonth(int m, int y) const;
|
||||
long GetDifference(const Date& d2) const;
|
||||
|
||||
long GetJulian() const;
|
||||
long GetJulian(int d, int m, int y) const;
|
||||
void ConvertFromJulian(long jd, int& d, int& m, int& y);
|
||||
|
||||
Blob Encode() const;
|
||||
size_t Encode(Blob& encoded) const;
|
||||
|
||||
Blob EncodeToGeneralizedTime() const;
|
||||
Blob GetGeneralizedTimeString() const;
|
||||
Blob GetLocalTimeString() const; // fixed format: "DD/MM/YYYY HH:MM:SS"
|
||||
|
||||
operator Blob() const;
|
||||
|
||||
int GetDayFromWeekDay (int weekday, int year, int month, int which);
|
||||
|
||||
#if defined(ACT_POSIX)
|
||||
static void copyDatetm(act::Date a, struct tm& b);
|
||||
static void copytmDate(struct tm a, act::Date& b);
|
||||
#endif
|
||||
|
||||
private:
|
||||
Date& SetYear(int year) { m_year = year; return *this; }
|
||||
Date& SetMonth(int month) { m_month = month; return *this; }
|
||||
Date& SetDay(int day) { m_day = day; return *this; }
|
||||
Date& SetHour(int hour) { m_hour = hour; return *this; }
|
||||
Date& SetMinute(int minute) { m_min = minute; return *this; }
|
||||
Date& SetSecond(int sec) { m_sec = sec; return *this; }
|
||||
bool IsValid() const;
|
||||
void AdjustDays();
|
||||
|
||||
private:
|
||||
int m_day, m_month, m_year;
|
||||
int m_hour, m_min, m_sec;
|
||||
bool m_ignore_time;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#endif // ACT_Date_h
|
||||
@@ -1,295 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Name: actDebug.h
|
||||
// Product: cv act library
|
||||
// Purpose: Integration of globally available debug macros and functions
|
||||
//
|
||||
// Copyright: (c) 2005 cv cryptovision GmbH
|
||||
// all rights reserved
|
||||
// Licence: The conditions for the use of this software are regulated
|
||||
// in the cv act library licence agreement.
|
||||
//
|
||||
// Autor: Markus Tesche (MTE)
|
||||
// Date: 12/15/2005
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ACT_Debug_h
|
||||
#define ACT_Debug_h
|
||||
|
||||
#include "actEnv.h"
|
||||
#include "actBasics.h"
|
||||
#include "actException.h"
|
||||
|
||||
//
|
||||
// ACT_NOOP use for semicolon terminated non operating macros.
|
||||
#ifdef _MSC_VER
|
||||
# if _MSC_VER >= 1210
|
||||
# define ACT_NOOP __noop
|
||||
# else
|
||||
# define ACT_NOOP ((void) 0)
|
||||
# endif
|
||||
// MSVC specific
|
||||
# if !defined(DEBUG_NEW)
|
||||
# if defined(_DEBUG) && !defined(_WIN32_WCE)
|
||||
# include <crtdbg.h>
|
||||
# define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
# else
|
||||
# define DEBUG_NEW new
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define ACT_NOOP ((void) 0)
|
||||
# define DEBUG_NEW new
|
||||
#endif
|
||||
|
||||
//
|
||||
// Declare all debug macros for release builds.
|
||||
#ifdef _DEBUG
|
||||
# ifdef UNDER_CE
|
||||
# define ACT_ASSERT ACT_NOOP
|
||||
# define ACT_ASSERT_ALWAYS(m, l, f) ACT_NOOP
|
||||
# endif
|
||||
# define ACT_DEBUG 1
|
||||
# define ACT_DEBUG_PARAM(p) p
|
||||
# define ACT_DEBUG_SOURCE() act::FileAndLine(__FILE__, __LINE__)
|
||||
# define ACT_NOT_IMPLEMENTED(m, w) throw act::NotImplementedException(m, w) << ACT_DEBUG_SOURCE()
|
||||
#else
|
||||
# define ACT_DEBUG 0
|
||||
# define ACT_DEBUG_SOURCE() act::FileAndLine()
|
||||
# define ACT_NOT_IMPLEMENTED(m, w) throw act::NotImplementedException(m, w)
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1210
|
||||
# define ACT_DEBUG_PARAM(p) p
|
||||
# define ACT_TRACE ACT_NOOP
|
||||
# define ACT_TRACELOG ACT_NOOP
|
||||
# define ACT_ASSERT ACT_NOOP
|
||||
# else
|
||||
# define ACT_DEBUG_PARAM(p)
|
||||
# define ACT_TRACE(...) ACT_NOOP
|
||||
# define ACT_TRACELOG(...) ACT_NOOP
|
||||
# define ACT_ASSERT(e) ACT_NOOP
|
||||
# endif
|
||||
# define ACT_ASSERT_ALWAYS(m, l, f) ACT_NOOP
|
||||
# define ACT_ASSERT_ON_THROW(m) ACT_NOOP
|
||||
#endif // _DEBUG
|
||||
|
||||
//
|
||||
// ACT_ASSERT
|
||||
#ifndef ACT_ASSERT
|
||||
# if defined(_MSC_VER)
|
||||
# include <crtdbg.h>
|
||||
# define ACT_ASSERT _ASSERTE
|
||||
# else
|
||||
# include <assert.h>
|
||||
# define ACT_ASSERT assert
|
||||
# endif
|
||||
#endif // ACT_ASSERT
|
||||
|
||||
//
|
||||
// ACT_ASSERT_ALWAYS
|
||||
#ifndef ACT_ASSERT_ALWAYS
|
||||
# if defined(_MSC_VER)
|
||||
# include <crtdbg.h>
|
||||
# define ACT_ASSERT_ALWAYS(m, f, l) _RPT_BASE((_CRT_ASSERT, f, l, 0, m))
|
||||
# else
|
||||
# include <assert.h>
|
||||
# define ACT_ASSERT_ALWAYS(m, f, l) assert(f == 0)
|
||||
# endif
|
||||
#endif // ACT_ASSERT_ALWAYS
|
||||
|
||||
//
|
||||
// ACT_ASSERT_ON_THROW
|
||||
#ifndef ACT_ASSERT_ON_THROW
|
||||
namespace act
|
||||
{
|
||||
class CheckForNoThrow : public FileAndLine
|
||||
{
|
||||
public:
|
||||
CheckForNoThrow(const char* msg, const char* file = 0, int line = 0)
|
||||
: FileAndLine(file, line)
|
||||
, m_msg(msg)
|
||||
{ }
|
||||
|
||||
~CheckForNoThrow()
|
||||
{
|
||||
const bool uc = ::std::uncaught_exception();
|
||||
if(uc == true) ACT_ASSERT_ALWAYS(m_msg, file(), line());
|
||||
}
|
||||
|
||||
private:
|
||||
const char* m_msg;
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#define ACT_ASSERT_ON_THROW(m) act::CheckForNoThrow __dbg_check_for_nothrow(m, __FILE__, __LINE__)
|
||||
#endif // ACT_ASSERT_ON_THROW
|
||||
|
||||
//
|
||||
// ACT_ENABLE_TRACE
|
||||
#ifdef ACT_ENABLE_TRACE
|
||||
# ifdef ACT_TRACE
|
||||
# undef ACT_TRACE
|
||||
# endif
|
||||
# ifdef ACT_TRACELOG
|
||||
# undef ACT_TRACELOG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// ACT_TRACE
|
||||
#ifndef ACT_TRACE
|
||||
|
||||
#ifndef ACT_TRACE_BUFFER
|
||||
#define ACT_TRACE_BUFFER 1024
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <typeinfo>
|
||||
|
||||
#if defined(ACT_WIN32) || defined(ACT_WIN32_WCE)
|
||||
#include <windows.h>
|
||||
|
||||
namespace act
|
||||
{
|
||||
struct Trace
|
||||
{
|
||||
void __cdecl operator()(const char* pFormat, va_list ptr, const char* pFileName = 0, int nLine = 0) const
|
||||
{
|
||||
char szBuf[ACT_TRACE_BUFFER] = {'\0'};
|
||||
int nLen = 0;
|
||||
|
||||
if(pFileName != 0) {
|
||||
int nTemp = _snprintf(szBuf + nLen, ACT_TRACE_BUFFER - nLen, "%s(%d) : ", pFileName, nLine);
|
||||
if(nTemp < 0)
|
||||
nLen = ACT_TRACE_BUFFER;
|
||||
else nLen += nTemp;
|
||||
}
|
||||
|
||||
_vsnprintf(szBuf + nLen, ACT_TRACE_BUFFER - nLen, pFormat, ptr);
|
||||
szBuf[ACT_TRACE_BUFFER - 1] = 0;
|
||||
#ifndef UNDER_CE
|
||||
::OutputDebugStringA(szBuf);
|
||||
#else
|
||||
{
|
||||
wchar_t wtmp[ACT_TRACE_BUFFER];
|
||||
mbstowcs(wtmp, szBuf, ACT_TRACE_BUFFER);
|
||||
::OutputDebugStringW(wtmp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#elif defined(ACT_POSIX)
|
||||
#include <syslog.h>
|
||||
|
||||
namespace act
|
||||
{
|
||||
struct Trace
|
||||
{
|
||||
void operator()(const char* pFormat, va_list ptr, const char* pFileName = 0, int nLine = 0) const
|
||||
{
|
||||
char szBuf[ACT_TRACE_BUFFER] = {'\0'};
|
||||
int nLen = 0;
|
||||
|
||||
if(pFileName != 0) {
|
||||
int nTemp = snprintf(szBuf + nLen, ACT_TRACE_BUFFER - nLen, "%s(%d) : ", pFileName, nLine);
|
||||
if(nTemp < 0)
|
||||
nLen = ACT_TRACE_BUFFER;
|
||||
else nLen += nTemp;
|
||||
}
|
||||
|
||||
vsnprintf(szBuf + nLen, ACT_TRACE_BUFFER - nLen, pFormat, ptr);
|
||||
szBuf[ACT_TRACE_BUFFER - 1] = 0;
|
||||
|
||||
syslog(LOG_DEBUG, "%s", szBuf);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#else
|
||||
# error act::Trace not implemented for this platform
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// act::TraceFileAndLine
|
||||
namespace act
|
||||
{
|
||||
class TraceFileAndLine : public FileAndLine
|
||||
{
|
||||
public:
|
||||
TraceFileAndLine() { }
|
||||
TraceFileAndLine(const FileAndLine& fl) : FileAndLine(fl) { }
|
||||
TraceFileAndLine(const char * file, int line) : FileAndLine(file, line) { }
|
||||
|
||||
inline void setFileAndLine(const FileAndLine* fl)
|
||||
{
|
||||
if(fl != 0) *static_cast<FileAndLine*>(this) = *fl;
|
||||
}
|
||||
|
||||
inline TraceFileAndLine& operator<<(const FileAndLine& fl)
|
||||
{
|
||||
*static_cast<FileAndLine*>(this) = fl;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//
|
||||
// default va_list based trace.
|
||||
void operator()(const char* pFormat, ...)
|
||||
{
|
||||
va_list ptr; va_start(ptr, pFormat);
|
||||
Trace()(pFormat, ptr, file(), line());
|
||||
va_end(ptr);
|
||||
}
|
||||
|
||||
//
|
||||
// Exception trace.
|
||||
void operator()(const Exception& e)
|
||||
{
|
||||
setFileAndLine(dynamic_cast<const FileAndLine*>(&e));
|
||||
switch(e.GetId())
|
||||
{
|
||||
case eiNoSuchAlgorithmException:
|
||||
(*this)("%s['0x%08x', '%&s', '%s', '%s']\n",
|
||||
typeid(e).name(),
|
||||
static_cast<const NoSuchAlgorithmException&>(e).algorithm(),
|
||||
e.code(), e.what(), e.where());
|
||||
break;
|
||||
|
||||
default:
|
||||
(*this)("%s['0x%08x', '%s', '%s']\n",
|
||||
typeid(e).name(), e.code(), e.what(), e.where());
|
||||
}
|
||||
}
|
||||
|
||||
void operator()(const Exception& e, const char* pName)
|
||||
{
|
||||
setFileAndLine(dynamic_cast<const FileAndLine*>(&e));
|
||||
switch(e.GetId())
|
||||
{
|
||||
case eiNoSuchAlgorithmException:
|
||||
(*this)("%s : %s['0x%08x', '%s', '%s', '%s']\n", pName,
|
||||
typeid(e).name(),
|
||||
e.code(),
|
||||
static_cast<const NoSuchAlgorithmException&>(e).algorithm(),
|
||||
e.what(), e.where());
|
||||
break;
|
||||
|
||||
default:
|
||||
(*this)("%s : %s['0x%08x', '%s', '%s']\n", pName,
|
||||
typeid(e).name(),
|
||||
e.code(), e.what(), e.where());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace act
|
||||
|
||||
#define ACT_TRACE act::TraceFileAndLine(__FILE__, __LINE__)
|
||||
#define ACT_TRACELOG act::TraceFileAndLine()
|
||||
|
||||
#endif // ACT_TRACE
|
||||
#endif // ACT_Debug_h
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user