Portuguese eID Middleware SDK  Version: 3.12.0
eIDMW::PTEID_SmartCard Class Referenceabstract

#include <eidlib.h>

Public Member Functions

virtual PTEIDSDK_API ~PTEID_SmartCard ()=0
 
PTEIDSDK_API void selectApplication (const PTEID_ByteArray &applicationId)
 
virtual PTEIDSDK_API PTEID_ByteArray sendAPDU (const PTEID_ByteArray &cmd, PTEID_Pin *pin=NULL, const char *csPinCode="")
 
virtual PTEIDSDK_API long readFile (const char *fileID, PTEID_ByteArray &in, PTEID_Pin *pin=NULL, const char *csPinCode="")
 
virtual PTEIDSDK_API bool writeFile (const char *fileID, const PTEID_ByteArray &out, PTEID_Pin *pin=NULL, const char *csPinCode="", unsigned long inOffset=0)
 
virtual PTEIDSDK_API unsigned long pinCount ()
 
virtual PTEIDSDK_API PTEID_PinsgetPins ()
 
virtual PTEIDSDK_API unsigned long certificateCount ()
 
- Public Member Functions inherited from eIDMW::PTEID_Card
virtual PTEIDSDK_API ~PTEID_Card ()=0
 
virtual PTEIDSDK_API PTEID_CardType getType ()
 
virtual PTEIDSDK_API PTEID_ByteArray sendAPDU (const PTEID_ByteArray &cmd)
 
virtual PTEIDSDK_API PTEID_ByteArray Sign (const PTEID_ByteArray &data, bool signatureKey=false) override
 
virtual PTEIDSDK_API PTEID_ByteArray SignSHA256 (const PTEID_ByteArray &data, bool signatureKey=false) override
 
virtual PTEIDSDK_API PTEID_ByteArray Sign (const PTEID_ByteArray &data, PTEID_RSAPaddingType paddingType, bool signatureKey=false)
 
virtual PTEIDSDK_API PTEID_ByteArray SignXades (const char *output_path, const char *const *paths, unsigned int n_paths, PTEID_SignatureLevel level=PTEID_LEVEL_BASIC) override
 
virtual PTEIDSDK_API PTEID_ByteArray SignXadesT (const char *output_path, const char *const *paths, unsigned int n_paths) override
 
virtual PTEIDSDK_API PTEID_ByteArray SignXadesA (const char *output_path, const char *const *paths, unsigned int n_paths) override
 
virtual PTEIDSDK_API void SignXadesIndividual (const char *output_path, const char *const *paths, unsigned int n_paths) override
 
virtual PTEIDSDK_API void SignXadesTIndividual (const char *output_path, const char *const *paths, unsigned int n_paths) override
 
virtual PTEIDSDK_API void SignXadesAIndividual (const char *output_path, const char *const *paths, unsigned int n_paths) override
 
virtual PTEIDSDK_API int SignPDF (PTEID_PDFSignature &sig_handler, int page, int page_sector, bool is_landscape, const char *location, const char *reason, const char *outfile_path) override
 
virtual PTEIDSDK_API int SignPDF (PTEID_PDFSignature &sig_handler, int page, double coord_x, double coord_y, const char *location, const char *reason, const char *outfile_path) override
 
virtual PTEIDSDK_API PTEID_CertificatesgetCertificates () override
 
virtual PTEIDSDK_API PTEID_CertificategetCert (PTEID_CertifType type) override
 
virtual PTEIDSDK_API PTEID_CertificategetRoot () override
 
virtual PTEIDSDK_API PTEID_CertificategetCA () override
 
virtual PTEIDSDK_API PTEID_CertificategetSignature () override
 
virtual PTEIDSDK_API PTEID_CertificategetAuthentication () override
 
virtual PTEIDSDK_API PTEID_SigningDeviceType getDeviceType () override
 
virtual PTEIDSDK_API PTEID_ByteArray readFile (const char *fileID, unsigned long ulOffset=0, unsigned long ulMaxLength=0)
 
virtual PTEIDSDK_API bool writeFile (const char *fileID, const PTEID_ByteArray &oData, unsigned long ulOffset=0)
 
virtual PTEIDSDK_API void initPaceAuthentication (const char *secret, size_t length, PTEID_CardPaceSecretType secretType)
 
- Public Member Functions inherited from eIDMW::PTEID_Object
virtual PTEIDSDK_API ~PTEID_Object ()=0
 
NOEXPORT_PTEIDSDK void Init (const SDK_Context *context, void *impl)
 
NOEXPORT_PTEIDSDK void Release ()
 

Protected Member Functions

 PTEID_SmartCard (const SDK_Context *context, APL_Card *impl)
 
- Protected Member Functions inherited from eIDMW::PTEID_Card
 PTEID_Card (const SDK_Context *context, APL_Card *impl)
 
- Protected Member Functions inherited from eIDMW::PTEID_Object
 PTEID_Object (const SDK_Context *context, void *impl)
 
void addObject (PTEID_Object *impl)
 
void backupObject (unsigned long idx)
 
PTEID_ObjectgetObject (unsigned long idx)
 
PTEID_ObjectgetObject (void *impl)
 
void delObject (unsigned long idx)
 
void delObject (void *impl)
 
void checkContextStillOk () const
 
 PTEID_Object (const PTEID_Object &obj)
 
PTEID_Objectoperator= (const PTEID_Object &obj)
 

Additional Inherited Members

- Protected Attributes inherited from eIDMW::PTEID_Object
bool m_delimpl
 
void * m_impl
 
unsigned long m_ulIndexExtAdd
 
std::map< unsigned long, PTEID_Object * > m_objects
 
SDK_Context * m_context
 

Detailed Description

Abstract base class for Smart card.

Constructor & Destructor Documentation

◆ ~PTEID_SmartCard()

virtual PTEIDSDK_API eIDMW::PTEID_SmartCard::~PTEID_SmartCard ( )
pure virtual

Destructor

◆ PTEID_SmartCard()

eIDMW::PTEID_SmartCard::PTEID_SmartCard ( const SDK_Context *  context,
APL_Card *  impl 
)
protected

For internal use : Constructor

Member Function Documentation

◆ certificateCount()

virtual PTEIDSDK_API unsigned long eIDMW::PTEID_SmartCard::certificateCount ( )
virtual
Returns
the number of certificate on the card.

◆ getPins()

virtual PTEIDSDK_API PTEID_Pins& eIDMW::PTEID_SmartCard::getPins ( )
virtual
Returns
an object to access all the pins on the card.

◆ pinCount()

virtual PTEIDSDK_API unsigned long eIDMW::PTEID_SmartCard::pinCount ( )
virtual
Returns
the number of pins on the card.

◆ readFile()

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
fileIDis the path of the file
inreturn the file
pinis the pin to ask for reading
csPinCodeis the code of the pin (it will be asked if needed and not set)

◆ selectApplication()

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

Select an application from the card

◆ sendAPDU()

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
cmdis the apdu command
pinis the pin to ask for writing
csPinCodeis the code of the pin (it will be asked if needed and not set)
Returns
a PTEID_ByteArray containing the result

◆ writeFile()

virtual PTEIDSDK_API bool eIDMW::PTEID_SmartCard::writeFile ( const char *  fileID,
const PTEID_ByteArray out,
PTEID_Pin pin = NULL,
const char *  csPinCode = "",
unsigned long  inOffset = 0 
)
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
fileIDis the path of the file
outcontents the bytes to write
pinis the pin to ask for writing
csPinCodeis the code of the pin (it will be asked if needed and not set)
inOffsetis the offset of the data to be written to the file