Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

medium.h File Reference

#include <gwenhywfar/misc.h>
#include <gwenhywfar/inherit.h>
#include <gwenhywfar/libloader.h>
#include <gwenhywfar/buffer.h>
#include <gwenhywfar/plugin.h>
#include <aqbanking/banking.h>
#include <aqhbci/objectref.h>
#include <gwenhywfar/crypt.h>
#include <aqhbci/hbci.h>
#include <aqhbci/mediumctx.h>

Go to the source code of this file.

Constructor And Destructor

AQHBCI_API AH_MEDIUMAH_Medium_new (AH_HBCI *hbci, const char *typeName, const char *subTypeName, const char *mediumName)
AQHBCI_API void AH_Medium_free (AH_MEDIUM *m)
AQHBCI_API void AH_Medium_Attach (AH_MEDIUM *m)

Informational Functions

AQHBCI_API AH_HBCIAH_Medium_GetHBCI (const AH_MEDIUM *m)
AQHBCI_API AB_BANKINGAH_Medium_GetBankingApi (const AH_MEDIUM *m)
AQHBCI_API const char * AH_Medium_GetMediumTypeName (const AH_MEDIUM *m)
AQHBCI_API const char * AH_Medium_GetMediumSubTypeName (const AH_MEDIUM *m)
AQHBCI_API const char * AH_Medium_GetMediumName (const AH_MEDIUM *m)
AQHBCI_API void AH_Medium_SetMediumName (AH_MEDIUM *m, const char *s)
AQHBCI_API const char * AH_Medium_GetDescriptiveName (const AH_MEDIUM *m)
AQHBCI_API void AH_Medium_SetDescriptiveName (AH_MEDIUM *m, const char *s)
AQHBCI_API GWEN_TYPE_UINT32 AH_Medium_GetFlags (const AH_MEDIUM *m)
AQHBCI_API void AH_Medium_SetFlags (AH_MEDIUM *m, GWEN_TYPE_UINT32 fl)
AQHBCI_API void AH_Medium_AddFlags (AH_MEDIUM *m, GWEN_TYPE_UINT32 fl)
AQHBCI_API void AH_Medium_SubFlags (AH_MEDIUM *m, GWEN_TYPE_UINT32 fl)
AQHBCI_API int AH_Medium_IsMounted (AH_MEDIUM *m)
AQHBCI_API int AH_Medium_GetTokenIdData (AH_MEDIUM *m, GWEN_BUFFER *buf)

Context Selection, Creation and Removal

AQHBCI_API int AH_Medium_SelectContext (AH_MEDIUM *m, int idx)
AH_MEDIUM_CTXAH_Medium_GetCurrentContext (AH_MEDIUM *m)
AQHBCI_API int AH_Medium_ReadContext (AH_MEDIUM *m, int idx, int *country, GWEN_BUFFER *bankId, GWEN_BUFFER *userId, GWEN_BUFFER *server, int *port)
AQHBCI_API int AH_Medium_WriteContext (AH_MEDIUM *m, int idx, int country, const char *bankId, const char *userId, const char *server, int port)

Encryption And Decryption

AQHBCI_API AH_MEDIUM_RESULT AH_Medium_Encrypt (AH_MEDIUM *m, GWEN_BUFFER *msgbuf, GWEN_BUFFER *encryptbuf, GWEN_BUFFER *msgKeyBuffer)
AQHBCI_API AH_MEDIUM_RESULT AH_Medium_Decrypt (AH_MEDIUM *m, GWEN_BUFFER *msgbuf, GWEN_BUFFER *decryptbuf, GWEN_BUFFER *msgKeyBuffer)

Virtual Functions

The functions in this group are wrappers which in most cases directly call the implementations of the functions (exceptions: AH_Medium_Mount and AH_Medium_Unmount).

AQHBCI_API int AH_Medium_Mount (AH_MEDIUM *m)
AQHBCI_API int AH_Medium_Create (AH_MEDIUM *m)
AQHBCI_API int AH_Medium_Unmount (AH_MEDIUM *m, int force)
AQHBCI_API int AH_Medium_ChangePin (AH_MEDIUM *m)
AQHBCI_API int AH_Medium_ToDB (const AH_MEDIUM *m, GWEN_DB_NODE *db)
AQHBCI_API int AH_Medium_FromDB (AH_MEDIUM *m, GWEN_DB_NODE *db)
AQHBCI_API AH_MEDIUM_RESULT AH_Medium_Sign (AH_MEDIUM *m, GWEN_BUFFER *msgbuf, GWEN_BUFFER *signbuf)
AQHBCI_API int AH_Medium_GetNextSignSeq (AH_MEDIUM *m)
AQHBCI_API AH_MEDIUM_RESULT AH_Medium_EncryptKey (AH_MEDIUM *m, GWEN_BUFFER *srckey, GWEN_BUFFER *encKey)
AQHBCI_API AH_MEDIUM_RESULT AH_Medium_DecryptKey (AH_MEDIUM *m, GWEN_BUFFER *srckey, GWEN_BUFFER *decKey)
AQHBCI_API GWEN_BUFFER * AH_Medium_GenerateMsgKey (AH_MEDIUM *m)
AQHBCI_API AH_MEDIUM_RESULT AH_Medium_Verify (AH_MEDIUM *m, GWEN_BUFFER *msgbuf, GWEN_BUFFER *signbuf, int signseq)

Helper Functions

AQHBCI_API int AH_Medium_InputPin (AH_MEDIUM *m, char *buffer, int minLen, int maxLen, int flags)
AQHBCI_API int AH_Medium_SetPinStatus (AH_MEDIUM *m, const char *pin, AB_BANKING_PINSTATUS status)
AQHBCI_API int AH_Medium_InputTan (AH_MEDIUM *m, char *buffer, int minLen, int maxLen)
AQHBCI_API int AH_Medium_SetTanStatus (AH_MEDIUM *m, const char *tan, AB_BANKING_TANSTATUS status)

Defines

#define AH_MEDIUM_FLAGS_DISABLE_SMALLER_SIGNATURE   0x00000001

Typedefs

typedef AH_MEDIUM AH_MEDIUM

Enumerations

enum  AH_MEDIUMTYPE { AH_MediumTypeDDV = 0, AH_MediumTypeRDH, AH_MediumTypePINTAN }
enum  AH_MEDIUM_RESULT {
  AH_MediumResultOk = 0, AH_MediumResultNoKey, AH_MediumResultBadKey, AH_MediumResultSignSeq,
  AH_MediumResultInvalidSignature, AH_MediumResultGenericError, AH_MediumResultNotSupported
}

Functions

 GWEN_LIST_FUNCTION_LIB_DEFS (AH_MEDIUM, AH_Medium, AQHBCI_API)
int AH_Medium_CreateKeys (AH_MEDIUM *m)
GWEN_CRYPTKEY * AH_Medium_GetLocalPubSignKey (AH_MEDIUM *m)
GWEN_CRYPTKEY * AH_Medium_GetLocalPubCryptKey (AH_MEDIUM *m)
GWEN_CRYPTKEY * AH_Medium_GetPubSignKey (AH_MEDIUM *m)
GWEN_CRYPTKEY * AH_Medium_GetPubCryptKey (AH_MEDIUM *m)
int AH_Medium_SetPubSignKey (AH_MEDIUM *m, const GWEN_CRYPTKEY *key)
int AH_Medium_SetPubCryptKey (AH_MEDIUM *m, const GWEN_CRYPTKEY *key)
int AH_Medium_ResetServerKeys (AH_MEDIUM *m)
int AH_Medium_ResetUserKeys (AH_MEDIUM *m)


Define Documentation

#define AH_MEDIUM_FLAGS_DISABLE_SMALLER_SIGNATURE   0x00000001
 

If this flag is set then signing with an RSA key will not choose the smaller signature according iso9796-appendix. The default is to allow it.

Definition at line 30 of file medium.h.


Typedef Documentation

typedef struct AH_MEDIUM AH_MEDIUM
 

Definition at line 36 of file medium.h.


Enumeration Type Documentation

enum AH_MEDIUM_RESULT
 

Enumerator:
AH_MediumResultOk 
AH_MediumResultNoKey 
AH_MediumResultBadKey 
AH_MediumResultSignSeq 
AH_MediumResultInvalidSignature 
AH_MediumResultGenericError 
AH_MediumResultNotSupported 

Definition at line 45 of file medium.h.

enum AH_MEDIUMTYPE
 

Enumerator:
AH_MediumTypeDDV 
AH_MediumTypeRDH 
AH_MediumTypePINTAN 

Definition at line 38 of file medium.h.


Function Documentation

AQHBCI_API void AH_Medium_AddFlags AH_MEDIUM m,
GWEN_TYPE_UINT32  fl
 

AQHBCI_API void AH_Medium_Attach AH_MEDIUM m  ) 
 

Attaches to the medium. This means that the usage count of this medium gets incremented so a following free will not really destroy it until the usage counter reaches zero. So after finishing using the medium attached to you should simply call AH_Medium_free and that function will take care of the usage counter stuff. Please note that AH_Medium_new also increments the usage counter so you do not have to call this function after creating the medium.

AQHBCI_API int AH_Medium_ChangePin AH_MEDIUM m  ) 
 

Makes the medium change the PIN.

AQHBCI_API int AH_Medium_Create AH_MEDIUM m  ) 
 

Creates the medium. A KeyFile medium would prepare the file upon this. Upon successful return this medium is mounted so you need to unmount it in order to really write a keyfile.

int AH_Medium_CreateKeys AH_MEDIUM m  ) 
 

AQHBCI_API AH_MEDIUM_RESULT AH_Medium_Decrypt AH_MEDIUM m,
GWEN_BUFFER *  msgbuf,
GWEN_BUFFER *  decryptbuf,
GWEN_BUFFER *  msgKeyBuffer
 

AQHBCI_API AH_MEDIUM_RESULT AH_Medium_DecryptKey AH_MEDIUM m,
GWEN_BUFFER *  srckey,
GWEN_BUFFER *  decKey
 

AQHBCI_API AH_MEDIUM_RESULT AH_Medium_Encrypt AH_MEDIUM m,
GWEN_BUFFER *  msgbuf,
GWEN_BUFFER *  encryptbuf,
GWEN_BUFFER *  msgKeyBuffer
 

AQHBCI_API AH_MEDIUM_RESULT AH_Medium_EncryptKey AH_MEDIUM m,
GWEN_BUFFER *  srckey,
GWEN_BUFFER *  encKey
 

AQHBCI_API void AH_Medium_free AH_MEDIUM m  ) 
 

Destroys the medium if the internal usage counter reaches zero. That counter is incremented by AH_Medium_new and AH_Medium_Attach and decremented by this function.

AQHBCI_API int AH_Medium_FromDB AH_MEDIUM m,
GWEN_DB_NODE *  db
 

Restores the medium from the given DB. This function restores the information it can access (like the keyspecs) and then calls the implementation with a subgroup of the given DB.

AQHBCI_API GWEN_BUFFER* AH_Medium_GenerateMsgKey AH_MEDIUM m  ) 
 

AQHBCI_API AB_BANKING* AH_Medium_GetBankingApi const AH_MEDIUM m  ) 
 

AH_MEDIUM_CTX* AH_Medium_GetCurrentContext AH_MEDIUM m  ) 
 

AQHBCI_API const char* AH_Medium_GetDescriptiveName const AH_MEDIUM m  ) 
 

This string is presented to the user to allow him to identify the medium an interactive function refers to (such as GetPin). This string should be stored by the medium upon unmount and restored when mounting the medium.

AQHBCI_API GWEN_TYPE_UINT32 AH_Medium_GetFlags const AH_MEDIUM m  ) 
 

AQHBCI_API AH_HBCI* AH_Medium_GetHBCI const AH_MEDIUM m  ) 
 

GWEN_CRYPTKEY* AH_Medium_GetLocalPubCryptKey AH_MEDIUM m  ) 
 

GWEN_CRYPTKEY* AH_Medium_GetLocalPubSignKey AH_MEDIUM m  ) 
 

AQHBCI_API const char* AH_Medium_GetMediumName const AH_MEDIUM m  ) 
 

AQHBCI_API const char* AH_Medium_GetMediumSubTypeName const AH_MEDIUM m  ) 
 

AQHBCI_API const char* AH_Medium_GetMediumTypeName const AH_MEDIUM m  ) 
 

AQHBCI_API int AH_Medium_GetNextSignSeq AH_MEDIUM m  ) 
 

GWEN_CRYPTKEY* AH_Medium_GetPubCryptKey AH_MEDIUM m  ) 
 

GWEN_CRYPTKEY* AH_Medium_GetPubSignKey AH_MEDIUM m  ) 
 

AQHBCI_API int AH_Medium_GetTokenIdData AH_MEDIUM m,
GWEN_BUFFER *  buf
 

AQHBCI_API int AH_Medium_InputPin AH_MEDIUM m,
char *  buffer,
int  minLen,
int  maxLen,
int  flags
 

AQHBCI_API int AH_Medium_InputTan AH_MEDIUM m,
char *  buffer,
int  minLen,
int  maxLen
 

AQHBCI_API int AH_Medium_IsMounted AH_MEDIUM m  ) 
 

AQHBCI_API int AH_Medium_Mount AH_MEDIUM m  ) 
 

The implementation of this function should make the KeySpecs available (using AH_Medium_SetRemoteCryptKeySpec and others as appropriate), at least id the medium is mounted for the first time in it's lifetime. These keyspecs are then preserved upon AH_Medium_ToDB and AH_Medium_fromDB.

It generally is a good idea to update the keyspecs upon mount.

Please note that this call only get's through to the virtual function of inheriting classes if the mountCount is 0. Otherwise the mountCount will simply be incremented without calling the implementation.

AQHBCI_API AH_MEDIUM* AH_Medium_new AH_HBCI hbci,
const char *  typeName,
const char *  subTypeName,
const char *  mediumName
 

Parameters:
mtn medium type name (like "RDHFile", "DDVCard" etc)
bankId bank code (German "Bankleitzahl")
userId id of this medium's owner

AQHBCI_API int AH_Medium_ReadContext AH_MEDIUM m,
int  idx,
int *  country,
GWEN_BUFFER *  bankId,
GWEN_BUFFER *  userId,
GWEN_BUFFER *  server,
int *  port
 

int AH_Medium_ResetServerKeys AH_MEDIUM m  ) 
 

int AH_Medium_ResetUserKeys AH_MEDIUM m  ) 
 

AQHBCI_API int AH_Medium_SelectContext AH_MEDIUM m,
int  idx
 

AQHBCI_API void AH_Medium_SetDescriptiveName AH_MEDIUM m,
const char *  s
 

AQHBCI_API void AH_Medium_SetFlags AH_MEDIUM m,
GWEN_TYPE_UINT32  fl
 

AQHBCI_API void AH_Medium_SetMediumName AH_MEDIUM m,
const char *  s
 

AQHBCI_API int AH_Medium_SetPinStatus AH_MEDIUM m,
const char *  pin,
AB_BANKING_PINSTATUS  status
 

int AH_Medium_SetPubCryptKey AH_MEDIUM m,
const GWEN_CRYPTKEY *  key
 

int AH_Medium_SetPubSignKey AH_MEDIUM m,
const GWEN_CRYPTKEY *  key
 

AQHBCI_API int AH_Medium_SetTanStatus AH_MEDIUM m,
const char *  tan,
AB_BANKING_TANSTATUS  status
 

AQHBCI_API AH_MEDIUM_RESULT AH_Medium_Sign AH_MEDIUM m,
GWEN_BUFFER *  msgbuf,
GWEN_BUFFER *  signbuf
 

AQHBCI_API void AH_Medium_SubFlags AH_MEDIUM m,
GWEN_TYPE_UINT32  fl
 

AQHBCI_API int AH_Medium_ToDB const AH_MEDIUM m,
GWEN_DB_NODE *  db
 

Stores all interesting data about this medium to the given DB (but not the keys!) in order to make the medium restoreable via AH_Medium_FromDB. This function stores the information it can access (like the keyspecs) and then calls the implementation with a subgroup of the given DB.

AQHBCI_API int AH_Medium_Unmount AH_MEDIUM m,
int  force
 

Please note that this call only get's through to the virtual function of inheriting classes if the mountCount is 1 or force is !=0. Otherwise the mountCount will simply be decremented without calling the implementation.

AQHBCI_API AH_MEDIUM_RESULT AH_Medium_Verify AH_MEDIUM m,
GWEN_BUFFER *  msgbuf,
GWEN_BUFFER *  signbuf,
int  signseq
 

Parameters:
signseq Signature sequence counter received. If 0 then this will not be verified, therefore the caller MUST make sure that a "0" is never accepted from a signature inside a message !

AQHBCI_API int AH_Medium_WriteContext AH_MEDIUM m,
int  idx,
int  country,
const char *  bankId,
const char *  userId,
const char *  server,
int  port
 

GWEN_LIST_FUNCTION_LIB_DEFS AH_MEDIUM  ,
AH_Medium  ,
AQHBCI_API 
 


Generated on Thu Oct 6 14:49:09 2005 for aqbanking by  doxygen 1.4.4