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

hbcicard.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 $RCSfile: hbcicard.h,v $ 00003 ------------------- 00004 cvs : $Id: hbcicard.h,v 1.8 2003/05/06 15:05:41 aquamaniac Exp $ 00005 begin : Tue Aug 28 2001 00006 copyright : (C) 2001 by Martin Preuss 00007 email : martin@libchipcard.de 00008 00009 *************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00024 * MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00028 00029 #ifndef HBCICARD_H 00030 #define HBCICARD_H 00031 00032 struct s_card_id; 00033 class HBCICard; 00034 00035 00036 #define k_HBCICARD_TYPE_UNKNOWN 0 00037 #define k_HBCICARD_TYPE_0 1 00038 #define k_HBCICARD_TYPE_1 2 00039 00040 00041 #include <string> 00042 #include <chipcard/cterror.h> 00043 00044 00045 00055 class CHIPCARD_API HBCICard : public CTProcessorCard { 00056 private: 00057 00058 int _type; 00059 string _cid; 00060 string _cmdPutInstData; 00061 string _cmdVerifyPin; 00062 string _cmdSecureVerifyPin; 00063 00064 s_card_id *_make_card_id(string &data); 00065 00070 CTError _checkType(); 00071 00073 bool _hash2mac0(string &hash, string &mac); 00074 00076 bool _hash2mac1(string &hash, string &mac); 00077 00078 bool _getKeyVersion0(int key,int &kv); 00079 bool _getKeyVersion1(int key,int &kv); 00080 00081 CTError _getCID(string &cid); 00082 00083 public: 00088 class CHIPCARD_API CardData { 00089 private: 00090 unsigned char _cardtype; 00091 unsigned char _industrialkey; 00092 unsigned int _shortinstcode; 00093 string _cardnumber; 00094 unsigned char _bestuntil_year; 00095 unsigned char _bestuntil_month; 00096 unsigned char _active_year; 00097 unsigned char _active_month; 00098 unsigned char _active_day; 00099 unsigned short _countrycode; 00100 string _currency; 00101 00102 public: 00103 CardData(); 00104 CardData(const string &s, int cardtype); 00105 ~CardData(); 00106 00111 int cardType() const { return _cardtype;}; 00116 int industrialKey() const { return _industrialkey;}; 00120 unsigned int shortInstituteCode() const { return _shortinstcode;}; 00124 const string &cardNumber() const { return _cardnumber;}; 00128 int bestuntil_year() const { return _bestuntil_year;}; 00132 int bestuntil_month() const { return _bestuntil_month;}; 00136 int active_year() const { return _active_year;}; 00140 int active_month() const { return _active_month;}; 00144 int active_day() const { return _active_day;}; 00148 int countryCode() const { return _countrycode;}; 00152 const string &currency() const { return _currency;}; 00153 }; 00154 00159 class CHIPCARD_API instituteData { 00160 private: 00161 string _name; 00162 string _code; 00163 char _service; 00164 string _addr; 00165 string _addr_suffix; 00166 int _country; 00167 string _user; 00168 00169 public: 00173 const string &name() const { return _name;}; 00177 const string &code() const { return _code;}; 00178 void setCode(const string &c) { _code=c;}; 00179 00183 char service() const { return _service;}; 00184 void setService(char s) { _service=s;}; 00185 00189 const string &address() const { return _addr;}; 00190 void setAddress(const string &a) { _addr=a;}; 00191 00195 const string &addressSuffix() const { return _addr_suffix;}; 00196 void setAddrSuffix(const string &s) { _addr_suffix=s;}; 00197 00201 int country() const { return _country;}; 00202 void setCountry(int i) { _country=i;}; 00203 00207 const string &user() const { return _user;}; 00208 void setUser(const string &u) { _user=u;}; 00209 00210 instituteData(const string &data); 00211 instituteData(); 00212 ~instituteData(); 00213 00214 CTError fromString(const string &data); 00215 string toString() const; 00216 00217 string dump(); 00218 }; 00219 00220 00226 HBCICard(const CTCard &c); 00227 00228 ~HBCICard(); 00230 00249 virtual CTError reopenCard(); 00250 00262 virtual CTError openCard(); 00263 00271 virtual CTError closeCard(bool force=false); 00273 00284 virtual string cardType(); 00285 00294 virtual string cardTypes(); 00295 00301 string cardNumber(); 00303 00316 CardData getCardId(); 00317 00325 CTError getCID(string &cid); 00327 00341 instituteData getInstituteData(int num); 00342 00346 CTError getInstituteData(int num, instituteData &idata); 00347 00355 CTError putInstituteData(int num, const instituteData &d); 00357 00370 CTError verifyPin(const string &pin); 00371 00376 CTError verifyPin(); 00378 00392 bool getKeyVersion(int key, int &kv); 00393 00399 bool getCryptKeyNumber(int &kn); 00400 00406 bool getSignKeyNumber(int &kn); 00408 00423 bool hash2MAC(string &hash, string &mac); 00424 00430 bool getRandom(string &d); 00431 00441 bool cryptBlock(string &src, string &dst); 00443 00457 bool readSEQ(unsigned int &d); 00458 00465 bool writeSEQ(unsigned int d); 00467 00468 }; 00469 00470 00471 #endif 00472 00473 00474 00475 00476 00477

Generated on Wed Jul 28 14:56:49 2004 for libchipcard by doxygen 1.3.7