Keypop Calypso Card C++ API 2.0.0
Reference Calypso Card API for C++
Public Member Functions | List of all members
keypop::calypso::card::transaction::TransactionManager< T > Class Template Referenceabstract

#include <TransactionManager.hpp>

Inheritance diagram for keypop::calypso::card::transaction::TransactionManager< T >:
Inheritance graph
[legend]

Public Member Functions

virtual T & prepareSelectFile (const uint16_t lid)=0
 
virtual T & prepareSelectFile (const SelectFileControl selectFileControl)=0
 
virtual T & prepareGetData (const GetDataTag tag)=0
 
virtual T & prepareReadRecord (const uint8_t sfi, const int recordNumber)=0
 
virtual T & prepareReadRecords (const uint8_t sfi, const int fromRecordNumber, const int toRecordNumber, const int recordSize)=0
 
virtual T & prepareReadRecordsPartially (const uint8_t sfi, const int fromRecordNumber, const int toRecordNumber, const int offset, const int nbBytesToRead)=0
 
virtual T & prepareReadBinary (const uint8_t sfi, const int offset, const int nbBytesToRead)=0
 
virtual T & prepareReadCounter (const uint8_t sfi, const int nbCountersToRead)=0
 
virtual T & prepareSearchRecords (const SearchCommandData data)=0
 
virtual T & prepareCheckPinStatus ()=0
 
virtual T & prepareAppendRecord (const uint8_t sfi, const std::vector< uint8_t > &recordData)=0
 
virtual T & prepareUpdateRecord (const uint8_t sfi, const int recordNumber, const std::vector< uint8_t > &recordData)=0
 
virtual T & prepareWriteRecord (const uint8_t sfi, const int recordNumber, const std::vector< uint8_t > &recordData)=0
 
virtual T & prepareUpdateBinary (const uint8_t sfi, const int offset, const std::vector< uint8_t > &data)=0
 
virtual T & prepareWriteBinary (const uint8_t sfi, const int offset, const std::vector< uint8_t > &data)=0
 
virtual T & prepareIncreaseCounter (const uint8_t sfi, const int counterNumber, const int incValue)=0
 
virtual T & prepareIncreaseCounters (const uint8_t sfi, const std::map< const int, const int > &counterNumberToIncValueMap)=0
 
virtual T & prepareDecreaseCounter (const uint8_t sfi, const int counterNumber, const int decValue)=0
 
virtual T & prepareDecreaseCounters (const uint8_t sfi, const std::map< const int, const int > &counterNumberToDecValueMap)=0
 
virtual T & prepareSetCounter (const uint8_t sfi, const int counterNumber, const int newValue)=0
 
virtual T & prepareSvReadAllLogs ()=0
 
virtual T & prepareVerifyPin (const std::vector< uint8_t > &pin)=0
 
virtual T & prepareChangePin (const std::vector< uint8_t > &newPin)=0
 
virtual T processCommands (const ChannelControl channelControl)=0
 
const st::vector< std::vector< uint8_t > > & getTransactionAuditData () const =0
 

Detailed Description

template<typename T>
class keypop::calypso::card::transaction::TransactionManager< T >

Contains operations common to all card transactions.

To exchange data with the card, it is first necessary to prepare the commands to be transmitted to the card and then to process the prepared commands via the processCommands(ChannelControl) method.

The card commands preparation step makes it possible to group commands together in order to minimize network data exchanges (especially useful in a distributed architecture).

The CalypsoCard object registered with the manager is updated during the transaction after each data exchange with the card.

For all "prepare" type commands, unless otherwise specified, here are the ranges of values checked for the various parameters:

Parameters
<T>The type of the lowest level child object.
Since
2.0.0

Definition at line 54 of file TransactionManager.hpp.

Member Function Documentation

◆ getTransactionAuditData()

template<typename T >
const st::vector< std::vector< uint8_t > > & keypop::calypso::card::transaction::TransactionManager< T >::getTransactionAuditData ( ) const
pure virtual

Returns the audit data of the transaction containing all APDU exchanges with the card and the cryptographic module.

Returns
An empty list if there is no audit data.
Since
1.2.0

◆ prepareAppendRecord()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareAppendRecord ( const uint8_t  sfi,
const std::vector< uint8_t > &  recordData 
)
pure virtual

Schedules the execution of an "Append Record" command to adds the data provided in the indicated "cyclic" file.

A new record is added, the oldest record is deleted.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiThe sfi to select.
recordDataThe new record data to write.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.0.0

◆ prepareChangePin()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareChangePin ( const std::vector< uint8_t > &  newPin)
pure virtual

Schedules the execution of a "Change PIN" command to replace the current PIN with the new value provided.

This command can be performed only out of a secure session. The new PIN code can be transmitted in plain text or encrypted according to the parameter set in SymmetricCryptoSecuritySetting.

When the PIN is transmitted plain, this command must be preceded by a successful Verify PIN command (see prepareVerifyPin(byte[])).

The PIN status will be available in CalypsoCard using the CalypsoCard#getPinAttemptRemaining() and CalypsoCard#isPinBlocked() methods.

Parameters
newPinThe new PIN code value (4-byte long byte array).
Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf the PIN feature is not available for this card.
IllegalArgumentExceptionIf the provided argument is out of range.
IllegalStateExceptionIf the command is executed while a secure session is open.
Since
1.6.0

◆ prepareCheckPinStatus()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareCheckPinStatus ( )
pure virtual

Schedules the execution of a "Verify Pin" command without PIN presentation in order to get the attempt counter.

The PIN status will be available in CalypsoCard using the CalypsoCard#getPinAttemptRemaining() and CalypsoCard#isPinBlocked() methods.

Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf the PIN feature is not available for this card.
Since
1.0.0

◆ prepareDecreaseCounter()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareDecreaseCounter ( const uint8_t  sfi,
const int  counterNumber,
const int  decValue 
)
pure virtual

Schedules the execution of a "Decrease" command to decrease the target counter.

If several counters of the same file have to be decremented at the same time of the transaction, it is recommended to use the method prepareDecreaseCounters(byte, Map) for optimization reasons.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiSFI of the EF to select.
counterNumberThe number of the counter (must be zero in case of a simulated counter).
decValueValue to subtract to the counter (defined as a positive int
<=
16777215 [FFFFFFh])
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.0.0

◆ prepareDecreaseCounters()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareDecreaseCounters ( const uint8_t  sfi,
const std::map< const int, const int > &  counterNumberToDecValueMap 
)
pure virtual

Schedules the execution of a "Decrease Multiple" command or multiple "Decrease" commands to decrease multiple target counters at the same time.

The decision to execute one or the other command is made according to the type of card.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiSFI of the EF to select.
counterNumberToDecValueMapThe map containing the counter numbers to be decremented and their associated decrement values.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range or if the map is null or empty.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.1.0

◆ prepareGetData()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareGetData ( const GetDataTag  tag)
pure virtual

Schedules the execution of a "Get Data" command to retrieve the data indicated by the provided tag.

Data will be available in CalypsoCard using the ElementaryFile#getHeader() or CalypsoCard#getDirectoryHeader() methods, depending on the provided tag.

Parameters
tagThe tag to use.
Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf the Get Data command with the provided tag is not supported.
IllegalArgumentExceptionIf tag is null.
Since
1.0.0

◆ prepareIncreaseCounter()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareIncreaseCounter ( const uint8_t  sfi,
const int  counterNumber,
const int  incValue 
)
pure virtual

Schedules the execution of an "Increase" command to increase the target counter.

If several counters of the same file have to be incremented at the same time of the transaction, it is recommended to use the method prepareIncreaseCounters(byte, Map) for optimization reasons.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiSFI of the EF to select.
counterNumberThe number of the counter (must be zero in case of a simulated counter).
incValueValue to add to the counter (defined as a positive int
<=
16777215 [FFFFFFh])
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.0.0

◆ prepareIncreaseCounters()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareIncreaseCounters ( const uint8_t  sfi,
const std::map< const int, const int > &  counterNumberToIncValueMap 
)
pure virtual

Schedules the execution of an "Increase Multiple" command or multiple "Increase" commands to increase multiple target counters at the same time.

The decision to execute one or the other command is made according to the type of card.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiSFI of the EF to select.
counterNumberToIncValueMapThe map containing the counter numbers to be incremented and their associated increment values.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range or if the map is null or empty.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.1.0

◆ prepareReadBinary()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareReadBinary ( const uint8_t  sfi,
const int  offset,
const int  nbBytesToRead 
)
pure virtual

Schedules the execution of one or multiple "Read Binary" commands to read all or part of the indicated "binary" EF.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Depending on whether we are inside a secure session, there are two types of behavior following this command:

  • Outside a secure session (best effort mode): the following "process" command will not fail whatever the existence of the targeted file or the validity of the offset and number of bytes to read (the CalypsoCard object may not be filled).
  • Inside a secure session (strict mode): the following "process" command will fail if the targeted file does not exist or if the offset and number of bytes to read are not valid (the CalypsoCard object is always filled or an exception is raised when the reading failed).
    Invalid parameters could lead to additional exchanges with the card and thus corrupt the security of the session.
Parameters
sfiThe SFI of the EF.
offsetThe offset (0 indicates the first byte).
nbBytesToReadThe number of bytes to read.
Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf this command is not supported by this card.
IllegalArgumentExceptionIf one of the provided argument is out of range.
Since
1.1.0

◆ prepareReadCounter()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareReadCounter ( const uint8_t  sfi,
const int  nbCountersToRead 
)
pure virtual

Schedules the execution of a "Read Records" command to reads a record of the indicated EF, which should be a "counter" file.

The record will be read up to the counter location indicated in parameter.
Thus, all previous counters will also be read.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Depending on whether we are inside a secure session, there are two types of behavior following this command:

  • Outside a secure session (best effort mode): the following "process" command will not fail whatever the existence of the targeted file or counter (the CalypsoCard object may not be filled).
  • Inside a secure session (strict mode): the following "process" command will fail if the targeted file or counter does not exist (the CalypsoCard object is always filled or an exception is raised when the reading failed).
    Invalid parameters could lead to additional exchanges with the card and thus corrupt the security of the session.
Parameters
sfiThe SFI of the EF.
nbCountersToReadThe number of counters to read.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range.
Since
1.1.0

◆ prepareReadRecord()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareReadRecord ( const uint8_t  sfi,
const int  recordNumber 
)
pure virtual

Schedules the execution of a "Read Records" command to read a single record from the indicated EF.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Depending on whether we are inside a secure session, there are two types of behavior following this command:

  • Outside a secure session (best effort mode): the following "process" command will not fail whatever the existence of the targeted file or record (the CalypsoCard object may not be filled).
  • Inside a secure session in contactless mode (strict mode): the following "process" command will fail if the targeted file or record does not exist (the CalypsoCard object is always filled or an exception is raised when the reading failed).

This method should not be used inside a secure session in contact mode because additional exchanges with the card will be operated and will corrupt the security of the session. Instead, use the method prepareReadRecords(byte, int, int, int) for this case and provide valid parameters.

Parameters
sfiThe SFI of the EF to read.
recordNumberThe record to read.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided arguments is out of range.
IllegalStateExceptionIf this method is called inside a secure session in contact mode.
Since
1.1.0

◆ prepareReadRecords()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareReadRecords ( const uint8_t  sfi,
const int  fromRecordNumber,
const int  toRecordNumber,
const int  recordSize 
)
pure virtual

Schedules the execution of a "Read Records" command to read one or more records from the indicated EF.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Depending on whether we are inside a secure session, there are two types of behavior following this command:

  • Outside a secure session (best effort mode): the following "process" command will not fail whatever the existence of the targeted file or record (the CalypsoCard object may not be filled).
  • Inside a secure session (strict mode): the following "process" command will fail if the targeted file or record does not exist (the CalypsoCard object is always filled or an exception is raised when the reading failed).
    Invalid parameters could lead to additional exchanges with the card and thus corrupt the security of the session.
Parameters
sfiThe SFI of the EF.
fromRecordNumberThe number of the first record to read.
toRecordNumberThe number of the last record to read.
recordSizeThe record length.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range.
Since
1.1.0

◆ prepareReadRecordsPartially()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareReadRecordsPartially ( const uint8_t  sfi,
const int  fromRecordNumber,
const int  toRecordNumber,
const int  offset,
const int  nbBytesToRead 
)
pure virtual

Schedules the execution of one or multiple "Read Record Multiple" commands to read all or parts of multiple records of the indicated EF.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Depending on whether we are inside a secure session, there are two types of behavior following this command:

  • Outside a secure session (best effort mode): the following "process" command will not fail whatever the existence of the targeted file or the validity of the offset and number of bytes to read (the CalypsoCard object may not be filled).
  • Inside a secure session (strict mode): the following "process" command will fail if the targeted file does not exist or if the offset and number of bytes to read are not valid (the CalypsoCard object is always filled or an exception is raised when the reading failed).
    Invalid parameters could lead to additional exchanges with the card and thus corrupt the security of the session.
Parameters
sfiThe SFI of the EF.
fromRecordNumberThe number of the first record to read.
toRecordNumberThe number of the last record to read.
offsetThe offset in the records where to start reading (0 indicates the first byte).
nbBytesToReadThe number of bytes to read from each record.
Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf this command is not supported by this card.
IllegalArgumentExceptionIf one of the provided argument is out of range.
Since
1.1.0

◆ prepareSearchRecords()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareSearchRecords ( const SearchCommandData  data)
pure virtual

Schedules the execution of a "Search Record Multiple" command to search data in the records of the indicated EF, from a given record to the last record of the file. It will return the list of record numbers containing these data, and if requested it will read the first record content.

The command is only possible with a "linear", "cyclic", Counters or Simulated "counter" EF.

The command searches if the given data are present in the records of the file. During the search, an optional mask is applied. The mask allows to specify precisely the bits to be taken into account in the comparison.

See SearchCommandData class for a description of the parameters.

Once this command is processed, the result is available in the provided input/output SearchCommandData object, and the content of the first matching record in CalypsoCard if requested.

Depending on whether we are inside a secure session, there are two types of behavior following this command:

  • Outside a secure session (best effort mode): the following "process" command will not fail whatever the existence of the targeted file or the validity of the record number and offset (the SearchCommandData and CalypsoCard objects may not be updated).
  • Inside a secure session (strict mode): the following "process" command will fail if the targeted file does not exist or if the record number and the offset are not valid (the SearchCommandData and CalypsoCard objects are always filled or an exception is raised when the reading failed).
Parameters
dataThe input/output data containing the parameters of the command.
Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf the "Search Record Multiple" command is not available for this card.
IllegalArgumentExceptionIf the input data is inconsistent.
See also
SearchCommandData
Since
1.1.0

◆ prepareSelectFile() [1/2]

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareSelectFile ( const SelectFileControl  selectFileControl)
pure virtual

Schedules the execution of a "Select File" command using a navigation selectFileControl defined by the ISO standard.

Data will be available in CalypsoCard using the ElementaryFile#getHeader() method.

Parameters
selectFileControlA SelectFileControl enum entry.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf selectFileControl is null.
Since
1.0.0

◆ prepareSelectFile() [2/2]

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareSelectFile ( const uint16_t  lid)
pure virtual

Schedules the execution of a "Select File" command to select an EF by its LID in the current DF.

Data will be available in CalypsoCard using the CalypsoCard#getFileBySfi(byte)/CalypsoCard#getFileByLid(short) and ElementaryFile#getHeader() methods.

Caution: the command will fail if the selected file is not an EF.

Parameters
lidThe LID of the EF to select.
Returns
The current instance.
Since
1.1.0

◆ prepareSetCounter()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareSetCounter ( const uint8_t  sfi,
const int  counterNumber,
const int  newValue 
)
pure virtual

Schedules the execution of an "Increase" or "Decrease" command to set the value of the target counter.

The operation (Increase or Decrease) is selected according to whether the difference between the current value and the desired value is negative (Increase) or positive (Decrease).

Data will be available in CalypsoCard using the dedicated file and data management methods.

Note: it is assumed here that:

  • the counter value has been read before,
  • the type of session (and associated access rights) is consistent with the requested operation: reload session if the counter is to be incremented, debit if it is to be decremented.
    No control is performed on this point by this method; the closing of the session will determine the success of the operation..
Parameters
counterNumber
>=
1: Counters file, number of the counter. 0: Simulated "counter" file.
sfiSFI of the EF to select.
newValueThe desired value for the counter (defined as a positive int
<=
16777215 [FFFFFFh])
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range.
IllegalStateExceptionIf the current counter value is unknown.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.0.0

◆ prepareSvReadAllLogs()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareSvReadAllLogs ( )
pure virtual

Schedules the execution of "Read Records" commands to read all SV logs.

Note: this method requires that the selected application is of type Store Value (file structure 20h).

The SV transaction logs are contained in two files with fixed identifiers:

  • The file whose SFI is 14h contains 1 record containing the unique reload log.
  • The file whose SFI is 15h contains 3 records containing the last three debit logs.

Data will be available in CalypsoCard in raw format using the dedicated file and data management methods or in the form of dedicated objects using the CalypsoCard#getSvLoadLogRecord() and CalypsoCard#getSvDebitLogAllRecords() methods.

Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf the SV feature is not available for this card.
Since
1.0.0

◆ prepareUpdateBinary()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareUpdateBinary ( const uint8_t  sfi,
const int  offset,
const std::vector< uint8_t > &  data 
)
pure virtual

Schedules the execution of one or multiple "Update Binary" command to replace the indicated data of a "binary" file with the new data given from the indicated offset.

The data of the file before the offset and after the data given are left unchanged.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiThe SFI of the EF to select.
offsetThe offset (0 indicates the first byte).
dataThe new data.
Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf this command is not supported by this card.
IllegalArgumentExceptionIf one of the provided argument is out of range.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.1.0

◆ prepareUpdateRecord()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareUpdateRecord ( const uint8_t  sfi,
const int  recordNumber,
const std::vector< uint8_t > &  recordData 
)
pure virtual

Schedules the execution of an "Update Record" command to overwrites the target file's record contents with the provided data.

If the input data is shorter than the record size, only the first bytes will be overwritten.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiThe sfi to select.
recordNumberThe record to update.
recordDataThe new record data. If length
<
RecSize, bytes beyond length are. left unchanged.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.0.0

◆ prepareVerifyPin()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareVerifyPin ( const std::vector< uint8_t > &  pin)
pure virtual

Schedules the execution of a "Verify PIN" command in order to authenticate the cardholder and/or unlock access to certain card files.

This command can be performed both in and out of a secure session. The PIN code can be transmitted in plain text or encrypted according to the parameter set in SymmetricCryptoSecuritySetting.

The PIN status will be available in CalypsoCard using the CalypsoCard#getPinAttemptRemaining() and CalypsoCard#isPinBlocked() methods.

Parameters
pinThe PIN code value (4-byte long byte array).
Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf the PIN feature is not available for this card.
IllegalArgumentExceptionIf the provided argument is out of range.
Since
1.6.0

◆ prepareWriteBinary()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareWriteBinary ( const uint8_t  sfi,
const int  offset,
const std::vector< uint8_t > &  data 
)
pure virtual

Schedules the execution of one or multiple "Write Binary" commands to write over the indicated data of a "binary" file. The new data will be the result of a binary OR operation between the existing data and the data given in the command from the indicated offset.

The data of the file before the offset and after the data given are left unchanged.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiThe SFI of the EF to select.
offsetThe offset (0 indicates the first byte).
dataThe data to write over the existing data.
Returns
The current instance.
Exceptions
UnsupportedOperationExceptionIf this command is not supported by this card.
IllegalArgumentExceptionIf one of the provided argument is out of range.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.1.0

◆ prepareWriteRecord()

template<typename T >
virtual T & keypop::calypso::card::transaction::TransactionManager< T >::prepareWriteRecord ( const uint8_t  sfi,
const int  recordNumber,
const std::vector< uint8_t > &  recordData 
)
pure virtual

Schedules the execution of a "Write Record" command to updates the target file's record contents with the result of a binary OR between the existing data and the provided data.

If the input data is shorter than the record size, only the first bytes will be overwritten.

Data will be available in CalypsoCard using the dedicated file and data management methods.

Parameters
sfiThe sfi to select.
recordNumberThe record to write.
recordDataThe data to overwrite in the record. If length
<
RecSize, bytes. beyond length are left unchanged.
Returns
The current instance.
Exceptions
IllegalArgumentExceptionIf one of the provided argument is out of range.
SessionBufferOverflowExceptionIf the command will overflow the modifications buffer size and the multiple session is not allowed.
Since
1.0.0

◆ processCommands()

template<typename T >
virtual T keypop::calypso::card::transaction::TransactionManager< T >::processCommands ( const ChannelControl  channelControl)
pure virtual

Processes all previously prepared commands and closes the physical channel if requested.

All APDUs corresponding to the prepared commands are sent to the card, their responses are retrieved and used to update the CalypsoCard associated with the transaction.

For write commands, the CalypsoCard is updated only when the command is successful.

The process is interrupted at the first failed command.

Parameters
channelControlPolicy for managing the physical channel after executing commands to the card.
Returns
The current instance.
Exceptions
ReaderIOExceptionIf a communication error with the card reader or the cryptographic module reader occurs.
CardIOExceptionIf a communication error with the card occurs.
CryptoIOExceptionIf a communication error with the cryptographic module occurs.
UnexpectedCommandStatusExceptionIf a command returns an unexpected status.
InconsistentDataExceptionIf inconsistent data have been detected.
UnauthorizedKeyExceptionIf the card requires an unauthorized session key.
CardSignatureNotVerifiableExceptionIf a secure session is open and multiple session mode is enabled and an intermediate session is correctly closed but the cryptographic module is no longer available to verify the card MAC.
InvalidCardSignatureExceptionIf the card signature is incorrect. In the case of a card transaction secured by "symmetrical" cryptography (e.g. SAM), this indicates that the card has correctly closed the secure session, but the card session is not authentic because the MAC of the card is incorrect.
SelectFileExceptionIf a "Select File" prepared card command indicated that the file was not found.
Since
1.6.0

The documentation for this class was generated from the following file: