#include <ctcard.h>
Inheritance diagram for CTCard:
Public Member Functions | |
Constructors/Destructor | |
CTCard (const CTCard &c) | |
virtual | ~CTCard () |
Opening and closing operations | |
Methods to connect and disconnect the card. Most other methods only work if the card is open. | |
virtual CTError | openCard () |
virtual CTError | closeCard (bool force=false) |
virtual CTError | reopenCard () |
Informational methods | |
These methods tell you about the type and the status of the card. | |
virtual string | cardType () |
virtual string | cardTypes () |
bool | isProcessorCard () const |
unsigned int | memorySize () const |
Commands | |
These methods allow you to send a command to the card. Of course the card needs to be already open. | |
CTError | makeAPDU (const string &command, string &cmdCache, string &apdu, const string ¶m1, const string ¶m2, const string ¶m3, const string ¶m4, const string ¶m5) |
CTError | execCommand (CTCommand &cmd) |
CTError | execCommand (const string &command, string &cmdCache, string &response, const string ¶m1="", const string ¶m2="", const string ¶m3="", const string ¶m4="", const string ¶m5="") |
CTError | selectFile (string &fcp, unsigned short fid) |
CTError | selectFile (string &fcp, const string &fid) |
CTError | readBinary (string &data, unsigned int offset, unsigned int size) |
CTError | readBinaryRaw (string &data, unsigned short offset, unsigned char size) |
CTError | updateBinary (const string &data, unsigned int offset) |
CTError | updateBinaryRaw (const string &data, unsigned short offset) |
Protected Member Functions | |
virtual CallBackResult | callback (bool first) |
This is just to let you mount/unmount a card, request its status etc. It is very general. Special things are done in the classes which inherit this one (like CTMemoryCard and CTProcessorCard. This class (and its children) is the C++ interface to libchipcard. When there is interaction with the card reader/card necessary then this class will automatically create all other objects/structs whatsoever on the fly. These things are all hidden from you, so you only have to concentrate on this class here.
|
This constructor is mainly used by derived classes to transform a basic CTCard object to a more special one. This allows opening a card as a CTCard object and then create e.g. a CTMemoryCard from this one. The source card will be immediately closed. The only thing you should do with it is to delete it. You should NOT use it any longer !!
|
|
|
|
Reimplemented from CTCardBase. |
|
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 in CTGeldKarte, CTKVKCard, CTMemoryCard, CTProcessorCard, HBCICard, and RSACard. |
|
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 in CTGeldKarte, CTKVKCard, CTMemoryCard, CTProcessorCard, HBCICard, and RSACard. |
|
Call this if you have finished working with the card. After this method is called you may safely remove the card from the reader.
|
|
This method sends a command using the config file driven command engine. You specify the name of the command (like "read_binary" and the parameters to it (for "read_binary" this would be the offset and size of the data to read).
|
|
Sends a command to the card reader terminal and retrieves its answer. When this method returns the members lr, sw1, sw2 and data are changed to reflect the answer. This method is used by EVERY other command method (like selectFile(), readBinary() etc).
|
|
Returns true if the card is a processor card. This is only valid if the card is open.
|
|
|
|
Returns the size of the memory on the card. Mostly used with memory cards, while processor cards sometimes return 0 (like the hbci card does). Please note that some cards seem to be lieing about their size ! This is only valid if the card is open.
|
|
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.
Reimplemented in CTGeldKarte, HBCICard, and RSACard. |
|
Reads data from the currently selected file.
|
|
|
|
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 in CTGeldKarte, CTKVKCard, CTMemoryCard, CTProcessorCard, HBCICard, and RSACard. |
|
This is the simplest form of the select file command. It should work with every card.
|
|
This is the simplest form of the select file command. It should work with every card.
|
|
Writes data into the currently selected file.
|
|
|