14#include "keyple/card/calypso/crypto/legacysam/CommandDigestInternalAuthenticate.hpp"
21#include "keyple/card/calypso/crypto/legacysam/AccessForbiddenException.hpp"
22#include "keyple/card/calypso/crypto/legacysam/IllegalParameterException.hpp"
23#include "keyple/core/util/ApduUtil.hpp"
31using keyple::core::util::ApduUtil;
33const std::map<int, const std::shared_ptr<StatusProperties>>
34 CommandDigestInternalAuthenticate::STATUS_TABLE = [] {
35 std::map<int, const std::shared_ptr<StatusProperties>> m(
36 Command::STATUS_TABLE);
40 std::make_shared<StatusProperties>(
41 std::string(
"Preconditions not satisfied:\n")
42 +
"- Session not in 'ongoing' state.\n"
43 +
"- Session not opened in Extended mode.\n"
44 +
"- Session opened in Verification mode.\n"
45 +
"- Authentication not allowed by the key (not an AES "
47 +
"- 250th occurrence since session start",
48 typeid(AccessForbiddenException))},
50 std::make_shared<StatusProperties>(
51 "Incorrect P1",
typeid(IllegalParameterException))}});
55CommandDigestInternalAuthenticate::CommandDigestInternalAuthenticate(
56 const std::shared_ptr<CommandContextDto> context)
57: Command(CommandRef::DIGEST_INTERNAL_AUTHENTICATE, 8, context)
60 std::make_shared<ApduRequestAdapter>(ApduUtil::build(
61 context->getTargetSam()->getClassByte(),
62 getCommandRef().getInstructionByte(),
68const std::vector<uint8_t>&
69CommandDigestInternalAuthenticate::getTerminalSignature()
const
71 return mTerminalSignature;
75CommandDigestInternalAuthenticate::finalizeRequest()
81CommandDigestInternalAuthenticate::isControlSamRequiredToFinalizeRequest()
const
87CommandDigestInternalAuthenticate::parseResponse(
88 const std::shared_ptr<ApduResponseApi> apduResponse)
90 setResponseAndCheckStatus(apduResponse);
92 mTerminalSignature = apduResponse->getDataOut();
95const std::map<int, const std::shared_ptr<StatusProperties>>&
96CommandDigestInternalAuthenticate::getStatusTable()
const