Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed May 24, 2024
1 parent 8ba5270 commit 5204fe0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ykman/_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def params_f(_):

elif scp11_creds:
# SCP11 a/c
if scp_kid not in (ScpKid.SCP11a, ScpKid.SCP11c, None):
if scp_kid and scp_kid not in (ScpKid.SCP11a, ScpKid.SCP11c):
raise CliFail("--scp with file(s) can only be used with SCP11 a/c")

first = scp11_creds.pop(0)
Expand Down
2 changes: 1 addition & 1 deletion ykman/_cli/securedomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def securedomain(ctx):
ctx.obj["authenticated"] = (
isinstance(scp_params, Scp03KeyParams)
or isinstance(scp_params, Scp11KeyParams)
and scp_params.ref.kid in (ScpKid.SCP11a, ScpKid.SCP11c)
and scp_params.ref.kid == ScpKid.SCP11a
)

ctx.obj["session"] = session
Expand Down
3 changes: 3 additions & 0 deletions yubikit/core/smartcard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
Scp11KeyParams,
INS_EXTERNAL_AUTHENTICATE,
)
from yubikit.logging import LOG_LEVEL
from enum import Enum, IntEnum, unique
from time import time
from typing import Tuple
Expand Down Expand Up @@ -264,6 +265,7 @@ def send_apdu(self, cla, ins, p1, p2, data, le, encrypt: bool = True):
cla |= 0x04

if encrypt:
logger.log(LOG_LEVEL.TRAFFIC, "Plaintext data: %s", data.hex())
data = self._state.encrypt(data)

# Calculate and add MAC to data
Expand All @@ -278,6 +280,7 @@ def send_apdu(self, cla, ins, p1, p2, data, le, encrypt: bool = True):
resp = self._state.unmac(resp, sw)
if resp:
resp = self._state.decrypt(resp)
logger.log(LOG_LEVEL.TRAFFIC, "Plaintext resp: %s", resp.hex())

return resp, sw

Expand Down
2 changes: 1 addition & 1 deletion yubikit/securedomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def store_ca_issuer(self, key: KeyRef, ski: bytes) -> None:
)
logger.info("CA issuer SKI stored")

def delete_key(self, kid: int, kvn: int, delete_last: bool = False) -> None:
def delete_key(self, kid: int = 0, kvn: int = 0, delete_last: bool = False) -> None:
"""Delete one (or more) keys.
Requires OCE verification.
Expand Down

0 comments on commit 5204fe0

Please sign in to comment.