Keypop Calypso Card C++ API - 2.1.2
Component of the Keypop C++ API
TransactionManager.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 <map>
14#include <vector>
15
19// #include "keypop/calypso/card/transaction/ChannelControl.hpp"
21#include "keypop/reader/transaction/spi/CardTransactionManager.hpp"
22
23namespace keypop {
24namespace calypso {
25namespace card {
26namespace transaction {
27
28using keypop::reader::transaction::spi::CardTransactionManager;
29
59template <typename T>
60class TransactionManager : public virtual CardTransactionManager<T> {
61public:
76 virtual T& prepareSelectFile(std::uint16_t lid) = 0;
77
90 virtual T& prepareSelectFile(SelectFileControl selectFileControl) = 0;
91
111 virtual T& prepareGetData(GetDataTag tag) = 0;
112
128 virtual T&
129 preparePutData(PutDataTag tag, const std::vector<std::uint8_t>& data) = 0;
130
155 virtual T& prepareReadRecord(std::uint8_t sfi, int recordNumber) = 0;
156
188 std::uint8_t sfi,
189 int fromRecordNumber,
190 int toRecordNumber,
191 int recordSize) = 0;
192
222 std::uint8_t sfi,
223 int fromRecordNumber,
224 int toRecordNumber,
225 int offset,
226 int nbBytesToRead) = 0;
227
261 virtual T&
262 prepareReadBinary(std::uint8_t sfi, int offset, int nbBytesToRead) = 0;
263
295 virtual T& prepareReadCounter(std::uint8_t sfi, int nbCountersToRead) = 0;
296
332 virtual T& prepareSearchRecords(std::shared_ptr<SearchCommandData> data)
333 = 0;
334
348 virtual T& prepareCheckPinStatus() = 0;
349
369 std::uint8_t sfi, const std::vector<std::uint8_t>& recordData) = 0;
370
393 std::uint8_t sfi,
394 int recordNumber,
395 const std::vector<std::uint8_t>& recordData) = 0;
396
420 std::uint8_t sfi,
421 int recordNumber,
422 const std::vector<std::uint8_t>& recordData) = 0;
423
448 std::uint8_t sfi, int offset, const std::vector<std::uint8_t>& data)
449 = 0;
450
476 std::uint8_t sfi, int offset, const std::vector<std::uint8_t>& data)
477 = 0;
478
502 virtual T&
503 prepareIncreaseCounter(std::uint8_t sfi, int counterNumber, int incValue)
504 = 0;
505
528 std::uint8_t sfi, const std::map<int, int>& counterNumberToIncValueMap)
529 = 0;
530
554 virtual T&
555 prepareDecreaseCounter(std::uint8_t sfi, int counterNumber, int decValue)
556 = 0;
557
580 std::uint8_t sfi, const std::map<int, int>& counterNumberToDecValueMap)
581 = 0;
582
618 virtual T&
619 prepareSetCounter(std::uint8_t sfi, int counterNumber, int newValue) = 0;
620
646 virtual T& prepareSvReadAllLogs() = 0;
647
669 virtual T& prepareVerifyPin(const std::vector<std::uint8_t>& pin) = 0;
670
695 virtual T& prepareChangePin(const std::vector<uint8_t>& newPin) = 0;
696
708
750 // virtual T& processCommands(ChannelControl channelControl) = 0;
751
759 virtual const std::vector<std::vector<std::uint8_t>>&
761};
762
763} /* namespace transaction */
764} /* namespace card */
765} /* namespace calypso */
766} /* namespace keypop */
Contains operations common to all card transactions.
virtual T & prepareSelectFile(SelectFileControl selectFileControl)=0
Schedules the execution of a "Select File" command using a navigation selectFileControl defined by th...
virtual T & prepareWriteBinary(std::uint8_t sfi, int offset, const std::vector< std::uint8_t > &data)=0
Schedules the execution of one or multiple "Write Binary" commands to write over the indicated data o...
virtual T & prepareSetCounter(std::uint8_t sfi, int counterNumber, int newValue)=0
Schedules the execution of an "Increase" or "Decrease" command to set the value of the target counter...
virtual const std::vector< std::vector< std::uint8_t > > & getTransactionAuditData() const =0
Processes all previously prepared commands and closes the physical channel if requested.
virtual T & prepareUpdateRecord(std::uint8_t sfi, int recordNumber, const std::vector< std::uint8_t > &recordData)=0
Schedules the execution of an "Update Record" command to overwrites the target file's record contents...
virtual T & prepareWriteRecord(std::uint8_t sfi, int recordNumber, const std::vector< std::uint8_t > &recordData)=0
Schedules the execution of a "Write Record" command to updates the target file's record contents with...
virtual T & prepareChangePin(const std::vector< uint8_t > &newPin)=0
Schedules the execution of a "Change PIN" command to replace the current PIN with the new value provi...
virtual T & prepareReadRecord(std::uint8_t sfi, int recordNumber)=0
Schedules the execution of a "Read Records" command to read a single record from the indicated EF.
virtual T & preparePutData(PutDataTag tag, const std::vector< std::uint8_t > &data)=0
Schedules the execution of one or more "Put Data" command to inject the provided data associated with...
virtual T & prepareSelectFile(std::uint16_t lid)=0
Schedules the execution of a "Select File" command to select an EF by its LID in the current DF.
virtual T & prepareSearchRecords(std::shared_ptr< SearchCommandData > data)=0
Schedules the execution of a "Search Record Multiple" command to search data in the records of the in...
virtual T & prepareReadRecords(std::uint8_t sfi, int fromRecordNumber, int toRecordNumber, int recordSize)=0
Schedules the execution of a "Read Records" command to read one or more records from the indicated EF...
virtual T & prepareIncreaseCounter(std::uint8_t sfi, int counterNumber, int incValue)=0
Schedules the execution of an "Increase" command to increase the target counter.
virtual T & prepareCheckPinStatus()=0
Schedules the execution of a "Verify Pin" command without PIN presentation in order to get the attemp...
virtual T & prepareGenerateAsymmetricKeyPair()=0
Schedules the execution of a "Generate Asymmetric Key Pair" command.
virtual T & prepareIncreaseCounters(std::uint8_t sfi, const std::map< int, int > &counterNumberToIncValueMap)=0
Schedules the execution of an "Increase Multiple" command or multiple "Increase" commands to increase...
virtual T & prepareDecreaseCounter(std::uint8_t sfi, int counterNumber, int decValue)=0
Schedules the execution of a "Decrease" command to decrease the target counter.
virtual T & prepareUpdateBinary(std::uint8_t sfi, int offset, const std::vector< std::uint8_t > &data)=0
Schedules the execution of one or multiple "Update Binary" command to replace the indicated data of a...
virtual T & prepareVerifyPin(const std::vector< std::uint8_t > &pin)=0
Schedules the execution of a "Verify PIN" command in order to authenticate the cardholder and/or unlo...
virtual T & prepareReadRecordsPartially(std::uint8_t sfi, int fromRecordNumber, int toRecordNumber, int offset, int nbBytesToRead)=0
Schedules the execution of one or multiple "Read Record Multiple" commands to read all or parts of mu...
virtual T & prepareReadCounter(std::uint8_t sfi, int nbCountersToRead)=0
Schedules the execution of a "Read Records" command to reads a record of the indicated EF,...
virtual T & prepareAppendRecord(std::uint8_t sfi, const std::vector< std::uint8_t > &recordData)=0
Schedules the execution of an "Append Record" command to adds the data provided in the indicated "cyc...
virtual T & prepareGetData(GetDataTag tag)=0
Schedules the execution of one or more "Get Data" command to retrieve the data indicated by the provi...
virtual T & prepareDecreaseCounters(std::uint8_t sfi, const std::map< int, int > &counterNumberToDecValueMap)=0
Schedules the execution of a "Decrease Multiple" command or multiple "Decrease" commands to decrease ...
virtual T & prepareSvReadAllLogs()=0
Schedules the execution of "Read Records" commands to read all SV logs.
virtual T & prepareReadBinary(std::uint8_t sfi, int offset, int nbBytesToRead)=0
Schedules the execution of one or multiple "Read Binary" commands to read all or part of the indicate...
GetDataTag
Enumeration of all output data types.
Definition: GetDataTag.hpp:27
SelectFileControl
Enumeration of all expected behaviors of the selection command (see the specifics of this command in ...
PutDataTag
Enumeration of all input data types.
Definition: PutDataTag.hpp:27