Here is a breif listing of the File/CHV operations that an application will use
to communicate with the PC/SC resource manager.  A separate library consisting
of these bare functions will have to be provided for each card - although much
of the code can be reused since most of these commands come straight from
ISO-7816-4.

/*****************************************************************
/
/ File   :   FileAccess.h
/ Author :   David Corcoran
/ Date   :   December 3, 1998
/ Purpose:   This provides an interface to the ICC filesystem.
/            See http://www.smartcardsys.com for more information.
/ License:   See file LICENSE
/
******************************************************************/

#ifndef _FileAccess_h_
#define _FileAccess_h_

#include "defines.h"
#include "SCard.h"


class FILEACCESS {
  
 private:
  SCARD scard;
  STR CurrentPath;
  
 public:
  
  FILEACCESS( SCARD scard );
  ~FILEACCESS();
  
  RESPONSECODE ChangeDir(
                         REFTYPE Ref,
                         STR PathSpec
                         );
  
  RESPONSECODE GetCurrentDir(
                             STR PathSpec
                             );
  
  RESPONSECODE Directory(
                         FILETYPE Type,
                         FILESPEC FileList[],
                         WORD Length
                         );
  
  RESPONSECODE GetProperties(
                             REFTYPE Ref,
                             STR PathSpec,
                             TLV Properties[],
                             WORD Length,
                             DWORD Flags
                             );
  
  
  RESPONSECODE SetProperties(
                             REFTYPE Ref,
                             STR PathSpec,
                             TLV Properties,
                             WORD Length,
                             DWORD Flags
                             );
  
  RESPONSECODE GetFileCapabilities(
                                   HANDLE hFile,
                                   TLV Properties[],
                                   WORD Length,
                                   DWORD Flags
                                   );
  
  RESPONSECODE Open(
                    REFTYPE Ref,
                    STR PathSpec,
                    HANDLE hFile
                    );
  
  
  RESPONSECODE Close(
                     HANDLE hFile
                     );
  
  RESPONSECODE Seek(
                    HANDLE hFile,
                    DWORD Offset,
                    DWORD SeekType
                    );
  
  RESPONSECODE Write(
                     HANDLE hFile,
                     DWORD Length,
                     BYTE Buffer[],
                     DWORD Flags
                     );
  
  
  RESPONSECODE Read(
                    HANDLE hFile,
                    DWORD Length,
                    BYTE Buffer,
                    DWORD Flags
                    );
  
  RESPONSECODE Create(
                      REFTYPE Ref,
                      STR PathSpec,
                      TLV TLVs[],
                      WORD Length,
                      WORD Flags,
                      VOID DataBuffer
                      );
  
  RESPONSECODE Delete(
                      REFTYPE Ref,
                      STR PathSpec,
                      WORD Flags
                      );
  
  RESPONSECODE Invalidate(
                          REFTYPE Ref,
                          STR PathSpec,
                          WORD Flag
                          );
  
  RESPONSECODE Rehabilitate(
                            REFTYPE Ref,
                            STR PathSpec,
                            WORD Flag
                            );


};



#endif



/*****************************************************************
/
/ File   :   SCard.h
/ Author :   David Corcoran
/ Date   :   December 3, 1998
/ Purpose:   This defines an applications interface to the ICC.
/            See http://www.smartcardsys.com for more information.
/ License:   See file LICENSE
/
******************************************************************/

#ifndef _SCard_h_
#define _SCard_h_

#include "defines.h"


class SCARD {
  
 private:

 public:

  SCARD();
  ~SCARD();
  
  RESPONSECODE CreateFileAccess(
                                FileAccess aFileAccess
                                );
  
  RESPONSECODE CreateCHVerification(
                                    CHVerification aCHVerification
                                    );
  
  RESPONSECODE CreateCardAuth(
                              CardAuth aCardAuth
                              );
  
  RESPONSECODE CreateCryptProv(
                               CryptProv aCryptProv
                               );
  
  RESPONSECODE AttachByHandle(
                              HANDLE hCard
                              );
  
  RESPONSECODE AttachByIFD(
                           STR ReaderName,
                           DWORD Flags
                           );
  
  RESPONSECODE Detach();
  
  RESPONSECODE Reconnect(
                         DWORD Flags
                         );
  
  RESPONSECODE Lock();
  
  RESPONSECODE Unlock();
  
  
};



#endif


/*****************************************************************
/
/ File   :   CardAuth.h
/ Author :   David Corcoran
/ Date   :   December 3, 1998
/ Purpose:   This exposes authentication services of an ICC.
/            See http://www.smartcardsys.com for more information.
/ License:   See file LICENSE
/
******************************************************************/

#ifndef _CardAuth_h_
#define _CardAuth_h_

#include "defines.h"

class CARDAUTH {
  
 private:
  SCARD scard;
  
  
 public:
  
  CARDAUTH( SCARD scard );
  ~CARDAUTH();
  
  RESPONSECODE GetChallenge(
                            DWORD AlgID,
                            VOID Param,
                            DWORD Length,
                            BYTE Buffer[]
                            );
  
  RESPONSECODE ICC_Auth(
                        LONG AlgID,
                        VOID Param,
                        DWORD Length,
                        BYTE Buffer[]
                        );
  
  RESPONSECODE APP_Auth(
                        LONG AlgID,
                        VOID Param,
                        BYTE Buffer[]
                        );
  
  RESPONSECODE User_Auth(
                         LONG AlgID,
                         VOID Param,
                         DWORD Length,
                         BYTE Buffer[]
                         );
  
  
};


#endif




 --
******************************************************************
David Corcoran                   Internet Security/Smartcards

Work:                            School:
205 Industrial Blvd              2252 US Highway 52 West Apt C4
Sugar Land, TX 77478             West Lafayette, IN 47906

Quotes:
  If it's a hobby for us and a job for you, then why are you doing
    such a shoddy job (Microsoft) ? ~ Linus Torvalds

  If you can't make it work, at least make it look good.
    ~ Bill Gates
******************************************************************
***************************************************************
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***************************************************************

Reply via email to