Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

HBCICard Class Reference
[Special Card Classes]

Special class for HBCI (German Home Banking Computer Interface) cards. More...

#include <hbcicard.h>

Inheritance diagram for HBCICard:

CTProcessorCard CTCard CTCardBase List of all members.

Public Member Functions

Constructors/Destructor
Methods to retrieve the private members of this class.

 HBCICard (const CTCard &c)
 ~HBCICard ()
Opening and closing operations
Methods to connect and disconnect the card. Most other methods only work if the card is open.

virtual CTError reopenCard ()
virtual CTError openCard ()
virtual CTError closeCard (bool force=false)
Informational methods
These methods tell you about the type and the status of the card.

virtual string cardType ()
virtual string cardTypes ()
string cardNumber ()
Card Data Methods
These methods return information about the HBCI card.

CardData getCardId ()
CTError getCID (string &cid)
Institute Data Methods
These methods return information about institutes stored on the card.

instituteData getInstituteData (int num)
CTError getInstituteData (int num, instituteData &idata)
CTError putInstituteData (int num, const instituteData &d)
Pin Verification Methods
These methods let you verify the pin with the card.

CTError verifyPin (const string &pin)
CTError verifyPin ()
Key Information Methods
These methods return information about the keys stored on the card.

bool getKeyVersion (int key, int &kv)
bool getCryptKeyNumber (int &kn)
bool getSignKeyNumber (int &kn)
Cryptographic Methods
These methods are involved in en-/decryption.

bool hash2MAC (string &hash, string &mac)
bool getRandom (string &d)
bool cryptBlock (string &src, string &dst)
Sequence Counter Methods
These methods allow reading and writing of the cards sequence counter. This counter is to be incremented after signing a HBCI message.

bool readSEQ (unsigned int &d)
bool writeSEQ (unsigned int d)

Detailed Description

Special class for HBCI (German Home Banking Computer Interface) cards.

This class provides easy access to HBCI cards. You may read and write from/to those cards. DDV cards of type 0 and of type 1 are supported. This class does not support RSA cards (like G&D cards).

Author:
Martin Preuss <martin@libchipcard.de>


Constructor & Destructor Documentation

HBCICard::HBCICard const CTCard c  ) 
 

HBCICard::~HBCICard  ) 
 


Member Function Documentation

string HBCICard::cardNumber  ) 
 

This method returns the cardnumber. This number is quite unique.

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
on error en empty string will be returned

virtual string HBCICard::cardType  )  [virtual]
 

This method returns a short name of the class which handles this card. A HBCI card for example returns "HBCICard". So you can use this method to check for the type of the card.

Reimplemented from CTProcessorCard.

virtual string HBCICard::cardTypes  )  [virtual]
 

This method returns a comma separated list of all card types this card inherits including the type of this card, e.g. a HBCI card would return "CTProcessorCard, HBCICard". If you overload this method in your own class (you SHOULD) you simply have to call this method of the class it directly inherits. That class will then do the same, so that there is a list upon return.

Reimplemented from CTProcessorCard.

virtual CTError HBCICard::closeCard bool  force = false  )  [virtual]
 

Call this if you have finished working with the card. After this method is called you may safely remove the card from the reader.

Author:
Martin Preuss<martin@libchipcard.de>
Returns:
CTError object that holds the result (call isOk() to see if there was an error)

Reimplemented from CTCard.

bool HBCICard::cryptBlock string &  src,
string &  dst
 

Crypts a block of 8 bytes. It uses the encrypting function of the chip card. That means if you crypt a block twice with this method here you do NOT get the clear text again !

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
src reference to a string containing the 8 bytes source
dst reference to a string to receive the decoded 8 bytes

CardData HBCICard::getCardId  ) 
 

Gets the card's id struct and selects the appropriate DF_BANKING or DF_BANKING_20 DF. May throw an CTError.

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
new CardData object null on error

CTError HBCICard::getCID string &  cid  ) 
 

Reads the full EF_ID file from the MF of the chip card. Is needed by HBCI.

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
CTError object that holds the result (call isOk() to see if there was an error)

bool HBCICard::getCryptKeyNumber int &  kn  ) 
 

Returns the key number of the crypt key (with 1 being the first)

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
false on error

CTError HBCICard::getInstituteData int  num,
instituteData idata
 

This is a non-exception version, it is temporarily used be OpenHBCI.

instituteData HBCICard::getInstituteData int  num  ) 
 

Gets you the institute data struct for the given entry. The HBCI card stores up to 5 entries with number 1 being the first. You have to VERIFY your pin prior to calling this method !

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
object containing the institute data. If an error occurs it will be thrown.

bool HBCICard::getKeyVersion int  key,
int &  kv
 

Returns the version of a the local EF_KEY (that is that EF_KEY which resides in the currently selected DF).

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
true if version could be retrieved, false on error
Parameters:
key key number (starting with 1)
kv reference to a variable which receives the key version

bool HBCICard::getRandom string &  d  ) 
 

Creates random data (8 bytes).

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
false on error

bool HBCICard::getSignKeyNumber int &  kn  ) 
 

Returns the key number of the sign key (with 1 being the first)

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
false on error

bool HBCICard::hash2MAC string &  hash,
string &  mac
 

Creates a MAC from a 20 byte hash. According to HBCI standard this has to be a RIPEMD-160 hash.

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
true if mac contains valid MAC, false on error
Parameters:
hash reference to a string containing the 20 bytes RIPEMD-160 hash
mac reference to a string that receives the 8 byte MAC.

virtual CTError HBCICard::openCard  )  [virtual]
 

Opens the card for usage. This way the card is powered on. This method does some basic checks and retrieves basic information about the card (whether it is a memory card or a processor card, the size of the memory etc). When this method successfully returns the card may be used.

Author:
Martin Preuss<martin@libchipcard.de>
Returns:
CTError object that holds the result (call isOk() to see if there was an error)

Reimplemented from CTCard.

CTError HBCICard::putInstituteData int  num,
const instituteData d
 

This writes the given institute data to the card. Of course it has to be open for this and you have to have verified your pin with the card.

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
error object

bool HBCICard::readSEQ unsigned int &  d  ) 
 

Reads the sequence counter from the chipcard. This counter should be incremented before signing a HBCI message. This method is only available to call after inserting the card.

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
true if value is read, false on error

virtual CTError HBCICard::reopenCard  )  [virtual]
 

When this method is called normally the card is already opened by means of openCard(). However, it is likely that openCard() has been called assuming this card is only a CTCard() object, nothing special. You may then call THIS method here on all known card classes to check for the type of this card. This method must assume that any file on the card is already selected, so it is in most cases a good idea to select the MF as the first action of this method. If the executing class finds that the card inserted is not of a type it can handle then it MUST return an error.

Reimplemented from CTProcessorCard.

CTError HBCICard::verifyPin  ) 
 

This method lets the user enter the pin via the pin pad.

Author:
Martin Preuss <martin@libchipcard.de>

CTError HBCICard::verifyPin const string &  pin  ) 
 

Verifies your pin with the ec card.

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
CTError object that holds the result (call isOk() to see if there was an error)
Parameters:
pin the PIN to verify

bool HBCICard::writeSEQ unsigned int  d  ) 
 

Stores the value of the sequence counter which is stored in this class at this moment. Call this after incrementing this value !

Author:
Martin Preuss <martin@libchipcard.de>
Returns:
false on error


The documentation for this class was generated from the following file:
Generated on Fri Dec 3 23:10:25 2004 for libchipcard by  doxygen 1.3.9.1