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) 2025 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 *
6 * https://opensource.org/licenses/MIT. *
7 * *
8 * SPDX-License-Identifier: MIT *
9 ******************************************************************************/
10
11#pragma once
12
13#include <cstdint>
14#include <map>
15#include <memory>
16#include <ostream>
17#include <vector>
18
19#include "keypop/reader/selection/spi/IsoSmartCard.hpp"
20
21namespace keypop {
22namespace calypso {
23namespace card {
24namespace card {
25
51class CalypsoCard : public IsoSmartCard {
52public:
58 enum class ProductType {
65
72
79
85 LIGHT,
86
92 BASIC,
93
100 UNKNOWN
101 };
102
109 virtual const ProductType& getProductType() const = 0;
110
117 virtual bool isHce() const = 0;
118
136 virtual bool isDfInvalidated() const = 0;
137
153 virtual const std::vector<uint8_t>& getDfName() const = 0;
154
162 virtual const std::vector<uint8_t> getApplicationSerialNumber() const = 0;
163
170 virtual const std::vector<uint8_t>& getStartupInfoRawData() const = 0;
171
178 virtual uint8_t getPlatform() const = 0;
179
187 virtual uint8_t getApplicationType() const = 0;
188
196 virtual uint8_t getApplicationSubtype() const = 0;
197
205 virtual uint8_t getSoftwareIssuer() const = 0;
206
214 virtual uint8_t getSoftwareVersion() const = 0;
215
223 virtual uint8_t getSoftwareRevision() const = 0;
224
235 virtual uint8_t getSessionModification() const = 0;
236
248 virtual const std::vector<uint8_t> getTraceabilityInformation() const = 0;
249
260 virtual const std::shared_ptr<DirectoryHeader>
262
275 virtual const std::shared_ptr<ElementaryFile>
276 getFileBySfi(const uint8_t sfi) const = 0;
277
290 virtual const std::shared_ptr<ElementaryFile>
291 getFileByLid(const uint16_t lid) const = 0;
292
306 virtual const std::map<const uint8_t, const std::shared_ptr<ElementaryFile>>
307 getAllFiles() const = 0;
308
320 virtual const std::vector<std::shared_ptr<ElementaryFile>>&
321 getFiles() const = 0;
322
334 virtual bool isDfRatified() const = 0;
335
353 virtual int getTransactionCounter() const = 0;
354
364 virtual bool isPkiModeSupported() const = 0;
365
378 virtual bool isExtendedModeSupported() const = 0;
379
389 virtual bool isRatificationOnDeselectSupported() const = 0;
390
399 virtual bool isPinFeatureAvailable() const = 0;
400
411 virtual bool isPinBlocked() const = 0;
412
423 virtual int getPinAttemptRemaining() const = 0;
424
433 virtual bool isSvFeatureAvailable() const = 0;
434
450 virtual int getSvBalance() const = 0;
451
467 virtual int getSvLastTNum() const = 0;
468
483 virtual const std::shared_ptr<SvLoadLogRecord> getSvLoadLogRecord() = 0;
484
499 virtual const std::shared_ptr<SvDebitLogRecord> getSvDebitLogLastRecord()
500 = 0;
501
517 virtual const std::vector<std::shared_ptr<SvDebitLogRecord>>
519};
520
521inline std::ostream&
522operator<<(std::ostream& os, const CalypsoCard::ProductType& pt) {
523 os << "PRODUCT_TYPE: ";
524
525 switch (pt) {
527 os << "BASIC";
528 break;
530 os << "LIGHT";
531 break;
533 os << "PRIME_REVISION_1";
534 break;
536 os << "PRIME_REVISION_2";
537 break;
539 os << "PRIME_REVISION_3";
540 break;
541 default:
542 os << "UNKNOWN";
543 break;
544 }
545
546 return os;
547}
548
549} /* namespace card */
550} /* namespace card */
551} /* namespace calypso */
552} /* 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)