Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcks15-tool --use-pinpad --change-pin prints confusing instructions #2744

Open
filip-zyzniewski opened this issue Apr 9, 2023 · 1 comment

Comments

@filip-zyzniewski
Copy link

Problem Description

When changing the user pin using a displayless pinpad (Cherry KC 1000 SC), pcks15-tool is printing confusing instructions on the console. It says:

Enter old PIN [UserPIN]: entry deferred to the reader keypad
Old PIN value will be prompted with pinpad.
Enter new PIN [UserPIN]: entry deferred to the reader keypad
New PIN value will be prompted with pinpad.

and then afterwards activates the pinpad three times in a row.

Perhaps it's a limitation of the protocol, but even in such case the tool could provide more useful guidance before activating the pinpad.

Proposed Resolution

The interaction could look something like this (stolen from a run without -use-pinpad):

$ pkcs15-tool --verbose --change-pin
Using reader with a card: Cherry KC 1000 SC [KC 1000 SC] 00 00
Connecting to card in reader Cherry KC 1000 SC [KC 1000 SC] 00 00...
Using card driver SmartCard-HSM.
Trying to find a PKCS#15 compatible card...
Found secondary!
Enter old PIN [UserPIN]: <pinpad activated, user enters pin and confirms>
Enter new PIN [UserPIN]: <pinpad activated, user enters pin and confirms>
Enter new PIN again [UserPIN]: <pinpad activated, user enters pin and confirms>
PIN code changed successfully.
filip@japko:~/git/github.com/filip-zyzniewski/OpenSC$

If the protocol does not provide feedback from the pinpad, then perhaps the message could be something like:

The reader keypad will be activated three times. Enter the old PIN once and the new PIN twice.

Steps to reproduce

filip@japko:~/git/github.com/filip-zyzniewski/OpenSC$ git rev-parse HEAD
5e06acb3f2e95448248b75aaf2e033131e46510d
filip@japko:~/git/github.com/filip-zyzniewski/OpenSC$ git diff
filip@japko:~/git/github.com/filip-zyzniewski/OpenSC$ src/tools/pkcs15-tool --verbose --use-pinpad --change-pin
Using reader with a card: Cherry KC 1000 SC [KC 1000 SC] 00 00
Connecting to card in reader Cherry KC 1000 SC [KC 1000 SC] 00 00...
Using card driver SmartCard-HSM.
Trying to find a PKCS#15 compatible card...
Found secondary!
Enter old PIN [UserPIN]: entry deferred to the reader keypad
Old PIN value will be prompted with pinpad.
Enter new PIN [UserPIN]: entry deferred to the reader keypad
New PIN value will be prompted with pinpad.
<pinpad activated, user enters pin and confirms>
<pinpad activated, user enters pin and confirms>
<pinpad activated, user enters pin and confirms>
PIN code changed successfully.
filip@japko:~/git/github.com/filip-zyzniewski/OpenSC$

Logs

with OPENSC_DEBUG=3: https://gist.github.com/filip-zyzniewski/fb4324c484f7501de9e623251ec6e30b

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

No branches or pull requests

2 participants