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

Error when changing the PIV PIN interactively #555

Open
bestiak opened this issue May 31, 2023 · 0 comments
Open

Error when changing the PIV PIN interactively #555

bestiak opened this issue May 31, 2023 · 0 comments

Comments

@bestiak
Copy link

bestiak commented May 31, 2023

  • YubiKey Manager (ykman) version: 5.1.1
  • How was it installed?: pip
  • Operating system and version: Fedora 38
  • YubiKey model and version: YubiKey 5C NFC
  • Bug description summary:

Error when changing the PIV PIN interactively.

Steps to reproduce

[Please explain what you did when the bug appeared, and if and how you have been
able to reproduce it.]

$ ykman piv access change-pin
Enter the current PIN: 123456
Enter the new PIN: 12345678
Repeat for confirmation: 12345678

Expected result

[What did you expect to happen when you did the above?]

Change PIN without errors.

Actual results and logs

[What actually happened?]

ERROR: An unexpected error has occuredTraceback (most recent call last):
File "/home/bestiak/.local/lib/python3.11/site-packages/ykman/_cli/main.py", line 364, in main
cli(obj={})
File "/usr/lib/python3.11/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bestiak/.local/lib/python3.11/site-packages/ykman/_cli/piv.py", line 310, in change_pin
pivman_change_pin(session, pin, new_pin)
File "/home/bestiak/.local/lib/python3.11/site-packages/ykman/piv.py", line 324, in pivman_change_pin
session.change_pin(old_pin, new_pin)
File "/home/bestiak/.local/lib/python3.11/site-packages/yubikit/piv.py", line 582, in change_pin
self._change_reference(INS_CHANGE_REFERENCE, PIN_P2, old_pin, new_pin)
File "/home/bestiak/.local/lib/python3.11/site-packages/yubikit/piv.py", line 826, in _change_reference
self.protocol.send_apdu(
File "/home/bestiak/.local/lib/python3.11/site-packages/yubikit/core/smartcard.py", line 198, in send_apdu
response, sw = self.connection.send_and_receive(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bestiak/.local/lib/python3.11/site-packages/ykman/pcsc/init.py", line 122, in send_and_receive
data, sw1, sw2 = self.connection.transmit(list(apdu))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bestiak/.local/lib/python3.11/site-packages/smartcard/CardConnectionDecorator.py", line 86, in transmit
return self.component.transmit(bytes, protocol)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bestiak/.local/lib/python3.11/site-packages/smartcard/CardConnection.py", line 159, in transmit
data, sw1, sw2 = self.doTransmit(bytes, protocol)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bestiak/.local/lib/python3.11/site-packages/smartcard/pcsc/PCSCCardConnection.py", line 247, in doTransmit
raise CardConnectionException(
smartcard.Exceptions.CardConnectionException: Failed to transmit with protocol T1. Card was reset.

Other info

[Anything else you would like to add?]

The error does not happen when passing the PIN and new PIN values as options.

$ ykman piv access change-pin --pin 123456 --new-pin 12345678
New PIN set.

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

No branches or pull requests

1 participant