eID middleware |

# eIDMW::PTEID_SmartCard Class Reference

Abstract base class for Smart card. More...

`#include <eidlib.h>`

Inheritance diagram for eIDMW::PTEID_SmartCard:

List of all members.

## Public Member Functions

virtual PTEIDSDK_API | ~PTEID_SmartCard ()=0
| Destructor.
PTEIDSDK_API void | selectApplication (const PTEID_ByteArray &applicationId)
| Select an application from the card.
virtual PTEIDSDK_API PTEID_ByteArray | sendAPDU (const PTEID_ByteArray &cmd, PTEID_Pin *pin=NULL, const char *csPinCode="")
| Send an APDU command to the card and get the result.
virtual PTEIDSDK_API long | readFile (const char *fileID, PTEID_ByteArray &in, PTEID_Pin *pin=NULL, const char *csPinCode="")
| Read a File from the card.
virtual PTEIDSDK_API bool | writeFile (const char *fileID, const PTEID_ByteArray &out, PTEID_Pin *pin=NULL, const char *csPinCode="")
| Write a file to the card.
virtual PTEIDSDK_API unsigned long | pinCount ()
| Return the number of pin on the card.
virtual PTEIDSDK_API PTEID_Pins & | getPins ()
| Return an object to access all the pins on the card.
virtual PTEIDSDK_API unsigned long | certificateCount ()
| Return the number of certificate on the card.
virtual PTEIDSDK_API PTEID_Certificates & | getCertificates ()
| Return an object to access all the certificates on the card.
virtual PTEIDSDK_API const PTEID_ByteArray & | getChallenge (bool bForceNewInit=false)
| Return the challenge.
virtual PTEIDSDK_API const PTEID_ByteArray & | getChallengeResponse ()
| Return the response to the challenge.
virtual PTEIDSDK_API bool | verifyChallengeResponse (const PTEID_ByteArray &challenge, const PTEID_ByteArray &response) const
| Return true if the response of the card to the given challenge is the same as the response expected.

## Protected Member Functions

| PTEID_SmartCard (const SDK_Context *context, APL_Card *impl)
| For internal use : Constructor.

## Detailed Description

Abstract base class for Smart card.

## Constructor & Destructor Documentation

virtual PTEIDSDK_API eIDMW::PTEID_SmartCard::~PTEID_SmartCard | ( |  | ) | `[pure virtual]`

Destructor.

eIDMW::PTEID_SmartCard::PTEID_SmartCard | ( | const SDK_Context * | context,
|  | APL_Card * | impl |
| ) |  |  | `[protected]`

For internal use : Constructor.

## Member Function Documentation

virtual PTEIDSDK_API unsigned long eIDMW::PTEID_SmartCard::certificateCount | ( |  | ) | `[virtual]`

Return the number of certificate on the card.

virtual PTEIDSDK_API PTEID_Certificates& eIDMW::PTEID_SmartCard::getCertificates | ( |  | ) | `[virtual]`

Return an object to access all the certificates on the card.

virtual PTEIDSDK_API const PTEID_ByteArray& eIDMW::PTEID_SmartCard::getChallenge | ( | bool | bForceNewInit = `false` | ) | `[virtual]`

Return the challenge.

Parameters:

  | bForceNewInit | force a new initialization of the couple challenge/response

virtual PTEIDSDK_API const PTEID_ByteArray& eIDMW::PTEID_SmartCard::getChallengeResponse | ( |  | ) | `[virtual]`

Return the response to the challenge.

virtual PTEIDSDK_API PTEID_Pins& eIDMW::PTEID_SmartCard::getPins | ( |  | ) | `[virtual]`

Return an object to access all the pins on the card.

virtual PTEIDSDK_API unsigned long eIDMW::PTEID_SmartCard::pinCount | ( |  | ) | `[virtual]`

Return the number of pin on the card.

virtual PTEIDSDK_API long eIDMW::PTEID_SmartCard::readFile | ( | const char * | fileID,
|  | PTEID_ByteArray & | in,
|  | PTEID_Pin * | pin = `NULL`,
|  | const char * | csPinCode = `""` |
| ) |  |  | `[virtual]`

Read a File from the card.

If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.

Parameters:

  | fileID | is the path of the file
  | in | return the file
  | pin | is the pin to ask for reading
  | csPinCode | is the code of the pin (it will be asked if needed and not set)

PTEIDSDK_API void eIDMW::PTEID_SmartCard::selectApplication | ( | const PTEID_ByteArray & | applicationId | ) |

Select an application from the card.

virtual PTEIDSDK_API PTEID_ByteArray eIDMW::PTEID_SmartCard::sendAPDU | ( | const PTEID_ByteArray & | cmd,
|  | PTEID_Pin * | pin = `NULL`,
|  | const char * | csPinCode = `""` |
| ) |  |  | `[virtual]`

Send an APDU command to the card and get the result.

Parameters:

  | cmd | is the apdu command
  | pin | is the pin to ask for writing
  | csPinCode | is the code of the pin (it will be asked if needed and not set)

Returns:
  a PTEID_ByteArray containing the result

virtual PTEIDSDK_API bool eIDMW::PTEID_SmartCard::verifyChallengeResponse | ( | const PTEID_ByteArray & | challenge,
|  | const PTEID_ByteArray & | response |
| ) |  |  | const`[virtual]`

Return true if the response of the card to the given challenge is the same as the response expected.

For virtual card (from file), always return false.

Parameters:

  | challenge | is the challenge to check
  | response | is the response expected from the card

virtual PTEIDSDK_API bool eIDMW::PTEID_SmartCard::writeFile | ( | const char * | fileID,
|  | const PTEID_ByteArray & | out,
|  | PTEID_Pin * | pin = `NULL`,
|  | const char * | csPinCode = `""` |
| ) |  |  | `[virtual]`

Write a file to the card.

Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.

If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.

Parameters:

  | fileID | is the path of the file
  | out | contents the bytes to write
  | pin | is the pin to ask for writing
  | csPinCode | is the code of the pin (it will be asked if needed and not set)

The documentation for this class was generated from the following file:

- eidlib.h