LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
yubikeyiso7816commands.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_YUBIKEYISO7816COMMANDS_HPP
8#define LOGICALACCESS_YUBIKEYISO7816COMMANDS_HPP
9
10#include <logicalaccess/key.hpp>
14
15namespace logicalaccess
16{
17#define CMD_YUBIKEYISO7816 "YubikeyISO7816"
18
19#define YUBIKEY_INS_PUT 0x01
20#define YUBIKEY_INS_DELETE 0x02
21#define YUBIKEY_INS_SET_CODE 0x03
22#define YUBIKEY_INS_RESET 0x04
23#define YUBIKEY_INS_LIST 0xA1
24#define YUBIKEY_INS_CALCULATE 0xA2
25#define YUBIKEY_INS_VALIDATE 0xA3
26#define YUBIKEY_INS_CALCULATE_ALL 0xA4
27#define YUBIKEY_INS_SEND_REMAINING 0xA5
28
35class LLA_READERS_ISO7816_API YubikeyISO7816Commands : public YubikeyCommands
36{
37 public:
42
43 explicit YubikeyISO7816Commands(std::string ct);
44
49
54 YubikeySelectResponse selectYubikeyOATH() override;
55
60 ByteVector selectYubikeyOTP() override;
61
62 /******************************************************
63 * *
64 * === OTP === *
65 * *
66 * All OTP management commands are skipped for now as *
67 * Yubikey Manager app can be used for initial setup. *
68 * *
69 ******************************************************/
70
77 ByteVector otp_getResponse(YubikeySlot slot, const ByteVector& challenge) override;
78
83 ByteVector otp_getSerialNumber() override;
84
89 std::vector<TLVPtr> otp_getDeviceInfo() override;
90
96 bool otp_queryFIPSMode() override;
97
98 /******************************************************
99 * *
100 * === OAUTH == *
101 * *
102 ******************************************************/
103
113 void oath_put(const ByteVector& name, YubikeyHMAC algorithm, uint8_t digits, const ByteVector& key, YubikeyProperty property = PROP_NONE, const ByteVector& imf = ByteVector()) override;
114
119 void oath_delete(const ByteVector& name) override;
120
129 void oath_setCode(YubikeyHMAC algorithm, const ByteVector& key, const ByteVector& challenge) override;
130
135 std::vector<YubikeyListItem> oath_list() override;
136
140 void oath_reset() override;
141
149 YubikeyCalculateResponse oath_calculate(const ByteVector& name, const ByteVector& challenge, bool truncate = false) override;
150
160 ByteVector oath_validate(const ByteVector& challenge, const ByteVector& response) override;
161
168 std::vector<YubikeyCalculateResponse> oath_calculateAll(const ByteVector& challenge, bool truncate) override;
169
174 ByteVector oath_sendRemainingInstruction() override;
175
176 std::shared_ptr<ISO7816Commands> getISO7816Commands() const override
177 {
178 auto command = std::make_shared<ISO7816ISO7816Commands>();
179 command->setChip(getChip());
180 command->setReaderCardAdapter(getReaderCardAdapter());
181 return command;
182 }
183
188 std::shared_ptr<ISO7816ReaderCardAdapter> getISO7816ReaderCardAdapter() const
189 {
190 return std::dynamic_pointer_cast<ISO7816ReaderCardAdapter>(
191 getReaderCardAdapter());
192 }
193};
194}
195
196#endif
The Yubikey commands class.
Definition: yubikeycommands.hpp:116
The Yubikey ISO7816 commands base class. Based on https://docs.yubico.com/yesdk/users-manual/applicat...
Definition: yubikeyiso7816commands.hpp:36
std::shared_ptr< ISO7816Commands > getISO7816Commands() const override
Definition: yubikeyiso7816commands.hpp:176
std::shared_ptr< ISO7816ReaderCardAdapter > getISO7816ReaderCardAdapter() const
Get the ISO7816 reader/card adapter.
Definition: yubikeyiso7816commands.hpp:188
Default ISO7816 reader/card adapter.
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
YubikeyProperty
Yubikey properties.
Definition: yubikeycommands.hpp:36
@ PROP_NONE
Definition: yubikeycommands.hpp:37
YubikeySlot
Yubikey slot. Only used for the old slot-based Yubikey API.
Definition: yubikeycommands.hpp:46
YubikeyHMAC
The HMAC algorithm.
Definition: yubikeycommands.hpp:23
Definition: yubikeycommands.hpp:75
Definition: yubikeycommands.hpp:67
Yubikey commands.