/*! * CardInfo.h * * \brief Contains the CardInfo and the CardInfoFactory * * \copyright Copyright (c) 2014 Governikus GmbH & Co. KG */ #pragma once #include "asn1/SecurityInfos.h" #include "SmartCardDefinitions.h" #include namespace governikus { class CardConnectionWorker; class PACEInfo; class Reader; class ReaderInfo; /*! * Holds smart card informations. * An instance of CardInfo is created using the CardInfoFactory. */ class CardInfo { CardType mCardType; QSharedPointer mEfCardAccess; int mRetryCounter; bool mPinDeactivated; bool mPukInoperative; public: CardInfo(CardType pCardType, QSharedPointer = QSharedPointer(), int pRetryCounter = -1, bool pPinDeactivated = false, bool pPukInoperative = false); CardType getCardType() const; QSharedPointer getEfCardAccess() const; QString getEidApplicationPath() const; int getRetryCounter() const; /*! * The online identification function has not been activated by the competent authority. */ bool isPinDeactivated() const; /*! * The PUK is inoperative. User is not able to unblock the PIN anymore. */ bool isPukInoperative() const; friend class Reader; }; /*! * Factory for creation of CardInfo instances. */ class CardInfoFactory { public: /*! * In order to create a CardInfo instance a connection is established to the smart card * and data is read. */ static bool create(const QSharedPointer& pCardConnectionWorker, ReaderInfo& pReaderInfo); private: /*! * Checks, if the smart card is a german eID card, i.e. a NPA or an EAT. */ static bool isGermanEidCard(const QSharedPointer& pCardConnectionWorker); /*! * Reads the EF.CardAccess */ static QSharedPointer readEfCardAccess(const QSharedPointer& pCardConnectionWorker); /*! * According to TR-03105 we have to perform some checks on EF.CardAccess the first time we read it. * Therefore we read it just once and handle malformed EF.CardAccess structures here in card recognition process. */ static bool checkEfCardAccess(const QSharedPointer& pEfCardAccess); }; } /* namespace governikus */