24#include "IllegalArgumentException.h"
30using namespace keyple::core::util;
31using namespace keyple::core::util::cpp::exception;
35const std::map<const int, const std::shared_ptr<StatusProperties>>
36 CmdSamCardGenerateKey::STATUS_TABLE = initStatusTable();
39 const uint8_t cipheringKif,
40 const uint8_t cipheringKvc,
41 const uint8_t sourceKif,
42 const uint8_t sourceKvc)
49 std::vector<uint8_t> data;
51 if (cipheringKif == 0 && cipheringKvc == 0) {
56 data = std::vector<uint8_t>(3);
64 data = std::vector<uint8_t>(5);
65 data[0] = cipheringKif;
66 data[1] = cipheringKvc;
73 std::make_shared<ApduRequestAdapter>(
82const std::map<const int, const std::shared_ptr<StatusProperties>>
83 CmdSamCardGenerateKey::initStatusTable()
85 std::map<const int, const std::shared_ptr<StatusProperties>> m =
89 std::make_shared<StatusProperties>(
"Incorrect Lc.",
92 std::make_shared<StatusProperties>(
"Preconditions not satisfied.",
93 typeid(CalypsoSamAccessForbiddenException))});
95 std::make_shared<StatusProperties>(
"Incorrect P1 or P2",
96 typeid(CalypsoSamIllegalParameterException))});
98 std::make_shared<StatusProperties>(
"Incorrect incoming data: unknown or incorrect " \
100 typeid(CalypsoSamIncorrectInputDataException))});
102 std::make_shared<StatusProperties>(
"Record not found: ciphering key or key to " \
104 typeid(CalypsoSamDataAccessException))});
109const std::map<const int, const std::shared_ptr<StatusProperties>>&
virtual const std::shared_ptr< ApduResponseApi > getApduResponse() const final
virtual bool isSuccessful() const final
virtual void setApduRequest(const std::shared_ptr< ApduRequestAdapter > apduRequest) final
static const std::map< const int, const std::shared_ptr< StatusProperties > > STATUS_TABLE
static const CalypsoSamCommand CARD_GENERATE_KEY
uint8_t getInstructionByte() const override
CmdSamCardGenerateKey(const CalypsoSam::ProductType productType, const uint8_t cipheringKif, const uint8_t cipheringKvc, const uint8_t sourceKif, const uint8_t sourceKvc)
const std::map< const int, const std::shared_ptr< StatusProperties > > & getStatusTable() const override
const std::vector< uint8_t > getCipheredData() const
static uint8_t getClassByte(const ProductType productType)
CalypsoSam::ProductType ProductType