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

HBCI::Medium Class Reference

Abstract base class for any security medium in OpenHBCI. More...

#include <medium.h>

Inheritance diagram for HBCI::Medium:

Inheritance graph
[legend]
List of all members.

Public Methods

 Medium (const Hbci *hbci)
virtual ~Medium ()
const Hbcihbci () const
void setOwner (Pointer< User > u)
Pointer< Userowner ()
Medium management
virtual Error selectContext (int country, const string &instcode, const string &userid)=0
virtual Error mountMedium (const string &pin="")=0
virtual Error unmountMedium (const string &pin="")=0
virtual unsigned int nextSEQ ()=0
virtual Error changePIN ()=0
virtual Error changeContext (int context, int country=0, const string instcode="", const string userid="", const string custid="", const string server="")=0
Medium information
virtual bool isMounted ()=0
virtual string mediumId () const=0
virtual int securityMode () const=0
virtual const string & mediumName () const=0
virtual MediumType mediumType () const=0
virtual string mediumTypeName () const=0
virtual int signKeyNumber () const=0
virtual int signKeyVersion () const=0
virtual int cryptKeyNumber () const=0
virtual int cryptKeyVersion () const=0
virtual Error getContext (int num, int &countrycode, string &instcode, string &userid, string &server) const=0
Cryptographic methods
virtual string createMessageKey () const=0
virtual string encryptKey (const string &srckey)=0
virtual string decryptKey (const string &srckey)=0
virtual Error verify (const string &data, const string &signature)=0
virtual string sign (const string &data)=0
virtual string encrypt (const string &src, const string &key)
virtual string decrypt (const string &src, const string &key)
Property handling
virtual Error getProperty (const string &propertyName, string &propertyValue)
virtual Error setProperty (const string &propertyName, const string &propertyValue)

Protected Methods

string ripe (const string &source)

Protected Attributes

const Hbci_hbci
int _version
Pointer< User_owner

Detailed Description

Abstract base class for any security medium in OpenHBCI.

This is the abstract base class for accessing security media. It is implemented by RSA file-based media and DES-based chip cards, or maybe even more. The actual type of this medium can be queried through Medium::securityMode.

Author:
Martin Preuss<openhbci@aquamaniac.de>


Constructor & Destructor Documentation

HBCI::Medium::Medium const Hbci   hbci
 

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual HBCI::Medium::~Medium   [virtual]
 


Member Function Documentation

virtual Error HBCI::Medium::changeContext int    context,
int    country = 0,
const string    instcode = "",
const string    userid = "",
const string    custid = "",
const string    server = ""
[pure virtual]
 

Change data that is stored on the medium.
Note: Each paramter you don't specify is not changed.
Note: Not every medium supports all of these parameters, see the medium implementations for details!

Parameters:
context  Some medium types support multiple contexts, use this parameter to select it (1..n)
country  The new country code (280 for Germany)
instcode  The new institute code
userid  The new user id
custid  The new customer id
server  The new server address

Implemented in HBCI::MediumRDHBase.

virtual Error HBCI::Medium::changePIN   [pure virtual]
 

Change the PIN that is used to protect the medium data.
The old and new PIN is requested via the Hbci::interactor()

Implemented in HBCI::MediumRDHBase.

virtual string HBCI::Medium::createMessageKey   const [pure virtual]
 

Creates a key for encryption of data.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
false on error

Implemented in HBCI::MediumRDHBase.

virtual int HBCI::Medium::cryptKeyNumber   const [pure virtual]
 

Returns the number of the crypt key. RDH-media return the number of the institutes public crypt key.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

virtual int HBCI::Medium::cryptKeyVersion   const [pure virtual]
 

Returns the version of the crypt key. RDH-media return the version of the institutes public crypt key.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

virtual string HBCI::Medium::decrypt const string &    src,
const string &    key
[virtual]
 

Decrypt data.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
false on error
Parameters:
src  string to decode
key  the key to use for decryption

virtual string HBCI::Medium::decryptKey const string &    srckey [pure virtual]
 

Lets the medium decrypt the key.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
false on error
Parameters:
srckey  the key to decode

Implemented in HBCI::MediumRDHBase.

virtual string HBCI::Medium::encrypt const string &    src,
const string &    key
[virtual]
 

Encrypt data.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
false on error
Parameters:
src  string to encode
key  the key to use for encryption

virtual string HBCI::Medium::encryptKey const string &    srckey [pure virtual]
 

Lets the medium encrypt the key.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
false on error
Parameters:
srckey  the key to encode

Implemented in HBCI::MediumRDHBase.

virtual Error HBCI::Medium::getContext int    num,
int &    countrycode,
string &    instcode,
string &    userid,
string &    server
const [pure virtual]
 

Returns the context with the given number.

Some media are able of storing multiple contexts (like chip cards). Please note that the medium has to be mounted prior to calling this method.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
true if a context with that number exists, false on error
Parameters:
num  number of the context (starting with 1)
countrycode  reference to an int var to receive the country code of the context (280 for Germany)
instcode  reference to a string variable to receive the institute code of that context (German "Bankleitzahl")
userid  reference to a string variable to receive the user id of the context (assigned to you by the institute)
server  reference to a string to receive the server address

Implemented in HBCI::MediumRDHBase.

virtual Error HBCI::Medium::getProperty const string &    propertyName,
string &    propertyValue
[virtual]
 

Returns the value of a given property. If the property is not supported by the medium the error code HBCI_ERROR_CODE_UNKNOWN_PROPERTY will be returned. is returned.

const Hbci* HBCI::Medium::hbci   const [inline]
 

virtual bool HBCI::Medium::isMounted   [pure virtual]
 

Checks whether the medium is mounted.

This method checks whether the CORRECT medium is mounted and returns false if no medium or even the wrong medium is mounted.

If internal class flags think the medium is mounted but in reality it is not (e.g. chip card was removed from drive), then the internal class flags will be reset accordingly. Hence this method is not const.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
true if medium mounted, false if not (or on error)

Implemented in HBCI::MediumRDHBase.

virtual string HBCI::Medium::mediumId   const [pure virtual]
 

Returns the id of the medium. For DDV this is the CID of the chip card, for RDH this is the system ID assigned to us by an institute.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

virtual const string& HBCI::Medium::mediumName   const [pure virtual]
 

Returns the id of the medium.

For DDV this is the card number. For RDH this is the name of the file. This is used when saving HBCIUser data to refer to the medium used.

Implemented in HBCI::MediumRDHBase.

virtual MediumType HBCI::Medium::mediumType   const [pure virtual]
 

Returns the type this medium is of.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

virtual string HBCI::Medium::mediumTypeName   const [pure virtual]
 

Returns the type name. This is needed to find the responsible MediumPlugin.

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual Error HBCI::Medium::mountMedium const string &    pin = "" [pure virtual]
 

Mounts a medium and makes its crypto methods available. When reimplementing this you should have a counter to allow nested mounting and unmounting.

Parameters:
pin  The secret PIN that is needed to actually mount this medium. If omitted the user will be asked for it when needed.
Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
An HBCI::Error, where Error.isOk()==true if medium mounted

Implemented in HBCI::MediumRDHBase.

virtual unsigned int HBCI::Medium::nextSEQ   [pure virtual]
 

Returns a unique sequence number.

This method MUST never return a sequence number it returned before! Therefore the medium will probably save the current sequence number before returning a new one. (Depends on the actual implementation class, of course.)

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

Pointer<User> HBCI::Medium::owner   [inline]
 

string HBCI::Medium::ripe const string &    source [protected]
 

virtual int HBCI::Medium::securityMode   const [pure virtual]
 

Returns the security mode of this medium. E.g. HBCI_SECURITY_DDV or HBCI_SECURITY_RDH.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

virtual Error HBCI::Medium::selectContext int    country,
const string &    instcode,
const string &    userid
[pure virtual]
 

Since some media (like hbci chip cards) are able to store multiple account entries you have to select one.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

void HBCI::Medium::setOwner Pointer< User   u [inline]
 

virtual Error HBCI::Medium::setProperty const string &    propertyName,
const string &    propertyValue
[virtual]
 

Set the given property to the given value. The following error code can be expected:

  • HBCI_ERROR_CODE_PROPERTY_READONLY: Property is readonly, you cannot change its content
  • HBCI_ERROR_CODE_UNKNOWN_PROPERTY: Property is not known to the medium
  • HBCI_ERROR_CODE_INVALID_VALUE: Property valuer is invalid

virtual string HBCI::Medium::sign const string &    data [pure virtual]
 

Sign data

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
false on error
Parameters:
data  data whose signatur is to be created

Implemented in HBCI::MediumRDHBase.

virtual int HBCI::Medium::signKeyNumber   const [pure virtual]
 

Returns the number of the sign key. RDH-media return the number of the users private sign key.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

virtual int HBCI::Medium::signKeyVersion   const [pure virtual]
 

Returns the version of the crypt key. RDH-media return the version of the users private sign key.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implemented in HBCI::MediumRDHBase.

virtual Error HBCI::Medium::unmountMedium const string &    pin = "" [pure virtual]
 

Unmounts a medium so that it may be removed. See mountMedium() about nested mounts.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Parameters:
pin  if omitted the user will be asked for it when needed
Returns :
nothing, but throws an Error when unmounting fails.

Implemented in HBCI::MediumRDHBase.

virtual Error HBCI::Medium::verify const string &    data,
const string &    signature
[pure virtual]
 

Verify the signature of given data

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
false on error
Parameters:
data  data whose signatur is to be verified
signature  signature to compare against

Implemented in HBCI::MediumRDHBase.


Member Data Documentation

const Hbci* HBCI::Medium::_hbci [protected]
 

Pointer<User> HBCI::Medium::_owner [protected]
 

int HBCI::Medium::_version [protected]
 


The documentation for this class was generated from the following file:
Generated on Mon Jun 23 13:41:11 2003 for openhbci by doxygen1.2.17