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)
154 length +=
static_cast<int>(data.size()) + 1;
159 return std::vector<uint8_t>(length);
163ApduUtil::allocateBuffer(
const std::vector<uint8_t>& data)
167 length +=
static_cast<int>(data.size() + 1);
169 return std::vector<uint8_t>(length);
173ApduUtil::allocateBuffer(
const uint8_t le)
181 return std::vector<uint8_t>(length);
185ApduUtil::allocateBuffer()
192 return std::vector<uint8_t>(length);
196ApduUtil::isCase4(
const std::vector<uint8_t>& apduCommand)
198 if (apduCommand.size() > 4) {
199 return apduCommand[4] == apduCommand.size() - 6;