You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
226 lines
7.5 KiB
226 lines
7.5 KiB
15 years ago
|
//////////////////////////////////////////////////////////////////////////////////
|
||
|
// 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 "actKeyKit.h"
|
||
|
#include "actKeyReg.h"
|
||
|
#include "actHashKit.h"
|
||
|
#include "actHashReg.h"
|
||
|
#include "actEMSAReg.h"
|
||
|
#include "actEMSAKit.h"
|
||
|
#include "actPaddingReg.h"
|
||
|
#include "actPaddingKit.h"
|
||
|
#include "actCertificateReg.h"
|
||
|
#include "actCertificateKit.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 "actPKCS15BehaviorReg.h"
|
||
|
# include "actPKCS15BehaviorKit.h"
|
||
|
#endif // NO_SMARTCARD
|
||
|
|
||
|
namespace act
|
||
|
{
|
||
|
// ------------------------------------------------------------------------
|
||
|
const KeyMapEntry KeyMap[] =
|
||
|
{
|
||
|
{ "RSA" , CreateRSAKey },
|
||
|
{ 0, 0 }
|
||
|
};
|
||
|
|
||
|
|
||
|
// ------------------------------------------------------------------------
|
||
|
const HashMapEntry HashMap[] =
|
||
|
{
|
||
|
{ "MD5" , CreateMD5 },
|
||
|
{ "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 PaddingMapEntry PaddingMap[] =
|
||
|
{
|
||
|
{ "PKCS5", CreatePKCS5Pad },
|
||
|
{ "RSAES", CreatePKCS1V1_5EMEPad },
|
||
|
{ "ISO", CreateOneAndZerosPad },
|
||
|
{ "ISO9796", CreateISO9796Pad },
|
||
|
{ "NOPAD", CreateNoPad },
|
||
|
{ 0, 0 }
|
||
|
};
|
||
|
|
||
|
// ------------------------------------------------------------------------
|
||
|
const CertificateMapEntry CertificateMap[] =
|
||
|
{
|
||
|
{ "X509", CreateX509Certificate },
|
||
|
{ 0, 0 }
|
||
|
};
|
||
|
|
||
|
#ifndef NO_SMARTCARD
|
||
|
// ------------------------------------------------------------------------
|
||
|
const SCardOSMapEntry SCardOSMap[] =
|
||
|
{
|
||
|
// CardOS
|
||
|
{ "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
|
||
|
|
||
|
{ ACT_ISO7816OS_NAME, CreateISO7816OS }, // use act::ISO7816OS as fallback
|
||
|
{ 0, 0 }
|
||
|
};
|
||
|
|
||
|
// ------------------------------------------------------------------------
|
||
|
const SCardTokenMapEntry SCardTokenMap[] =
|
||
|
{
|
||
|
// PKCS#15
|
||
|
{ IsV4PKCS15ECProfile, CreateV4PKCS15ECProfile },
|
||
|
{ IsV4PKCS15Profile, CreateV4PKCS15Profile },
|
||
|
|
||
|
// CardOS
|
||
|
{ IsM4cvMoCProfile, CreateM4cvMoCProfile },
|
||
|
{ IsM4cvECProfile, CreateM4cvECProfile },
|
||
|
{ IsV4cvECProfile, CreateV4cvECProfile },
|
||
|
{ IsV4cvProfile, CreateV4cvProfile },
|
||
|
{ IsM4cvProfile, CreateM4cvProfile },
|
||
|
// { IsV4CNSProfile, CreateV4CNSProfile },
|
||
|
|
||
|
{ 0, 0 }
|
||
|
};
|
||
|
|
||
|
// ------------------------------------------------------------------------
|
||
|
const PKCS15BehaviorMapEntry PKCS15BehaviorMap[] =
|
||
|
{
|
||
|
{ "cv cryptovision gmbh (c) v1.0n", CreateV4PKCS15Behavior },
|
||
|
{ "", CreatePKCS15Behavior }, // default
|
||
|
{ 0, 0 }
|
||
|
};
|
||
|
|
||
|
// ------------------------------------------------------------------------
|
||
|
const TokenExtensionMapEntry TokenExtensionMap[] =
|
||
|
{
|
||
|
{ "MDProfileExt", CreateMDProfileExt }, // Minidriver FS Profile Extension
|
||
|
{ 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 },
|
||
|
{ 0, 0, 0 }
|
||
|
};
|
||
|
|
||
|
// ------------------------------------------------------------------------
|
||
|
const SlotMonitorRegEntry SlotMonitorMap[] =
|
||
|
{
|
||
|
{ "PCSC", { CreatePCSCSlotMonitor, CreatePCSCSystemSlotMonitor } },
|
||
|
{ 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);
|
||
|
HashReg::Insert(HashMap);
|
||
|
EMSAReg::Insert(EMSAMap);
|
||
|
PaddingReg::Insert(PaddingMap);
|
||
|
CertificateReg::Insert(CertificateMap);
|
||
|
|
||
|
#ifndef NO_SMARTCARD
|
||
|
SubsystemReg::Insert(SubsystemMap);
|
||
|
SlotMonitorReg::Insert(SlotMonitorMap);
|
||
|
SCardOSReg::Insert(SCardOSMap);
|
||
|
SCardTokenReg::Insert(SCardTokenMap);
|
||
|
PKCS15BehaviorReg::Insert(PKCS15BehaviorMap);
|
||
|
TokenExtensionReg::Insert(TokenExtensionMap);
|
||
|
TokenAuthProtocolReg::Insert(TokenAuthProtocolMap);
|
||
|
#endif
|
||
|
CreateFastRNG = CreateFIPS186;
|
||
|
CreateStrongRNG = CreateBBS;
|
||
|
loaded = true;
|
||
|
}
|
||
|
|
||
|
} // namespace act
|
||
|
|
||
|
#endif // actInit_h
|