aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
Commit message (Collapse)AuthorAge
* Add function reading HOTP slot detailsSzczepan Zalega2019-06-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Handle new commands in C++ APISzczepan Zalega2019-06-13
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Storage v0.54: enable 320 bit OTP secret and auth commandsSzczepan Zalega2019-03-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Return firmware version parts as uint8_t instead of intfix/get-firmware-versionRobin Krahl2019-01-17
| | | | | | | | The firmware version parts returned by the Nitrokey devices are uint8_t values. This is part of the public API as part of the NK_storage_status struct. For consistency with this API, this patch changes the functions NK_get_major_firmware_version and NK_get_minor_firmware_version to return uint8_t instead of int.
* Change NitrokeyManager::connect_with_path to also work with ProRobin Krahl2019-01-13
| | | | | | | | | | Previously, Stick20 was hardcoded in connect_with_path. Now we first use hid_enumerate to find out the model on that path, then we connect to that model. We also could have added the model as a parameter to connect_with_path. Yet we cannot directly check the model after connecting, so this would be error-prone.
* Make Device::enumerate staticRobin Krahl2019-01-13
| | | | | | | | | | | Device::enumerate does not need any instance data, therefore it is made static. Note that this not only changes the public API by making the method static. We also return all connected Nitrokey devices instead of only Storage devices. The NitrokeyManager method list_devices_by_cpuID is changed to check the device type so that they still only return Storage devices. The list_device method now returns both Storage and Pro devices.
* Change Nitrokey::list_devices return type to use DeviceInfoRobin Krahl2019-01-13
| | | | | | In the previous commit, we changed the return value of Device::enumerate to std::vector<DeviceInfo>. Now we change Nitrokey::list_devices to also return DeviceInfo instances.
* Change Device::enumerate return type to use DeviceInfoRobin Krahl2019-01-13
| | | | | | The return type of Device::enumerate is changed from std::vector<std::string> to std::vector<DeviceInfo> to expose the additional information contained in the DeviceInfo struct.
* Handle command for getting production dataSzczepan Zalega2018-06-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Handle WINK commandSzczepan Zalega2018-06-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch 'pr_115'Szczepan Zalega2018-06-20
|\ | | | | | | | | | | Fix connect() return value in offline mode Fixes #115
| * Correct return value for NitrokeyManager::connect()Robin Krahl2018-05-21
| | | | | | | | | | | | | | | | | | | | | | | | NitrokeyManager::connect() currently returns true if the device pointer is set. Yet this does not mean that the connection was successful. For example, NitrokeyManger::connect(const char*) sets the device pointer even if it was not successful. This patch introduces a variable that keeps track of the connection instead of checking the device pointer. This corrects the return value without changing the behavior of the connect method (returning the Storage device if both a Pro and a Storage device are present).
* | Add set_time_soft to replace get_timeRobin Krahl2018-06-19
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | The SetTime command supports two modes: set the time without checking the currently set time, or verify that the currently set time is not zero and not larger than the new time (see cmd_set_time(uint8_t*, uint8_t*) in src/keyboard/report_protocol.c, lines 678--710, in the Nitrokey Pro firmware). NitrokeyManager called these two modes set_time(uint64_t) and get_time(uint64_t), which is highly misleading -- the command does never get the time. Furthermore, the get_time method per default calls the command with the time zero, which will always result in an error. The C API has the methods NK_totp_set_time(uint64_t) and NK_totp_get_time(). NK_totp_get_time() calls get_time(uint64_t) with the time zero, leading to an error, and is therefore useless. This patch proposes a new wording. While it would make sense to call the first mode “reset” and the second mode “set”, this would break compatibility. Therefore, new methods set_time_soft(uint64_t) and NK_totp_set_time_soft(uint64_t) are introduced to represent the difference between a hard and a soft setting of the time. The old methods, get_time(uint64_t) and NK_totp_get_time(), are not removed but marked as deprecated. They should be removed in an upcoming major release.
* Change const char* to char* for functions returning duplicated strings.Szczepan Zalega2018-04-19
| | | | | | | All functions returning duplicated C-strings, which needs to be deallocated on caller side, are typed char* instead of const char* Issue #110 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Do not output DEBUG messages by defaultv3.3Szczepan Zalega2018-04-10
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Delay RO/RW PIN type change to start from v0.52 (instead of v0.51)Szczepan Zalega2018-04-10
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch '102-get_status_invalid'Szczepan Zalega2018-04-10
|\ | | | | | | Fixes #102
| * Precise value for p.enable_user_password field to 1 on true, as in firmwareSzczepan Zalega2018-04-10
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | Add a NitrokeyManager::connect overload for enumRobin Krahl2018-04-10
|/ | | | | | | Identifying the model to connect to by the first character of a string is not intuitive. This patch adds an overload for the connect function that accepts a device::DeviceModel enum value, providing a cleaner interface.
* Make unbundling easierDavid Seifert2018-03-13
|
* Minor cleanupSzczepan Zalega2018-03-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add to device's ID USB path. Convert ID to hex.Szczepan Zalega2018-02-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Log current device IDSzczepan Zalega2018-02-28
| | | | | | | | Allow logger to set global prefix Used to indicate current device Store USB path when used to connection as well Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Return USB path as id, when device is running long operationSzczepan Zalega2018-02-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Disconnect all devices before enumerating and discovering ids. Add log.Szczepan Zalega2018-02-28
| | | | | | Disconnection allows rediscovering devices. Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Do not disconnect device on getting status failureSzczepan Zalega2018-02-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* List devices by unique SC:SD idSzczepan Zalega2018-02-28
| | | | | | | Add C API and tests Add mutexes Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Initial support for multiple devices with C++ and testSzczepan Zalega2018-02-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Handle getting firmware version internallySzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Divide unencrypted volume ro/rw commands for backward compatibilitySzczepan Zalega2018-02-23
| | | | | | | | | | Unencrypted volume ro/rw: rename user_admin_pin -> admin_pin to be consistent with latest API. Update description. Document PIN requirements in C++ API Extract pin type function Add C API for separate unencrypted volume read write handling Use correct commands to set ro/rw mode of unencrypted volume Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Implement command for testing smartcard statusSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Correct variable name for unencrypted ro/rw switchSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Tests: set debug level from environment variable, show connected device ↵Szczepan Zalega2018-02-23
| | | | | | model and version Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Unify unencrypted volume ro/rw switchingSzczepan Zalega2018-02-23
| | | | | | | For 0.49 run new command, which needs Admin PIN For 0.48 and lower run old command Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Correct getting minor and major from firmware versionSzczepan Zalega2018-02-23
| | | | | | | | | Add get_minor_firmware_version Correct get_major_firmware version (was returning minor instead) Name 3rd version field for test builds Use minor firmware version in tests Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Support execution of the 0.49 commandsSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Update license/copyright linesSzczepan Zalega2018-01-16
| | | | | | Remove redundant file Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch 'test_organize'Szczepan Zalega2017-10-10
|\ | | | | | | | | | | Improve test organization Disable CRC check Improve log
| * Increase maximum duplicated string lengthSzczepan Zalega2017-10-10
| | | | | | | | | | | | To cover Storage's status string getter Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | Correct exception typeSzczepan Zalega2017-10-07
|/ | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch 'windows_MSVC2017' into OSX_merge_cleanedSzczepan Zalega2017-09-20
|\
| * Run compilation using Qt CreatorSzczepan Zalega2017-06-28
| |
| * Adjust code to make compilation under MSVC 2017Szczepan Zalega2017-06-28
| |
* | Correct mutex placementSzczepan Zalega2017-09-20
|/ | | | | | Move mutex from template instantation to single compilation unit to make it work as desired Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Code refactoringSzczepan Zalega2017-05-13
| | | | | | | Remove doubled implementation Remove clutter from DEBUG log level Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Refactor log codeSzczepan Zalega2017-05-12
| | | | | | | Inverse log levels order. Allow to change logging level with int. Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Return empty value on no connectionSzczepan Zalega2017-04-26
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Rename device mutex in NitrokeyManagerSzczepan Zalega2017-04-25
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Use own strndup implementation under WindowsSzczepan Zalega2017-04-25
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Security: exchange strdup with strndupSzczepan Zalega2017-04-14
| | | | | | Keep build directory (removed in earlier commit) Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>