Keyple Card Calypso C++ Library 2.1.0
Reference Terminal Reader API for C++
CmdCardGetChallenge.cpp
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional information regarding *
5 * copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the terms of the Eclipse *
8 * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 *
9 * *
10 * SPDX-License-Identifier: EPL-2.0 *
11 **************************************************************************************************/
12
13#include "CmdCardGetChallenge.h"
14
15#include <sstream>
16
17/* Keyple Core Util */
18#include "ApduUtil.h"
19#include "Arrays.h"
20#include "System.h"
21
22/* Keyple Card Calypso */
29
30namespace keyple {
31namespace card {
32namespace calypso {
33
34using namespace keyple::core::util;
35using namespace keyple::core::util::cpp;
36
37const CalypsoCardCommand CmdCardGetChallenge::mCommand = CalypsoCardCommand::GET_CHALLENGE;
38
40: AbstractCardCommand(mCommand)
41{
42 const uint8_t p1 = 0x00;
43 const uint8_t p2 = 0x00;
44 const uint8_t le = 0x08;
45
47 std::make_shared<ApduRequestAdapter>(
48 ApduUtil::build(calypsoCardClass.getValue(),
49 mCommand.getInstructionByte(),
50 p1,
51 p2,
52 le)));
53}
54
56{
57 return false;
58}
59
60const std::vector<uint8_t> CmdCardGetChallenge::getCardChallenge() const
61{
62 return getApduResponse()->getDataOut();
63}
64
65}
66}
67}
virtual const std::shared_ptr< ApduResponseApi > getApduResponse() const final
virtual void setApduRequest(const std::shared_ptr< ApduRequestAdapter > apduRequest) final
static const CalypsoCardCommand GET_CHALLENGE
CmdCardGetChallenge(const CalypsoCardClass calypsoCardClass)
const std::vector< uint8_t > getCardChallenge() const