16#include "FileHeader.h"
19#include "ByteArrayUtil.h"
21#include "IllegalArgumentException.h"
22#include "IllegalStateException.h"
36using namespace calypsonet::terminal::calypso;
37using namespace keyple::core::util;
38using namespace keyple::core::util::cpp;
39using namespace keyple::core::util::cpp::exception;
43const std::string CalypsoCardAdapter::PATTERN_1_BYTE_HEX =
"%02Xh";
44const std::string CalypsoCardAdapter::PATTERN_2_BYTES_HEX =
"%04Xh";
46const int CalypsoCardAdapter::CARD_REV1_ATR_LENGTH = 20;
47const int CalypsoCardAdapter::REV1_CARD_DEFAULT_WRITE_OPERATIONS_NUMBER_SUPPORTED_PER_SESSION = 3;
48const int CalypsoCardAdapter::REV2_CARD_DEFAULT_WRITE_OPERATIONS_NUMBER_SUPPORTED_PER_SESSION = 6;
49const int CalypsoCardAdapter::SI_BUFFER_SIZE_INDICATOR = 0;
50const int CalypsoCardAdapter::SI_PLATFORM = 1;
51const int CalypsoCardAdapter::SI_APPLICATION_TYPE = 2;
52const int CalypsoCardAdapter::SI_APPLICATION_SUBTYPE = 3;
53const int CalypsoCardAdapter::SI_SOFTWARE_ISSUER = 4;
54const int CalypsoCardAdapter::SI_SOFTWARE_VERSION = 5;
55const int CalypsoCardAdapter::SI_SOFTWARE_REVISION = 6;
56const int CalypsoCardAdapter::DEFAULT_PAYLOAD_CAPACITY = 250;
58const uint8_t CalypsoCardAdapter::APP_TYPE_WITH_CALYPSO_PIN = 0x01;
59const uint8_t CalypsoCardAdapter::APP_TYPE_WITH_CALYPSO_SV = 0x02;
60const uint8_t CalypsoCardAdapter::APP_TYPE_RATIFICATION_COMMAND_REQUIRED = 0x04;
61const uint8_t CalypsoCardAdapter::APP_TYPE_CALYPSO_REV_32_MODE = 0x08;
62const uint8_t CalypsoCardAdapter::APP_TYPE_WITH_PUBLIC_AUTHENTICATION = 0x10;
64const std::vector<int> CalypsoCardAdapter::BUFFER_SIZE_INDICATOR_TO_BUFFER_SIZE = {
65 0, 0, 0, 0, 0, 0, 215, 256, 304, 362, 430, 512, 608, 724, 861, 1024, 1217, 1448, 1722, 2048,
66 2435, 2896, 3444, 4096, 4870, 5792, 6888, 8192, 9741, 11585, 13777, 16384, 19483, 23170,
67 27554, 32768, 38967, 46340, 55108, 65536, 77935, 92681, 110217, 131072, 155871, 185363,
68 220435, 262144, 311743, 370727, 440871, 524288, 623487, 741455, 881743, 1048576
71const std::vector<std::shared_ptr<CalypsoCardAdapter::PatchRev3>>
72 CalypsoCardAdapter::mPatchesRev3 = initPatchRev3();
73const std::vector<std::shared_ptr<CalypsoCardAdapter::PatchRev12>>
74 CalypsoCardAdapter::mPatchesRev12 = initPatchRev12();
79 const std::shared_ptr<CardSelectionResponseApi> cardSelectionResponse)
81 if (cardSelectionResponse !=
nullptr) {
83 if (cardSelectionResponse->getSelectApplicationResponse() !=
nullptr) {
87 }
else if (cardSelectionResponse->getPowerOnData() !=
"") {
89 initializeWithPowerOnData(cardSelectionResponse->getPowerOnData());
94const std::vector<std::shared_ptr<CalypsoCardAdapter::PatchRev12>>
95 CalypsoCardAdapter::initPatchRev12()
97 std::shared_ptr<PatchRev12> p =
nullptr;
98 std::vector<std::shared_ptr<PatchRev12>> v;
103 p = std::shared_ptr<PatchRev12>(
new PatchRev12(
"06000103000000",
"FF00FFFF000000"));
104 p->setCounterValuePostponed();
108 p = std::shared_ptr<PatchRev12>(
new PatchRev12(
"060A0102000000",
"FFFFFFFF000000"));
109 p->setCounterValuePostponed();
113 p = std::shared_ptr<PatchRev12>(
new PatchRev12(
"00000000150000",
"0000F000FF0000"));
114 p->setCounterValuePostponed();
118 p = std::shared_ptr<PatchRev12>(
new PatchRev12(
"00001000150000",
"0000F000FF0000"));
119 p->setCounterValuePostponed();
125const std::vector<std::shared_ptr<CalypsoCardAdapter::PatchRev3>>
126 CalypsoCardAdapter::initPatchRev3()
128 std::shared_ptr<PatchRev3> p =
nullptr;
129 std::vector<std::shared_ptr<PatchRev3>> v;
134 p = std::shared_ptr<PatchRev3>(
new PatchRev3(
"003C0000001000",
"00FF000000FF00"));
135 p->setPayloadCapacity(235);
141void CalypsoCardAdapter::initializeWithPowerOnData(
const std::string& powerOnData)
143 mProductType = ProductType::PRIME_REVISION_1;
146 mPowerOnData = powerOnData;
152 const std::vector<uint8_t> atr = HexUtil::toByteArray(powerOnData);
155 if (atr.size() != CARD_REV1_ATR_LENGTH) {
157 throw IllegalArgumentException(
"Unexpected ATR length: " + powerOnData);
161 mCalypsoSerialNumber = std::vector<uint8_t>(8);
167 System::arraycopy(atr, 12, mCalypsoSerialNumber, 4, 4);
168 mModificationsCounterMax = REV1_CARD_DEFAULT_WRITE_OPERATIONS_NUMBER_SUPPORTED_PER_SESSION;
170 mStartupInfo = std::vector<uint8_t>(7);
173 mStartupInfo[0] =
static_cast<uint8_t
>(mModificationsCounterMax);
176 System::arraycopy(atr, 6, mStartupInfo, 1, 6);
178 mIsRatificationOnDeselectSupported =
true;
182 const std::shared_ptr<ApduResponseApi> selectApplicationResponse)
184 mSelectApplicationResponse = selectApplicationResponse;
186 if (selectApplicationResponse->getDataOut().size() == 0) {
197 cardGetDataFci->AbstractCardCommand::parseApduResponse(selectApplicationResponse,
200 if (!cardGetDataFci->isValidCalypsoFCI()) {
201 throw IllegalArgumentException(
"Bad FCI format.");
207 const std::shared_ptr<CmdCardGetDataFci> cmdCardGetDataFci)
209 mIsDfInvalidated = cmdCardGetDataFci->isDfInvalidated();
212 mDfName = cmdCardGetDataFci->getDfName();
213 mCalypsoSerialNumber = cmdCardGetDataFci->getApplicationSerialNumber();
216 mStartupInfo = cmdCardGetDataFci->getDiscretionaryData();
225 mApplicationType = mStartupInfo[SI_APPLICATION_TYPE];
226 mProductType = computeProductType(mApplicationType & 0xFF);
229 mApplicationSubType = mStartupInfo[SI_APPLICATION_SUBTYPE];
230 if (mApplicationSubType == 0x00 || mApplicationSubType == 0xFF) {
231 throw IllegalArgumentException(
"Unexpected application subtype: " +
232 std::to_string(mApplicationSubType));
235 mSessionModification = mStartupInfo[SI_BUFFER_SIZE_INDICATOR];
237 if (mProductType == ProductType::PRIME_REVISION_2) {
241 mIsModificationCounterInBytes =
false;
242 mModificationsCounterMax = REV2_CARD_DEFAULT_WRITE_OPERATIONS_NUMBER_SUPPORTED_PER_SESSION;
244 }
else if (mProductType == ProductType::BASIC) {
246 if (mSessionModification < 0x04 || mSessionModification > 0x37) {
247 throw IllegalArgumentException(
"Wrong session modification value for a Basic type " \
248 "(should be between 04h and 37h): " +
249 std::to_string(mSessionModification));
253 mIsModificationCounterInBytes =
false;
254 mModificationsCounterMax = 3;
262 if (mSessionModification < 0x06 || mSessionModification > 0x37) {
263 throw IllegalArgumentException(
"Session modifications byte should be in range 06h to" \
265 std::to_string(mSessionModification));
268 mModificationsCounterMax = BUFFER_SIZE_INDICATOR_TO_BUFFER_SIZE[mSessionModification];
272 if (mProductType == ProductType::PRIME_REVISION_3) {
273 mIsExtendedModeSupported = (mApplicationType & APP_TYPE_CALYPSO_REV_32_MODE) != 0;
274 mIsRatificationOnDeselectSupported =
275 (mApplicationType & APP_TYPE_RATIFICATION_COMMAND_REQUIRED) == 0;
276 mIsPkiModeSupported = (mApplicationType & APP_TYPE_WITH_PUBLIC_AUTHENTICATION) != 0;
279 if (mProductType == ProductType::PRIME_REVISION_3 ||
280 mProductType == ProductType::PRIME_REVISION_2) {
281 mIsSvFeatureAvailable = (mApplicationType & APP_TYPE_WITH_CALYPSO_SV) != 0;
282 mIsPinFeatureAvailable = (mApplicationType & APP_TYPE_WITH_CALYPSO_PIN) != 0;
285 mIsHce = (mCalypsoSerialNumber[3] & 0x80) == 0x80;
287 applyPatchIfNeeded();
292 if (applicationType == 0) {
293 throw IllegalArgumentException(
"Invalid application type 00h");
294 }
else if (applicationType == 0xFF) {
295 return ProductType::UNKNOWN;
296 }
else if (applicationType <= 0x1F) {
297 return ProductType::PRIME_REVISION_2;
298 }
else if (applicationType >= 0x90 && applicationType <= 0x97) {
299 return ProductType::LIGHT;
300 }
else if (applicationType >= 0x98 && applicationType <= 0x9F) {
301 return ProductType::BASIC;
304 return ProductType::PRIME_REVISION_3;
324 return mCalypsoSerialNumber;
329 std::vector<uint8_t> applicationSerialNumber = mCalypsoSerialNumber;
330 applicationSerialNumber[0] = 0;
331 applicationSerialNumber[1] = 0;
333 return applicationSerialNumber;
343 return mPayloadCapacity;
348 return mIsModificationCounterInBytes;
353 return mModificationsCounterMax;
358 return mStartupInfo[SI_PLATFORM];
363 return mApplicationType;
368 return mIsExtendedModeSupported;
373 return mIsRatificationOnDeselectSupported;
378 return mIsSvFeatureAvailable;
383 return mIsPinFeatureAvailable;
388 return mIsPkiModeSupported;
393 return mApplicationSubType;
398 return mStartupInfo[SI_SOFTWARE_ISSUER];
403 return mStartupInfo[SI_SOFTWARE_VERSION];
408 return mStartupInfo[SI_SOFTWARE_REVISION];
413 return mSessionModification;
419 return mTraceabilityInformation;
424 return mIsDfInvalidated;
429 if (mIsDfRatified !=
nullptr) {
430 return *mIsDfRatified.get();
433 throw IllegalStateException(
"Unable to determine the ratification status. No session was " \
439 if (mTransactionCounter ==
nullptr) {
440 throw IllegalStateException(
"Unable to determine the transaction counter. No session was " \
444 return *mTransactionCounter.get();
449 mTransactionCounter = std::make_shared<int>(transactionCounter);
453 const std::vector<uint8_t>& svGetHeader,
454 const std::vector<uint8_t>& svGetData,
456 const int svLastTNum,
457 const std::shared_ptr<SvLoadLogRecord> svLoadLogRecord,
458 const std::shared_ptr<SvDebitLogRecord> svDebitLogRecord)
461 mSvGetHeader = svGetHeader;
462 mSvGetData = svGetData;
463 mSvBalance = std::make_shared<int>(svBalance);
464 mSvLastTNum = svLastTNum;
467 if (mSvLoadLogRecord ==
nullptr) {
468 mSvLoadLogRecord = svLoadLogRecord;
471 if (mSvDebitLogRecord ==
nullptr) {
472 mSvDebitLogRecord = svDebitLogRecord;
478 if (mSvBalance ==
nullptr) {
479 throw IllegalStateException(
"No SV Get command has been executed.");
482 return *mSvBalance.get();
487 if (mSvBalance ==
nullptr) {
488 new IllegalStateException(
"No SV Get command has been executed.");
496 if (mSvLoadLogRecord ==
nullptr) {
498 const std::shared_ptr<ElementaryFile> ef =
501 const std::vector<uint8_t> logRecord = ef->getData()->getContent();
502 mSvLoadLogRecord = std::make_shared<SvLoadLogRecordAdapter>(logRecord, 0);
506 return mSvLoadLogRecord;
511 if (mSvDebitLogRecord ==
nullptr) {
513 const std::vector<std::shared_ptr<SvDebitLogRecord>> svDebitLogRecords =
515 mSvDebitLogRecord = svDebitLogRecords[0];
518 return mSvDebitLogRecord;
524 std::vector<std::shared_ptr<SvDebitLogRecord>> svDebitLogRecords;
527 const std::shared_ptr<ElementaryFile> ef =
530 return svDebitLogRecords;
533 const std::map<const uint8_t, std::vector<uint8_t>>& logRecords =
534 ef->getData()->getAllRecordsContent();
535 for (
const auto& entry : logRecords) {
536 svDebitLogRecords.push_back(std::make_shared<SvDebitLogRecordAdapter>(entry.second, 0));
539 return svDebitLogRecords;
544 mIsDfRatified = std::make_shared<bool>(dfRatified);
549 return mCalypsoCardClass;
554 return mDirectoryHeader;
558 const std::shared_ptr<DirectoryHeader> directoryHeader)
560 mDirectoryHeader = directoryHeader;
561 mIsDfInvalidated = (directoryHeader->getDfStatus() & 0x01) != 0;
572 for (
const auto& ef : mFiles) {
573 if (ef->getSfi() == sfi) {
578 mLogger->warn(
"EF with SFI % is not found\n", sfi);
585 for (
const auto& ef : mFiles) {
586 if (ef->getHeader() !=
nullptr && ef->getHeader()->getLid() == lid) {
591 mLogger->warn(
"EF with LID % is not found\n", lid);
596const std::map<const uint8_t, const std::shared_ptr<ElementaryFile>>
599 std::map<const uint8_t, const std::shared_ptr<ElementaryFile>> res;
600 for (
const auto& ef : mFiles) {
601 if (ef->getSfi() != 0) {
602 res.insert({ef->getSfi(), ef});
614const std::shared_ptr<ElementaryFileAdapter> CalypsoCardAdapter::getOrCreateFile(
const uint8_t sfi,
617 if (sfi == 0 && lid == 0 && mCurrentEf !=
nullptr) {
625 for (
const auto& ef : mFiles) {
627 if (ef->getSfi() == sfi) {
629 mCurrentEf = std::dynamic_pointer_cast<ElementaryFileAdapter>(ef);
634 }
else if (lid != 0) {
637 for (
const auto& ef : mFiles) {
639 if (ef->getHeader() !=
nullptr && ef->getHeader()->getLid() == lid) {
641 mCurrentEf = std::dynamic_pointer_cast<ElementaryFileAdapter>(ef);
648 mCurrentEf = std::make_shared<ElementaryFileAdapter>(sfi);
649 mFiles.push_back(mCurrentEf);
661 if (mPinAttemptCounter ==
nullptr) {
662 throw IllegalStateException(
"PIN status has not been checked.");
665 return *mPinAttemptCounter.get();
670 mPinAttemptCounter = std::make_shared<int>(pinAttemptCounter);
674 const std::shared_ptr<FileHeaderAdapter> header)
676 std::shared_ptr<ElementaryFileAdapter> ef = getOrCreateFile(sfi, header->getLid());
677 if (ef->getHeader() ==
nullptr) {
679 ef->setHeader(header);
683 std::dynamic_pointer_cast<FileHeaderAdapter>(ef->getHeader())
684 ->updateMissingInfoFrom(header);
689 const uint8_t numRecord,
690 const std::vector<uint8_t>& content)
692 std::shared_ptr<ElementaryFileAdapter> ef = getOrCreateFile(sfi, 0);
693 std::dynamic_pointer_cast<FileDataAdapter>(ef->getData())->setContent(numRecord, content);
697 const uint8_t numCounter,
698 const std::vector<uint8_t>& content)
700 std::shared_ptr<ElementaryFileAdapter> ef = getOrCreateFile(sfi, 0);
701 std::dynamic_pointer_cast<FileDataAdapter>(ef->getData())->setCounter(numCounter, content);
705 const uint8_t numRecord,
706 const std::vector<uint8_t>& content,
709 std::shared_ptr<ElementaryFileAdapter> ef = getOrCreateFile(sfi, 0);
710 std::dynamic_pointer_cast<FileDataAdapter>(ef->getData())
711 ->setContent(numRecord, content, offset);
715 const uint8_t numRecord,
716 const std::vector<uint8_t>& content,
719 std::shared_ptr<ElementaryFileAdapter> ef = getOrCreateFile(sfi, 0);
720 std::dynamic_pointer_cast<FileDataAdapter>(ef->getData())
721 ->fillContent(numRecord, content, offset);
726 std::shared_ptr<ElementaryFileAdapter> ef = getOrCreateFile(sfi, 0);
727 std::dynamic_pointer_cast<FileDataAdapter>(ef->getData())->addCyclicContent(content);
732 copyFiles(mFiles, mFilesBackup);
737 copyFiles(mFilesBackup, mFiles);
740void CalypsoCardAdapter::copyFiles(
const std::vector<std::shared_ptr<ElementaryFile>>& src,
741 std::vector<std::shared_ptr<ElementaryFile>>& dest)
744 for (
const auto& file : src) {
745 dest.push_back(std::make_shared<ElementaryFileAdapter>(file));
756 if (mSelectApplicationResponse ==
nullptr) {
757 return std::vector<uint8_t>();
760 return mSelectApplicationResponse->getApdu();
765 mCardChallenge = cardChallenge;
769 const std::vector<uint8_t>& traceabilityInformation)
771 mTraceabilityInformation = traceabilityInformation;
776 mSvOperationSignature = svOperationSignature;
781 return mCardChallenge;
791 if (mSvGetHeader.empty()) {
793 throw IllegalStateException(
"SV Get Header not available.");
801 if (mSvGetData.empty()) {
803 throw new IllegalStateException(
"SV Get Data not available.");
811 return mSvOperationSignature;
814void CalypsoCardAdapter::applyPatchIfNeeded()
816 uint64_t startupInfoLong =
817 ByteArrayUtil::extractLong(mStartupInfo, 0, mStartupInfo.size(),
false);
819 if (mProductType == ProductType::PRIME_REVISION_3) {
821 std::vector<std::shared_ptr<CalypsoCardAdapter::Patch>> v;
822 for (
const auto& p : mPatchesRev3) {
824 v.push_back(std::dynamic_pointer_cast<CalypsoCardAdapter::Patch>(p));
827 applyPatchIfNeededForRevision(v, startupInfoLong);
829 }
else if (mProductType == ProductType::PRIME_REVISION_2 ||
830 mProductType == ProductType::PRIME_REVISION_1) {
832 mPayloadCapacity = 128;
834 std::vector<std::shared_ptr<CalypsoCardAdapter::Patch>> v;
835 for (
const auto& p : mPatchesRev12) {
837 v.push_back(std::dynamic_pointer_cast<CalypsoCardAdapter::Patch>(p));
840 applyPatchIfNeededForRevision(v, startupInfoLong);
844void CalypsoCardAdapter::applyPatchIfNeededForRevision(
845 const std::vector<std::shared_ptr<CalypsoCardAdapter::Patch>>& patches,
846 const uint64_t startupInfoLong)
848 for (
const auto& patch : patches) {
850 if (patch->isApplicableTo(startupInfoLong)) {
860 return mIsCounterValuePostponed;
865CalypsoCardAdapter::Patch::Patch(
const std::string& startupInfo)
866: mStartupInfo(HexUtil::toLong(startupInfo)) {}
868CalypsoCardAdapter::Patch::Patch(
const std::string& startupInfo,
const std::string& mask)
869: mStartupInfo(HexUtil::toLong(startupInfo)),
870 mMask(HexUtil::toLong(mask)) {}
872bool CalypsoCardAdapter::Patch::isApplicableTo(
const uint64_t startupInfo)
const
874 return mStartupInfo == (startupInfo & mMask);
879CalypsoCardAdapter::PatchRev3::PatchRev3(
const std::string& startupInfo)
880: CalypsoCardAdapter::Patch(startupInfo) {}
882CalypsoCardAdapter::PatchRev3::PatchRev3(
const std::string& startupInfo,
const std::string& mask)
883: CalypsoCardAdapter::Patch(startupInfo, mask) {}
885CalypsoCardAdapter::PatchRev3& CalypsoCardAdapter::PatchRev3::setPayloadCapacity(
886 const int payloadCapacity)
888 mPayloadCapacity = std::make_shared<int>(payloadCapacity);
893void CalypsoCardAdapter::PatchRev3::apply(CalypsoCardAdapter* calypsoCard)
895 if (mPayloadCapacity !=
nullptr) {
897 calypsoCard->mPayloadCapacity = *mPayloadCapacity;
903CalypsoCardAdapter::PatchRev12::PatchRev12(
const std::string& startupInfo)
904: CalypsoCardAdapter::Patch(startupInfo) {}
906CalypsoCardAdapter::PatchRev12::PatchRev12(
const std::string& startupInfo,
const std::string& mask)
907: CalypsoCardAdapter::Patch(startupInfo, mask) {}
909CalypsoCardAdapter::PatchRev12& CalypsoCardAdapter::PatchRev12::setCounterValuePostponed()
911 mIsCounterValuePostponed = std::make_shared<bool>(
true);
916void CalypsoCardAdapter::PatchRev12::apply(CalypsoCardAdapter* calypsoCard)
918 if (mIsCounterValuePostponed !=
nullptr) {
920 calypsoCard->mIsCounterValuePostponed = *mIsCounterValuePostponed;
928 os <<
"CALYPSO_CARD_ADAPTER: {"
929 <<
"SELECT_APPLICATION_RESPONSE: " << cca.mSelectApplicationResponse <<
", "
930 <<
"POWER_ON_DATA: " << cca.mPowerOnData <<
", "
931 <<
"IS_EXTENDED_MODE_SUPPORTED: " << cca.mIsExtendedModeSupported <<
", "
932 <<
"IS_RATIFICATION_ON_DESELECT_SUPPORTED: " << cca.mIsRatificationOnDeselectSupported <<
", "
933 <<
"IS_SV_FEATURE_AVAILABLE: " << cca.mIsSvFeatureAvailable <<
", "
934 <<
"IS_PIN_FEATURE_AVAILABLE: " << cca.mIsPinFeatureAvailable <<
", "
935 <<
"IS_PKI_MODE_SUPPORTED:" << cca.mIsPkiModeSupported <<
", "
936 <<
"IS_DF_INVALIDATED:" << cca.mIsDfInvalidated <<
", "
937 <<
"CALYPSO_CARD_CLASS: " << cca.mCalypsoCardClass <<
", "
938 <<
"CALYPSO_SERIAL_NUMBER: " << cca.mCalypsoSerialNumber <<
", "
939 <<
"STARTUP_INFO:" << cca.mStartupInfo <<
", "
940 <<
"PRODUCT_TYPE: " << cca.mProductType <<
", "
941 <<
"DF_NAME: " << cca.mDfName <<
", "
942 <<
"MODIFICATIONS_COUNTER_MAX: " << cca.mModificationsCounterMax <<
", "
943 <<
"IS_MODIFICATION_COUNTER_IN_BYTES: " << cca.mIsModificationCounterInBytes <<
", "
944 <<
"DIRECTORY_HEADER: " << cca.mDirectoryHeader <<
", "
945 <<
"FILES: " << cca.mFiles <<
", "
946 <<
"FILES_BACKUP: " << cca.mFilesBackup <<
", "
947 <<
"ID_DF_RATIFIED: " << cca.mIsDfRatified <<
", "
948 <<
"PIN_ATTEMPT_COUNTER: " << cca.mPinAttemptCounter <<
", "
949 <<
"SV_BALANCE: " << cca.mSvBalance <<
", "
950 <<
"SV_LAST_T_NUM: " << cca.mSvLastTNum <<
", "
951 <<
"SV_LOAD_LOG_RECORD: " << cca.mSvLoadLogRecord <<
", "
952 <<
"SV_DEBIT_LOG_RECORD: " << cca.mSvDebitLogRecord <<
", "
953 <<
"IS_HCE: " << cca.mIsHce <<
", "
954 <<
"CARD_CHALLENGE: " << cca.mCardChallenge <<
", "
955 <<
"TRACEABILITY_INFORMATION: " << cca.mTraceabilityInformation <<
", "
956 <<
"SV_KVC: " << cca.mSvKvc <<
", "
957 <<
"SV_GET_HEADER: " << cca.mSvGetHeader <<
", "
958 <<
"SV_GET_DATA: " << cca.mSvGetData <<
", "
959 <<
"SV_OPERATION_SIGNATURE: " << cca.mSvOperationSignature <<
", "
960 <<
"APPLICATION_SUB_TYPE: " << cca.mApplicationSubType <<
", "
961 <<
"APPLICATION_TYPE: " << cca.mApplicationType <<
", "
962 <<
"SESSION_MODIFICATION: " << cca.mSessionModification
968std::ostream&
operator<<(std::ostream& os,
const std::shared_ptr<CalypsoCardAdapter> cca)
970 if (cca ==
nullptr) {
972 os <<
"CALYPSO_CARD_ADAPTER: null";
CalypsoCard & setDirectoryHeader(const std::shared_ptr< DirectoryHeader > directoryHeader)
const std::vector< uint8_t > & getStartupInfoRawData() const override
const std::shared_ptr< SvDebitLogRecord > getSvDebitLogLastRecord() override
uint8_t getSessionModification() const override
bool isPinBlocked() const override
bool isDfInvalidated() const override
const std::vector< std::shared_ptr< ElementaryFile > > & getFiles() const override
bool isHce() const override
const std::shared_ptr< ElementaryFile > getFileBySfi(const uint8_t sfi) const override
uint8_t getPlatform() const override
const CalypsoCard::ProductType & getProductType() const override
const std::map< const uint8_t, const std::shared_ptr< ElementaryFile > > getAllFiles() const override
const std::vector< uint8_t > getApplicationSerialNumber() const override
uint8_t getSoftwareVersion() const override
const std::string & getPowerOnData() const override
void setTraceabilityInformation(const std::vector< uint8_t > &traceabilityInformation)
uint8_t getApplicationType() const override
const std::vector< uint8_t > & getDfName() const override
void setPinAttemptRemaining(const int pinAttemptCounter)
uint8_t getSoftwareIssuer() const override
void initialize(const std::shared_ptr< CardSelectionResponseApi > cardSelectionResponse)
bool isPinFeatureAvailable() const override
const std::shared_ptr< DirectoryHeader > getDirectoryHeader() const override
int getPinAttemptRemaining() const override
const std::shared_ptr< ElementaryFile > getFileByLid(const uint16_t lid) const override
const std::vector< uint8_t > & getSvGetData() const
int getTransactionCounter() const override
bool isSvFeatureAvailable() const override
void setSvOperationSignature(const std::vector< uint8_t > &svOperationSignature)
const std::shared_ptr< SvLoadLogRecord > getSvLoadLogRecord() override
bool isCounterValuePostponed() const
void addCyclicContent(const uint8_t sfi, const std::vector< uint8_t > content)
uint8_t getApplicationSubtype() const override
void setContent(const uint8_t sfi, const uint8_t numRecord, const std::vector< uint8_t > &content)
const std::vector< uint8_t > & getSvOperationSignature() const
uint8_t getPayloadCapacity() const
CalypsoCardClass getCardClass() const
bool isRatificationOnDeselectSupported() const override
const std::vector< std::shared_ptr< SvDebitLogRecord > > getSvDebitLogAllRecords() const override
void setCardChallenge(const std::vector< uint8_t > &cardChallenge)
void fillContent(const uint8_t sfi, const uint8_t numRecord, const std::vector< uint8_t > &content, const int offset)
void initializeWithFci(const std::shared_ptr< CmdCardGetDataFci > cmdCardGetDataFci)
int getSvBalance() const override
const std::vector< uint8_t > & getSvGetHeader() const
int getSvLastTNum() const override
const std::vector< uint8_t > getSelectApplicationResponse() const override
int getModificationsCounter() const
void setSvData(const uint8_t svKvc, const std::vector< uint8_t > &svGetHeader, const std::vector< uint8_t > &svGetData, const int svBalance, const int svLastTNum, const std::shared_ptr< SvLoadLogRecord > svLoadLogRecord, const std::shared_ptr< SvDebitLogRecord > svDebitLogRecord)
void setDfRatified(const bool dfRatified)
void setFileHeader(const uint8_t sfi, const std::shared_ptr< FileHeaderAdapter > header)
bool isPkiModeSupported() const override
bool isExtendedModeSupported() const override
uint8_t getSoftwareRevision() const override
const std::vector< uint8_t > & getCardChallenge() const
bool isModificationsCounterInBytes() const
void setTransactionCounter(const int transactionCounter)
const std::vector< uint8_t > & getCalypsoSerialNumberFull() const
bool isDfRatified() const override
void setCounter(const uint8_t sfi, const uint8_t numCounter, const std::vector< uint8_t > &content)
const std::vector< uint8_t > getTraceabilityInformation() const override
static const CalypsoCardClass LEGACY
static const CalypsoCardClass ISO
static const uint8_t SV_DEBIT_LOG_FILE_SFI
static const uint8_t SV_RELOAD_LOG_FILE_SFI
CalypsoSam::ProductType ProductType
std::ostream & operator<<(std::ostream &os, const std::shared_ptr< ApduRequestAdapter > ara)