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

HBCI::MediumRDHBase Class Reference

Base class for all RDH based media. More...

#include <mediumrdhbase.h>

Inheritance diagram for HBCI::MediumRDHBase:

Inheritance graph
[legend]
List of all members.

Public Methods

 MediumRDHBase (const Hbci *hbci)
virtual ~MediumRDHBase ()
Medium management
virtual Error selectContext (int country, const string &instcode, const string &userid)=0
virtual Error createMedium (int country, const string &instcode, const string &userid, const string &pin="")=0
virtual Error mountMedium (const string &pin="")=0
virtual Error unmountMedium (const string &pin="")=0
virtual Error changePIN ()
virtual Error changeContext (int context, int country=0, const string instcode="", const string userid="", const string custid="", const string server="")
virtual unsigned int nextSEQ ()=0
virtual void resetSEQ ()=0
virtual void setSEQ (int seq)=0
Medium Information
virtual bool isMounted ()=0
virtual string mediumId () const=0
virtual int securityMode () const
virtual const string & mediumName () const=0
virtual MediumType mediumType () const=0
virtual int signKeyNumber () const=0
virtual int signKeyVersion () const=0
virtual int cryptKeyNumber () const=0
virtual int cryptKeyVersion () const=0
virtual const string & cryptKeyOwner () 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
Key Generation and management
virtual Error createUserKeys (bool activate=true)=0
virtual Error activateKeys ()=0
virtual Pointer< RSAKey > getTempSignKey ()=0
virtual Pointer< RSAKey > getTempCryptKey ()=0
virtual Error setInstituteCryptKey (Pointer< RSAKey > cryptkey)=0
virtual Error setInstituteSignKey (Pointer< RSAKey > signkey)=0
virtual void setSystemId (const string &newid)=0
Key Information
virtual bool hasInstSignKey () const=0
virtual Pointer< RSAKey > userPubCryptKey () const=0
virtual Pointer< RSAKey > userPubSignKey () const=0
Ini-Letter Information
virtual string getInstIniLetterModulus (bool crypt=false) const=0
virtual string getInstIniLetterExponent (bool crypt=false) const=0
virtual string getInstIniLetterHash (bool crypt=false) const=0
virtual int getInstKeyNumber (bool usecrypt=false) const=0
virtual int getInstKeyVersion (bool usecrypt=false) const=0
virtual string getUserIniLetterModulus () const=0
virtual string getUserIniLetterExponent () const=0
virtual string getUserIniLetterHash () const=0
virtual int getUserKeyNumber () const=0
virtual int getUserKeyVersion () const=0

Static Public Attributes

const unsigned int minPinSize

Detailed Description

Base class for all RDH based media.

This is a base class for all RSA-DES-hybrid (RDH) media. RSA keys are used for authentification and encryption of the session keys, and Triple-DES-keys are used as session keys for the actual encryption of messages.

Currently only key files are supported, but in future RDH chip cards might also be implemented.

Author:
Martin Preuss<martin@aquamaniac.de>


Constructor & Destructor Documentation

HBCI::MediumRDHBase::MediumRDHBase const Hbci   hbci
 

Constructor.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Parameters:
hbci  pointer to the HBCI object your program uses.

virtual HBCI::MediumRDHBase::~MediumRDHBase   [virtual]
 


Member Function Documentation

virtual Error HBCI::MediumRDHBase::activateKeys   [pure virtual]
 

Activates the previously created keys. This is required if you specified "false" as arguement to createUserKeys(). This will finally store the created keys to their destination, so that they are usable for further signing/crypting.

Author:
Martin Preuss<openhbci@aquamaniac.de>

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

Change data that is stored on the medium.
Note: Each paramter you don't specify is not changed.

Parameters:
context  Medium supports 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

Implements HBCI::Medium.

virtual Error HBCI::MediumRDHBase::changePIN   [virtual]
 

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

Implements HBCI::Medium.

virtual Error HBCI::MediumRDHBase::createMedium int    country,
const string &    instcode,
const string &    userid,
const string &    pin = ""
[pure virtual]
 

Creates a context in your medium. A context is just the combination of a userid and the institute code (+ country code). IMPORTANT: If you want to add a context to an already existing medium you MUST call this method with the medium MOUNTED !! Otherwise the keys on that medium will be LOST !! Well, of course, if that medium does not exist you have to this method without prior mounting (since there is nothing to mount).

Author:
Martin Preuss<openhbci@aquamaniac.de>

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

Creates a key for encryption of data.

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

Implements HBCI::Medium.

virtual Error HBCI::MediumRDHBase::createUserKeys bool    activate = true [pure virtual]
 

Generates the users sign and crypt keys.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Parameters:
activate  if true then the key will be activated immediately. Otherwise just a temporary key will be created which must be activated by calling activateKey(). If the key is not activated you can get it by calling getTempSignKey() and getTempCryptKey().

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

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

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implements HBCI::Medium.

virtual const string& HBCI::MediumRDHBase::cryptKeyOwner   const [pure virtual]
 

Returns the user ID of the owner of the crypt key. RDH-media should return the owner of the institutes public crypt key. This is retrieved from HIISA segments.

Author:
Martin Preuss<openhbci@aquamaniac.de>

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

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

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implements HBCI::Medium.

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

Lets the card decrypt the key.

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

Implements HBCI::Medium.

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

Lets the card encrypt the key.

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

Implements HBCI::Medium.

virtual Error HBCI::MediumRDHBase::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

Implements HBCI::Medium.

virtual string HBCI::MediumRDHBase::getInstIniLetterExponent bool    crypt = false const [pure virtual]
 

return the ini-letter-exponent that is needed to print the ini-letter

Parameters:
crypt  If true, then the data of crypt key is read instead of that of the sign key. This exists for the case when your institute does not sign its messages. In that not-so-good case, MediumRDH::hasInstSignKey returned false (the inverse of this argument). If unsure, leave it to the default value false.

virtual string HBCI::MediumRDHBase::getInstIniLetterHash bool    crypt = false const [pure virtual]
 

return the ini-letter-hash that is needed to print the ini-letter

Parameters:
crypt  If true, then the data of crypt key is read instead of that of the sign key. This exists for the case when your institute does not sign its messages. In that not-so-good case, MediumRDH::hasInstSignKey returned false (the inverse of this argument). If unsure, leave it to the default value false.

virtual string HBCI::MediumRDHBase::getInstIniLetterModulus bool    crypt = false const [pure virtual]
 

Returns the modulus of the institute key that is needed to print the ini-letter.

Parameters:
crypt  If true, then the data of crypt key is read instead of that of the sign key. This exists for the case when your institute does not sign its messages. In that not-so-good case, MediumRDH::hasInstSignKey returned false (the inverse of this argument). If unsure, leave it to the default value false.

virtual int HBCI::MediumRDHBase::getInstKeyNumber bool    usecrypt = false const [pure virtual]
 

Returns the number of the institute key.

Parameters:
usecrypt  If true, then the data of crypt key is read instead of that of the sign key. This exists for the case when your institute does not sign its messages. In that not-so-good case, MediumRDH::hasInstSignKey returned false (the inverse of this argument). If unsure, leave it to the default value false.

virtual int HBCI::MediumRDHBase::getInstKeyVersion bool    usecrypt = false const [pure virtual]
 

Returns the version of the institute key.

Parameters:
usecrypt  If true, then the data of crypt key is read instead of that of the sign key. This exists for the case when your institute does not sign its messages. In that not-so-good case, MediumRDH::hasInstSignKey returned false (the inverse of this argument). If unsure, leave it to the default value false.

virtual Pointer<RSAKey> HBCI::MediumRDHBase::getTempCryptKey   [pure virtual]
 

This returns the temporary crypt key which has been created by createUserKeys(). You'll need this in a key change protocol.

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual Pointer<RSAKey> HBCI::MediumRDHBase::getTempSignKey   [pure virtual]
 

This returns the temporary sign key which has been created by createUserKeys(). You'll need this in a key change protocol.

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual string HBCI::MediumRDHBase::getUserIniLetterExponent   const [pure virtual]
 

return the ini-letter-exponent that is needed to print the ini-letter

virtual string HBCI::MediumRDHBase::getUserIniLetterHash   const [pure virtual]
 

return the ini-letter-hash that is needed to print the ini-letter

virtual string HBCI::MediumRDHBase::getUserIniLetterModulus   const [pure virtual]
 

return the ini-letter-modulus that is needed to print the ini-letter

virtual int HBCI::MediumRDHBase::getUserKeyNumber   const [pure virtual]
 

This method is needed when generating the users ini letter.

Returns :
the number of the user's public crypt key

virtual int HBCI::MediumRDHBase::getUserKeyVersion   const [pure virtual]
 

This method is needed when generating the users ini letter.

Returns :
the version of the user's public crypt key

virtual bool HBCI::MediumRDHBase::hasInstSignKey   const [pure virtual]
 

Returns true, if the institute/bank of this MediumRDH uses a public signature key.

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

Checks whether the medium is mounted.

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

Implements HBCI::Medium.

virtual string HBCI::MediumRDHBase::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>

Implements HBCI::Medium.

virtual const string& HBCI::MediumRDHBase::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.

Implements HBCI::Medium.

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

Returns the type this medium is of.

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implements HBCI::Medium.

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

Mounts a medium and makes its crypto methods available.

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

Implements HBCI::Medium.

virtual unsigned int HBCI::MediumRDHBase::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>

Implements HBCI::Medium.

virtual void HBCI::MediumRDHBase::resetSEQ   [pure virtual]
 

Sets the seq counter to 1

virtual int HBCI::MediumRDHBase::securityMode   const [inline, virtual]
 

Returns the security mode of this medium (DDV, RDH)

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implements HBCI::Medium.

virtual Error HBCI::MediumRDHBase::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>

Implements HBCI::Medium.

virtual Error HBCI::MediumRDHBase::setInstituteCryptKey Pointer< RSAKey >    cryptkey [pure virtual]
 

Sets the institutes public crypt key.

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual Error HBCI::MediumRDHBase::setInstituteSignKey Pointer< RSAKey >    signkey [pure virtual]
 

Sets the institutes public sign key.

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual void HBCI::MediumRDHBase::setSEQ int    seq [pure virtual]
 

Directly set the seq counter

virtual void HBCI::MediumRDHBase::setSystemId const string &    newid [pure virtual]
 

Sets the SystemId.

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual string HBCI::MediumRDHBase::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

Implements HBCI::Medium.

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

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

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implements HBCI::Medium.

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

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

Author:
Martin Preuss<openhbci@aquamaniac.de>

Implements HBCI::Medium.

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

Unmounts a medium so that it may be removed.

Author:
Martin Preuss<openhbci@aquamaniac.de>
Returns :
true if medium unmounted

Implements HBCI::Medium.

virtual Pointer<RSAKey> HBCI::MediumRDHBase::userPubCryptKey   const [pure virtual]
 

Returns the users public crypt key.

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual Pointer<RSAKey> HBCI::MediumRDHBase::userPubSignKey   const [pure virtual]
 

Returns the users public sign key.

Author:
Martin Preuss<openhbci@aquamaniac.de>

virtual Error HBCI::MediumRDHBase::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

Implements HBCI::Medium.


Member Data Documentation

const unsigned int HBCI::MediumRDHBase::minPinSize [static]
 

The minimum size of a new PIN, otherwise it will not be accepted and an Error will be thrown.


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