Keyple Card Calypso C++ Library 2.1.0
Reference Terminal Reader API for C++
Classes | Public Member Functions | List of all members
keyple::card::calypso::CmdCardOpenSession Class Referencefinal

#include <CmdCardOpenSession.h>

Inheritance diagram for keyple::card::calypso::CmdCardOpenSession:
Inheritance graph
[legend]
Collaboration diagram for keyple::card::calypso::CmdCardOpenSession:
Collaboration graph
[legend]

Public Member Functions

 CmdCardOpenSession (const std::shared_ptr< CalypsoCard > calypsoCard, const uint8_t debitKeyIndex, const std::vector< uint8_t > sessionTerminalChallenge, const uint8_t sfi, const uint8_t recordNumber)
 
void createRev3 (const uint8_t keyIndex, const std::vector< uint8_t > &samChallenge, const uint8_t sfi, const uint8_t recordNumber, const std::shared_ptr< CalypsoCard > calypsoCard)
 
void createRev24 (const uint8_t keyIndex, const std::vector< uint8_t > &samChallenge, const uint8_t sfi, const uint8_t recordNumber)
 
void createRev10 (const uint8_t keyIndex, const std::vector< uint8_t > &samChallenge, const uint8_t sfi, const uint8_t recordNumber)
 
void buildLegacyApduRequest (const uint8_t keyIndex, const std::vector< uint8_t > &samChallenge, const uint8_t sfi, const uint8_t recordNumber, const uint8_t p1)
 
bool isSessionBufferUsed () const override
 
uint8_t getSfi () const
 
uint8_t getRecordNumber () const
 
CmdCardOpenSessionsetApduResponse (const std::shared_ptr< ApduResponseApi > apduResponse) override
 
void parseRev3 (const std::vector< uint8_t > &apduResponseData)
 
void parseRev24 (const std::vector< uint8_t > &apduResponseData)
 
void parseRev10 (const std::vector< uint8_t > &apduResponseData)
 
const std::vector< uint8_t > & getCardChallenge () const
 
int getTransactionCounterValue () const
 
bool wasRatified () const
 
bool isManageSecureSessionAuthorized () const
 
const std::shared_ptr< uint8_t > getSelectedKif () const
 
const std::shared_ptr< uint8_t > getSelectedKvc () const
 
const std::vector< uint8_t > & getRecordDataRead () const
 
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable () const override
 
- Public Member Functions inherited from keyple::card::calypso::AbstractCardCommand
 AbstractCardCommand (const CalypsoCardCommand &commandRef)
 
const CalypsoCardCommandgetCommandRef () const override
 
const CalypsoApduCommandException buildCommandException (const std::type_info &exceptionClass, const std::string &message, const CardCommand &commandRef, const int statusWord) const final
 
void checkStatus () override
 
- Public Member Functions inherited from keyple::card::calypso::AbstractApduCommand
 AbstractApduCommand (const CardCommand &commandRef)
 
virtual void addSubName (const std::string &subName) final
 
virtual const std::string & getName () const final
 
virtual void setApduRequest (const std::shared_ptr< ApduRequestAdapter > apduRequest) final
 
virtual const std::shared_ptr< ApduRequestAdaptergetApduRequest () const final
 
virtual const std::shared_ptr< ApduResponseApi > getApduResponse () const final
 
virtual bool isSuccessful () const final
 
virtual const std::string getStatusInformation () const final
 

Additional Inherited Members

- Static Public Attributes inherited from keyple::card::calypso::AbstractApduCommand
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
 

Detailed Description

(package-private)
Builds the Open Secure Session APDU command.

Since
2.0.1

Definition at line 46 of file CmdCardOpenSession.h.

Constructor & Destructor Documentation

◆ CmdCardOpenSession()

keyple::card::calypso::CmdCardOpenSession::CmdCardOpenSession ( const std::shared_ptr< CalypsoCard >  calypsoCard,
const uint8_t  debitKeyIndex,
const std::vector< uint8_t >  sessionTerminalChallenge,
const uint8_t  sfi,
const uint8_t  recordNumber 
)

(package-private)
Instantiates a new CmdCardOpenSession.

Parameters
calypsoCardthe CalypsoCard.
Exceptions
IllegalArgumentExceptionIf the key index is 0 and rev is 2.4
IllegalArgumentExceptionIf the request is inconsistent
Since
2.0.1

Definition at line 106 of file CmdCardOpenSession.cpp.

Member Function Documentation

◆ buildLegacyApduRequest()

void keyple::card::calypso::CmdCardOpenSession::buildLegacyApduRequest ( const uint8_t  keyIndex,
const std::vector< uint8_t > &  samChallenge,
const uint8_t  sfi,
const uint8_t  recordNumber,
const uint8_t  p1 
)

(private)
Build legacy apdu request.

Parameters
keyIndexthe key index.
samChallengethe sam challenge returned by the SAM Get Challenge APDU command.
sfithe sfi to select.
recordNumberthe record number to read.
p1P1.
Exceptions
IllegalArgumentExceptionIf the request is inconsistent

Definition at line 214 of file CmdCardOpenSession.cpp.

◆ createRev10()

void keyple::card::calypso::CmdCardOpenSession::createRev10 ( const uint8_t  keyIndex,
const std::vector< uint8_t > &  samChallenge,
const uint8_t  sfi,
const uint8_t  recordNumber 
)

(private)
Create Rev 1.0

Parameters
keyIndexthe key index.
samChallengethe sam challenge returned by the SAM Get Challenge APDU command.
sfithe sfi to select.
recordNumberthe record number to read.
Exceptions
IllegalArgumentExceptionIf key index is 0 (rev 1.0)
IllegalArgumentExceptionIf the request is inconsistent

Definition at line 197 of file CmdCardOpenSession.cpp.

◆ createRev24()

void keyple::card::calypso::CmdCardOpenSession::createRev24 ( const uint8_t  keyIndex,
const std::vector< uint8_t > &  samChallenge,
const uint8_t  sfi,
const uint8_t  recordNumber 
)

(private)
Create Rev 2.4

Parameters
keyIndexthe key index.
samChallengethe sam challenge returned by the SAM Get Challenge APDU command.
sfithe sfi to select.
recordNumberthe record number to read.
Exceptions
IllegalArgumentExceptionIf key index is 0 (rev 2.4)
IllegalArgumentExceptionIf the request is inconsistent

Definition at line 180 of file CmdCardOpenSession.cpp.

◆ createRev3()

void keyple::card::calypso::CmdCardOpenSession::createRev3 ( const uint8_t  keyIndex,
const std::vector< uint8_t > &  samChallenge,
const uint8_t  sfi,
const uint8_t  recordNumber,
const std::shared_ptr< CalypsoCard >  calypsoCard 
)

(private)
Create Rev 3

Parameters
keyIndexthe key index.
samChallengethe sam challenge returned by the SAM Get Challenge APDU command.
sfithe sfi to select.
recordNumberthe record number to read.
calypsoCardThe CalypsoCard.
Exceptions
IllegalArgumentExceptionIf the request is inconsistent

Definition at line 133 of file CmdCardOpenSession.cpp.

◆ getCardChallenge()

const std::vector< uint8_t > & keyple::card::calypso::CmdCardOpenSession::getCardChallenge ( ) const

(package-private)

Returns
A non empty value.
Since
2.0.1

Definition at line 398 of file CmdCardOpenSession.cpp.

◆ getRecordDataRead()

const std::vector< uint8_t > & keyple::card::calypso::CmdCardOpenSession::getRecordDataRead ( ) const

(package-private)

Returns
The optional read data.
Since
2.0.1

Definition at line 428 of file CmdCardOpenSession.cpp.

◆ getRecordNumber()

uint8_t keyple::card::calypso::CmdCardOpenSession::getRecordNumber ( ) const

(package-private)

Returns
the record number to read
Since
2.0.1

Definition at line 255 of file CmdCardOpenSession.cpp.

◆ getSelectedKif()

const std::shared_ptr< uint8_t > keyple::card::calypso::CmdCardOpenSession::getSelectedKif ( ) const

(package-private)

Returns
The current KIF.
Since
2.0.1

Definition at line 418 of file CmdCardOpenSession.cpp.

◆ getSelectedKvc()

const std::shared_ptr< uint8_t > keyple::card::calypso::CmdCardOpenSession::getSelectedKvc ( ) const

(package-private)

Returns
The current KVC.
Since
2.0.1

Definition at line 423 of file CmdCardOpenSession.cpp.

◆ getSfi()

uint8_t keyple::card::calypso::CmdCardOpenSession::getSfi ( ) const

(package-private)

Returns
the SFI of the file read while opening the secure session
Since
2.0.1

Definition at line 250 of file CmdCardOpenSession.cpp.

◆ getStatusTable()

const std::map< const int, const std::shared_ptr< StatusProperties > > & keyple::card::calypso::CmdCardOpenSession::getStatusTable ( ) const
overridevirtual

(package-private)
Returns the internal status table

Returns
A not null reference
Since
2.0.1

Since
2.0.1

Reimplemented from keyple::card::calypso::AbstractApduCommand.

Definition at line 483 of file CmdCardOpenSession.cpp.

◆ getTransactionCounterValue()

int keyple::card::calypso::CmdCardOpenSession::getTransactionCounterValue ( ) const

(package-private)

Returns
A non negative number.
Since
2.0.1

Definition at line 403 of file CmdCardOpenSession.cpp.

◆ isManageSecureSessionAuthorized()

bool keyple::card::calypso::CmdCardOpenSession::isManageSecureSessionAuthorized ( ) const

(package-private)

Returns
True if the managed secure session is authorized.
Since
2.0.1

Definition at line 413 of file CmdCardOpenSession.cpp.

◆ isSessionBufferUsed()

bool keyple::card::calypso::CmdCardOpenSession::isSessionBufferUsed ( ) const
overridevirtual

(package-private)
Indicates if the session buffer is used when executing this command.Allows the management of the overflow of this buffer.

Returns
True if this command uses the session buffer
Since
2.0.1

Returns
False
Since
2.0.1

Implements keyple::card::calypso::AbstractCardCommand.

Definition at line 245 of file CmdCardOpenSession.cpp.

◆ parseRev10()

void keyple::card::calypso::CmdCardOpenSession::parseRev10 ( const std::vector< uint8_t > &  apduResponseData)

(private)
Parse Rev 1.0

In rev 1.0 mode, the response to the Open Secure Session command is as follows:

CC CC CC CC [RR RR] [NN..NN]

Where:

  • CC CC CC CC = card challenge
  • RR RR = ratification bytes (may be absent)
  • NN..NN = record data (29 bytes)

Legal length values are:

  • 4: ratified, 4-byte challenge, no data
  • 33: ratified, 4-byte challenge, 29 bytes of data
  • 6: not ratified (2 ratification bytes), 4-byte challenge, no data
  • 35 not ratified (2 ratification bytes), 4-byte challenge, 29 bytes of data
Parameters
apduResponseDataThe response data.

Definition at line 358 of file CmdCardOpenSession.cpp.

◆ parseRev24()

void keyple::card::calypso::CmdCardOpenSession::parseRev24 ( const std::vector< uint8_t > &  apduResponseData)

(private)
Parse Rev 2.4

In rev 2.4 mode, the response to the Open Secure Session command is as follows:

KK CC CC CC CC [RR RR] [NN..NN]

Where:

  • KK = KVC byte CC
  • CC CC CC CC = card challenge
  • RR RR = ratification bytes (may be absent)
  • NN..NN = record data (29 bytes)

Legal length values are:

  • 5: ratified, 1-byte KCV, 4-byte challenge, no data
  • 34: ratified, 1-byte KCV, 4-byte challenge, 29 bytes of data
  • 7: not ratified (2 ratification bytes), 1-byte KCV, 4-byte challenge, no data
  • 35 not ratified (2 ratification bytes), 1-byte KCV, 4-byte challenge, 29 bytes of data
Parameters
apduResponseDataThe response data.

Definition at line 317 of file CmdCardOpenSession.cpp.

◆ parseRev3()

void keyple::card::calypso::CmdCardOpenSession::parseRev3 ( const std::vector< uint8_t > &  apduResponseData)

(private)
Parse Rev 3

Parameters
apduResponseDataThe response data.

Definition at line 282 of file CmdCardOpenSession.cpp.

◆ setApduResponse()

CmdCardOpenSession & keyple::card::calypso::CmdCardOpenSession::setApduResponse ( const std::shared_ptr< ApduResponseApi >  apduResponse)
overridevirtual

(package-private)
Sets the command ApduResponseApi.

Parameters
apduResponseThe APDU response.
Returns
The current instance.
Since
2.0.1
Since
2.0.1

Since
2.0.1

Reimplemented from keyple::card::calypso::AbstractCardCommand.

Definition at line 260 of file CmdCardOpenSession.cpp.

◆ wasRatified()

bool keyple::card::calypso::CmdCardOpenSession::wasRatified ( ) const

(package-private)

Returns
True if the previous session was ratified.
Since
2.0.1

Definition at line 408 of file CmdCardOpenSession.cpp.


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