14#include "keyple/card/calypso/crypto/legacysam/CommandGetChallenge.hpp"
19#include "keyple/card/calypso/crypto/legacysam/IllegalParameterException.hpp"
20#include "keyple/core/util/ApduUtil.hpp"
28using keyple::core::util::ApduUtil;
30const std::map<int, const std::shared_ptr<StatusProperties>>
31 CommandGetChallenge::STATUS_TABLE = [] {
32 std::map<int, const std::shared_ptr<StatusProperties>> m(
33 Command::STATUS_TABLE);
37 std::make_shared<StatusProperties>(
38 "Incorrect Le",
typeid(IllegalParameterException))}});
43CommandGetChallenge::CommandGetChallenge(
44 std::shared_ptr<DtoAdapters::CommandContextDto> context,
45 int expectedResponseLength)
46: Command(CommandRef::GET_CHALLENGE, expectedResponseLength, context)
49 std::make_shared<ApduRequestAdapter>(ApduUtil::build(
50 context->getTargetSam()->getClassByte(),
51 getCommandRef().getInstructionByte(),
54 static_cast<uint8_t
>(expectedResponseLength))));
58CommandGetChallenge::finalizeRequest()
64CommandGetChallenge::isControlSamRequiredToFinalizeRequest()
const
70CommandGetChallenge::parseResponse(
71 std::shared_ptr<ApduResponseApi> apduResponse)
73 setResponseAndCheckStatus(apduResponse);
74 getContext()->getTargetSam()->setChallenge(apduResponse->getDataOut());
77const std::map<int, const std::shared_ptr<StatusProperties>>&
78CommandGetChallenge::getStatusTable()
const