keyple-card-calypso-crypto-legacysam-cpp-lib - 1.0.2
Component of the Keyple C++ middleware
CommandRef.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/CommandRef.hpp"
15
16#include <string>
17namespace keyple {
18namespace card {
19namespace calypso {
20namespace crypto {
21namespace legacysam {
22
23const CommandRef CommandRef::SELECT_DIVERSIFIER("Select Diversifier", 0x14);
24const CommandRef CommandRef::GET_CHALLENGE("Get Challenge", 0x84);
25const CommandRef CommandRef::DIGEST_INIT("Digest Init", 0x8A);
26const CommandRef CommandRef::DIGEST_UPDATE("Digest Update", 0x8C);
27const CommandRef
28 CommandRef::DIGEST_UPDATE_MULTIPLE("Digest Update Multiple", 0x8C);
29const CommandRef CommandRef::DIGEST_CLOSE("Digest Close", 0x8E);
30const CommandRef CommandRef::DIGEST_AUTHENTICATE("Digest Authenticate", 0x82);
31const CommandRef CommandRef::DIGEST_INTERNAL_AUTHENTICATE(
32 "Digest Internal Authenticate", 0x88);
33const CommandRef CommandRef::GIVE_RANDOM("Give Random", 0x86);
34const CommandRef CommandRef::CARD_GENERATE_KEY("Card Generate Key", 0x12);
35const CommandRef CommandRef::CARD_CIPHER_PIN("Card Cipher PIN", 0x12);
36const CommandRef CommandRef::UNLOCK("Unlock", 0x20);
37const CommandRef CommandRef::WRITE_KEY("Write Key", 0x1A);
38const CommandRef CommandRef::READ_KEY_PARAMETERS("Read Key Parameters", 0xBC);
39const CommandRef CommandRef::READ_EVENT_COUNTER("Read Event Counter", 0xBE);
40const CommandRef CommandRef::READ_CEILINGS("Read Ceilings", 0xBE);
41const CommandRef CommandRef::READ_PARAMETERS("Read Parameters", 0xBE);
42const CommandRef CommandRef::SV_CHECK("SV Check", 0x58);
43const CommandRef CommandRef::SV_PREPARE_DEBIT("SV Prepare Debit", 0x54);
44const CommandRef CommandRef::SV_PREPARE_LOAD("SV Prepare Load", 0x56);
45const CommandRef CommandRef::SV_PREPARE_UNDEBIT("SV Prepare Undebit", 0x5C);
46const CommandRef CommandRef::DATA_CIPHER("Data Cipher", 0x1C);
47const CommandRef
48 CommandRef::PSO_COMPUTE_SIGNATURE("PSO Compute Signature", 0x2A);
49const CommandRef CommandRef::PSO_VERIFY_SIGNATURE("PSO Verify Signature", 0x2A);
50const CommandRef CommandRef::SAM_DATA_CIPHER("SAM Data Cipher", 0x16);
51const CommandRef CommandRef::SAM_GENERATE_KEY("SAM Generate Key", 0x16);
52const CommandRef CommandRef::WRITE_CEILINGS("Write Ceilings", 0xD8);
53const CommandRef CommandRef::WRITE_PARAMETERS("Write Parameters", 0xD8);
54const CommandRef CommandRef::GET_DATA("Get Data", 0xCA);
55const CommandRef
56 CommandRef::PSO_COMPUTE_CERTIFICATE("PSO Compute Certificate", 0x2A);
57const CommandRef CommandRef::CARD_GENERATE_ASYMMETRIC_KEY_PAIR(
58 "Card Generate Asymmetric Key Pair", 0x46);
59
60CommandRef::CommandRef(const std::string& name, std::uint8_t instructionByte)
61: mName(name)
62, mInstructionByte(instructionByte)
63{
64}
65
66const std::string&
67CommandRef::getName() const
68{
69 return mName;
70}
71
72std::uint8_t
73CommandRef::getInstructionByte() const
74{
75 return mInstructionByte;
76}
77
78bool
79CommandRef::operator==(const CommandRef& other) const
80{
81 return mName == other.mName && mInstructionByte == other.mInstructionByte;
82}
83
84bool
85CommandRef::operator!=(const CommandRef& other) const
86{
87 return !(*this == other);
88}
89
90} /* namespace legacysam */
91} /* namespace crypto */
92} /* namespace calypso */
93} /* namespace card */
94} /* namespace keyple */