Skip to content

Commit

Permalink
Send extended APDUs by default in the "apdu" command
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed May 30, 2024
1 parent d2dcdd6 commit cb88d32
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ykman/_cli/apdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from yubikit.core.smartcard import (
SmartCardConnection,
SmartCardProtocol,
ApduFormat,
ApduError,
SW,
AID,
Expand Down Expand Up @@ -102,9 +103,10 @@ def _print_response(resp: bytes, sw: int, no_pretty: bool) -> None:
required=False,
help="select application",
)
@click.option("--short", is_flag=True, help="use short APDUs instead of extended")
@click.argument("apdu", nargs=-1)
@click.option("-s", "--send-apdu", multiple=True, help="provide full APDUs")
def apdu(ctx, no_pretty, app, apdu, send_apdu):
def apdu(ctx, no_pretty, app, short, apdu, send_apdu):
"""
Execute arbitrary APDUs.
Provide APDUs as a hex encoded, space-separated list using the following syntax:
Expand Down Expand Up @@ -150,6 +152,11 @@ def apdu(ctx, no_pretty, app, apdu, send_apdu):
else:
params = None

if not short:
protocol.apdu_format = ApduFormat.EXTENDED
elif params:
ctx.fail("--short cannot be used with SCP")

if app:
is_first = False
click.echo("SELECT AID: " + _hex(app))
Expand Down

0 comments on commit cb88d32

Please sign in to comment.