Keypop Calypso Crypto Legacy SAM C++ API - 1.0.0
Component of the Keypop C++ API
LegacySam.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * This program and the accompanying materials are made available under the *
5 * terms of the MIT License which is available at *
6 * https://opensource.org/licenses/MIT. *
7 * *
8 * SPDX-License-Identifier: MIT *
9 ******************************************************************************/
10
11#pragma once
12
13#include <cstdint>
14#include <map>
15#include <memory>
16#include <string>
17#include <vector>
18
23#include "keypop/reader/selection/spi/SmartCard.hpp"
24
25namespace keypop {
26namespace calypso {
27namespace crypto {
28namespace legacysam {
29namespace sam {
30
31using keypop::reader::selection::spi::SmartCard;
32
45class LegacySam : public SmartCard {
46public:
52 enum class ProductType {
58 SAM_C1,
59
65 HSM_C1,
66
73
80
86 UNKNOWN,
87
93 NONE
94 };
95
102 virtual ProductType getProductType() const = 0;
103
110 virtual std::string getProductInfo() const = 0;
111
118 virtual const std::vector<uint8_t>& getSerialNumber() const = 0;
119
126 virtual uint8_t getPlatform() const = 0;
127
134 virtual uint8_t getApplicationType() const = 0;
135
142 virtual uint8_t getApplicationSubType() const = 0;
143
150 virtual uint8_t getSoftwareIssuer() const = 0;
151
158 virtual uint8_t getSoftwareVersion() const = 0;
159
166 virtual uint8_t getSoftwareRevision() const = 0;
167
177 virtual std::shared_ptr<int> getCounter(const int counterNumber) const = 0;
178
189 virtual const std::map<const int, int>& getCounters() const = 0;
190
201 getCounterIncrementAccess(const int counterNumber) const = 0;
202
213 virtual std::shared_ptr<int>
214 getCounterCeiling(const int counterNumber) const = 0;
215
225 virtual const std::map<const int, int>& getCounterCeilings() const = 0;
226
236 virtual const std::vector<uint8_t>& getCaCertificate() const = 0;
237
246 virtual std::shared_ptr<SamParameters> getSamParameters() const = 0;
247
261 virtual std::shared_ptr<KeyParameter>
262 getSystemKeyParameter(const SystemKeyType systemKeyType) const = 0;
263
276 virtual std::shared_ptr<KeyParameter>
277 getWorkKeyParameter(const int recordNumber) const = 0;
278
292 virtual std::shared_ptr<KeyParameter>
293 getWorkKeyParameter(const uint8_t kif, const uint8_t kvc) const = 0;
294};
295
296} /* namespace sam */
297} /* namespace legacysam */
298} /* namespace crypto */
299} /* namespace calypso */
300} /* namespace keypop */
Extends the SmartCard interface of the "Keypop Reader API" to provide additional functionality specif...
Definition: LegacySam.hpp:45
virtual std::shared_ptr< KeyParameter > getSystemKeyParameter(const SystemKeyType systemKeyType) const =0
Returns the parameters of the system key for the specified key type.
virtual uint8_t getSoftwareRevision() const =0
Returns the software revision number.
virtual const std::map< const int, int > & getCounters() const =0
Returns the value of known counters in a sorted map where.
virtual const std::vector< uint8_t > & getCaCertificate() const =0
Returns the CA certificate retrieved from the SAM as a 384-byte byte array.
virtual uint8_t getApplicationType() const =0
Returns the application type.
virtual std::shared_ptr< KeyParameter > getWorkKeyParameter(const int recordNumber) const =0
Returns the parameters of the work key referenced by its record number.
virtual uint8_t getSoftwareVersion() const =0
Returns the software version number.
virtual std::shared_ptr< SamParameters > getSamParameters() const =0
Returns the SAM parameters retrieved from the SAM.
virtual std::shared_ptr< KeyParameter > getWorkKeyParameter(const uint8_t kif, const uint8_t kvc) const =0
Returns the parameters of the work key referenced by its KIF and KVC.
virtual CounterIncrementAccess getCounterIncrementAccess(const int counterNumber) const =0
Returns the counter increment access mode.
virtual ProductType getProductType() const =0
Returns the SAM product type.
virtual uint8_t getApplicationSubType() const =0
Returns the application subtype.
virtual uint8_t getPlatform() const =0
Returns the platform identifier.
virtual std::shared_ptr< int > getCounter(const int counterNumber) const =0
Returns the value of a counter.
virtual uint8_t getSoftwareIssuer() const =0
Returns the software issuer identifier.
virtual std::string getProductInfo() const =0
Returns a text description of the SAM.
virtual const std::map< const int, int > & getCounterCeilings() const =0
Returns the value of known counter ceilings in a sorted map where.
virtual std::shared_ptr< int > getCounterCeiling(const int counterNumber) const =0
Returns the value of a counter ceiling.
ProductType
All Calypso SAM products supported by this API.
Definition: LegacySam.hpp:52
virtual const std::vector< uint8_t > & getSerialNumber() const =0
Returns the SAM serial number as a byte array.
CounterIncrementAccess
Enumeration of the different possible access rights for incrementing event counters.
SystemKeyType
Enumeration of the system key types of a Legacy Sam.