Skip to content

Conversation

@robinkrahl
Copy link
Contributor

This patch adds getters for the number of PWS, TOTP and HOTP slots on
the current device and the maximum length of a PWS slot name, login and
password as well as a OTP slot name and secret.

Fixes #197.

if (device == nullptr) {
return 0;
} else {
return 40;
Copy link
Member

@szszszsz szszszsz Apr 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For earlier firmware versions of Nitrokey Pro this would be 20. Please add FIXME here to remember about extending that (details are in the libnitrokey's OTP implementation); ideally you can add this implementation here already (so it would not rot until I will get there).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I’ll have a look at it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, it was changed in v0.8 for the Nitrokey Pro and v0.54 for the Nitrokey Storage, see is_320_OTP_secret_supported. But it would be nicer if we would not have to perform a GET_STATUS command to query this number. I’ll think about other solutions.

This patch extracts the HOTP and TOTP slot count as well as the maximum
length for the OTP slot name and secret into defines in device_proto.h,
similar to the PWS constants.
This patch adds getters for the number of PWS, TOTP and HOTP slots on
the current device and the maximum length of a PWS slot name, login and
password as well as a OTP slot name and secret.

Fixes Nitrokey#197.
@szszszsz
Copy link
Member

Hi! Please let me know once the PR is ready to go.

@robinkrahl
Copy link
Contributor Author

robinkrahl commented Apr 27, 2021 via email

@szszszsz
Copy link
Member

Indeed, the firmware update is not very much frequent event, but should be taken into account anyway (e.g. for the tools that check the changed firmware version). Until now I was expecting the client applications to do the caching (see Nitrokey App and its libnitrokey wrapper), and libnitrokey to do the raw communication, to not add too much hidden logic or unexpected side-effects.

We need some cache invalidation mechanism with that, e.g. in a form of a logout function. Perhaps calling "device lock" could function as such, so there would not be a need for extending the API. Thoughts?

@robinkrahl
Copy link
Contributor Author

robinkrahl commented Apr 27, 2021 via email

@szszszsz
Copy link
Member

Yes, sounds like a better choice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose OTP and PWS properties (slot counts, limits)

2 participants