Skip to content

Commit

Permalink
PIV: Prompt to confirm PIN when unblocking with PUK
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Mar 26, 2024
1 parent b7eb566 commit 838a0ee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ykman/_cli/piv.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,11 @@ def unblock_pin(ctx, puk, new_pin):
puk = click_prompt("Enter PUK", default="", show_default=False, hide_input=True)
if not new_pin:
new_pin = click_prompt(
"Enter a new PIN", default="", show_default=False, hide_input=True
"Enter a new PIN",
default="",
show_default=False,
hide_input=True,
confirmation_prompt=True,
)
try:
session.unblock_pin(puk, new_pin)
Expand All @@ -534,6 +538,10 @@ def unblock_pin(ctx, puk, new_pin):
raise CliFail("PIN unblock failed - %d tries left." % attempts)
else:
raise CliFail("PUK is blocked.")
except ApduError as e:
if e.sw == SW.CONDITIONS_NOT_SATISFIED:
raise CliFail("PIN does not meet complexity requirement.")
raise


@piv.group()
Expand Down

0 comments on commit 838a0ee

Please sign in to comment.