![]() |
Keyple Card Calypso C++ Library 2.2.2
Reference Terminal Reader API for C++
|
#include <CalypsoCardAdapter.h>
Public Member Functions | |
CalypsoCardAdapter () | |
void | initializeWithPowerOnData (const std::string &powerOnData) |
void | initializeWithFci (const std::shared_ptr< ApduResponseApi > selectApplicationResponse) |
const CalypsoCard::ProductType & | getProductType () const override |
bool | isHce () const override |
const std::vector< uint8_t > & | getDfName () const override |
const std::vector< uint8_t > & | getCalypsoSerialNumberFull () const |
const std::vector< uint8_t > | getApplicationSerialNumber () const override |
const std::vector< uint8_t > & | getStartupInfoRawData () const override |
uint8_t | getPayloadCapacity () const |
bool | isModificationsCounterInBytes () const |
int | getModificationsCounter () const |
uint8_t | getPlatform () const override |
uint8_t | getApplicationType () const override |
bool | isExtendedModeSupported () const override |
bool | isRatificationOnDeselectSupported () const override |
bool | isSvFeatureAvailable () const override |
bool | isPinFeatureAvailable () const override |
bool | isPkiModeSupported () const override |
uint8_t | getApplicationSubtype () const override |
uint8_t | getSoftwareIssuer () const override |
uint8_t | getSoftwareVersion () const override |
uint8_t | getSoftwareRevision () const override |
uint8_t | getSessionModification () const override |
const std::vector< uint8_t > | getTraceabilityInformation () const override |
bool | isDfInvalidated () const override |
bool | isDfRatified () const override |
int | getTransactionCounter () const override |
void | setTransactionCounter (const int transactionCounter) |
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) |
int | getSvBalance () const override |
int | getSvLastTNum () const override |
const std::shared_ptr< SvLoadLogRecord > | getSvLoadLogRecord () override |
const std::shared_ptr< SvDebitLogRecord > | getSvDebitLogLastRecord () override |
const std::vector< std::shared_ptr< SvDebitLogRecord > > | getSvDebitLogAllRecords () const override |
void | setDfRatified (const bool dfRatified) |
CalypsoCardClass | getCardClass () const |
const std::shared_ptr< DirectoryHeader > | getDirectoryHeader () const override |
CalypsoCard & | setDirectoryHeader (const std::shared_ptr< DirectoryHeader > directoryHeader) |
const std::shared_ptr< ElementaryFile > | getFileBySfi (const uint8_t sfi) const override |
const std::shared_ptr< ElementaryFile > | getFileByLid (const uint16_t lid) const override |
const std::map< const uint8_t, const std::shared_ptr< ElementaryFile > > | getAllFiles () const override |
const std::vector< std::shared_ptr< ElementaryFile > > & | getFiles () const override |
bool | isPinBlocked () const override |
int | getPinAttemptRemaining () const override |
void | setPinAttemptRemaining (const int pinAttemptCounter) |
void | setFileHeader (const uint8_t sfi, const std::shared_ptr< FileHeaderAdapter > header) |
void | setContent (const uint8_t sfi, const uint8_t numRecord, const std::vector< uint8_t > &content) |
void | setCounter (const uint8_t sfi, const uint8_t numCounter, const std::vector< uint8_t > &content) |
void | setContent (const uint8_t sfi, const uint8_t numRecord, const std::vector< uint8_t > &content, const uint8_t offset) |
void | fillContent (const uint8_t sfi, const uint8_t numRecord, const std::vector< uint8_t > &content, const uint8_t offset) |
void | addCyclicContent (const uint8_t sfi, const std::vector< uint8_t > content) |
void | backupFiles () |
void | restoreFiles () |
const std::string & | getPowerOnData () const override |
const std::vector< uint8_t > | getSelectApplicationResponse () const override |
void | setCardChallenge (const std::vector< uint8_t > &cardChallenge) |
void | setTraceabilityInformation (const std::vector< uint8_t > &traceabilityInformation) |
void | setSvOperationSignature (const std::vector< uint8_t > &svOperationSignature) |
const std::vector< uint8_t > & | getCardChallenge () const |
uint8_t | getSvKvc () const |
const std::vector< uint8_t > & | getSvGetHeader () const |
const std::vector< uint8_t > & | getSvGetData () const |
const std::vector< uint8_t > & | getSvOperationSignature () const |
Friends | |
KEYPLECARDCALYPSO_API std::ostream & | operator<< (std::ostream &os, const CalypsoCardAdapter &cca) |
KEYPLECARDCALYPSO_API std::ostream & | operator<< (std::ostream &os, const std::shared_ptr< CalypsoCardAdapter > cca) |
(package-private)
Implementation of CalypsoCard.
Definition at line 54 of file CalypsoCardAdapter.h.
keyple::card::calypso::CalypsoCardAdapter::CalypsoCardAdapter | ( | ) |
void keyple::card::calypso::CalypsoCardAdapter::addCyclicContent | ( | const uint8_t | sfi, |
const std::vector< uint8_t > | content | ||
) |
(package-private)
Add cyclic content at record #1 by rolling previously all actual records contents (record #1 -> record #2, record #2 -> record #3,...) of the current selected file.
This is useful for cyclic files. Note that records are infinitely shifted.
If EF does not exist, then it is created.
sfi | the SFI. |
content | the content (should be not empty). |
Definition at line 665 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::backupFiles | ( | ) |
(package-private)
Make a backup of the Elementary Files.
This method should be used before starting a card secure session.
Definition at line 672 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::fillContent | ( | const uint8_t | sfi, |
const uint8_t | numRecord, | ||
const std::vector< uint8_t > & | content, | ||
const uint8_t | offset | ||
) |
(package-private)
Fills the content at the specified offset of the specified record of the current selected file using a binary OR operation with the provided content.
If EF does not exist, then it is created.
If actual record content is not set or has a size
offset + content size, then missing data will be completed by the provided content.
sfi | the SFI. |
numRecord | the record number (should be >=
|
content | the content (should be not empty). |
Definition at line 654 of file CalypsoCardAdapter.cpp.
|
override |
|
override |
Definition at line 264 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 329 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 299 of file CalypsoCardAdapter.cpp.
const std::vector< uint8_t > & keyple::card::calypso::CalypsoCardAdapter::getCalypsoSerialNumberFull | ( | ) | const |
(package-private)
Gets the full Calypso serial number including the possible validity date information in the two MSB.
The serial number to be used as diversifier for key derivation.
This is the complete number returned by the card in its response to the Select command.
Definition at line 259 of file CalypsoCardAdapter.cpp.
const std::vector< uint8_t > & keyple::card::calypso::CalypsoCardAdapter::getCardChallenge | ( | ) | const |
(package-private)
Gets the challenge received from the card
Definition at line 721 of file CalypsoCardAdapter.cpp.
CalypsoCardClass keyple::card::calypso::CalypsoCardAdapter::getCardClass | ( | ) | const |
(package-private)
Gets the current card class.
Definition at line 485 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 254 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 490 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 521 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 504 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 547 of file CalypsoCardAdapter.cpp.
int keyple::card::calypso::CalypsoCardAdapter::getModificationsCounter | ( | ) | const |
(package-private)
Indicates the maximum number of changes allowed in session.
This number can be a number of operations or a number of commands (see isModificationsCounterInBytes)
Definition at line 289 of file CalypsoCardAdapter.cpp.
uint8_t keyple::card::calypso::CalypsoCardAdapter::getPayloadCapacity | ( | ) | const |
(package-private)
Gets the maximum length of data that an APDU in this card can carry.
Definition at line 278 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 596 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 294 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 691 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 244 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 696 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 349 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 334 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 344 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 339 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 273 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 414 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 459 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 447 of file CalypsoCardAdapter.cpp.
const std::vector< uint8_t > & keyple::card::calypso::CalypsoCardAdapter::getSvGetData | ( | ) | const |
(package-private)
Gets the SV Get command response data
IllegalStateException | If the requested data has not been set. |
Definition at line 740 of file CalypsoCardAdapter.cpp.
const std::vector< uint8_t > & keyple::card::calypso::CalypsoCardAdapter::getSvGetHeader | ( | ) | const |
(package-private)
Gets the SV Get command header
IllegalStateException | If the requested data has not been set. |
Definition at line 731 of file CalypsoCardAdapter.cpp.
uint8_t keyple::card::calypso::CalypsoCardAdapter::getSvKvc | ( | ) | const |
(package-private)
Gets the SV KVC from the card
Definition at line 726 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 423 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 432 of file CalypsoCardAdapter.cpp.
const std::vector< uint8_t > & keyple::card::calypso::CalypsoCardAdapter::getSvOperationSignature | ( | ) | const |
(package-private)
Gets the last SV Operation signature (SV Reload, Debit or Undebit)
Definition at line 749 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 354 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 375 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::initializeWithFci | ( | const std::shared_ptr< ApduResponseApi > | selectApplicationResponse | ) |
(package-private)
Initializes or post-initializes the object with the application FCI data.
selectApplicationResponse | The select application response. |
IllegalArgumentException | If the FCI is inconsistent. |
Definition at line 127 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::initializeWithPowerOnData | ( | const std::string & | powerOnData | ) |
(package-private)
Initializes the object with the card power-on data.
This method should be invoked only when no response to select application is available.
powerOnData | The card's power-on data. |
IllegalArgumentException | If powerOnData is inconsistent. |
Definition at line 88 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 360 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 365 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 304 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 249 of file CalypsoCardAdapter.cpp.
bool keyple::card::calypso::CalypsoCardAdapter::isModificationsCounterInBytes | ( | ) | const |
(package-private)
Tells if the change counter allowed in session is established in number of operations or number of bytes modified.
This varies depending on the product type of the card.
Definition at line 284 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 591 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 319 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 324 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 309 of file CalypsoCardAdapter.cpp.
|
override |
Definition at line 314 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::restoreFiles | ( | ) |
(package-private)
Restore the last backup of Elementary Files.
This method should be used when SW of the card close secure session command is unsuccessful or if secure session is aborted.
Definition at line 677 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setCardChallenge | ( | const std::vector< uint8_t > & | cardChallenge | ) |
(package-private)
Sets the challenge received in response to the GET CHALLENGE command.
cardChallenge | A not empty array. |
Definition at line 705 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setContent | ( | const uint8_t | sfi, |
const uint8_t | numRecord, | ||
const std::vector< uint8_t > & | content | ||
) |
(package-private)
Set or replace the entire content of the specified record #numRecord of the current selected file by the provided content.
If EF does not exist, then it is created.
sfi | the SFI. |
numRecord | the record number (should be >=
|
content | the content (should be not empty). |
Definition at line 625 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setContent | ( | const uint8_t | sfi, |
const uint8_t | numRecord, | ||
const std::vector< uint8_t > & | content, | ||
const uint8_t | offset | ||
) |
(package-private)
Set or replace the content at the specified offset of record #numRecord of the current selected file by a copy of the provided content.
If EF does not exist, then it is created.
If actual record content is not set or has a size
offset, then missing data will be padded with 0.
sfi | the SFI. |
numRecord | the record number (should be >=
|
content | the content (should be not empty). |
offset | the offset (should be >=
|
Definition at line 643 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setCounter | ( | const uint8_t | sfi, |
const uint8_t | numCounter, | ||
const std::vector< uint8_t > & | content | ||
) |
(package-private)
Sets a counter value in record #1 of the current selected file.
If EF does not exist, then it is created.
sfi | the SFI. |
numCounter | the counter number (should be >=
|
content | the counter value (should be not null and 3 bytes length). |
Definition at line 634 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setDfRatified | ( | const bool | dfRatified | ) |
(package-private)
Sets the ratification status
dfRatified | true if the session was ratified. |
Definition at line 480 of file CalypsoCardAdapter.cpp.
CalypsoCard & keyple::card::calypso::CalypsoCardAdapter::setDirectoryHeader | ( | const std::shared_ptr< DirectoryHeader > | directoryHeader | ) |
(package-private)
Sets the DF metadata.
Updates the invalidation flag.
directoryHeader | the DF metadata (should be not null). |
Definition at line 495 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setFileHeader | ( | const uint8_t | sfi, |
const std::shared_ptr< FileHeaderAdapter > | header | ||
) |
(package-private)
Sets the provided ileHeaderAdapter} to the current selected file.
If EF does not exist, then it is created.
sfi | the SFI. |
header | the file header (should be not null). |
Definition at line 610 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setPinAttemptRemaining | ( | const int | pinAttemptCounter | ) |
(package-private)
Sets the PIN attempts counter.
The PIN attempt counter is interpreted to give the results of the methods isPinBlocked and getPinAttemptRemaining.
pinAttemptCounter | the number of remaining attempts to present the PIN code. |
Definition at line 605 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::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 | ||
) |
(package-private)
Sets the Stored Value data from the SV Get command
svKvc | The KVC value. |
svGetHeader | A not empty array. |
svGetData | A not empty array. |
svBalance | the current SV balance. |
svLastTNum | the last SV transaction number. |
svLoadLogRecord | the SV load log record (it may be null if not available). |
svDebitLogRecord | the SV debit log record (it may be null if not available). |
Definition at line 390 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setSvOperationSignature | ( | const std::vector< uint8_t > & | svOperationSignature | ) |
(package-private)
Sets the SV signature.
svOperationSignature | A not empty array. |
Definition at line 716 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setTraceabilityInformation | ( | const std::vector< uint8_t > & | traceabilityInformation | ) |
(package-private)
Sets the traceability information received in response to the GET DATA command for the tag GetDataTag::TRACEABILITY_INFORMATION}.
traceabilityInformation | The traceability information. |
Definition at line 710 of file CalypsoCardAdapter.cpp.
void keyple::card::calypso::CalypsoCardAdapter::setTransactionCounter | ( | const int | transactionCounter | ) |
(package-private)
Sets the transaction counter.
transactionCounter | The counter value. |
Definition at line 385 of file CalypsoCardAdapter.cpp.
|
friend |
Definition at line 754 of file CalypsoCardAdapter.cpp.
|
friend |
Definition at line 798 of file CalypsoCardAdapter.cpp.