14#include "keyple/core/util/ApduUtil.hpp"
18#include "keyple/core/util/cpp/System.hpp"
24using keyple::core::util::cpp::System;
30const std::vector<uint8_t>
36 const std::vector<uint8_t>& dataIn,
39 std::vector<uint8_t> apduCommand;
42 apduCommand = allocateBuffer(dataIn, le);
51 if (dataIn.size() != 0) {
53 apduCommand[4] =
static_cast<uint8_t
>(dataIn.size());
55 dataIn, 0, apduCommand, 5,
static_cast<int>(dataIn.size()));
56 apduCommand[apduCommand.size() - 1] = le;
65const std::vector<uint8_t>
71 const std::vector<uint8_t>& dataIn)
73 std::vector<uint8_t> apduCommand;
76 apduCommand = allocateBuffer(dataIn);
85 if (dataIn.size() != 0) {
87 apduCommand[4] =
static_cast<uint8_t
>(dataIn.size());
89 dataIn, 0, apduCommand, 5,
static_cast<int>(dataIn.size()));
93 apduCommand[4] = 0x00;
98const std::vector<uint8_t>
106 std::vector<uint8_t> apduCommand;
109 apduCommand = allocateBuffer(le);
112 apduCommand[0] = cla;
113 apduCommand[1] = ins;
124const std::vector<uint8_t>
126 const uint8_t cla,
const uint8_t ins,
const uint8_t p1,
const uint8_t p2)
128 std::vector<uint8_t> apduCommand;
131 apduCommand = allocateBuffer();
134 apduCommand[0] = cla;
135 apduCommand[1] = ins;
141 apduCommand[4] = 0x00;
147ApduUtil::allocateBuffer(
const std::vector<uint8_t>& data,
const uint8_t le)
153 length +=
static_cast<int>(data.size() + 1);
156 return std::vector<uint8_t>(length);
160ApduUtil::allocateBuffer(
const std::vector<uint8_t>& data)
164 length +=
static_cast<int>(data.size() + 1);
166 return std::vector<uint8_t>(length);
170ApduUtil::allocateBuffer(
const uint8_t le)
178 return std::vector<uint8_t>(length);
182ApduUtil::allocateBuffer()
189 return std::vector<uint8_t>(length);
193ApduUtil::isCase4(
const std::vector<uint8_t>& apduCommand)
195 if (apduCommand.size() > 4) {
196 return apduCommand[4] == apduCommand.size() - 6;