Keypop Calypso Card C++ API 2.0.0
Reference Calypso Card API for C++
CalypsoCard.hpp
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * This program and the accompanying materials are made available under the *
5 * terms of the MIT License which is available at https://opensource.org/licenses/MIT. *
6 * *
7 * SPDX-License-Identifier: MIT *
8 **************************************************************************************************/
9
10#pragma once
11
12#include <cstdint>
13#include <map>
14#include <memory>
15#include <ostream>
16#include <vector>
17
18#include "keypop/reader/selection/spi/IsoSmartCard.hpp"
19
20namespace keypop {
21namespace calypso {
22namespace card {
23namespace card {
24
50class CalypsoCard : public IsoSmartCard {
51public:
57 enum class ProductType {
64
71
78
84 LIGHT,
85
91 BASIC,
92
100 };
101
108 virtual const ProductType& getProductType() const = 0;
109
116 virtual bool isHce() const = 0;
117
133 virtual bool isDfInvalidated() const = 0;
134
149 virtual const std::vector<uint8_t>& getDfName() const = 0;
150
157 virtual const std::vector<uint8_t> getApplicationSerialNumber() const = 0;
158
165 virtual const std::vector<uint8_t>& getStartupInfoRawData() const = 0;
166
173 virtual uint8_t getPlatform() const = 0;
174
181 virtual uint8_t getApplicationType() const = 0;
182
190 virtual uint8_t getApplicationSubtype() const = 0;
191
199 virtual uint8_t getSoftwareIssuer() const = 0;
200
208 virtual uint8_t getSoftwareVersion() const = 0;
209
217 virtual uint8_t getSoftwareRevision() const = 0;
218
228 virtual uint8_t getSessionModification() const = 0;
229
240 virtual const std::vector<uint8_t> getTraceabilityInformation() const = 0;
241
252 virtual const std::shared_ptr<DirectoryHeader> getDirectoryHeader() const = 0;
253
264 virtual const std::shared_ptr<ElementaryFile> getFileBySfi(const uint8_t sfi) const = 0;
265
276 virtual const std::shared_ptr<ElementaryFile> getFileByLid(const uint16_t lid) const = 0;
277
288 virtual const std::map<const uint8_t, const std::shared_ptr<ElementaryFile>> getAllFiles() const
289 = 0;
290
300 virtual const std::vector<std::shared_ptr<ElementaryFile>>& getFiles() const = 0;
301
311 virtual bool isDfRatified() const = 0;
312
328 virtual int getTransactionCounter() const = 0;
329
338 virtual bool isPkiModeSupported() const = 0;
339
351 virtual bool isExtendedModeSupported() const = 0;
352
361 virtual bool isRatificationOnDeselectSupported() const = 0;
362
371 virtual bool isPinFeatureAvailable() const = 0;
372
383 virtual bool isPinBlocked() const = 0;
384
394 virtual int getPinAttemptRemaining() const = 0;
395
404 virtual bool isSvFeatureAvailable() const = 0;
405
418 virtual int getSvBalance() const = 0;
419
432 virtual int getSvLastTNum() const = 0;
433
445 virtual const std::shared_ptr<SvLoadLogRecord> getSvLoadLogRecord() = 0;
446
458 virtual const std::shared_ptr<SvDebitLogRecord> getSvDebitLogLastRecord() = 0;
459
471 virtual const std::vector<std::shared_ptr<SvDebitLogRecord>> getSvDebitLogAllRecords() const
472 = 0;
473};
474
475inline std::ostream&
476operator<<(std::ostream& os, const CalypsoCard::ProductType& pt) {
477 os << "PRODUCT_TYPE: ";
478
479 switch (pt) {
481 os << "BASIC";
482 break;
484 os << "LIGHT";
485 break;
487 os << "PRIME_REVISION_1";
488 break;
490 os << "PRIME_REVISION_2";
491 break;
493 os << "PRIME_REVISION_3";
494 break;
495 default:
496 os << "UNKNOWN";
497 break;
498 }
499
500 return os;
501}
502
503} /* namespace card */
504} /* namespace card */
505} /* namespace calypso */
506} /* namespace keypop */
virtual const std::shared_ptr< ElementaryFile > getFileByLid(const uint16_t lid) const =0
virtual bool isDfInvalidated() const =0
virtual int getPinAttemptRemaining() const =0
virtual const std::vector< uint8_t > & getDfName() const =0
virtual uint8_t getApplicationSubtype() const =0
virtual const std::vector< uint8_t > getApplicationSerialNumber() const =0
virtual const ProductType & getProductType() const =0
virtual const std::shared_ptr< SvLoadLogRecord > getSvLoadLogRecord()=0
virtual uint8_t getPlatform() const =0
virtual int getTransactionCounter() const =0
virtual bool isExtendedModeSupported() const =0
virtual bool isPkiModeSupported() const =0
virtual const std::shared_ptr< SvDebitLogRecord > getSvDebitLogLastRecord()=0
virtual const std::vector< uint8_t > getTraceabilityInformation() const =0
virtual bool isSvFeatureAvailable() const =0
virtual const std::shared_ptr< ElementaryFile > getFileBySfi(const uint8_t sfi) const =0
virtual const std::vector< std::shared_ptr< SvDebitLogRecord > > getSvDebitLogAllRecords() const =0
virtual uint8_t getSoftwareVersion() const =0
virtual bool isDfRatified() const =0
virtual const std::vector< uint8_t > & getStartupInfoRawData() const =0
virtual const std::shared_ptr< DirectoryHeader > getDirectoryHeader() const =0
virtual uint8_t getApplicationType() const =0
virtual uint8_t getSoftwareRevision() const =0
virtual bool isPinBlocked() const =0
virtual uint8_t getSoftwareIssuer() const =0
virtual const std::map< const uint8_t, const std::shared_ptr< ElementaryFile > > getAllFiles() const =0
virtual uint8_t getSessionModification() const =0
virtual bool isPinFeatureAvailable() const =0
virtual bool isRatificationOnDeselectSupported() const =0
virtual const std::vector< std::shared_ptr< ElementaryFile > > & getFiles() const =0
std::ostream & operator<<(std::ostream &os, const CalypsoCard::ProductType &pt)