keyple-card-calypso-crypto-legacysam-cpp-lib - 1.0.2
Component of the Keyple C++ middleware
KeyParameterAdapter.cpp
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional *
5 * information regarding copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the *
8 * terms of the Eclipse Public License 2.0 which is available at *
9 * http://www.eclipse.org/legal/epl-2.0 *
10 * *
11 * SPDX-License-Identifier: EPL-2.0 *
12 ******************************************************************************/
13
14#include "keyple/card/calypso/crypto/legacysam/KeyParameterAdapter.hpp"
15
16#include <utility>
17#include <vector>
18
19#include "keyple/core/util/KeypleAssert.hpp"
20
21namespace keyple {
22namespace card {
23namespace calypso {
24namespace crypto {
25namespace legacysam {
26
27using keyple::core::util::Assert;
28
29KeyParameterAdapter::KeyParameterAdapter(std::vector<uint8_t> keyParameters)
30: mKeyParameters(std::move(keyParameters))
31{
32}
33
34const std::vector<uint8_t>&
35KeyParameterAdapter::getRawData() const
36{
37 return mKeyParameters;
38}
39
40uint8_t
41KeyParameterAdapter::getKif() const
42{
43 return mKeyParameters[0];
44}
45
46uint8_t
47KeyParameterAdapter::getKvc() const
48{
49 return mKeyParameters[1];
50}
51
52uint8_t
53KeyParameterAdapter::getAlgorithm() const
54{
55 return mKeyParameters[2];
56}
57
58uint8_t
59KeyParameterAdapter::getParameterValue(const int parameterNumber) const
60{
61 Assert::getInstance().isInRange(parameterNumber, 1, 10, "parameterNumber");
62
63 return mKeyParameters[2 + parameterNumber];
64}
65
66} /* namespace legacysam */
67} /* namespace crypto */
68} /* namespace calypso */
69} /* namespace card */
70} /* namespace keyple */