00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00033 #ifndef HBCIMEDIUM_H
00034 #define HBCIMEDIUM_H
00035
00036 #ifdef __cplusplus
00037 #include <string>
00038 #endif
00039
00040 #include <openhbci/dllimport.h>
00041 #include <openhbci/pointer.h>
00042 #include <openhbci/error.h>
00043
00044 #ifdef __cplusplus
00045 namespace HBCI {
00046 class Medium;
00047 };
00049 typedef struct HBCI::Medium HBCI_Medium;
00050 #else
00051 typedef struct HBCI_Medium HBCI_Medium;
00052 #endif
00053
00057 typedef enum MediumType {
00061 MediumTypeUnknown=0,
00065 MediumTypeCard,
00066
00070 MediumTypeFile
00071 } MediumType;
00072
00073
00074 #include <openhbci/user.h>
00075 #include <openhbci/hbci.h>
00076
00077
00078 #ifdef __cplusplus
00079 namespace HBCI {
00089 class DLLIMPORT Medium {
00090 protected:
00091 const Hbci *_hbci;
00092 int _version;
00093 Pointer<User> _owner;
00094
00095 string ripe(const string &source);
00096
00097 public:
00102 Medium(const Hbci *hbci);
00103
00104 virtual ~Medium();
00105
00106 const Hbci *hbci() const { return _hbci;};
00107
00108 void setOwner(Pointer<User> u) { _owner=u;};
00109 Pointer<User> owner() { return _owner;};
00110
00120 virtual Error selectContext(int country,
00121 const string &instcode,
00122 const string &userid)=0;
00123
00136 virtual Error mountMedium(const string &pin="")=0;
00137
00145 virtual Error unmountMedium(const string &pin="")=0;
00146
00156 virtual unsigned int nextSEQ()=0;
00157
00162 virtual Error changePIN()=0;
00163
00177 virtual Error changeContext(int context, int country=0,
00178 const string instcode="",
00179 const string userid="",
00180 const string custid="",
00181 const string server="")=0;
00182
00201 virtual bool isMounted() =0;
00202
00208 virtual string mediumId() const =0;
00209
00214 virtual int securityMode() const =0;
00215
00222 virtual const string& mediumName() const =0;
00223
00229 virtual MediumType mediumType() const =0;
00230
00236 virtual string mediumTypeName() const =0;
00237
00243 virtual int signKeyNumber() const =0;
00244
00250 virtual int signKeyVersion() const =0;
00251
00257 virtual int cryptKeyNumber() const =0;
00258
00264 virtual int cryptKeyVersion() const =0;
00265
00283 virtual Error getContext(int num,
00284 int &countrycode,
00285 string &instcode,
00286 string &userid,
00287 string &server) const =0;
00297 virtual string createMessageKey() const =0;
00298
00305 virtual string encryptKey(const string &srckey)=0;
00306
00313 virtual string decryptKey(const string &srckey)=0;
00314
00322 virtual Error verify(const string &data, const string &signature)=0;
00323
00330 virtual string sign(const string &data)=0;
00331
00339 virtual string encrypt(const string &src, const string &key);
00340
00348 virtual string decrypt(const string &src, const string &key);
00369 virtual Error getProperty(const string &propertyName,
00370 string &propertyValue);
00371
00383 virtual Error setProperty(const string &propertyName,
00384 const string &propertyValue);
00385
00388 };
00389
00390 }
00391
00392 extern "C" {
00393 #endif
00394
00403 extern HBCI_Error * HBCI_Medium_selectContext(HBCI_Medium *h,
00404 int country,
00405 const char *instcode,
00406 const char *userid);
00416 extern HBCI_Error *
00417 HBCI_Medium_mountMedium(HBCI_Medium *h, const char *pin);
00418
00427 extern HBCI_Error *
00428 HBCI_Medium_unmountMedium(HBCI_Medium *h, const char *pin);
00440 extern int HBCI_Medium_isMounted(HBCI_Medium *h);
00441
00449 extern char *HBCI_Medium_mediumId(const HBCI_Medium *h);
00450
00454 extern int HBCI_Medium_securityMode(const HBCI_Medium *h);
00455
00462 extern const char *HBCI_Medium_mediumName(const HBCI_Medium *h);
00463
00493 extern HBCI_Error * HBCI_Medium_getContext(const HBCI_Medium *h,
00494 int num,
00495 int *countrycode,
00496 char **instcode,
00497 char **userid,
00498 char **server);
00501
00502 #ifdef __cplusplus
00503 }
00504 #endif
00505
00506 #endif
00507